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

difftreelog

ci node only update changes (#956)

BuddyGlas2023-08-14parent: #fc1ccc4.patch.diff
in: master

4 files changed

deleted.docker/Dockerfile-parachain-node-onlydiffbeforeafterboth

no changes

added.docker/Dockerfile-parachain-node-only.j2diffbeforeafterboth

no changes

added.docker/docker-compose.node-only.j2diffbeforeafterboth

no changes

modified.github/workflows/node-only-update.ymldiffbeforeafterboth
11# A workflow run is made up of one or more jobs that can run sequentially or in parallel11# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12jobs:12jobs:
1313
14 nodes-execution-matrix:14 prepare-execution-matrix:
1515
16 name: execution matrix16 name: execution matrix
1717
43 network {unique}, wasm_name {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}43 network {unique}, wasm_name {unique}, mainnet_branch {${{ env.UNIQUE_MAINNET_BRANCH }}}, relay_branch {${{ env.POLKADOT_MAINNET_BRANCH }}}
44
45
46 node-only-update-build:
47
48 needs: prepare-execution-matrix
49 # The type of runner that the job will run on
50 runs-on: [self-hosted-ci]
51
52 timeout-minutes: 2880 # 48 hours for execution jobs.
53
54 name: ${{ matrix.network }}-build
55
56 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.
57
58 strategy:
59 matrix:
60 include: ${{fromJson(needs.prepare-execution-matrix.outputs.matrix)}}
61
62 steps:
63
64 - name: Skip if pull request is in Draft
65 if: github.event.pull_request.draft == true
66 run: exit 1
67
68 - name: Clean Workspace
69 uses: AutoModality/action-clean@v1.1.0
70
71 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
72 - uses: actions/checkout@v3.1.0
73 with:
74 ref: ${{ github.head_ref }} #Checking out head commit
75
76 # Prepare SHA
77 - name: Prepare SHA
78 uses: ./.github/actions/prepare
79
80 - name: Read .env file
81 uses: xom9ikk/dotenv@v2
82
83 # Build main image for NODE-ONLY-UPDATE
84 - name: Generate ENV related extend Dockerfile file
85 uses: cuchi/jinja2-action@v1.2.0
86 with:
87 template: .docker/Dockerfile-parachain-node-only.j2
88 output_file: .docker/Dockerfile-parachain-node-only.${{ matrix.network }}.yml
89 variables: |
90 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
91 NETWORK=${{ matrix.network }}
92 MAINNET_BRANCH=${{ matrix.mainnet_branch }}
93 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}
94 WASM_NAME=${{ matrix.wasm_name }}
95 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
96
97 - name: Show build configuration
98 run: cat .docker/Dockerfile-parachain-node-only.${{ matrix.network }}.yml
99
100 - name: Generate launch-config.json
101 uses: cuchi/jinja2-action@v1.2.0
102 with:
103 template: .docker/forkless-config/launch-config-forkless-nodata.j2
104 output_file: .docker/forkless-config/launch-config-node-only.json
105 variables: |
106 WASM_NAME=${{ matrix.wasm_name }}
107 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }}
108
109 - name: Show launch-config-forkless configuration
110 run: cat .docker/forkless-config/launch-config-node-only.json
111
112 - name: Run find-and-replace to remove slashes from branch name
113 uses: mad9000/actions-find-and-replace-string@4
114 id: branchname
115 with:
116 source: ${{ github.head_ref }}
117 find: '/'
118 replace: '-'
119
120 - name: Set build SHA
121 shell: bash
122 run: |
123 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV
124
125 - name: Build the stack
126 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-parachain-node-only.${{ matrix.network }}.yml --tag uniquenetwork/ci-node-only-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA ../
127
128 - name: Log in to Docker Hub
129 uses: docker/login-action@v2.1.0
130 with:
131 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
132 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
133
134 - name: Push docker image version
135 run: docker push uniquenetwork/ci-node-only-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA
136
137 - name: Remove builder cache
138 if: always() # run this step always
139 run: |
140 docker builder prune -f
141 docker system prune -f
44142
45143
46 nodes-only-update:144 node-only-update-tests:
47 needs: nodes-execution-matrix145 needs: [prepare-execution-matrix, node-only-update-build]
48 # The type of runner that the job will run on146 # The type of runner that the job will run on
49 runs-on: [self-hosted-ci]147 runs-on: [self-hosted-ci, large]
50148
51 timeout-minutes: 2880 # 48 hours for execution jobs.149 timeout-minutes: 2880
52150
53 name: ${{ matrix.network }}151 name: ${{ matrix.network }}-tests
54152
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.153 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.
56154
57 strategy:155 strategy:
58 matrix:156 matrix:
59 include: ${{fromJson(needs.nodes-execution-matrix.outputs.matrix)}}157 include: ${{fromJson(needs.prepare-execution-matrix.outputs.matrix)}}
60158
61 steps:159 steps:
160 - name: Skip if pull request is in Draft
161 if: github.event.pull_request.draft == true
162 run: exit 1
62163
63 - name: Clean Workspace164 - name: Clean Workspace
64 uses: AutoModality/action-clean@v1.1.0165 uses: AutoModality/action-clean@v1.1.0
68 with:169 with:
69 ref: ${{ github.head_ref }} #Checking out head commit170 ref: ${{ github.head_ref }} #Checking out head commit
70171
71 - name: Read .env file172 - name: Prepare
72 uses: xom9ikk/dotenv@v2173 uses: ./.github/actions/prepare
174
175 - name: Set build SHA
176 shell: bash
177 run: |
178 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV
73179
74 - name: Generate ENV related extend file for docker-compose180 - name: Run find-and-replace to remove slashes from branch name
75 uses: cuchi/jinja2-action@v1.2.0181 uses: mad9000/actions-find-and-replace-string@4
182 id: branchname
76 with:183 with:
77 template: .docker/docker-compose.tmp-node.j2184 source: ${{ github.head_ref }}
78 output_file: .docker/docker-compose.node.${{ matrix.network }}.yml185 find: '/'
79 variables: |186 replace: '-'
80 REPO_URL=${{ github.server_url }}/${{ github.repository }}.git
81 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
82 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
83 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}
84 # POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }}
85 # MAINNET_TAG=${{ matrix.mainnet_tag }}
86 MAINNET_BRANCH=${{ matrix.mainnet_branch }}
87 NETWORK=${{ matrix.network }}
88 WASM_NAME=${{ matrix.wasm_name }}
89 # BRANCH=${{ github.head_ref }}
90187
91 - name: Show build configuration188 - name: Read .env file
92 run: cat .docker/docker-compose.node.${{ matrix.network }}.yml189 uses: xom9ikk/dotenv@v2
93190
94 - name: Generate launch-config-forkless-nodata.json191 - name: Generate ENV related extend file for docker-compose
95 uses: cuchi/jinja2-action@v1.2.0192 uses: cuchi/jinja2-action@v1.2.0
96 with:193 with:
97 template: .docker/forkless-config/launch-config-forkless-nodata.j2194 template: .docker/docker-compose.node-only.j2
98 output_file: .docker/launch-config-forkless-nodata.json195 output_file: .docker/docker-compose.node-only.${{ matrix.network }}.yml
99 variables: |196 variables: |
100 NETWORK=${{ matrix.network }}197 NETWORK=${{ matrix.network }}
101 WASM_NAME=${{ matrix.wasm_name }}198 BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA
102 RELAY_CHAIN_TYPE=${{ env.RELAY_CHAIN_TYPE }}
103199
104 - name: Show launch-config-forkless configuration200 - name: Show build configuration
105 run: cat .docker/launch-config-forkless-nodata.json201 run: cat .docker/docker-compose.node-only.${{ matrix.network }}.yml
106202
107 - uses: actions/setup-node@v3.5.1203 - name: Log in to Docker Hub
204 uses: docker/login-action@v2.1.0
108 with:205 with:
109 node-version: 16206 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
207 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
110208
111 - name: Build the stack209 - name: Build the stack
112 run: docker-compose -f ".docker/docker-compose.node.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate --timeout 300210 run: docker-compose -f ".docker/docker-compose.node-only.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300
113211
114 # 🚀 POLKADOT LAUNCH COMPLETE 🚀212 # 🚀 POLKADOT LAUNCH COMPLETE 🚀
115 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.213 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.
116 if: success()214 if: success()
117 run: |215 run: |
118 counter=160216 counter=160
119 function check_container_status {217 function check_container_status {
120 docker inspect -f {{.State.Running}} node-parachain218 docker inspect -f {{.State.Running}} node-only
121 }219 }
122 function do_docker_logs {220 function do_docker_logs {
123 docker logs --details node-parachain 2>&1221 docker logs --details node-only 2>&1
124 }222 }
125 function is_started {223 function is_started {
126 if [ "$(check_container_status)" == "true" ]; then224 if [ "$(check_container_status)" == "true" ]; then
127 echo "Container: node-parachain RUNNING";225 echo "Container: node-only RUNNING";
128 echo "Check Docker logs"226 echo "Check Docker logs"
129 DOCKER_LOGS=$(do_docker_logs)227 DOCKER_LOGS=$(do_docker_logs)
130 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then228 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then
131 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"229 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"
132 return 0230 return 0
133 else231 else
134 echo "Message not found in logs output, repeating..."232 echo "Message not found in logs output, repeating..."
135 return 1233 return 1
136 fi234 fi
137 else235 else
138 echo "Container node-parachain NOT RUNNING"236 echo "Container node-only NOT RUNNING"
139 echo "Halting all future checks"237 echo "Halting all future checks"
140 exit 1238 exit 1
141 fi239 fi
142 echo "something goes wrong"240 echo "something goes wrong"
143 exit 1241 exit 1
144 }242 }
145 while ! is_started; do243 while ! is_started; do
146 echo "Waiting for special message in log files "244 echo "Waiting for special message in log files "
147 sleep 30s245 sleep 30s
148 counter=$(( $counter - 1 ))246 counter=$(( $counter - 1 ))
149 echo "Counter: $counter"247 echo "Counter: $counter"
150 if [ "$counter" -gt "0" ]; then248 if [ "$counter" -gt "0" ]; then
151 continue249 continue
152 else250 else
153 break251 break
154 fi252 fi
155 done253 done
156 echo "Halting script"254 echo "Halting script"
157 exit 0255 exit 0
158 shell: bash256 shell: bash
159257
160 - name: Checkout at '${{ matrix.mainnet_branch }}' branch258 - name: Checkout at '${{ matrix.mainnet_branch }}' branch
163 ref: ${{ matrix.mainnet_branch }} #Checking out head commit261 ref: ${{ matrix.mainnet_branch }} #Checking out head commit
164 path: ${{ matrix.mainnet_branch }}262 path: ${{ matrix.mainnet_branch }}
263
264 - uses: actions/setup-node@v3.5.1
265 with:
266 node-version: 16
165267
166 - name: Run Parallel tests before Node Parachain upgrade268 - name: Run Parallel tests before Node Parachain upgrade
167 working-directory: ${{ matrix.mainnet_branch }}/tests269 working-directory: ${{ matrix.mainnet_branch }}/tests
176 env:278 env:
177 RPC_URL: http://127.0.0.1:9944/279 RPC_URL: http://127.0.0.1:9944/
178
179 # - name: Upload Parallel Test Report Before Node upgrade
180 # uses: phoenix-actions/test-reporting@v8
181 # id: test-parallel-report-before
182 # if: success() || failure() # run this step even if previous step failed
183 # with:
184 # name: Tests before node upgrade ${{ matrix.network }} # Name of the check run which will be created
185 # path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-parallel-*.json # Path to test results
186 # reporter: mochawesome-json
187 # fail-on-error: 'false'
188280
189 - name: Run Sequential tests before Node Parachain upgrade281 - name: Run Sequential tests before Node Parachain upgrade
190 if: success() || failure()282 if: success() || failure()
193 env:285 env:
194 RPC_URL: http://127.0.0.1:9944/286 RPC_URL: http://127.0.0.1:9944/
195
196 # - name: Upload Sequential Test Report Before Node upgrade
197 # uses: phoenix-actions/test-reporting@v10
198 # id: test-sequential-report-before
199 # if: success() || failure() # run this step even if previous step failed
200 # with:
201 # name: Tests before node upgrade ${{ matrix.network }} # Name of the check run which will be created
202 # path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-sequential-*.json # Path to test results
203 # reporter: mochawesome-json
204 # fail-on-error: 'false'
205287
206 - name: Send SIGUSR1 to polkadot-launch process288 - name: Send SIGUSR1 to polkadot-launch process
207 if: success() || failure()289 if: success() || failure()
208 run: |290 run: |
209 #Get PID of polkadot-launch291 #Get PID of polkadot-launch
210 ContainerID=$(docker ps -aqf "name=node-parachain")292 ContainerID=$(docker ps -aqf "name=node-only")
211 PID=$(docker exec node-parachain pidof 'polkadot-launch')293 PID=$(docker exec node-only pidof 'polkadot-launch')
212 sleep 30s294 sleep 30s
213 echo -e "\n"295 echo -e "\n"
214 echo -e "Restart polkadot-launch process: $PID\n"296 echo -e "Restart polkadot-launch process: $PID\n"
215 docker exec node-parachain kill -SIGUSR1 ${PID}297 docker exec node-only kill -SIGUSR1 ${PID}
216 echo "SIGUSR1 sent to Polkadot-launch PID: $PID"298 echo "SIGUSR1 sent to Polkadot-launch PID: $PID"
217 sleep 60s299 sleep 60s
218 echo -e "Show logs of node-parachain container.\n"300 echo -e "Show logs of node-only container.\n"
219 docker logs ${ContainerID}301 docker logs ${ContainerID}
220302
221 - name: Get chain logs in case of docker image crashed after Polkadot Launch restart303 - name: Get chain logs in case of docker image crashed after Polkadot Launch restart
222 if: failure() # run this step only at failure304 if: failure() # run this step only at failure
223 run: |305 run: |
224 docker exec node-parachain tail -n 1000 /polkadot-launch/9944.log306 docker exec node-only tail -n 1000 /polkadot-launch/9944.log
225 docker exec node-parachain tail -n 1000 /polkadot-launch/9945.log307 docker exec node-only tail -n 1000 /polkadot-launch/9945.log
226 docker exec node-parachain tail -n 1000 /polkadot-launch/alice.log308 docker exec node-only tail -n 1000 /polkadot-launch/alice.log
227309
228 - name: copy chain log files from container to the host310 - name: copy chain log files from container to the host
229 if: success() || failure() # run this step even if previous step failed311 if: success() || failure() # run this step even if previous step failed
230 run: |312 run: |
231 mkdir -p /tmp/node-only-update313 mkdir -p /tmp/node-only-update
232 docker cp node-parachain:/polkadot-launch/9944.log /tmp/node-only-update/314 docker cp node-only:/polkadot-launch/9944.log /tmp/node-only-update/
233 docker cp node-parachain:/polkadot-launch/9945.log /tmp/node-only-update/315 docker cp node-only:/polkadot-launch/9945.log /tmp/node-only-update/
234 docker cp node-parachain:/polkadot-launch/alice.log /tmp/node-only-update/316 docker cp node-only:/polkadot-launch/alice.log /tmp/node-only-update/
235317
236 - name: Upload chain log files318 - name: Upload chain log files
237 if: success() || failure()319 if: success() || failure()
243325
244 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.326 - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade.
245 if: success()327 if: success()
246 run: |328 run: |
247 counter=160329 counter=160
248 function check_container_status {330 function check_container_status {
249 docker inspect -f {{.State.Running}} node-parachain331 docker inspect -f {{.State.Running}} node-only
250 }332 }
251 function do_docker_logs {333 function do_docker_logs {
252 docker logs --details node-parachain 2>&1334 docker logs --details node-only 2>&1
253 }335 }
254 function is_started {336 function is_started {
255 if [ "$(check_container_status)" == "true" ]; then337 if [ "$(check_container_status)" == "true" ]; then
256 echo "Container: node-parachain RUNNING";338 echo "Container: node-only RUNNING";
257 echo "Check Docker logs"339 echo "Check Docker logs"
258 DOCKER_LOGS=$(do_docker_logs)340 DOCKER_LOGS=$(do_docker_logs)
259 if [[ ${DOCKER_LOGS} = *"All parachain collators restarted with the new binaries."* ]];then341 if [[ ${DOCKER_LOGS} = *"All parachain collators restarted with the new binaries."* ]];then
260 echo "🌗 All parachain collators restarted with the new binaries."342 echo "🌗 All parachain collators restarted with the new binaries."
261 return 0343 return 0
262 else344 else
263 echo "Message not found in logs output, repeating..."345 echo "Message not found in logs output, repeating..."
264 return 1346 return 1
265 fi347 fi
266 else348 else
267 echo "Container node-parachain NOT RUNNING"349 echo "Container node-only NOT RUNNING"
268 echo "Halting all future checks"350 echo "Halting all future checks"
269 exit 1351 exit 1
270 fi352 fi
271 echo "something goes wrong"353 echo "something goes wrong"
272 exit 1354 exit 1
273 }355 }
274 while ! is_started; do356 while ! is_started; do
275 echo "Waiting for special message in log files "357 echo "Waiting for special message in log files "
276 sleep 30s358 sleep 30s
277 counter=$(( $counter - 1 ))359 counter=$(( $counter - 1 ))
278 echo "Counter: $counter"360 echo "Counter: $counter"
279 if [ "$counter" -gt "0" ]; then361 if [ "$counter" -gt "0" ]; then
280 continue362 continue
281 else363 else
282 break364 break
283 fi365 fi
284 done366 done
285 echo "Halting script"367 echo "Halting script"
286 exit 0368 exit 0
287 shell: bash369 shell: bash
288370
289 - name: Run Parallel tests after Node Parachain upgrade371 - name: Run Parallel tests after Node Parachain upgrade
299 env:381 env:
300 RPC_URL: http://127.0.0.1:9944/382 RPC_URL: http://127.0.0.1:9944/
301
302 #- name: Test Report Parallel After Node upgrade
303 # uses: phoenix-actions/test-reporting@v10
304 # id: test-report-parallel-after
305 # if: success() || failure() # run this step even if previous step failed
306 # with:
307 # name: Tests after node upgrade ${{ matrix.network }} # Name of the check run which will be created
308 # path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-parallel-*.json # Path to test results
309 # reporter: mochawesome-json
310 # fail-on-error: 'false'
311383
312 - name: Run Sequential tests after Node Parachain upgrade384 - name: Run Sequential tests after Node Parachain upgrade
313 if: success() || failure()385 if: success() || failure()
316 env:388 env:
317 RPC_URL: http://127.0.0.1:9944/389 RPC_URL: http://127.0.0.1:9944/
318
319 #- name: Upload Sequential Test Report After Node upgrade
320 # uses: phoenix-actions/test-reporting@v10
321 # id: test-sequential-report-after
322 # if: success() || failure() # run this step even if previous step failed
323 # with:
324 # name: Tests before node upgrade ${{ matrix.network }} # Name of the check run which will be created
325 # path: ${{ matrix.mainnet_branch }}/tests/mochawesome-report/test-sequential-*.json # Path to test results
326 # reporter: mochawesome-json
327 # fail-on-error: 'false'
328390
329 - name: Stop running containers391 - name: Stop running containers
330 if: always() # run this step always392 if: always() # run this step always
331 run: docker-compose -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes393 run: docker-compose -f ".docker/docker-compose.node-only.${{ matrix.network }}.yml" down
332394
333 - name: Remove builder cache395 - name: Remove builder cache
334 if: always() # run this step always396 if: always() # run this step always