git.delta.rocks / unique-network / refs/commits / 6f79f09ea997

difftreelog

ci collator-selection for dockerhub

Konstantin Astakhov2023-06-23parent: #c575769.patch.diff
in: master

5 files changed

deleted.docker/Dockerfile-collatorsdiffbeforeafterboth

no changes

added.docker/Dockerfile-collators.j2diffbeforeafterboth

no changes

added.docker/docker-compose.collators.j2diffbeforeafterboth

no changes

deleted.docker/docker-compose.tmp-collators.j2diffbeforeafterboth

no changes

modified.github/workflows/collator-selection.ymldiffbeforeafterboth
66
7# A workflow run is made up of one or more jobs that can run sequentially or in parallel7# A workflow run is made up of one or more jobs that can run sequentially or in parallel
8jobs:8jobs:
9 execution-marix:9 prepare-execution-marix:
10 name: Prepare execution matrix10 name: Prepare execution matrix
1111
12 runs-on: self-hosted-ci12 runs-on: self-hosted-ci
35 network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}35 network {quartz}, wasm_name {quartz}, mainnet_branch {${{ env.QUARTZ_MAINNET_BRANCH }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}
36 network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, replica_from_address {${{ env.SAPPHIRE_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}36 network {sapphire}, wasm_name {quartz}, mainnet_branch {${{ env.SAPPHIRE_MAINNET_BRANCH }}}, replica_from_address {${{ env.SAPPHIRE_REPLICA_FROM }}}, relay_branch {${{ env.UNIQUEEAST_MAINNET_BRANCH }}}
37
38 collator-selection-build:
39 needs: prepare-execution-marix
40 # The type of runner that the job will run on
41 runs-on: [self-hosted-ci,large]
42 timeout-minutes: 1380
43
44 name: ${{ matrix.network }}-build
45 strategy:
46 matrix:
47 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}
48
49 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.
50
51 steps:
52 - name: Clean Workspace
53 uses: AutoModality/action-clean@v1.1.0
54
55 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
56 - uses: actions/checkout@v3
57 with:
58 ref: ${{ github.head_ref }} #Checking out head commit
59
60 - name: Read .env file
61 uses: xom9ikk/dotenv@v2
62
63 # Prepare SHA
64 - name: Prepare SHA
65 uses: ./.github/actions/prepare
66
67 # Build main image for FORKLESS-UPDATE-NODATA
68 - name: Generate ENV related extend Dockerfile file
69 uses: cuchi/jinja2-action@v1.2.0
70 with:
71 template: .docker/Dockerfile-collators.j2
72 output_file: .docker/Dockerfile-collators.${{ matrix.network }}.yml
73 variables: |
74 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
75 NETWORK=${{ matrix.network }}
76 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}
77 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}
78 BRANCH=${{ github.head_ref }}
79
80 - name: Show build configuration
81 run: cat .docker/Dockerfile-collators.${{ matrix.network }}.yml
82
83 - name: Run find-and-replace to remove slashes from branch name
84 uses: mad9000/actions-find-and-replace-string@4
85 id: branchname
86 with:
87 source: ${{ github.head_ref }}
88 find: '/'
89 replace: '-'
90
91 - name: Set build SHA
92 shell: bash
93 run: |
94 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV
95
96 - name: Build the stack
97 run: cd .docker/ && docker build --no-cache --file ./Dockerfile-collators.${{ matrix.network }}.yml --tag uniquenetwork/ci-collator-selection-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA ../
98
99 - name: Log in to Docker Hub
100 uses: docker/login-action@v2.1.0
101 with:
102 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
103 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
104
105 - name: Push docker image version
106 run: docker push uniquenetwork/ci-collator-selection-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA
107
108 - name: Remove builder cache
109 if: always() # run this step always
110 run: |
111 docker builder prune -f
112 docker system prune -f
37113
38 collator-selection:114 collator-selection-tests:
39 needs: execution-marix115 needs: [prepare-execution-marix, collator-selection-build]
40 # The type of runner that the job will run on116 # The type of runner that the job will run on
41 runs-on: [self-hosted-ci,large]117 runs-on: [self-hosted-ci, large]
118
42 timeout-minutes: 1380119 timeout-minutes: 600
43120
44 name: ${{ matrix.network }}121 name: ${{ matrix.network }}-tests
122
123 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.
124
45 strategy:125 strategy:
46 matrix:126 matrix:
47 include: ${{fromJson(needs.execution-marix.outputs.matrix)}}127 include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}
48
49 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.
50128
51 steps:129 steps:
130 - name: Skip if pull request is in Draft
131 if: github.event.pull_request.draft == true
132 run: exit 1
133
52 - name: Clean Workspace134 - name: Clean Workspace
53 uses: AutoModality/action-clean@v1.1.0135 uses: AutoModality/action-clean@v1.1.0
54136
55 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it137 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
56 - uses: actions/checkout@v3138 - uses: actions/checkout@v3.1.0
57 with:139 with:
58 ref: ${{ github.head_ref }} #Checking out head commit140 ref: ${{ github.head_ref }} #Checking out head commit
141
142 - name: Prepare
143 uses: ./.github/actions/prepare
144
145 - name: Set build SHA
146 shell: bash
147 run: |
148 echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV
149
150 - name: Run find-and-replace to remove slashes from branch name
151 uses: mad9000/actions-find-and-replace-string@4
152 id: branchname
153 with:
154 source: ${{ github.head_ref }}
155 find: '/'
156 replace: '-'
59157
60 - name: Read .env file158 - name: Read .env file
61 uses: xom9ikk/dotenv@v2159 uses: xom9ikk/dotenv@v2
62160
63 - name: Generate ENV related extend file for docker-compose161 - name: Generate ENV related extend file for docker-compose
64 uses: cuchi/jinja2-action@v1.2.0162 uses: cuchi/jinja2-action@v1.2.0
65 with:163 with:
66 template: .docker/docker-compose.tmp-collators.j2164 template: .docker/docker-compose.collators.j2
67 output_file: .docker/docker-compose.collators.${{ matrix.network }}.yml165 output_file: .docker/docker-compose.collators.${{ matrix.network }}.yml
68 variables: |166 variables: |
69 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}167 NETWORK=${{ matrix.network }}
70 POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}168 BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA
71 POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}
72 NETWORK=${{ matrix.network }}
73 BRANCH=${{ github.head_ref }}
74169
75 - name: Show build configuration170 - name: Show build configuration
76 run: cat .docker/docker-compose.collators.${{ matrix.network }}.yml171 run: cat .docker/docker-compose.collators.${{ matrix.network }}.yml
77172
78 - name: Show launch-config configuration173 - name: Log in to Docker Hub
174 uses: docker/login-action@v2.1.0
175 with:
79 run: cat launch-config.json176 username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}
177 password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}
80178
81 - name: Build the stack179 - name: Build the stack
82 run: docker-compose -f ".docker/docker-compose.collators.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300180 run: docker-compose -f ".docker/docker-compose.collators.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300
83181
84 # 🚀 POLKADOT LAUNCH COMPLETE 🚀182 # 🚀 POLKADOT LAUNCH COMPLETE 🚀
85 - name: Check if docker logs consist messages related to testing of collator tests 183 - name: Check if docker logs consist messages related to testing of collator tests
86 if: success()184 if: success()
87 run: |185 run: |
88 counter=160186 counter=160
89 function check_container_status {187 function check_container_status {
90 docker inspect -f {{.State.Running}} parachain-collators188 docker inspect -f {{.State.Running}} collator-selection-${{ matrix.network }}
91 }189 }
92 function do_docker_logs {190 function do_docker_logs {
93 docker logs --details parachain-collators 2>&1191 docker logs --details collator-selection-${{ matrix.network }} 2>&1
94 }192 }
95 function is_started {193 function is_started {
96 if [ "$(check_container_status)" == "true" ]; then194 if [ "$(check_container_status)" == "true" ]; then
97 echo "Container: collator-${{ matrix.network }}-testnet-local RUNNING";195 echo "Container: collator-selection-${{ matrix.network }} RUNNING";
98 echo "Check Docker logs"196 echo "Check Docker logs"
99 DOCKER_LOGS=$(do_docker_logs)197 DOCKER_LOGS=$(do_docker_logs)
100 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then198 if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then
101 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"199 echo "🚀 POLKADOT LAUNCH COMPLETE 🚀"
102 return 0200 return 0
103 else201 else
104 echo "Message not found in logs output, repeating..."202 echo "Message not found in logs output, repeating..."
105 return 1203 return 1
106 fi204 fi
107 else205 else
108 echo "Container collator-${{ matrix.network }}-testnet-local NOT RUNNING"206 echo "Container collator-selection-${{ matrix.network }} NOT RUNNING"
109 echo "Halting all future checks"207 echo "Halting all future checks"
110 exit 1208 exit 1
111 fi209 fi
112 echo "something goes wrong"210 echo "something goes wrong"
113 exit 1211 exit 1
114 }212 }
115 while ! is_started; do213 while ! is_started; do
116 echo "Waiting for special message in log files "214 echo "Waiting for special message in log files "
117 sleep 30s215 sleep 30s
118 counter=$(( $counter - 1 ))216 counter=$(( $counter - 1 ))
119 echo "Counter: $counter"217 echo "Counter: $counter"
120 if [ "$counter" -gt "0" ]; then218 if [ "$counter" -gt "0" ]; then
121 continue219 continue
122 else220 else
123 break221 break
124 fi222 fi
125 done223 done
126 echo "Halting script"224 echo "Halting script"
127 exit 0225 exit 0
128 shell: bash226 shell: bash
129227
130 - uses: actions/setup-node@v3228 - uses: actions/setup-node@v3
160258
161 - name: Remove builder cache259 - name: Remove builder cache
162 if: always() # run this step always260 if: always() # run this step always
163 run: |261 run: |
164 docker builder prune -f -a262 docker builder prune -f -a
165 docker system prune -f263 docker system prune -f
166264
265