Skip to content

Commit 49a5189

Browse files
authored
Feature/fix build (#245) - fix CI workflows
* upgrade docker/build-push-action to v5 * fix tag (slashes) * add set up buildx * update registry to ghcr.io * update master build action
1 parent 0270d48 commit 49a5189

File tree

2 files changed

+149
-90
lines changed

2 files changed

+149
-90
lines changed

.github/workflows/dev.yml

Lines changed: 105 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,31 @@ jobs:
112112
- name: Skip message
113113
if: steps.check.outputs.build_needed == 'false'
114114
run: echo "No changes in gatewayApi, skipping build"
115-
- uses: docker/build-push-action@v1
115+
- name: Sanitize tag name
116116
if: steps.check.outputs.build_needed == 'true'
117+
id: tag
118+
run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT
119+
- name: Set up Docker Buildx
120+
if: steps.check.outputs.build_needed == 'true'
121+
uses: docker/setup-buildx-action@v3
122+
- name: Log in to GitHub Container Registry
123+
if: steps.check.outputs.build_needed == 'true'
124+
uses: docker/login-action@v3
117125
with:
118-
registry: docker.pkg.github.com
119-
username: $GITHUB_ACTOR
126+
registry: ghcr.io
127+
username: ${{ github.actor }}
120128
password: ${{ secrets.GITHUB_TOKEN }}
121-
repository: bcgov/gwa-api/gwa-gateway-api
122-
path: microservices/gatewayApi
123-
dockerfile: microservices/gatewayApi/Dockerfile
124-
tag_with_ref: true
125-
tag_with_sha: false
126-
add_git_labels: true
129+
logout: false
130+
- uses: docker/build-push-action@v5
131+
if: steps.check.outputs.build_needed == 'true'
132+
with:
133+
context: microservices/gatewayApi
134+
file: microservices/gatewayApi/Dockerfile
127135
push: true
136+
tags: ghcr.io/bcgov/gwa-api/gwa-gateway-api:${{ steps.tag.outputs.tag }}
137+
labels: |
138+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
139+
org.opencontainers.image.revision=${{ github.sha }}
128140
129141
gwa-scheduler:
130142
needs: sonar-scan
@@ -145,19 +157,31 @@ jobs:
145157
- name: Skip message
146158
if: steps.check.outputs.build_needed == 'false'
147159
run: echo "No changes in gatewayJobScheduler, skipping build"
148-
- uses: docker/build-push-action@v1
160+
- name: Sanitize tag name
161+
if: steps.check.outputs.build_needed == 'true'
162+
id: tag
163+
run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT
164+
- name: Set up Docker Buildx
149165
if: steps.check.outputs.build_needed == 'true'
166+
uses: docker/setup-buildx-action@v3
167+
- name: Log in to GitHub Container Registry
168+
if: steps.check.outputs.build_needed == 'true'
169+
uses: docker/login-action@v3
150170
with:
151-
registry: docker.pkg.github.com
152-
username: $GITHUB_ACTOR
171+
registry: ghcr.io
172+
username: ${{ github.actor }}
153173
password: ${{ secrets.GITHUB_TOKEN }}
154-
repository: bcgov/gwa-api/gwa-scheduler
155-
path: microservices/gatewayJobScheduler
156-
dockerfile: microservices/gatewayJobScheduler/Dockerfile
157-
tag_with_ref: true
158-
tag_with_sha: false
159-
add_git_labels: true
174+
logout: false
175+
- uses: docker/build-push-action@v5
176+
if: steps.check.outputs.build_needed == 'true'
177+
with:
178+
context: microservices/gatewayJobScheduler
179+
file: microservices/gatewayJobScheduler/Dockerfile
160180
push: true
181+
tags: ghcr.io/bcgov/gwa-api/gwa-scheduler:${{ steps.tag.outputs.tag }}
182+
labels: |
183+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
184+
org.opencontainers.image.revision=${{ github.sha }}
161185
162186
gwa-kube-api:
163187
needs: sonar-scan
@@ -178,19 +202,31 @@ jobs:
178202
- name: Skip message
179203
if: steps.check.outputs.build_needed == 'false'
180204
run: echo "No changes in kubeApi, skipping build"
181-
- uses: docker/build-push-action@v1
205+
- name: Sanitize tag name
206+
if: steps.check.outputs.build_needed == 'true'
207+
id: tag
208+
run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT
209+
- name: Set up Docker Buildx
210+
if: steps.check.outputs.build_needed == 'true'
211+
uses: docker/setup-buildx-action@v3
212+
- name: Log in to GitHub Container Registry
182213
if: steps.check.outputs.build_needed == 'true'
214+
uses: docker/login-action@v3
183215
with:
184-
registry: docker.pkg.github.com
185-
username: $GITHUB_ACTOR
216+
registry: ghcr.io
217+
username: ${{ github.actor }}
186218
password: ${{ secrets.GITHUB_TOKEN }}
187-
repository: bcgov/gwa-api/gwa-kube-api
188-
path: microservices/kubeApi
189-
dockerfile: microservices/kubeApi/Dockerfile
190-
tag_with_ref: true
191-
tag_with_sha: false
192-
add_git_labels: true
219+
logout: false
220+
- uses: docker/build-push-action@v5
221+
if: steps.check.outputs.build_needed == 'true'
222+
with:
223+
context: microservices/kubeApi
224+
file: microservices/kubeApi/Dockerfile
193225
push: true
226+
tags: ghcr.io/bcgov/gwa-api/gwa-kube-api:${{ steps.tag.outputs.tag }}
227+
labels: |
228+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
229+
org.opencontainers.image.revision=${{ github.sha }}
194230
195231
gwa-compatibility-api:
196232
needs: sonar-scan
@@ -211,19 +247,31 @@ jobs:
211247
- name: Skip message
212248
if: steps.check.outputs.build_needed == 'false'
213249
run: echo "No changes in compatibilityApi, skipping build"
214-
- uses: docker/build-push-action@v1
250+
- name: Sanitize tag name
251+
if: steps.check.outputs.build_needed == 'true'
252+
id: tag
253+
run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT
254+
- name: Set up Docker Buildx
215255
if: steps.check.outputs.build_needed == 'true'
256+
uses: docker/setup-buildx-action@v3
257+
- name: Log in to GitHub Container Registry
258+
if: steps.check.outputs.build_needed == 'true'
259+
uses: docker/login-action@v3
216260
with:
217-
registry: docker.pkg.github.com
218-
username: $GITHUB_ACTOR
261+
registry: ghcr.io
262+
username: ${{ github.actor }}
219263
password: ${{ secrets.GITHUB_TOKEN }}
220-
repository: bcgov/gwa-api/gwa-compatibility-api
221-
path: microservices/compatibilityApi
222-
dockerfile: microservices/compatibilityApi/Dockerfile
223-
tag_with_ref: true
224-
tag_with_sha: false
225-
add_git_labels: true
264+
logout: false
265+
- uses: docker/build-push-action@v5
266+
if: steps.check.outputs.build_needed == 'true'
267+
with:
268+
context: microservices/compatibilityApi
269+
file: microservices/compatibilityApi/Dockerfile
226270
push: true
271+
tags: ghcr.io/bcgov/gwa-api/gwa-compatibility-api:${{ steps.tag.outputs.tag }}
272+
labels: |
273+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
274+
org.opencontainers.image.revision=${{ github.sha }}
227275
228276
gwa-csit-oas-validation-api:
229277
needs: sonar-scan
@@ -244,16 +292,28 @@ jobs:
244292
- name: Skip message
245293
if: steps.check.outputs.build_needed == 'false'
246294
run: echo "No changes in csitOasValidationApi, skipping build"
247-
- uses: docker/build-push-action@v1
295+
- name: Sanitize tag name
296+
if: steps.check.outputs.build_needed == 'true'
297+
id: tag
298+
run: echo "tag=$(echo '${{ github.ref_name }}' | tr '/' '-')" >> $GITHUB_OUTPUT
299+
- name: Set up Docker Buildx
300+
if: steps.check.outputs.build_needed == 'true'
301+
uses: docker/setup-buildx-action@v3
302+
- name: Log in to GitHub Container Registry
248303
if: steps.check.outputs.build_needed == 'true'
304+
uses: docker/login-action@v3
249305
with:
250-
registry: docker.pkg.github.com
251-
username: $GITHUB_ACTOR
306+
registry: ghcr.io
307+
username: ${{ github.actor }}
252308
password: ${{ secrets.GITHUB_TOKEN }}
253-
repository: bcgov/gwa-api/gwa-csit-oas-validation-api
254-
path: microservices/csitOasValidationApi
255-
dockerfile: microservices/csitOasValidationApi/Dockerfile
256-
tag_with_ref: true
257-
tag_with_sha: false
258-
add_git_labels: true
309+
logout: false
310+
- uses: docker/build-push-action@v5
311+
if: steps.check.outputs.build_needed == 'true'
312+
with:
313+
context: microservices/csitOasValidationApi
314+
file: microservices/csitOasValidationApi/Dockerfile
259315
push: true
316+
tags: ghcr.io/bcgov/gwa-api/gwa-csit-oas-validation-api:${{ steps.tag.outputs.tag }}
317+
labels: |
318+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
319+
org.opencontainers.image.revision=${{ github.sha }}

.github/workflows/master.yml

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -97,67 +97,66 @@ jobs:
9797
echo "Got tag name ${{ steps.release.outputs.tag_name }}"
9898
echo "Got release version ${{ steps.release.outputs.version }}"
9999
100-
- name: Create gwa-api docker image related to the release
101-
uses: docker/build-push-action@v1
100+
- name: Set up Docker Buildx
101+
uses: docker/setup-buildx-action@v3
102+
- name: Log in to GitHub Container Registry
103+
uses: docker/login-action@v3
102104
with:
103-
registry: docker.pkg.github.com
104-
username: $GITHUB_ACTOR
105+
registry: ghcr.io
106+
username: ${{ github.actor }}
105107
password: ${{ secrets.GITHUB_TOKEN }}
106-
repository: bcgov/gwa-api/gwa-gateway-api
107-
path: microservices/gatewayApi
108-
dockerfile: microservices/gatewayApi/Dockerfile
108+
logout: false
109+
- name: Create gwa-api docker image related to the release
110+
uses: docker/build-push-action@v5
111+
with:
112+
context: microservices/gatewayApi
113+
file: microservices/gatewayApi/Dockerfile
109114
push: true
110-
tags: ${{ steps.release.outputs.tag_name }}
111-
tag_with_sha: false
115+
tags: ghcr.io/bcgov/gwa-api/gwa-gateway-api:${{ steps.release.outputs.tag_name }}
116+
labels: |
117+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
118+
org.opencontainers.image.revision=${{ github.sha }}
112119
113120
- name: Create gwa-kube-api docker image related to the release
114-
uses: docker/build-push-action@v1
121+
uses: docker/build-push-action@v5
115122
with:
116-
registry: docker.pkg.github.com
117-
username: $GITHUB_ACTOR
118-
password: ${{ secrets.GITHUB_TOKEN }}
119-
repository: bcgov/gwa-api/gwa-kube-api
120-
path: microservices/kubeApi
121-
dockerfile: microservices/kubeApi/Dockerfile
123+
context: microservices/kubeApi
124+
file: microservices/kubeApi/Dockerfile
122125
push: true
123-
tags: ${{ steps.release.outputs.tag_name }}
124-
tag_with_sha: false
126+
tags: ghcr.io/bcgov/gwa-api/gwa-kube-api:${{ steps.release.outputs.tag_name }}
127+
labels: |
128+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
129+
org.opencontainers.image.revision=${{ github.sha }}
125130
126131
- name: Create gwa-scheduler docker image related to the release
127-
uses: docker/build-push-action@v1
132+
uses: docker/build-push-action@v5
128133
with:
129-
registry: docker.pkg.github.com
130-
username: $GITHUB_ACTOR
131-
password: ${{ secrets.GITHUB_TOKEN }}
132-
repository: bcgov/gwa-api/gwa-scheduler
133-
path: microservices/gatewayJobScheduler
134-
dockerfile: microservices/gatewayJobScheduler/Dockerfile
134+
context: microservices/gatewayJobScheduler
135+
file: microservices/gatewayJobScheduler/Dockerfile
135136
push: true
136-
tags: ${{ steps.release.outputs.tag_name }}
137-
tag_with_sha: false
137+
tags: ghcr.io/bcgov/gwa-api/gwa-scheduler:${{ steps.release.outputs.tag_name }}
138+
labels: |
139+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
140+
org.opencontainers.image.revision=${{ github.sha }}
138141
139142
- name: Create gwa-compatibility-api docker image related to the release
140-
uses: docker/build-push-action@v1
143+
uses: docker/build-push-action@v5
141144
with:
142-
registry: docker.pkg.github.com
143-
username: $GITHUB_ACTOR
144-
password: ${{ secrets.GITHUB_TOKEN }}
145-
repository: bcgov/gwa-api/gwa-compatibility-api
146-
path: microservices/compatibilityApi
147-
dockerfile: microservices/compatibilityApi/Dockerfile
145+
context: microservices/compatibilityApi
146+
file: microservices/compatibilityApi/Dockerfile
148147
push: true
149-
tags: ${{ steps.release.outputs.tag_name }}
150-
tag_with_sha: false
148+
tags: ghcr.io/bcgov/gwa-api/gwa-compatibility-api:${{ steps.release.outputs.tag_name }}
149+
labels: |
150+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
151+
org.opencontainers.image.revision=${{ github.sha }}
151152
152153
- name: Create gwa-csit-oas-validation-api docker image related to the release
153-
uses: docker/build-push-action@v1
154+
uses: docker/build-push-action@v5
154155
with:
155-
registry: docker.pkg.github.com
156-
username: $GITHUB_ACTOR
157-
password: ${{ secrets.GITHUB_TOKEN }}
158-
repository: bcgov/gwa-api/gwa-csit-oas-validation-api
159-
path: microservices/csitOasValidationApi
160-
dockerfile: microservices/csitOasValidationApi/Dockerfile
156+
context: microservices/csitOasValidationApi
157+
file: microservices/csitOasValidationApi/Dockerfile
161158
push: true
162-
tags: ${{ steps.release.outputs.tag_name }}
163-
tag_with_sha: false
159+
tags: ghcr.io/bcgov/gwa-api/gwa-csit-oas-validation-api:${{ steps.release.outputs.tag_name }}
160+
labels: |
161+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
162+
org.opencontainers.image.revision=${{ github.sha }}

0 commit comments

Comments
 (0)