Skip to content

Deploy Dataflow Flex Template #11

Deploy Dataflow Flex Template

Deploy Dataflow Flex Template #11

name: Deploy Dataflow Flex Template
env:
PROJECT_ID: gb-poc-373711
LOCATION: europe-west1
CI_SERVICE_NAME: github-actions
REPO_NAME: internal-images
IMAGE_NAME: 'dataflow/team-league-java'
IMAGE_TAG: latest
METADATA_FILE: 'config/metadata.json'
METADATA_TEMPLATE_FILE_PATH: 'gs://mazlum_dev/dataflow/templates/team_league/java/team-league-java'
SDK_LANGUAGE: 'JAVA'
WORKLOAD_IDENTITY_PROVIDER: 'projects/975119474255/locations/global/workloadIdentityPools/gb-github-actions-ci-cd-pool/providers/gb-github-actions-ci-cd-provider'
SA_CI_CD_EMAIL: 'sa-dataflow-dev@gb-poc-373711.iam.gserviceaccount.com'
on:
workflow_dispatch:
jobs:
deploy-template:
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: 'Checkout'
uses: 'actions/checkout@v3'
- name: 'Google auth'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
service_account: '${{ env.SA_CI_CD_EMAIL }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
version: '>= 444.0.0'
project_id: '${{ env.PROJECT_ID }}'
- name: 'Docker auth'
run: |-
gcloud auth configure-docker ${{ env.LOCATION }}-docker.pkg.dev
- name: 'Build And Publish Flex Template Docker image'
run: |-
REPO_PATH="${{ env.LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPO_NAME }}/${{ env.IMAGE_NAME }}/${{ env.CI_SERVICE_NAME }}:${{ env.IMAGE_TAG }}"
docker build -t "${REPO_PATH}" .
docker push "${REPO_PATH}"
- name: 'Create Flex Template Spec file'
run: |
scripts/create_flex_template_spec_file_gcs.sh