Skip to content

Commit

Permalink
CI: Tag and push container images for public repo (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
divergentdave authored Oct 26, 2022
1 parent f862f93 commit f41ead0
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions .github/workflows/push-docker-images-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
steps:
- uses: actions/checkout@v3
# See https://github.com/google-github-actions/auth#authenticating-to-container-registry-and-artifact-registry
- id: "gcp-auth"
name: "Authenticate to GCP"
- id: "gcp-auth-private"
name: "Authenticate to GCP (private repositories)"
uses: "google-github-actions/auth@v0"
with:
workload_identity_provider: ${{ secrets.GCP_ARTIFACT_PUBISHER_WORKLOAD_IDENTITY_PROVIDER }}
Expand All @@ -28,44 +28,64 @@ jobs:
access_token_lifetime: "3600s"
access_token_scopes: "https://www.googleapis.com/auth/cloud-platform"
export_environment_variables: true
- id: "gcp-auth-public"
name: "Authenticate to GCP (public repositories)"
uses: "google-github-actions/auth@v0"
with:
workload_identity_provider: ${{ secrets.GCP_PUBLIC_ARTIFACT_PUBISHER_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_PUBLIC_ARTIFACT_PUBLISHER_DEPLOY_SERVICE_ACCOUNT }}
token_format: "access_token"
access_token_lifetime: "3600s"
access_token_scopes: "https://www.googleapis.com/auth/cloud-platform"
export_environment_variables: true
- uses: "docker/login-action@v2"
with:
registry: "us-west2-docker.pkg.dev"
username: "oauth2accesstoken"
password: ${{ steps.gcp-auth.outputs.access_token }}
password: ${{ steps.gcp-auth-private.outputs.access_token }}
- name: Get the version
id: get_version
run: echo VERSION=${GITHUB_REF/refs\/tags\//} >> $GITHUB_OUTPUT
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregator:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregator:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregator:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregator:${{ steps.get_version.outputs.VERSION }} \
.
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregator:latest
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_creator:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_creator:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_creator:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_creator:${{ steps.get_version.outputs.VERSION }} \
--build-arg BINARY=aggregation_job_creator \
.
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_creator:latest
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_creator:${{ steps.get_version.outputs.VERSION }}
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_driver:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_driver:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_driver:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_driver:${{ steps.get_version.outputs.VERSION }} \
--build-arg BINARY=aggregation_job_driver \
.
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_driver:latest
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_collect_job_driver:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_collect_job_driver:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_collect_job_driver:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_collect_job_driver:${{ steps.get_version.outputs.VERSION }} \
--build-arg BINARY=collect_job_driver \
.
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_collect_job_driver:latest
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_collect_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_cli:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_cli:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_cli:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_cli:${{ steps.get_version.outputs.VERSION }} \
--build-arg BINARY=janus_cli \
.
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_cli:latest
Expand All @@ -74,20 +94,48 @@ jobs:
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_client:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_client:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_client:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_client:${{ steps.get_version.outputs.VERSION }} \
--build-arg BINARY=janus_interop_client \
-f Dockerfile.interop .
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_client:latest
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_client:${{ steps.get_version.outputs.VERSION }}
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_aggregator:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_aggregator:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_aggregator:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_aggregator:${{ steps.get_version.outputs.VERSION }} \
-f Dockerfile.interop_aggregator .
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_aggregator:latest
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: |-
docker build --tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_collector:latest \
--tag us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_collector:${{ steps.get_version.outputs.VERSION }} \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_collector:latest \
--tag us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_collector:${{ steps.get_version.outputs.VERSION }} \
--build-arg BINARY=janus_interop_collector \
-f Dockerfile.interop .
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_collector:latest
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_collector:${{ steps.get_version.outputs.VERSION }}

- uses: "docker/login-action@v2"
with:
registry: "us-west2-docker.pkg.dev"
username: "oauth2accesstoken"
password: ${{ steps.gcp-auth-public.outputs.access_token }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregator:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_creator:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_creator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_driver:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_collect_job_driver:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_collect_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_cli:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_cli:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_client:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_client:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_aggregator:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_collector:latest
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_collector:${{ steps.get_version.outputs.VERSION }}

0 comments on commit f41ead0

Please sign in to comment.