-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DT-1191: Fully switch to new image location (#1001)
- Loading branch information
Showing
2 changed files
with
19 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ on: | |
branches: | ||
- develop | ||
env: | ||
REGISTRY_HOST: gcr.io | ||
GOOGLE_PROJECT: broad-dsp-gcr-public | ||
REGISTRY_HOST: us-central1-docker.pkg.dev | ||
GOOGLE_PROJECT: dsp-artifact-registry | ||
SERVICE_NAME: ${{ github.event.repository.name }} | ||
jobs: | ||
tag-build-push: | ||
|
@@ -32,17 +32,18 @@ jobs: | |
- name: Construct tags | ||
id: construct-tags | ||
run: | | ||
SHA_TAG="${REGISTRY_HOST}/${GOOGLE_PROJECT}/${SERVICE_NAME}:${SHORT_SHA}" | ||
SHA_TAG="${REGISTRY_HOST}/${GOOGLE_PROJECT}/${SERVICE_NAME}/${SERVICE_NAME}:${SHORT_SHA}" | ||
ENVIRONMENT_TAG="" | ||
if ${{ github.event_name == 'pull_request'}}; then | ||
ENVIRONMENT_TAG="${REGISTRY_HOST}/${GOOGLE_PROJECT}/${SERVICE_NAME}:pr-${SHORT_SHA}" | ||
elif ${{github.event_name == 'push' }}; then | ||
ENVIRONMENT_TAG="${REGISTRY_HOST}/${GOOGLE_PROJECT}/${SERVICE_NAME}:dev" | ||
if [ "$GITHUB_EVENT" = "pull_request" ]; then | ||
ENVIRONMENT_TAG="${REGISTRY_HOST}/${GOOGLE_PROJECT}/${SERVICE_NAME}/${SERVICE_NAME}:pr-${SHORT_SHA}" | ||
elif [ "$GITHUB_EVENT" = "push" ]; then | ||
ENVIRONMENT_TAG="${REGISTRY_HOST}/${GOOGLE_PROJECT}/${SERVICE_NAME}/${SERVICE_NAME}:dev" | ||
fi | ||
echo "sha-tag=$SHA_TAG" >> $GITHUB_OUTPUT | ||
echo "environment-tag=$ENVIRONMENT_TAG" >> $GITHUB_OUTPUT | ||
env: | ||
SHORT_SHA: ${{ steps.short-sha.outputs.sha }} | ||
GITHUB_EVENT: ${{ github.event_name }} | ||
- name: Build Image | ||
run: | | ||
docker build -t "${SHA_TAG}" -t "${ENVIRONMENT_TAG}" . | ||
|
@@ -55,12 +56,20 @@ jobs: | |
uses: 'google-github-actions/auth@v2' | ||
with: | ||
# Centralized in dsp-tools-k8s; ask in #dsp-devops-champions for help troubleshooting | ||
token_format: 'access_token' | ||
workload_identity_provider: 'projects/1038484894585/locations/global/workloadIdentityPools/github-wi-pool/providers/github-wi-provider' | ||
service_account: '[email protected]' | ||
- name: Push Image to GCR | ||
service_account: 'dsp-artifact-registry-push@dsp-artifact-registry.iam.gserviceaccount.com' | ||
# authenticate to GAR docker repo | ||
- name: Docker Login | ||
uses: 'docker/login-action@v3' | ||
with: | ||
registry: 'us-central1-docker.pkg.dev' | ||
username: 'oauth2accesstoken' | ||
password: '${{ steps.auth.outputs.access_token }}' | ||
- name: Push Image to DSP GAR | ||
if: github.actor != 'dependabot[bot]' | ||
run: | | ||
gcloud auth configure-docker --quiet | ||
gcloud auth configure-docker "$GOOGLE_PROJECT" --quiet | ||
docker push "${SHA_TAG}" | ||
docker push "${ENVIRONMENT_TAG}" | ||
env: | ||
|
This file was deleted.
Oops, something went wrong.