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`
6- name : Build, Tag and Push Container Images to GAR Repository
1+ name : Build, Tag and Push Container Images to GAR
72
83on :
94 pull_request :
105 types : [opened, labeled, unlabeled, synchronize]
11- # paths:
12- # - '**/sync*/**'
136 push :
147 branches :
158 - master
@@ -37,15 +30,30 @@ jobs:
3730 contents : read
3831 id-token : write
3932 packages : write
40- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
41- with :
42- image_name : syncstorage-rs
43- gar_name : sync-prod
44- project_id : moz-fx-sync-prod
45- docker_build_args : |
46- SYNCSTORAGE_DATABASE_BACKEND=spanner
47- MYSQLCLIENT_PKG=libmysqlclient-dev
48- should_tag_ghcr : true
33+ runs-on : ubuntu-latest
34+ steps :
35+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
36+ with :
37+ persist-credentials : false
38+
39+ - uses : ./.github/actions/build-and-push
40+ id : setup
41+ with :
42+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
43+ prod_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
44+
45+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
46+ with :
47+ context : .
48+ push : true
49+ build-args : |
50+ SYNCSTORAGE_DATABASE_BACKEND=spanner
51+ MYSQLCLIENT_PKG=libmysqlclient-dev
52+ tags : |
53+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncstorage-rs:${{ steps.setup.outputs.image_tag }}
54+ ghcr.io/${{ github.repository }}/syncstorage-rs:${{ steps.setup.outputs.image_tag }}
55+ cache-from : type=gha
56+ cache-to : type=gha,mode=max
4957
5058 build-and-push-syncserver-postgres :
5159 if : >
@@ -63,40 +71,32 @@ jobs:
6371 contents : read
6472 id-token : write
6573 packages : write
66- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
67- with :
68- image_name : syncserver-postgres
69- gar_name : sync-prod
70- project_id : moz-fx-sync-prod
71- docker_build_args : |
72- SYNCSTORAGE_DATABASE_BACKEND=postgres
73- TOKENSERVER_DATABASE_BACKEND=postgres
74- should_tag_ghcr : true
75-
76- build-and-push-syncserver-postgres-enterprise-gar :
77- if : >
78- github.event_name == 'workflow_dispatch' ||
79- (
80- github.event_name == 'push' &&
81- (github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
82- ) ||
83- (
84- github.event_name == 'pull_request' &&
85- contains(github.event.pull_request.labels.*.name, 'preview') &&
86- github.event.pull_request.head.repo.full_name == github.repository
87- )
88- permissions :
89- contents : read
90- id-token : write
91- packages : write
92- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
93- with :
94- image_name : syncserver-postgres
95- gar_name : fx-enterprise-private
96- project_id : moz-fx-fx-enterprise-prod
97- docker_build_args : |
98- SYNCSTORAGE_DATABASE_BACKEND=postgres
99- TOKENSERVER_DATABASE_BACKEND=postgres
74+ runs-on : ubuntu-latest
75+ steps :
76+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
77+ with :
78+ persist-credentials : false
79+
80+ - uses : ./.github/actions/build-and-push
81+ id : setup
82+ with :
83+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
84+ prod_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
85+ enterprise_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-fx-enterprise-prod.iam.gserviceaccount.com"
86+
87+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
88+ with :
89+ context : .
90+ push : true
91+ build-args : |
92+ SYNCSTORAGE_DATABASE_BACKEND=postgres
93+ TOKENSERVER_DATABASE_BACKEND=postgres
94+ tags : |
95+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncserver-postgres:${{ steps.setup.outputs.image_tag }}
96+ us-docker.pkg.dev/moz-fx-fx-enterprise-prod/fx-enterprise-private/syncserver-postgres:${{ steps.setup.outputs.image_tag }}
97+ ghcr.io/${{ github.repository }}/syncserver-postgres:${{ steps.setup.outputs.image_tag }}
98+ cache-from : type=gha
99+ cache-to : type=gha,mode=max
100100
101101 # Note: we are moving towards renaming all images `syncserver`, the union of sync and tokenserver.
102102 # This presently remains for the time being to simplify deploys by maintaining `image_name: syncstorage-rs-spanner-python-utils`.
@@ -117,14 +117,29 @@ jobs:
117117 contents : read
118118 id-token : write
119119 packages : write
120- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
121- with :
122- image_name : syncstorage-rs-spanner-python-utils
123- gar_name : sync-prod
124- project_id : moz-fx-sync-prod
125- dockerfile_path : tools/spanner/Dockerfile
126- image_build_context : tools/spanner
127- should_tag_ghcr : true
120+ runs-on : ubuntu-latest
121+ steps :
122+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
123+ with :
124+ persist-credentials : false
125+
126+ - uses : ./.github/actions/build-and-push
127+ id : setup
128+ with :
129+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
130+ prod_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
131+ version_json_path : ./tools/spanner/version.json
132+
133+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
134+ with :
135+ context : tools/spanner
136+ file : tools/spanner/Dockerfile
137+ push : true
138+ tags : |
139+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncstorage-rs-spanner-python-utils:${{ steps.setup.outputs.image_tag }}
140+ ghcr.io/${{ github.repository }}/syncstorage-rs-spanner-python-utils:${{ steps.setup.outputs.image_tag }}
141+ cache-from : type=gha
142+ cache-to : type=gha,mode=max
128143
129144 build-and-push-syncserver-postgres-python-utils :
130145 if : >
@@ -142,38 +157,31 @@ jobs:
142157 contents : read
143158 id-token : write
144159 packages : write
145- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
146- with :
147- image_name : syncserver-postgres-python-utils
148- gar_name : sync-prod
149- project_id : moz-fx-sync-prod
150- dockerfile_path : tools/postgres/Dockerfile
151- image_build_context : tools/postgres
152- should_tag_ghcr : true
153-
154- build-and-push-syncserver-postgres-python-utils-enterprise-gar :
155- if : >
156- github.event_name == 'workflow_dispatch' ||
157- (
158- github.event_name == 'push' &&
159- (github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
160- ) ||
161- (
162- github.event_name == 'pull_request' &&
163- contains(github.event.pull_request.labels.*.name, 'preview') &&
164- github.event.pull_request.head.repo.full_name == github.repository
165- )
166- permissions :
167- contents : read
168- id-token : write
169- packages : write
170- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
171- with :
172- image_name : syncserver-postgres-python-utils
173- gar_name : fx-enterprise-private
174- project_id : moz-fx-fx-enterprise-prod
175- dockerfile_path : tools/postgres/Dockerfile
176- image_build_context : tools/postgres
160+ runs-on : ubuntu-latest
161+ steps :
162+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
163+ with :
164+ persist-credentials : false
165+
166+ - uses : ./.github/actions/build-and-push
167+ id : setup
168+ with :
169+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
170+ prod_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
171+ enterprise_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-fx-enterprise-prod.iam.gserviceaccount.com"
172+ version_json_path : ./tools/postgres/version.json
173+
174+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
175+ with :
176+ context : tools/postgres
177+ file : tools/postgres/Dockerfile
178+ push : true
179+ tags : |
180+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncserver-postgres-python-utils:${{ steps.setup.outputs.image_tag }}
181+ us-docker.pkg.dev/moz-fx-fx-enterprise-prod/fx-enterprise-private/syncserver-postgres-python-utils:${{ steps.setup.outputs.image_tag }}
182+ ghcr.io/${{ github.repository }}/syncserver-postgres-python-utils:${{ steps.setup.outputs.image_tag }}
183+ cache-from : type=gha
184+ cache-to : type=gha,mode=max
177185
178186 build-and-push-syncserver-mysql :
179187 if : >
@@ -191,12 +199,27 @@ jobs:
191199 contents : read
192200 id-token : write
193201 packages : write
194- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
195- with :
196- image_name : syncserver-mysql
197- gar_name : sync-prod
198- project_id : moz-fx-sync-prod
199- docker_build_args : |
200- SYNCSTORAGE_DATABASE_BACKEND=mysql
201- TOKENSERVER_DATABASE_BACKEND=mysql
202- should_tag_ghcr : true
202+ runs-on : ubuntu-latest
203+ steps :
204+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
205+ with :
206+ persist-credentials : false
207+
208+ - uses : ./.github/actions/build-and-push
209+ id : setup
210+ with :
211+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
212+ prod_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
213+
214+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
215+ with :
216+ context : .
217+ push : true
218+ build-args : |
219+ SYNCSTORAGE_DATABASE_BACKEND=mysql
220+ TOKENSERVER_DATABASE_BACKEND=mysql
221+ tags : |
222+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncserver-mysql:${{ steps.setup.outputs.image_tag }}
223+ ghcr.io/${{ github.repository }}/syncserver-mysql:${{ steps.setup.outputs.image_tag }}
224+ cache-from : type=gha
225+ cache-to : type=gha,mode=max
0 commit comments