Skip to content

Commit d2fda79

Browse files
authored
chore: Update GAR Image Tagging to MozCloud Spec (#2029)
chore: Update GAR Image Tagging to MozCloud Spec
1 parent b9ea119 commit d2fda79

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

.github/workflows/mozcloud-publish.yaml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Mozilla Deploy Actions url: <https://github.com/mozilla-it/deploy-actions>
2+
# Note: even though Mozilla maintains the above actions, it is still suggested
3+
# when upgrading to use the full commit SHA and comment with version.
4+
# See <https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions>
5+
# Ex. `mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2`
16
name: Build, Tag and Push Container Images to GAR Repository
27

38
on:
@@ -13,7 +18,17 @@ on:
1318
workflow_dispatch: {}
1419

1520
jobs:
21+
generate-timestamp:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
timestamp: ${{ steps.timestamp.outputs.timestamp }}
25+
steps:
26+
- name: Generate timestamp
27+
id: timestamp
28+
run: echo "timestamp=$(date -u +%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT
29+
1630
build-and-push-syncstorage-rs:
31+
needs: generate-timestamp
1732
if: >
1833
github.event_name == 'workflow_dispatch' ||
1934
(
@@ -29,7 +44,7 @@ jobs:
2944
contents: read
3045
id-token: write
3146
packages: write
32-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
47+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
3348
with:
3449
image_name: syncstorage-rs
3550
gar_name: sync-prod
@@ -38,8 +53,10 @@ jobs:
3853
SYNCSTORAGE_DATABASE_BACKEND=spanner
3954
MYSQLCLIENT_PKG=libmysqlclient-dev
4055
should_tag_ghcr: true
56+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
4157

4258
build-and-push-syncstorage-rs-postgres:
59+
needs: generate-timestamp
4360
if: >
4461
github.event_name == 'workflow_dispatch' ||
4562
(
@@ -55,7 +72,7 @@ jobs:
5572
contents: read
5673
id-token: write
5774
packages: write
58-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
75+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
5976
with:
6077
image_name: syncstorage-rs-postgres
6178
gar_name: sync-prod
@@ -64,13 +81,15 @@ jobs:
6481
SYNCSTORAGE_DATABASE_BACKEND=postgres
6582
TOKENSERVER_DATABASE_BACKEND=postgres
6683
should_tag_ghcr: true
84+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
6785

6886
build-and-push-syncstorage-rs-spanner-python-utils:
87+
needs: generate-timestamp
6988
if: >
7089
github.event_name == 'workflow_dispatch' ||
7190
(
7291
github.event_name == 'push' &&
73-
startsWith(github.ref, 'refs/tags/')
92+
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
7493
) ||
7594
(
7695
github.event_name == 'pull_request' &&
@@ -81,21 +100,23 @@ jobs:
81100
contents: read
82101
id-token: write
83102
packages: write
84-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
103+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
85104
with:
86105
image_name: syncstorage-rs-spanner-python-utils
87106
gar_name: sync-prod
88107
project_id: moz-fx-sync-prod
89108
dockerfile_path: tools/spanner/Dockerfile
90109
image_build_context: tools/spanner
91110
should_tag_ghcr: true
111+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
92112

93113
build-and-push-syncstorage-rs-postgres-python-utils:
114+
needs: generate-timestamp
94115
if: >
95116
github.event_name == 'workflow_dispatch' ||
96117
(
97118
github.event_name == 'push' &&
98-
startsWith(github.ref, 'refs/tags/')
119+
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
99120
) ||
100121
(
101122
github.event_name == 'pull_request' &&
@@ -106,16 +127,18 @@ jobs:
106127
contents: read
107128
id-token: write
108129
packages: write
109-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
130+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
110131
with:
111132
image_name: syncstorage-rs-postgres-python-utils
112133
gar_name: sync-prod
113134
project_id: moz-fx-sync-prod
114135
dockerfile_path: tools/postgres/Dockerfile
115136
image_build_context: tools/postgres
116137
should_tag_ghcr: true
138+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
117139

118140
build-and-push-syncstorage-rs-mysql:
141+
needs: generate-timestamp
119142
if: >
120143
github.event_name == 'workflow_dispatch' ||
121144
(
@@ -131,7 +154,7 @@ jobs:
131154
contents: read
132155
id-token: write
133156
packages: write
134-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
157+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
135158
with:
136159
image_name: syncstorage-rs-mysql
137160
gar_name: sync-prod
@@ -140,3 +163,4 @@ jobs:
140163
SYNCSTORAGE_DATABASE_BACKEND=mysql
141164
TOKENSERVER_DATABASE_BACKEND=mysql
142165
should_tag_ghcr: true
166+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}

0 commit comments

Comments
 (0)