From cb180fbc713fc2421c8e952101bb5352d10b3267 Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Fri, 15 Mar 2024 14:48:37 +0900 Subject: [PATCH 1/7] Add sub action --- action.yml | 2 +- create/Dockerfile | 6 ++++++ create/action.yml | 19 +++++++++++++++++++ create/entrypoint.sh | 7 +++++++ entrypoint.sh | 4 +++- 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 create/Dockerfile create mode 100644 create/action.yml create mode 100644 create/entrypoint.sh diff --git a/action.yml b/action.yml index 50b304d..2f7da42 100644 --- a/action.yml +++ b/action.yml @@ -11,7 +11,7 @@ inputs: description: 'Path to a previously taken snapshot, if does not exists we will create it' default: '/tmp/default.snap' runtime: - description: 'Path to a try-runtime enabled runtime to test migrations for' + description: 'Path to a try-runtime enabled runtime to test migrations for, Set to SKIP to skip test and only download snapshot' required: true checks: description: 'Checks to run' diff --git a/create/Dockerfile b/create/Dockerfile new file mode 100644 index 0000000..781d36c --- /dev/null +++ b/create/Dockerfile @@ -0,0 +1,6 @@ +FROM ghcr.io/nodlecode/try-runtime-cli:v0.5.1 + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/create/action.yml b/create/action.yml new file mode 100644 index 0000000..f2f7267 --- /dev/null +++ b/create/action.yml @@ -0,0 +1,19 @@ +name: 'Try Runtime - create snapshot' +description: 'Runs try-runtime to create a snapshot' +branding: + icon: 'check-circle' + color: 'green' +inputs: + url: + description: 'URL of the node to take a snapshot from' + required: true + snap: + description: 'Path to a previously taken snapshot, if does not exists we will create it' + default: '/tmp/default.snap' + +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.url }} + - ${{ inputs.snap }} \ No newline at end of file diff --git a/create/entrypoint.sh b/create/entrypoint.sh new file mode 100644 index 0000000..8c642a4 --- /dev/null +++ b/create/entrypoint.sh @@ -0,0 +1,7 @@ +#! /bin/sh -l + +url=$1 +snap=$2 +shift 2 + +try-runtime --runtime existing create-snapshot --uri $url $snap diff --git a/entrypoint.sh b/entrypoint.sh index 61cbfdf..c4124d0 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,4 +12,6 @@ if [ ! -f "$snap" ]; then try-runtime --runtime existing create-snapshot --uri $url $snap fi -try-runtime --runtime $runtime on-runtime-upgrade --checks=$checks $* snap --path $snap +if [ -f "$runtime" ];then + try-runtime --runtime $runtime on-runtime-upgrade --checks=$checks $* snap --path $snap +fi \ No newline at end of file From 02c1e2b2b9d3d911ef8635ad5aeac3fcd2118d02 Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Fri, 15 Mar 2024 15:02:58 +0900 Subject: [PATCH 2/7] Add check action --- check/Dockerfile | 6 ++++++ check/action.yml | 27 +++++++++++++++++++++++++++ check/entrypoint.sh | 8 ++++++++ 3 files changed, 41 insertions(+) create mode 100644 check/Dockerfile create mode 100644 check/action.yml create mode 100644 check/entrypoint.sh diff --git a/check/Dockerfile b/check/Dockerfile new file mode 100644 index 0000000..781d36c --- /dev/null +++ b/check/Dockerfile @@ -0,0 +1,6 @@ +FROM ghcr.io/nodlecode/try-runtime-cli:v0.5.1 + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/check/action.yml b/check/action.yml new file mode 100644 index 0000000..eaab953 --- /dev/null +++ b/check/action.yml @@ -0,0 +1,27 @@ +name: 'Try Runtime' +description: 'Runs try-runtime on-runtime-upgrade on the specified chain and runtime' +branding: + icon: 'check-circle' + color: 'green' +inputs: + snap: + description: 'Path to a previously taken snapshot' + default: '/tmp/default.snap' + runtime: + description: 'Path to a try-runtime enabled runtime to test migrations for' + required: true + checks: + description: 'Checks to run' + default: 'all' + options: + description: 'try-runtime command line options' + default: '' + required: false +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.snap }} + - ${{ inputs.runtime }} + - ${{ inputs.checks }} + - ${{ inputs.options }} diff --git a/check/entrypoint.sh b/check/entrypoint.sh new file mode 100644 index 0000000..2d3b337 --- /dev/null +++ b/check/entrypoint.sh @@ -0,0 +1,8 @@ +#! /bin/sh -l + +url=$1 +runtime=$3 +checks=$4 +shift 3 + +try-runtime --runtime $runtime on-runtime-upgrade --checks=$checks $* snap --path $snap From 9488a41fee8032c3dbdeb547823e6f49193513fb Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Fri, 15 Mar 2024 15:08:14 +0900 Subject: [PATCH 3/7] Use v0.6.1 --- DEVELOP.md | 12 ++++++------ Dockerfile | 2 +- README.md | 2 +- check/Dockerfile | 2 +- create/Dockerfile | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/DEVELOP.md b/DEVELOP.md index 04d5bfd..72da37f 100644 --- a/DEVELOP.md +++ b/DEVELOP.md @@ -10,10 +10,10 @@ > By convention please follow the release numbers from [Parity's repo](https://github.com/paritytech/try-runtime-cli). -1. Run the [prebuild github action](https://github.com/NodleCode/action-try-runtime/actions/workflows/base-image.yml) to pre-build `try-runtime`. Pass it the latest version from parity's repo (for example `v0.5.1`). +1. Run the [prebuild github action](https://github.com/NodleCode/action-try-runtime/actions/workflows/base-image.yml) to pre-build `try-runtime`. Pass it the latest version from parity's repo (for example `v0.6.1`). 2. Wait for the action to build succesfully, which will take a little while. -3. Update the first line in the action [`Dockerfile`](./Dockerfile) to use the version number of the new prebuilt container (in this example `v0.5.1`). -4. Draft a new github release for the same version number (`v0.5.1` in this example). +3. Update the first line in the action [`Dockerfile`](./Dockerfile) to use the version number of the new prebuilt container (in this example `v0.6.1`). +4. Draft a new github release for the same version number (`v0.6.1` in this example). 5. You may now use the newly release and built action in your CI/CD pipeline. > We prebuild a docker container with `try-runtime` to ensure Github does not rebuilt `try-runtime` everytime we use this action, thus giving us a nice speed improvement. @@ -23,19 +23,19 @@ Verify online version ``` -docker run ghcr.io/nodlecode/try-runtime-cli:v0.5.1 try-runtime -V +docker run ghcr.io/nodlecode/try-runtime-cli:v0.6.1 try-runtime -V ``` Execute the prebuilt docker image ``` -docker run -v ~/nodle/chain/snapshots:/snapshots ghcr.io/nodlecode/try-runtime-cli:v0.5.1 try-runtime --runtime ./snapshots/runtime_eden.wasm on-runtime-upgrade snap -p snapshots/eden-ci +docker run -v ~/nodle/chain/snapshots:/snapshots ghcr.io/nodlecode/try-runtime-cli:v0.6.1 try-runtime --runtime ./snapshots/runtime_eden.wasm on-runtime-upgrade snap -p snapshots/eden-ci ``` Build and run image locally ``` cd base -docker build --build-arg VERSION=v0.5.1 . -t milkman -f ./Dockerfile +docker build --build-arg VERSION=v0.6.1 . -t milkman -f ./Dockerfile docker run milkman try-runtime --version docker run milkman try-runtime --help diff --git a/Dockerfile b/Dockerfile index 781d36c..054db1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/nodlecode/try-runtime-cli:v0.5.1 +FROM ghcr.io/nodlecode/try-runtime-cli:v0.6.1 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/README.md b/README.md index 652355c..263acc9 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ with: ### Use case with some more options ```yaml - name: Run try-runtime - uses: NodleCode/action-try-runtime@v0.5.1 + uses: NodleCode/action-try-runtime@v0.6.1 with: url: 'https://rpc.nodleprotocol.io' snap: snapshots/eden-snapshot-full diff --git a/check/Dockerfile b/check/Dockerfile index 781d36c..054db1e 100644 --- a/check/Dockerfile +++ b/check/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/nodlecode/try-runtime-cli:v0.5.1 +FROM ghcr.io/nodlecode/try-runtime-cli:v0.6.1 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/create/Dockerfile b/create/Dockerfile index 781d36c..054db1e 100644 --- a/create/Dockerfile +++ b/create/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/nodlecode/try-runtime-cli:v0.5.1 +FROM ghcr.io/nodlecode/try-runtime-cli:v0.6.1 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh From 8db27b7641cb361fc0d1309d2a896b691da408e6 Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Mon, 18 Mar 2024 09:39:43 +0900 Subject: [PATCH 4/7] Other options --- create/action.yml | 6 +++++- create/entrypoint.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/create/action.yml b/create/action.yml index f2f7267..d4c543b 100644 --- a/create/action.yml +++ b/create/action.yml @@ -10,10 +10,14 @@ inputs: snap: description: 'Path to a previously taken snapshot, if does not exists we will create it' default: '/tmp/default.snap' + options: + description: "Other command line options" + required: false runs: using: 'docker' image: 'Dockerfile' args: - ${{ inputs.url }} - - ${{ inputs.snap }} \ No newline at end of file + - ${{ inputs.snap }} + - ${{ inputs.options }} \ No newline at end of file diff --git a/create/entrypoint.sh b/create/entrypoint.sh index 8c642a4..acc7bfa 100644 --- a/create/entrypoint.sh +++ b/create/entrypoint.sh @@ -4,4 +4,4 @@ url=$1 snap=$2 shift 2 -try-runtime --runtime existing create-snapshot --uri $url $snap +try-runtime --runtime existing create-snapshot --uri $url $snap $* From 4da87df34a9f7c5fc64523f459bd08f95223ae7b Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Mon, 18 Mar 2024 14:47:58 +0900 Subject: [PATCH 5/7] Update script --- check/entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check/entrypoint.sh b/check/entrypoint.sh index 2d3b337..a516f17 100644 --- a/check/entrypoint.sh +++ b/check/entrypoint.sh @@ -1,8 +1,8 @@ #! /bin/sh -l -url=$1 -runtime=$3 -checks=$4 +snap=$1 +runtime=$2 +checks=$3 shift 3 try-runtime --runtime $runtime on-runtime-upgrade --checks=$checks $* snap --path $snap From 2e6a4e11a4ac25308c1d5774dfe4ab6ee0b549db Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Tue, 19 Mar 2024 12:21:52 +0900 Subject: [PATCH 6/7] Use one dockerfile --- check/Dockerfile | 6 ------ check/action.yml | 2 +- create/Dockerfile | 6 ------ create/action.yml | 2 +- 4 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 check/Dockerfile delete mode 100644 create/Dockerfile diff --git a/check/Dockerfile b/check/Dockerfile deleted file mode 100644 index 054db1e..0000000 --- a/check/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM ghcr.io/nodlecode/try-runtime-cli:v0.6.1 - -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/check/action.yml b/check/action.yml index eaab953..2102a63 100644 --- a/check/action.yml +++ b/check/action.yml @@ -19,7 +19,7 @@ inputs: required: false runs: using: 'docker' - image: 'Dockerfile' + image: '../Dockerfile' args: - ${{ inputs.snap }} - ${{ inputs.runtime }} diff --git a/create/Dockerfile b/create/Dockerfile deleted file mode 100644 index 054db1e..0000000 --- a/create/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM ghcr.io/nodlecode/try-runtime-cli:v0.6.1 - -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/create/action.yml b/create/action.yml index d4c543b..d765bd5 100644 --- a/create/action.yml +++ b/create/action.yml @@ -16,7 +16,7 @@ inputs: runs: using: 'docker' - image: 'Dockerfile' + image: '../Dockerfile' args: - ${{ inputs.url }} - ${{ inputs.snap }} From 11df19e253779702ae819d1cbf50d8c59db1fb5e Mon Sep 17 00:00:00 2001 From: Fredrik Simonsson Date: Tue, 19 Mar 2024 12:26:32 +0900 Subject: [PATCH 7/7] Revert "Use one dockerfile" This reverts commit 2e6a4e11a4ac25308c1d5774dfe4ab6ee0b549db. --- check/Dockerfile | 6 ++++++ check/action.yml | 2 +- create/Dockerfile | 6 ++++++ create/action.yml | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 check/Dockerfile create mode 100644 create/Dockerfile diff --git a/check/Dockerfile b/check/Dockerfile new file mode 100644 index 0000000..054db1e --- /dev/null +++ b/check/Dockerfile @@ -0,0 +1,6 @@ +FROM ghcr.io/nodlecode/try-runtime-cli:v0.6.1 + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/check/action.yml b/check/action.yml index 2102a63..eaab953 100644 --- a/check/action.yml +++ b/check/action.yml @@ -19,7 +19,7 @@ inputs: required: false runs: using: 'docker' - image: '../Dockerfile' + image: 'Dockerfile' args: - ${{ inputs.snap }} - ${{ inputs.runtime }} diff --git a/create/Dockerfile b/create/Dockerfile new file mode 100644 index 0000000..054db1e --- /dev/null +++ b/create/Dockerfile @@ -0,0 +1,6 @@ +FROM ghcr.io/nodlecode/try-runtime-cli:v0.6.1 + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/create/action.yml b/create/action.yml index d765bd5..d4c543b 100644 --- a/create/action.yml +++ b/create/action.yml @@ -16,7 +16,7 @@ inputs: runs: using: 'docker' - image: '../Dockerfile' + image: 'Dockerfile' args: - ${{ inputs.url }} - ${{ inputs.snap }}