Skip to content

Commit ced903f

Browse files
fix(ci): use runner name when starting a new container (#848)
Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 7c32a70 commit ced903f

File tree

4 files changed

+86
-73
lines changed

4 files changed

+86
-73
lines changed

.github/workflows/ci_cd_night.yml

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,31 @@ jobs:
9292
9393
- name: "Generate the name of the Docker image and the container"
9494
id: docker
95+
env:
96+
RUNNER: ${{ runner.name }}
9597
run: |
9698
image_name="${STK_DOCKER_IMAGE}-python${MAIN_PYTHON_VERSION}"
99+
container_name="stk-python${MAIN_PYTHON_VERSION}-${RUNNER}"
97100
echo "image=${image_name}" >> "${GITHUB_OUTPUT}"
101+
echo "container=${container_name}" >> "${GITHUB_OUTPUT}"
98102
99103
- name: "Start the container from the desired image"
100-
id: container
101104
env:
102105
STK_IMAGE: ${{ steps.docker.outputs.image }}
106+
STK_CONTAINER: ${{ steps.docker.outputs.image }}
103107
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
104108
run: |
105109
docker run \
106110
--detach -it \
107111
--network="host" \
112+
--name="${STK_CONTAINER}" \
108113
--env ANSYSLMD_LICENSE_FILE="${LICENSE_SERVER_PORT}@${LICENSE_SERVER}" \
109114
--volume ${PWD}:/home/stk/pystk \
110115
"${STK_IMAGE}"
111116
112-
container_name=$(docker ps --latest --format "{{.Names}}")
113-
echo "name=${container_name}" >> "${GITHUB_OUTPUT}"
114-
115117
- name: "Install system dependencies required for building examples"
116118
env:
117-
STK_CONTAINER: ${{ steps.container.outputs.name }}
119+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
118120
run: |
119121
docker exec \
120122
--user root \
@@ -140,7 +142,7 @@ jobs:
140142
141143
- name: "Install Tox"
142144
env:
143-
STK_CONTAINER: ${{ steps.container.outputs.name }}
145+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
144146
run: |
145147
docker exec \
146148
--workdir ${PYSTK_DIR} \
@@ -149,7 +151,7 @@ jobs:
149151
150152
- name: "Build the full documentation"
151153
env:
152-
STK_CONTAINER: ${{ steps.container.outputs.name }}
154+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
153155
run: |
154156
docker exec \
155157
--workdir ${PYSTK_DIR} \
@@ -165,7 +167,7 @@ jobs:
165167
- name: "Stop the container"
166168
if: always()
167169
env:
168-
STK_CONTAINER: ${{ steps.container.outputs.name }}
170+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
169171
run: |
170172
docker stop "${STK_CONTAINER}"
171173
docker logs "${STK_CONTAINER}"
@@ -199,14 +201,18 @@ jobs:
199201

200202
- name: "Generate the name of the Docker image and the container"
201203
id: docker
204+
env:
205+
RUNNER: ${{ runner.name }}
202206
run: |
203-
image_name=${STK_DOCKER_IMAGE}-python${MAIN_PYTHON_VERSION}
207+
image_name="${STK_DOCKER_IMAGE}-python${MAIN_PYTHON_VERSION}"
208+
container_name="stk-python${MAIN_PYTHON_VERSION}-${RUNNER}"
204209
echo "image=${image_name}" >> "${GITHUB_OUTPUT}"
210+
echo "container=${container_name}" >> "${GITHUB_OUTPUT}"
205211
206212
- name: "Start the container from the desired image"
207-
id: container
208213
env:
209214
STK_IMAGE: ${{ steps.docker.outputs.image }}
215+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
210216
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
211217
run: |
212218
docker run \
@@ -222,7 +228,7 @@ jobs:
222228
223229
- name: "Install the project with the testing dependencies"
224230
env:
225-
STK_CONTAINER: ${{ steps.container.outputs.name }}
231+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
226232
run: |
227233
docker exec \
228234
--workdir ${PYSTK_DIR} \
@@ -231,7 +237,7 @@ jobs:
231237
232238
- name: "Install coverage dependencies"
233239
env:
234-
STK_CONTAINER: ${{ steps.container.outputs.name }}
240+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
235241
run: |
236242
docker exec \
237243
--workdir ${PYSTK_DIR} \
@@ -242,7 +248,7 @@ jobs:
242248

243249
- name: "Run the extensions tests"
244250
env:
245-
STK_CONTAINER: ${{ steps.container.outputs.name }}
251+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
246252
run: |
247253
docker exec \
248254
--workdir ${PYSTK_DIR} \
@@ -251,7 +257,7 @@ jobs:
251257
252258
- name: "Run the API migration assistant tests"
253259
env:
254-
STK_CONTAINER: ${{ steps.container.outputs.name }}
260+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
255261
run: |
256262
docker exec \
257263
--workdir ${PYSTK_DIR} \
@@ -260,7 +266,7 @@ jobs:
260266
261267
- name: "Run the aviator tests"
262268
env:
263-
STK_CONTAINER: ${{ steps.container.outputs.name }}
269+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
264270
run: |
265271
docker exec \
266272
--workdir ${PYSTK_DIR} \
@@ -269,7 +275,7 @@ jobs:
269275
270276
- name: "Run the non graphics stk tests"
271277
env:
272-
STK_CONTAINER: ${{ steps.container.outputs.name }}
278+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
273279
run: |
274280
docker exec \
275281
--workdir ${PYSTK_DIR} \
@@ -278,7 +284,7 @@ jobs:
278284
279285
- name: "Run the graphics only stk tests"
280286
env:
281-
STK_CONTAINER: ${{ steps.container.outputs.name }}
287+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
282288
run: |
283289
docker exec \
284290
--workdir ${PYSTK_DIR} \
@@ -287,7 +293,7 @@ jobs:
287293
288294
- name: "Run the vgt tests"
289295
env:
290-
STK_CONTAINER: ${{ steps.container.outputs.name }}
296+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
291297
run: |
292298
docker exec \
293299
--workdir ${PYSTK_DIR} \
@@ -296,7 +302,7 @@ jobs:
296302
297303
- name: "Run the doc snippet tests"
298304
env:
299-
STK_CONTAINER: ${{ steps.container.outputs.name }}
305+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
300306
run: |
301307
docker exec \
302308
--workdir ${PYSTK_DIR} \
@@ -308,7 +314,7 @@ jobs:
308314
- name: "Combine all coverage results"
309315
if: ${{ matrix.python == env.MINIMUM_PYTHON_VERSION }}
310316
env:
311-
STK_CONTAINER: ${{ steps.container.outputs.name }}
317+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
312318
run: |
313319
docker exec \
314320
--workdir ${PYSTK_DIR}/.cov \
@@ -318,7 +324,7 @@ jobs:
318324
- name: "Generate coverage report in XML and HTML"
319325
if: ${{ matrix.python == env.MINIMUM_PYTHON_VERSION }}
320326
env:
321-
STK_CONTAINER: ${{ steps.container.outputs.name }}
327+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
322328
run: |
323329
docker exec \
324330
--workdir ${PYSTK_DIR} \
@@ -346,7 +352,7 @@ jobs:
346352
- name: "Stop the container"
347353
if: always()
348354
env:
349-
STK_CONTAINER: ${{ steps.container.outputs.name }}
355+
STK_CONTAINER: ${{ steps.docker.outputs.container }}
350356
run: |
351357
docker stop "${STK_CONTAINER}"
352358
docker logs "${STK_CONTAINER}"

0 commit comments

Comments
 (0)