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
@@ -48,46 +41,88 @@ jobs:
4841 contents : read
4942 id-token : write
5043 packages : write
51- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
52- with :
53- image_name : syncstorage-rs
54- gar_name : sync-prod
55- project_id : moz-fx-sync-prod
56- docker_build_args : |
57- SYNCSTORAGE_DATABASE_BACKEND=spanner
58- MYSQLCLIENT_PKG=libmysqlclient-dev
59- should_tag_ghcr : true
44+ runs-on : ubuntu-latest
45+ steps :
46+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
47+ with :
48+ persist-credentials : false
49+
50+ - uses : ./.github/actions/build-and-push
51+ id : setup
52+ with :
53+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
54+ gcp_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
55+
56+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
57+ with :
58+ context : .
59+ push : true
60+ build-args : |
61+ SYNCSTORAGE_DATABASE_BACKEND=spanner
62+ MYSQLCLIENT_PKG=libmysqlclient-dev
63+ tags : |
64+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncstorage-rs:${{ steps.setup.outputs.image_tag }}
65+ ghcr.io/${{ github.repository }}/syncstorage-rs:${{ steps.setup.outputs.image_tag }}
66+ cache-from : type=gha
67+ cache-to : type=gha,mode=max
6068
6169 build-and-push-syncserver-postgres :
6270 needs : check
6371 permissions :
6472 contents : read
6573 id-token : write
6674 packages : write
67- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
68- with :
69- image_name : syncserver-postgres
70- gar_name : sync-prod
71- project_id : moz-fx-sync-prod
72- docker_build_args : |
73- SYNCSTORAGE_DATABASE_BACKEND=postgres
74- TOKENSERVER_DATABASE_BACKEND=postgres
75- should_tag_ghcr : true
76-
77- build-and-push-syncserver-postgres-enterprise-gar :
78- needs : check
79- permissions :
80- contents : read
81- id-token : write
82- packages : write
83- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
84- with :
85- image_name : syncserver-postgres
86- gar_name : fx-enterprise-private
87- project_id : moz-fx-fx-enterprise-prod
88- docker_build_args : |
89- SYNCSTORAGE_DATABASE_BACKEND=postgres
90- TOKENSERVER_DATABASE_BACKEND=postgres
75+ runs-on : ubuntu-latest
76+ steps :
77+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
78+ with :
79+ persist-credentials : false
80+
81+ - uses : ./.github/actions/build-and-push
82+ id : setup
83+ with :
84+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
85+ gcp_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
86+
87+ - name : Build and push to prod GAR and ghcr
88+ uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
89+ with :
90+ context : .
91+ push : true
92+ build-args : |
93+ SYNCSTORAGE_DATABASE_BACKEND=postgres
94+ TOKENSERVER_DATABASE_BACKEND=postgres
95+ tags : |
96+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/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
100+
101+ - name : GCP auth (enterprise)
102+ id : gcp_auth_ent
103+ uses : google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
104+ with :
105+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
106+ service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-fx-enterprise-prod.iam.gserviceaccount.com"
107+ token_format : access_token
108+
109+ - name : Log in to enterprise GAR
110+ uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
111+ with :
112+ registry : us-docker.pkg.dev
113+ username : oauth2accesstoken
114+ password : ${{ steps.gcp_auth_ent.outputs.access_token }}
115+
116+ - name : Build and push to enterprise GAR
117+ uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
118+ with :
119+ context : .
120+ push : true
121+ build-args : |
122+ SYNCSTORAGE_DATABASE_BACKEND=postgres
123+ TOKENSERVER_DATABASE_BACKEND=postgres
124+ tags : us-docker.pkg.dev/moz-fx-fx-enterprise-prod/fx-enterprise-private/syncserver-postgres:${{ steps.setup.outputs.image_tag }}
125+ cache-from : type=gha
91126
92127 # Note: we are moving towards renaming all images `syncserver`, the union of sync and tokenserver.
93128 # This presently remains for the time being to simplify deploys by maintaining `image_name: syncstorage-rs-spanner-python-utils`.
@@ -98,56 +133,112 @@ jobs:
98133 contents : read
99134 id-token : write
100135 packages : write
101- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
102- with :
103- image_name : syncstorage-rs-spanner-python-utils
104- gar_name : sync-prod
105- project_id : moz-fx-sync-prod
106- dockerfile_path : tools/spanner/Dockerfile
107- image_build_context : tools/spanner
108- should_tag_ghcr : true
136+ runs-on : ubuntu-latest
137+ steps :
138+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
139+ with :
140+ persist-credentials : false
141+
142+ - uses : ./.github/actions/build-and-push
143+ id : setup
144+ with :
145+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
146+ gcp_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
147+ version_json_path : ./tools/spanner/version.json
148+
149+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
150+ with :
151+ context : tools/spanner
152+ file : tools/spanner/Dockerfile
153+ push : true
154+ tags : |
155+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncstorage-rs-spanner-python-utils:${{ steps.setup.outputs.image_tag }}
156+ ghcr.io/${{ github.repository }}/syncstorage-rs-spanner-python-utils:${{ steps.setup.outputs.image_tag }}
157+ cache-from : type=gha
158+ cache-to : type=gha,mode=max
109159
110160 build-and-push-syncserver-postgres-python-utils :
111161 needs : check
112162 permissions :
113163 contents : read
114164 id-token : write
115165 packages : write
116- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
117- with :
118- image_name : syncserver-postgres-python-utils
119- gar_name : sync-prod
120- project_id : moz-fx-sync-prod
121- dockerfile_path : tools/postgres/Dockerfile
122- image_build_context : tools/postgres
123- should_tag_ghcr : true
124-
125- build-and-push-syncserver-postgres-python-utils-enterprise-gar :
126- needs : check
127- permissions :
128- contents : read
129- id-token : write
130- packages : write
131- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
132- with :
133- image_name : syncserver-postgres-python-utils
134- gar_name : fx-enterprise-private
135- project_id : moz-fx-fx-enterprise-prod
136- dockerfile_path : tools/postgres/Dockerfile
137- image_build_context : tools/postgres
166+ runs-on : ubuntu-latest
167+ steps :
168+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
169+ with :
170+ persist-credentials : false
171+
172+ - uses : ./.github/actions/build-and-push
173+ id : setup
174+ with :
175+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
176+ gcp_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
177+ version_json_path : ./tools/postgres/version.json
178+
179+ - name : Build and push to prod GAR and ghcr
180+ uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
181+ with :
182+ context : tools/postgres
183+ file : tools/postgres/Dockerfile
184+ push : true
185+ tags : |
186+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncserver-postgres-python-utils:${{ steps.setup.outputs.image_tag }}
187+ ghcr.io/${{ github.repository }}/syncserver-postgres-python-utils:${{ steps.setup.outputs.image_tag }}
188+ cache-from : type=gha
189+ cache-to : type=gha,mode=max
190+
191+ - name : GCP auth (enterprise)
192+ id : gcp_auth_ent
193+ uses : google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
194+ with :
195+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
196+ service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-fx-enterprise-prod.iam.gserviceaccount.com"
197+ token_format : access_token
198+
199+ - name : Log in to enterprise GAR
200+ uses : docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
201+ with :
202+ registry : us-docker.pkg.dev
203+ username : oauth2accesstoken
204+ password : ${{ steps.gcp_auth_ent.outputs.access_token }}
205+
206+ - name : Build and push to enterprise GAR
207+ uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
208+ with :
209+ context : tools/postgres
210+ file : tools/postgres/Dockerfile
211+ push : true
212+ tags : us-docker.pkg.dev/moz-fx-fx-enterprise-prod/fx-enterprise-private/syncserver-postgres-python-utils:${{ steps.setup.outputs.image_tag }}
213+ cache-from : type=gha
138214
139215 build-and-push-syncserver-mysql :
140216 needs : check
141217 permissions :
142218 contents : read
143219 id-token : write
144220 packages : write
145- uses : mozilla-it/deploy-actions/.github/workflows/build-and-push.yml@4784cb70739a4f32ce010921f60fb1ebbc791a38 # v6.2.2
146- with :
147- image_name : syncserver-mysql
148- gar_name : sync-prod
149- project_id : moz-fx-sync-prod
150- docker_build_args : |
151- SYNCSTORAGE_DATABASE_BACKEND=mysql
152- TOKENSERVER_DATABASE_BACKEND=mysql
153- should_tag_ghcr : true
221+ runs-on : ubuntu-latest
222+ steps :
223+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
224+ with :
225+ persist-credentials : false
226+
227+ - uses : ./.github/actions/build-and-push
228+ id : setup
229+ with :
230+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
231+ gcp_service_account : " ${{ vars.SERVICE_ACCOUNT_NAME || 'artifact-writer' }}@moz-fx-sync-prod.iam.gserviceaccount.com"
232+
233+ - uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7
234+ with :
235+ context : .
236+ push : true
237+ build-args : |
238+ SYNCSTORAGE_DATABASE_BACKEND=mysql
239+ TOKENSERVER_DATABASE_BACKEND=mysql
240+ tags : |
241+ us-docker.pkg.dev/moz-fx-sync-prod/sync-prod/syncserver-mysql:${{ steps.setup.outputs.image_tag }}
242+ ghcr.io/${{ github.repository }}/syncserver-mysql:${{ steps.setup.outputs.image_tag }}
243+ cache-from : type=gha
244+ cache-to : type=gha,mode=max
0 commit comments