Skip to content

GCP - gw-fxci-gcp-l1-2404 #12

GCP - gw-fxci-gcp-l1-2404

GCP - gw-fxci-gcp-l1-2404 #12

run-name: GCP - ${{ github.event.inputs.config }}
name: FXCI - GCP
on:
workflow_dispatch:
inputs:
config:
type: choice
description: Choose which pool to build
options:
- gw-fxci-gcp-l1-2404
- gw-fxci-gcp-l1-2404-tc
- gw-fxci-gcp-l1-2404-gui
- gw-fxci-gcp-l1-arm64
- gw-fxci-gcp-l1-arm64-gui
permissions:
id-token: write
contents: read
jobs:
job1:
name: "Get Project ID from Config"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: set-matrix
shell: pwsh
run: |
Import-Module ${{ github.workspace }}\bin\WorkerImages\WorkerImages.psm1
Set-GCPWorkerImageProject -Key '${{ github.event.inputs.config }}'
outputs:
PROJECT: ${{ steps.set-matrix.outputs.PROJECT }}
job2:
needs: job1
name: "GCP ${{ github.event.inputs.config }}"
runs-on: ubuntu-latest
environment: prod
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: 'google-github-actions/auth@v2'
id: auth
with:
workload_identity_provider: "projects/324168772199/locations/global/workloadIdentityPools/github-actions/providers/github-actions"
service_account: "deploy-prod@${{ needs.job1.outputs.PROJECT }}.iam.gserviceaccount.com"
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Run Packer'
shell: pwsh
run: |
Import-Module ${{ github.workspace }}\bin\WorkerImages\WorkerImages.psm1
$Vars = @{
Key = '${{ github.event.inputs.config }}'
Worker_Env_Var_Key = "${{ secrets.WORKER_ENV_VAR_KEY }}"
TC_worker_cert = "${{ secrets.TC_WORKER_CERT }}"
TC_worker_key = "${{ secrets.TC_WORKER_KEY }}"
}
New-GCPWorkerImage @Vars