git.delta.rocks / unique-network / refs/commits / f2665353b047

difftreelog

ci move forkless-data to baedeker

Yaroslav Bolyukin2023-09-08parent: #5a3f942.patch.diff
in: master

2 files changed

added.baedeker/forkless-data.jsonnetdiffbeforeafterboth

no changes

modified.github/workflows/forkless-update-data.ymldiffbeforeafterboth
9# A workflow run is made up of one or more jobs that can run sequentially or in parallel9# A workflow run is made up of one or more jobs that can run sequentially or in parallel
10jobs:10jobs:
1111
12 prepare-execution-marix:12 prepare-execution-matrix:
1313
14 name: Prepare execution matrix14 name: execution matrix
1515
16 runs-on: self-hosted-ci16 runs-on: self-hosted-ci
17 outputs:17 outputs:
34 uses: CertainLach/create-matrix-action@v434 uses: CertainLach/create-matrix-action@v4
35 id: create_matrix35 id: create_matrix
36 with:36 with:
37 # TODO: Remove state-version-0 after mainnet upgrade
38 matrix: |37 matrix: |
39 network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, extra_features {,state-version-0}38 network {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, runtime_features {opal-runtime}, fork_source {${{ env.OPAL_REPLICA_FROM }}}
40 network {unique}, wasm_name {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, replica_from_address {${{ env.UNIQUE_REPLICA_FROM }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, extra_features {,state-version-0}39 network {sapphire}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}, runtime_features {sapphire-runtime}, wasm_name {quartz}, fork_source {${{ env.SAPPHIRE_REPLICA_FROM }}}
41 network {opal}, wasm_name {opal}, mainnet_branch {${{ env.OPAL_MAINNET_BRANCH }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}, extra_features {,state-version-0}40 network {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, runtime_features {quartz-runtime}, wasm_name {quartz}, fork_source {${{ env.QUARTZ_REPLICA_FROM }}}
42 network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, replica_from_address {${{ env.SAPPHIRE_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}, extra_features {,state-version-0}41 network {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}, runtime_features {unique-runtime}, wasm_name {unique}, fork_source {${{ env.UNIQUE_REPLICA_FROM }}}
4342
44 forkless-data-build:43 forkless-data-build:
45 needs: prepare-execution-marix44
46 # The type of runner that the job will run on
47 runs-on: [self-hosted-ci,large]
48 timeout-minutes: 1380
49
50 name: ${{ matrix.network }}-data-build
51 strategy:
52 matrix:
53 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}
54
55 continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.
56
57 steps:
58 - name: Clean Workspace
59 uses: AutoModality/action-clean@v1.1.0
60
61 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
62 - uses: actions/checkout@v3.1.0
63 with:
64 ref: ${{ github.head_ref }} #Checking out head commit
65
66 - name: Read .env file
67 uses: xom9ikk/dotenv@v2
68
69 # Prepare SHA
70 - name: Prepare SHA
71 uses: ./.github/actions/prepare
72
73 # Build main image for FORKLESS-UPDATE-NODATA
74 - name: Generate ENV related extend Dockerfile file
75 uses: cuchi/jinja2-action@v1.2.0
76 with:
77 template: .docker/Dockerfile-parachain-upgrade-data.j2
78 output_file: .docker/Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml
79 variables: |
80 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
81 NETWORK=${{ matrix.network }}
82 MAINNET_BRANCH=${{ matrix.mainnet_branch }}
83 WASM_NAME=${{ matrix.wasm_name }}
84 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }}
85 DESTINATION_SPEC_VERSION=${{ env.DESTINATION_SPEC_VERSION }}
86 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
87 REPLICA_FROM=${{ matrix.replica_from_address }}
88 CHAINQL=${{ env.CHAINQL }}
89 EXTRA_FEATURES=${{ matrix.extra_features }}
90
91 - name: Show build configuration
92 run: cat .docker/Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml
93
94 - name: Run find-and-replace to remove slashes from branch name
95 uses: mad9000/actions-find-and-replace-string@4
96 id: branchname
97 with:
98 source: ${{ github.head_ref }}
99 find: '/'
100 replace: '-'
101
102 - name: Set build SHA
103 shell: bash
104 run: |
105 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV
106
107 - name: Build the stack
108 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-parachain-upgrade-data.${{ matrix.network }}.yml --tag uniquenetwork/ci-forkless-data-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA ../
109
110 - name: Log in to Docker Hub
111 uses: docker/login-action@v2.1.0
112 with:
113 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
114 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
115
116 - name: Push docker image version
117 run: docker push uniquenetwork/ci-forkless-data-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA
118
119 - name: Remove builder cache
120 if: always() # run this step always
121 run: |
122 docker builder prune -f
123 docker system prune -f
124
125 forkless-data-tests:
126 needs: [prepare-execution-marix, forkless-data-build]45 needs: prepare-execution-matrix
127 # The type of runner that the job will run on46 # The type of runner that the job will run on
128 runs-on: [self-hosted-ci, large]47 runs-on: [self-hosted-ci,large]
12948
130 timeout-minutes: 60049 timeout-minutes: 1380
13150
132 name: ${{ matrix.network }}-data-tests51 name: ${{ matrix.network }}-data-build
13352
134 continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.53 continue-on-error: true #Do not stop testing of matrix runs failed. As it decided during PR review - it required 50/50& Let's check it with false.
13554
136 strategy:55 strategy:
137 matrix:56 matrix:
138 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}57 include: ${{fromJson(needs.prepare-execution-matrix.outputs.matrix)}}
13958
140 steps:59 steps:
141 - name: Skip if pull request is in Draft
142 if: github.event.pull_request.draft == true
143 run: exit 1
14460
145 - name: Clean Workspace61 - name: Clean Workspace
146 uses: AutoModality/action-clean@v1.1.062 uses: AutoModality/action-clean@v1.1.0
150 with:66 with:
151 ref: ${{ github.head_ref }} #Checking out head commit67 ref: ${{ github.head_ref }} #Checking out head commit
15268
69 # Prepare SHA
153 - name: Prepare70 - name: Prepare SHA
154 uses: ./.github/actions/prepare71 uses: ./.github/actions/prepare
15572
156 - name: Set build SHA73 - name: Read .env file
157 shell: bash74 uses: xom9ikk/dotenv@v2
158 run: |
159 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV
16075
161 - name: Run find-and-replace to remove slashes from branch name76 - name: Log in to Docker Hub
162 uses: mad9000/actions-find-and-replace-string@477 uses: docker/login-action@v2.1.0
163 id: branchname
164 with:78 with:
165 source: ${{ github.head_ref }}79 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
166 find: '/'80 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
167 replace: '-'
16881
169 - name: Read .env file82 - name: Generate ENV related extend Dockerfile file for POLKADOT
170 uses: xom9ikk/dotenv@v283 uses: cuchi/jinja2-action@v1.2.0
17184 with:
85 template: .docker/Dockerfile-polkadot.j2
86 output_file: .docker/Dockerfile-polkadot.${{ matrix.relay_branch }}.yml
87 variables: |
88 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
89 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
90
172 - name: Generate ENV related extend file for docker-compose91 - name: Prepare polkadot
173 uses: cuchi/jinja2-action@v1.2.092 uses: ./.github/actions/buildContainer
93 id: polkadot
174 with:94 with:
95 container: uniquenetwork/builder-polkadot
175 template: .docker/docker-compose.forkless-data.j296 tag: ${{ matrix.relay_branch }}
97 context: .docker
176 output_file: .docker/docker-compose.forkless-data.${{ matrix.network }}.yml98 dockerfile: Dockerfile-polkadot.${{ matrix.relay_branch }}.yml
99 dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
177 variables: |100 dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
178 NETWORK=${{ matrix.network }}
179 BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA
180101
181 - name: Show build configuration102 - name: Prepare mainnet
103 uses: ./.github/actions/buildContainer
104 id: mainnet
105 with:
182 run: cat .docker/docker-compose.forkless-data.${{ matrix.network }}.yml106 container: uniquenetwork/ci-data-${{ matrix.network }}
107 tag: ${{ matrix.mainnet_branch }}
108 context: .docker
109 dockerfile: Dockerfile-unique-release
110 args: |
111 --build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }}
112 --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
113 --build-arg UNIQUE_VERSION=${{ matrix.mainnet_branch }}
114 dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
115 dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
183116
184 - name: Log in to Docker Hub117 - name: Prepare latest
185 uses: docker/login-action@v2.1.0118 uses: ./.github/actions/buildContainer
119 id: latest
186 with:120 with:
121 container: uniquenetwork/ci-data-${{ matrix.network }}
122 tag: ${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}
123 context: .
124 dockerfile: .docker/Dockerfile-unique
125 args: |
126 --build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }}
127 --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
187 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}128 dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
188 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}129 dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
189130
190 - name: Build the stack131 - name: Extract wasms
132 uses: ./.github/actions/extractDocker
133 id: wasms
134 with:
135 image: ${{ steps.latest.outputs.name }}
191 run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300136 directory: /wasm
192137
193 - uses: actions/setup-node@v3.5.1138 - uses: actions/setup-node@v3.5.1
194 with:139 with:
195 node-version: 18140 node-version: 18
141
142 - name: Install baedeker
143 uses: UniqueNetwork/baedeker-action/setup@built
144
145 - name: Setup library
146 run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library
196147
197 - name: Check if docker logs consist logs related to Runtime Upgrade testing.148 - name: Start network
149 uses: UniqueNetwork/baedeker-action@built
198 if: success()150 id: bdk
151 with:
152 jpath: |
153 .baedeker/vendor
199 run: |154 tla-str: |
200 counter=160155 relay_spec=rococo-local
201 function check_container_status {156 forked_spec=${{ matrix.network }}
202 docker inspect -f {{.State.Running}} forkless-data-${{ matrix.network }}157 fork_source=${{ matrix.fork_source }}
203 }
204 function do_docker_logs {
205 docker logs --details forkless-data-${{ matrix.network }} 2>&1
206 }
207 function is_started {
208 if [ "$(check_container_status)" == "true" ]; then
209 echo "Container: forkless-data-${{ matrix.network }} RUNNING";
210 echo "Check Docker logs"
211 DOCKER_LOGS=$(do_docker_logs)
212 if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then
213 echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"
214 return 0
215 elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then
216 echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"
217 return 1
218 else
219 echo "Message not found in logs output, repeating..."
220 return 1
221 fi
222 else
223 echo "Container forkless-data-${{ matrix.network }} not RUNNING"
224 echo "Halting all future checks"
225 exit 1
226 fi
227 exit 0
228 }
229 while ! is_started; do
230 echo "Waiting for special message in log files "
231 sleep 30s
232 counter=$(( $counter - 1 ))
233 echo "Counter: $counter"
234 if [ "$counter" -gt "0" ]; then
235 continue
236 else
237 echo "Counter reached zero, yet upgrade is not finished"
238 exit 1
239 fi
240 done
241 echo "Halting script"
242 exit 0
243 shell: bash158 inputs: |
159 .baedeker/forkless-data.jsonnet
160 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.name }}'}})
161 snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.mainnet.outputs.name }}'}}, extra_node_mixin = {legacyRpc: true})
244162
245 - name: Collect Docker Logs163 - name: "Reconcile: runtime is upgraded"
246 if: success() || failure()164 working-directory: tests
247 uses: jwalton/gh-docker-logs@v2.2.1165 run: |
166 yarn
167 ./scripts/wait_for_first_block.sh
168 echo "Executing upgrade"
169 yarn ts-node --esm src/util/authorizeEnactUpgrade.ts ${{ steps.wasms.outputs.dir }}/${{ matrix.wasm_name }}-runtime/${{ matrix.wasm_name }}_runtime.compact.compressed.wasm
248 with:170 env:
249 dest: './forkless-parachain-upgrade-data-logs.${{ matrix.network }}'171 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}
250172
251 - name: Show Docker logs173 - name: Run Parallel tests after forkless upgrade
252 if: success() || failure()174 working-directory: tests
253 run: cat './forkless-parachain-upgrade-data-logs.${{ matrix.network }}/forkless-data-${{ matrix.network }}.log'175 run: |
176 ./scripts/wait_for_first_block.sh
177 echo "Ready to start tests"
178 NOW=$(date +%s) && yarn testParallel --reporter mochawesome --reporter-options reportFilename=test-parallel-${NOW}
179 env:
180 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}
254181
255 - name: Stop running containers182 - name: Run Sequential tests after forkless upgrade
256 if: always() # run this step always183 if: success() || failure()
184 working-directory: ${{ matrix.mainnet_branch }}/tests
257 run: docker-compose -f ".docker/docker-compose.forkless-data.${{ matrix.network }}.yml" down --volumes185 run: NOW=$(date +%s) && yarn testSequential --reporter mochawesome --reporter-options reportFilename=test-sequential-${NOW}
186 env:
187 RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}
258188
259 - name: Remove builder cache189 - name: Remove builder cache
260 if: always() # run this step always190 if: always() # run this step always
261 run: |191 run: |
262 docker builder prune -f -a192 docker system prune -f
263 docker system prune -f
264 docker image prune -f -a
265193