Skip to content

Commit b8b54e7

Browse files
authored
maint: CI/CD maintenance related to Docker images (#521)
1 parent cab1e51 commit b8b54e7

File tree

4 files changed

+134
-9
lines changed

4 files changed

+134
-9
lines changed

.github/workflows/ci_cd.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ env:
1313
PACKAGE_NAME: 'ansys-geometry-core'
1414
PACKAGE_NAMESPACE: 'ansys.geometry.core'
1515
DOCUMENTATION_CNAME: 'geometry.docs.pyansys.com'
16+
ANSRV_GEO_IMAGE: 'ghcr.io/pyansys/geometry'
1617
ANSRV_GEO_IMAGE_WINDOWS_TAG: ghcr.io/pyansys/geometry:windows-latest
17-
ANSRV_GEO_IMAGE_LINUX_TAG: ghcr.io/pyansys/geometry:linux-latest
1818
ANSRV_GEO_PORT: 700
1919
ANSRV_GEO_LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
2020
GEO_CONT_NAME: ans_geo
@@ -76,6 +76,15 @@ jobs:
7676
name: Testing and coverage (Windows)
7777
needs: [smoke-tests]
7878
runs-on: [self-hosted, pygeometry]
79+
continue-on-error: ${{ matrix.experimental }}
80+
strategy:
81+
fail-fast: false
82+
matrix:
83+
include:
84+
- docker-image: "windows-latest"
85+
experimental: false
86+
- docker-image: "windows-latest-unstable"
87+
experimental: true
7988

8089
steps:
8190
- uses: actions/checkout@v3
@@ -108,7 +117,7 @@ jobs:
108117
password: ${{ secrets.GITHUB_TOKEN }}
109118

110119
- name: Download Geometry service container (if needed)
111-
run: docker pull $env:ANSRV_GEO_IMAGE_WINDOWS_TAG
120+
run: docker pull ${{ env.ANSRV_GEO_IMAGE }}:${{ matrix.docker-image }}
112121

113122
- name: Check location of self-hosted runner and define license server accordingly
114123
if: runner.name == 'pygeometry-ci-1'
@@ -118,7 +127,7 @@ jobs:
118127
- name: Start Geometry service and verify start
119128
run: |
120129
.\.venv\Scripts\Activate.ps1
121-
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE_WINDOWS_TAG }}
130+
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE }}:${{ matrix.docker-image }}
122131
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
123132
124133
- name: Restore images cache
@@ -256,6 +265,15 @@ jobs:
256265
name: Testing and coverage (Linux)
257266
needs: [smoke-tests]
258267
runs-on: ubuntu-latest
268+
continue-on-error: ${{ matrix.experimental }}
269+
strategy:
270+
fail-fast: false
271+
matrix:
272+
include:
273+
- docker-image: "linux-latest"
274+
experimental: false
275+
- docker-image: "linux-latest-unstable"
276+
experimental: true
259277

260278
steps:
261279
- name: Login in Github Container registry
@@ -267,8 +285,8 @@ jobs:
267285

268286
- name: Pull and launch geometry service
269287
run: |
270-
docker pull ${{ env.ANSRV_GEO_IMAGE_LINUX_TAG }}
271-
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE_LINUX_TAG }}
288+
docker pull ${{ env.ANSRV_GEO_IMAGE }}:${{ matrix.docker-image }}
289+
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ${{ env.ANSRV_GEO_IMAGE }}:${{ matrix.docker-image }}
272290
273291
- name: Checkout repository
274292
uses: actions/checkout@v3

.github/workflows/package_cleanup.yml renamed to .github/workflows/docker_cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Geometry Service - Package cleanup
1+
name: Docker images - Cleanup
22
on:
33
workflow_dispatch:
44
schedule: # UTC at 0200
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Docker images - Push stable
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
images:
6+
description: 'Generate image'
7+
required: true
8+
default: 'all'
9+
type: choice
10+
options:
11+
- windows-latest
12+
- linux-latest
13+
- all
14+
15+
ansyslab:
16+
description: 'Push to Ansys Lab'
17+
type: boolean
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
permissions:
24+
packages: write
25+
26+
jobs:
27+
windows:
28+
name: Publish Windows latest image
29+
runs-on: windows-latest
30+
if: inputs.images == 'all' || inputs.images == 'windows-latest'
31+
env:
32+
WINDOWS_UNSTABLE: ghcr.io/pyansys/geometry:windows-latest-unstable
33+
WINDOWS_STABLE_GHCR: ghcr.io/pyansys/geometry:windows-latest
34+
WINDOWS_STABLE_FUJI: azwepsifujiaksacr.azurecr.io/ansys/discovery/geometry:windows-latest
35+
steps:
36+
- name: Login in Github Container registry
37+
uses: docker/login-action@v2
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Pull Windows latest unstable container
44+
run: docker pull ${{ env.WINDOWS_UNSTABLE }}
45+
46+
- name: Tag container as latest (stable) for Github Container registry
47+
run: docker tag ${{ env.WINDOWS_UNSTABLE }} ${{ env.WINDOWS_STABLE_GHCR }}
48+
49+
- name: Publish latest stable container in ghcr.io
50+
run: docker push ${{ env.WINDOWS_STABLE_GHCR }}
51+
52+
- name: Login in AnsysLab registry
53+
if: ${{ inputs.ansyslab }}
54+
uses: docker/login-action@v2
55+
with:
56+
registry: azwepsifujiaksacr.azurecr.io
57+
username: ${{ secrets.FUJI_USER }}
58+
password: ${{ secrets.FUJI_TOKEN }}
59+
60+
- name: Tag container as latest (stable) for AnsysLab registry
61+
if: ${{ inputs.ansyslab }}
62+
run: docker tag ${{ env.WINDOWS_UNSTABLE }} ${{ env.WINDOWS_STABLE_FUJI }}
63+
64+
- name: Publish latest stable container in AnsysLab registry
65+
if: ${{ inputs.ansyslab }}
66+
run: docker push ${{ env.WINDOWS_STABLE_FUJI }}
67+
68+
linux:
69+
name: Publish Linux latest image
70+
runs-on: ubuntu-latest
71+
if: inputs.images == 'all' || inputs.images == 'linux-latest'
72+
env:
73+
LINUX_UNSTABLE: ghcr.io/pyansys/geometry:linux-latest-unstable
74+
LINUX_STABLE_GHCR: ghcr.io/pyansys/geometry:linux-latest
75+
LINUX_STABLE_FUJI: azwepsifujiaksacr.azurecr.io/ansys/discovery/geometry:linux-latest
76+
steps:
77+
- name: Login in Github Container registry
78+
uses: docker/login-action@v2
79+
with:
80+
registry: ghcr.io
81+
username: ${{ github.actor }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
83+
84+
- name: Pull Linux latest unstable container
85+
run: docker pull ${{ env.LINUX_UNSTABLE }}
86+
87+
- name: Tag container as latest (stable) for Github Container registry
88+
run: docker tag ${{ env.LINUX_UNSTABLE }} ${{ env.LINUX_STABLE_GHCR }}
89+
90+
- name: Publish latest stable container in ghcr.io
91+
run: docker push ${{ env.LINUX_STABLE_GHCR }}
92+
93+
- name: Login in AnsysLab registry
94+
if: ${{ inputs.ansyslab }}
95+
uses: docker/login-action@v2
96+
with:
97+
registry: azwepsifujiaksacr.azurecr.io
98+
username: ${{ secrets.FUJI_USER }}
99+
password: ${{ secrets.FUJI_TOKEN }}
100+
101+
- name: Tag container as latest (stable) for AnsysLab registry
102+
if: ${{ inputs.ansyslab }}
103+
run: docker tag ${{ env.LINUX_UNSTABLE }} ${{ env.LINUX_STABLE_FUJI }}
104+
105+
- name: Publish latest stable container in AnsysLab registry
106+
if: ${{ inputs.ansyslab }}
107+
run: docker push ${{ env.LINUX_STABLE_FUJI }}

.github/workflows/build_docker_image.yml renamed to .github/workflows/docker_test_build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Build Docker images
1+
name: Docker images - Test build
22
on:
33
workflow_dispatch:
44
pull_request:
55
paths:
66
- 'docker/**'
7-
- '.github/workflows/build_docker_image.yml'
7+
- '.github/workflows/docker_test_build.yml'
88
push:
99
branches:
1010
- main
1111
paths:
1212
- 'docker/**'
13-
- '.github/workflows/build_docker_image.yml'
13+
- '.github/workflows/docker_test_build.yml'
1414
release:
1515
types: [published]
1616

0 commit comments

Comments
 (0)