Skip to content

Commit

Permalink
update OSMOSIS_E2E_UPGRADE_VERSION on upgrade handler #4029 (backport #…
Browse files Browse the repository at this point in the history
…4173) (#4176)

* update OSMOSIS_E2E_UPGRADE_VERSION variable in .vscode/launch.json (#4173)

(cherry picked from commit 386c9f0)

# Conflicts:
#	scripts/empty_upgrade_handler_gen.sh

* merge conflict fix

---------

Co-authored-by: Master Pi <[email protected]>
Co-authored-by: Ruslan Akhtariev <[email protected]>
  • Loading branch information
3 people authored Feb 1, 2023
1 parent 968ae4a commit b163ad2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/gen-upgrade-on-manual-input.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# When user trigger this workflow with custom version input, this action will do 3 things:
# 1) it will create a directory with an empty upgrade handler in app/upgrades folder
# 2) will increase an E2E_UPGRADE_VERSION variable in Makefile
# 3) create a pull request with these changes to main
# 1) create a directory with an empty upgrade handler in app/upgrades folder
# 2) increase E2E_UPGRADE_VERSION variable in Makefile
# 3) update OSMOSIS_E2E_UPGRADE_VERSION variable in .vscode/launch.json
# 4) create a pull request with these changes to main

# Please note that if the given version (or release major version) is smaller than the latest
# existing upgrade handler version in `app/upgrades/`, this will be a no-op.
Expand Down Expand Up @@ -58,6 +59,7 @@ jobs:
Update report
- Created a new empty upgrade handler
- Increased E2E_UPGRADE_VERSION in Makefile by 1
- Increased OSMOSIS_E2E_UPGRADE_VERSION in .vscode/launch.json by 1
labels: |
T:auto
C:e2e
Expand Down
38 changes: 34 additions & 4 deletions scripts/empty_upgrade_handler_gen.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/bash

# 1) this script creates an empty directory in app/upgrades called "vX" where X is a previous version + 1 with an empty upgrade handler.
# 2) increases E2E_UPGRADE_VERSION in makefile by 1
# 3) adds new version to app.go
# 2) adds new version to app.go
# 3) update OSMOSIS_E2E_UPGRADE_VERSION variable in .vscode/launch.json
# 4) increases E2E_UPGRADE_VERSION in makefile by 1
# 5) bumps up previous e2e-init version in tests/e2e/containers/config.go

# Also insures that all the imports make use of a current module version from go mod:
# (see: module=$(go mod edit -json | jq ".Module.Path") in this script)
Expand Down Expand Up @@ -88,5 +90,33 @@ func CreateUpgradeHandler(
NEW_IMPORT="$version_create $module/app/upgrades/$version_create$bracks"
sed -i "s|.*$PREV_IMPORT.*|\t$PREV_IMPORT\n\t$NEW_IMPORT|" $app_file

# change e2e version in makefile
sed -i "s/E2E_UPGRADE_VERSION := ${bracks}v$latest_version$bracks/E2E_UPGRADE_VERSION := ${bracks}$version_create$bracks/" ./Makefile
# change e2e version in makefile
sed -i "s/E2E_UPGRADE_VERSION := ${bracks}v$latest_version$bracks/E2E_UPGRADE_VERSION := ${bracks}$version_create$bracks/" ./Makefile

# bumps up prev e2e version
e2e_file=./tests/e2e/containers/config.go
PREV_OSMOSIS_DEV_TAG=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/osmolabs/osmosis-dev/tags?page=1&page_size=100' | jq -r '.results[] | .name | select(.|test("^(?:v|)[0-9]+\\.[0-9]+(?:$|\\.[0-9]+$)"))' | grep --max-count=1 "")
PREV_OSMOSIS_E2E_TAG=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/osmolabs/osmosis-e2e-init-chain/tags?page=1&page_size=100' | jq -r '.results[] | .name | select(.|test("^(?:v|)[0-9]+\\.[0-9]+(?:$|\\.[0-9]+$)"))' | grep --max-count=1 "")

# previousVersionOsmoTag = PREV_OSMOSIS_DEV_TAG
if [[ $version_create == v$(($(echo $PREV_OSMOSIS_DEV_TAG | awk -F . '{print $1}')+1)) ]]; then
echo "Found previous osmosis-dev tag $PREV_OSMOSIS_DEV_TAG"
sed -i '/previousVersionOsmoTag/s/".*"/'"\"$PREV_OSMOSIS_DEV_TAG\""'/' $e2e_file
else
PREV_OSMOSIS_DEV_TAG=v$((${version_create:1}-1)).0.0
echo "Using pre-defined osmosis-dev tag: $PREV_OSMOSIS_DEV_TAG"
sed -i '/previousVersionOsmoTag/s/".*"/'"\"$PREV_OSMOSIS_DEV_TAG\""'/' $e2e_file
fi

# previousVersionInitTag = PREV_OSMOSIS_E2E_TAG
if [[ $version_create == v$(($(echo $PREV_OSMOSIS_E2E_TAG | awk -F . '{print $1}' | grep -Eo '[0-9]*')+1)) ]]; then
echo "Found previous osmosis-e2e-init-chain tag $PREV_OSMOSIS_E2E_TAG"
sed -i '/previousVersionInitTag/s/".*"/'"\"$PREV_OSMOSIS_E2E_TAG\""'/' $e2e_file
else
PREV_OSMOSIS_E2E_TAG=v$((${version_create:1}-1)).0.0
echo "Using pre-defined osmosis-e2e-init-chain tag: $PREV_OSMOSIS_E2E_TAG"
sed -i '/previousVersionInitTag/s/".*"/'"\"$PREV_OSMOSIS_E2E_TAG\""'/' $e2e_file
fi

# update OSMOSIS_E2E_UPGRADE_VERSION in launch.json
sed -i "s/${bracks}OSMOSIS_E2E_UPGRADE_VERSION${bracks}: ${bracks}v$latest_version${bracks}/${bracks}OSMOSIS_E2E_UPGRADE_VERSION${bracks}: ${bracks}$version_create${bracks}/" ./.vscode/launch.json

0 comments on commit b163ad2

Please sign in to comment.