Skip to content

Commit

Permalink
auto: code-gen upgrade handler v25 (osmosis-labs#7933)
Browse files Browse the repository at this point in the history
* [create-pull-request] automated change

* add rc tags to docker push

* switch to already existing logic

* add quote

* initial fix

* Update config.go

* revert

---------

Co-authored-by: czarcas7ic <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
  • Loading branch information
4 people authored Apr 5, 2024
1 parent edeaef3 commit 29f838e
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 44 deletions.
57 changes: 19 additions & 38 deletions .github/workflows/push-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,24 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
if: ${{ !contains(github.ref_name, 'iavl') }}
steps:
-
name: Check out the repo
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Find go version
- name: Find go version
run: |
GO_VERSION=$(cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV
-
name: Parse tag
- name: Parse tag
id: tag
run: |
VERSION=$(echo ${{ github.ref_name }} | sed "s/v//")
Expand All @@ -78,8 +72,7 @@ jobs:
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV
echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV
# Distroless Docker image (default)
-
name: Build and push (distroless)
- name: Build and push (distroless)
id: build_push_distroless
uses: docker/build-push-action@v5
with:
Expand All @@ -100,8 +93,7 @@ jobs:
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}-distroless
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-distroless
# Distroless nonroot Docker image
-
name: Build and push (nonroot)
- name: Build and push (nonroot)
id: build_push_nonroot
uses: docker/build-push-action@v5
with:
Expand All @@ -119,8 +111,7 @@ jobs:
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}-nonroot
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-nonroot
# Alpine Docker image
-
name: Build and push (alpine)
- name: Build and push (alpine)
id: build_push_alpine
uses: docker/build-push-action@v5
with:
Expand All @@ -137,8 +128,7 @@ jobs:
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}-alpine
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}-alpine
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-alpine
-
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0')
- if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0')
name: Build and push (e2e-chain-init)
uses: docker/build-push-action@v5
with:
Expand All @@ -157,30 +147,24 @@ jobs:
runs-on: buildjet-4vcpu-ubuntu-2204
if: ${{ contains(github.ref_name, 'iavl') }}
steps:
-
name: Check out the repo
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Find go version
- name: Find go version
run: |
GO_VERSION=$(cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2)
echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV
-
name: Parse tag
- name: Parse tag
id: tag
run: |
VERSION=$(echo ${{ github.ref_name }} | sed "s/v//")
Expand All @@ -192,8 +176,7 @@ jobs:
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV
echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV
# Distroless Docker image (default)
-
name: Build and push (distroless)
- name: Build and push (distroless)
id: build_push_distroless
uses: docker/build-push-action@v5
with:
Expand All @@ -212,8 +195,7 @@ jobs:
# osmosis:X.Y.Z-iavl-v1-distroless
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-distroless
# Distroless nonroot Docker image
-
name: Build and push (nonroot)
- name: Build and push (nonroot)
id: build_push_nonroot
uses: docker/build-push-action@v5
with:
Expand All @@ -230,8 +212,7 @@ jobs:
# osmosis:X.Y.Z-iavl-v1-nonroot
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-nonroot
# Alpine Docker image
-
name: Build and push (alpine)
- name: Build and push (alpine)
id: build_push_alpine
uses: docker/build-push-action@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"OSMOSIS_E2E_SKIP_UPGRADE": "false",
"OSMOSIS_E2E_SKIP_CLEANUP": "true",
"OSMOSIS_E2E_SKIP_STATE_SYNC": "true",
"OSMOSIS_E2E_UPGRADE_VERSION": "v24",
"OSMOSIS_E2E_UPGRADE_VERSION": "v25",
"OSMOSIS_E2E_DEBUG_LOG": "false",
},
"preLaunchTask": "e2e-setup"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BUILDDIR ?= $(CURDIR)/build
DOCKER := $(shell which docker)
E2E_UPGRADE_VERSION := "v24"
E2E_UPGRADE_VERSION := "v25"
#SHELL := /bin/bash

# Go version to be used in docker images
Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import (
v22 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v22"
v23 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v23"
v24 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v24"
v25 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v25"
v3 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v3"
v4 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v4"
v5 "github.com/osmosis-labs/osmosis/v24/app/upgrades/v5"
Expand Down Expand Up @@ -153,7 +154,7 @@ var (

_ runtime.AppI = (*OsmosisApp)(nil)

Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade, v16.Upgrade, v17.Upgrade, v18.Upgrade, v19.Upgrade, v20.Upgrade, v21.Upgrade, v22.Upgrade, v23.Upgrade, v24.Upgrade}
Upgrades = []upgrades.Upgrade{v4.Upgrade, v5.Upgrade, v7.Upgrade, v9.Upgrade, v11.Upgrade, v12.Upgrade, v13.Upgrade, v14.Upgrade, v15.Upgrade, v16.Upgrade, v17.Upgrade, v18.Upgrade, v19.Upgrade, v20.Upgrade, v21.Upgrade, v22.Upgrade, v23.Upgrade, v24.Upgrade, v25.Upgrade}
Forks = []upgrades.Fork{v3.Fork, v6.Fork, v8.Fork, v10.Fork}

// rpcAddressConfigName is the name of the config key that holds the RPC address.
Expand Down
19 changes: 19 additions & 0 deletions app/upgrades/v25/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package v25

import (
"github.com/osmosis-labs/osmosis/v24/app/upgrades"

store "github.com/cosmos/cosmos-sdk/store/types"
)

// UpgradeName defines the on-chain upgrade name for the Osmosis v25 upgrade.
const UpgradeName = "v25"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
Deleted: []string{},
},
}
28 changes: 28 additions & 0 deletions app/upgrades/v25/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package v25

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/osmosis-labs/osmosis/v24/app/keepers"
"github.com/osmosis-labs/osmosis/v24/app/upgrades"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
bpm upgrades.BaseAppParamManager,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Run migrations before applying any other state changes.
// NOTE: DO NOT PUT ANY STATE CHANGES BEFORE RunMigrations().
migrations, err := mm.RunMigrations(ctx, configurator, fromVM)
if err != nil {
return nil, err
}

return migrations, nil
}
}
2 changes: 1 addition & 1 deletion tests/e2e/configurer/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (bc *baseConfigurer) runValidators(chainConfig *chain.Config) error {
wg.Add(1)
go func(node *chain.NodeConfig) {
defer wg.Done()
if err := node.Run(false); err != nil {
if err := node.Run(true); err != nil {
errCh <- err
}
}(node)
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/containers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const (
// It should be uploaded to Docker Hub. OSMOSIS_E2E_SKIP_UPGRADE should be unset
// for this functionality to be used.
previousVersionOsmoRepository = "osmolabs/osmosis"
previousVersionOsmoTag = "23.0.0-rc1-alpine"
previousVersionOsmoTag = "24.0.0-alpine"
// Pre-upgrade repo/tag for osmosis initialization (this should be one version below upgradeVersion)
previousVersionInitRepository = "osmolabs/osmosis-e2e-init-chain"
previousVersionInitTag = "v23.0.8-temp"
previousVersionInitTag = "24.0.0"
// Hermes repo/version for relayer
relayerRepository = "osmolabs/relayer"
relayerTag = "1.5.1"
Expand Down

0 comments on commit 29f838e

Please sign in to comment.