diff --git a/.github/workflows/gen-upgrade-on-manual-input.yml b/.github/workflows/gen-upgrade-on-manual-input.yml index 2b8a02b8ca1..081c176d662 100644 --- a/.github/workflows/gen-upgrade-on-manual-input.yml +++ b/.github/workflows/gen-upgrade-on-manual-input.yml @@ -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. @@ -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 diff --git a/scripts/empty_upgrade_handler_gen.sh b/scripts/empty_upgrade_handler_gen.sh index 17608e73cd9..f8df838d66c 100755 --- a/scripts/empty_upgrade_handler_gen.sh +++ b/scripts/empty_upgrade_handler_gen.sh @@ -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) @@ -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 \ No newline at end of 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 + +# 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