Skip to content

Commit 1fe415b

Browse files
committed
add job for timestamp gen and pass as metadata to img
1 parent b9ea119 commit 1fe415b

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

.github/workflows/mozcloud-publish.yaml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@ on:
99
branches:
1010
- master
1111
tags:
12-
- '**'
12+
- "**"
1313
workflow_dispatch: {}
1414

1515
jobs:
16+
generate-timestamp:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
timestamp: ${{ steps.timestamp.outputs.timestamp }}
20+
steps:
21+
- name: Generate timestamp
22+
id: timestamp
23+
run: echo "timestamp=$(date -u +%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT
24+
1625
build-and-push-syncstorage-rs:
26+
needs: generate-timestamp
1727
if: >
1828
github.event_name == 'workflow_dispatch' ||
1929
(
@@ -29,7 +39,7 @@ jobs:
2939
contents: read
3040
id-token: write
3141
packages: write
32-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
42+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@v6.2.2
3343
with:
3444
image_name: syncstorage-rs
3545
gar_name: sync-prod
@@ -38,8 +48,10 @@ jobs:
3848
SYNCSTORAGE_DATABASE_BACKEND=spanner
3949
MYSQLCLIENT_PKG=libmysqlclient-dev
4050
should_tag_ghcr: true
51+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
4152

4253
build-and-push-syncstorage-rs-postgres:
54+
needs: generate-timestamp
4355
if: >
4456
github.event_name == 'workflow_dispatch' ||
4557
(
@@ -55,7 +67,7 @@ jobs:
5567
contents: read
5668
id-token: write
5769
packages: write
58-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
70+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@v6.2.2
5971
with:
6072
image_name: syncstorage-rs-postgres
6173
gar_name: sync-prod
@@ -64,13 +76,15 @@ jobs:
6476
SYNCSTORAGE_DATABASE_BACKEND=postgres
6577
TOKENSERVER_DATABASE_BACKEND=postgres
6678
should_tag_ghcr: true
79+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
6780

6881
build-and-push-syncstorage-rs-spanner-python-utils:
82+
needs: generate-timestamp
6983
if: >
7084
github.event_name == 'workflow_dispatch' ||
7185
(
7286
github.event_name == 'push' &&
73-
startsWith(github.ref, 'refs/tags/')
87+
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
7488
) ||
7589
(
7690
github.event_name == 'pull_request' &&
@@ -81,21 +95,23 @@ jobs:
8195
contents: read
8296
id-token: write
8397
packages: write
84-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
98+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@v6.2.2
8599
with:
86100
image_name: syncstorage-rs-spanner-python-utils
87101
gar_name: sync-prod
88102
project_id: moz-fx-sync-prod
89103
dockerfile_path: tools/spanner/Dockerfile
90104
image_build_context: tools/spanner
91105
should_tag_ghcr: true
106+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
92107

93108
build-and-push-syncstorage-rs-postgres-python-utils:
109+
needs: generate-timestamp
94110
if: >
95111
github.event_name == 'workflow_dispatch' ||
96112
(
97113
github.event_name == 'push' &&
98-
startsWith(github.ref, 'refs/tags/')
114+
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
99115
) ||
100116
(
101117
github.event_name == 'pull_request' &&
@@ -106,16 +122,18 @@ jobs:
106122
contents: read
107123
id-token: write
108124
packages: write
109-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
125+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@v6.2.2
110126
with:
111127
image_name: syncstorage-rs-postgres-python-utils
112128
gar_name: sync-prod
113129
project_id: moz-fx-sync-prod
114130
dockerfile_path: tools/postgres/Dockerfile
115131
image_build_context: tools/postgres
116132
should_tag_ghcr: true
133+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}
117134

118135
build-and-push-syncstorage-rs-mysql:
136+
needs: generate-timestamp
119137
if: >
120138
github.event_name == 'workflow_dispatch' ||
121139
(
@@ -131,7 +149,7 @@ jobs:
131149
contents: read
132150
id-token: write
133151
packages: write
134-
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@1b87069d293273436a84dff04954a8950d3ff9ca # v6.1.0
152+
uses: mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@v6.2.2
135153
with:
136154
image_name: syncstorage-rs-mysql
137155
gar_name: sync-prod
@@ -140,3 +158,4 @@ jobs:
140158
SYNCSTORAGE_DATABASE_BACKEND=mysql
141159
TOKENSERVER_DATABASE_BACKEND=mysql
142160
should_tag_ghcr: true
161+
image_tag_metadata: ${{ needs.generate-timestamp.outputs.timestamp }}

0 commit comments

Comments
 (0)