Skip to content

ci: fix env var interpolation #143

ci: fix env var interpolation

ci: fix env var interpolation #143

Workflow file for this run

name: Validate the Packer templates
on:
push:
branches-ignore: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: 👷 ${{ matrix.cloud }}
strategy:
matrix:
cloud: [aws, azure, gcp]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
# AWS
PKR_VAR_encrypt_boot: false
# GCP
PKR_VAR_project_id: spacelift-workers
PKR_VAR_account_file: ./gcp.json
PKR_VAR_image_base_name: spacelift-worker
PKR_VAR_image_family: spacelift-worker
# Azure
PKR_VAR_client_id: "433d3ca3-1866-4dfa-b9bf-65d6c4391ec7"
PKR_VAR_tenant_id: ${{ secrets.AZURE_TENANT_ID }}
PKR_VAR_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
PKR_VAR_oidc_request_url: ${{ env.ACTIONS_ID_TOKEN_REQUEST_URL }}

Check failure on line 33 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / Validate the Packer templates

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 33, Col: 33): Unrecognized named-value: 'env'. Located at position 1 within expression: env.ACTIONS_ID_TOKEN_REQUEST_URL .github/workflows/ci.yml (Line: 34, Col: 35): Unrecognized named-value: 'env'. Located at position 1 within expression: env.ACTIONS_ID_TOKEN_REQUEST_TOKEN
PKR_VAR_oidc_request_token: ${{ env.ACTIONS_ID_TOKEN_REQUEST_TOKEN }}
PKR_VAR_image_resource_group: rg-worker_images-public-westeurope
PKR_VAR_packer_work_group: rg-worker_images_packer-public-westeurope
PKR_VAR_gallery_resource_group: rg-worker_images-public-westeurope
PKR_VAR_gallery_name: worker_images_public
PKR_VAR_gallery_image_name: ubuntu_20_04
PKR_VAR_gallery_replication_regions: '["westeurope"]'
PKR_VAR_gallery_image_version: 1.0.${{ github.run_number }}
steps:
- name: Check out the source code
uses: actions/checkout@main
- name: Configure AWS credentials
run: |
echo $PKR_VAR_oidc_request_url
echo $PKR_VAR_oidc_request_token
- name: Create account file for GCP
if: matrix.cloud == 'gcp'
run: |
echo '${{ secrets.GCP_CREDENTIALS_JSON }}' > ${{ env.PKR_VAR_account_file }}
- name: Export suffix for GCP
if: matrix.cloud == 'gcp'
run: |
echo "PKR_VAR_suffix=$(date +%s)-$(cat /dev/urandom | tr -dc 'a-z0-9' | head -c 8)" >> $GITHUB_ENV
- name: Setup packer
uses: hashicorp/setup-packer@main
with:
version: latest
- name: Initialize Packer
run: packer init ${{ matrix.cloud }}.pkr.hcl
- name: Validate the Packer template
id: validate
run: packer validate ${{ matrix.cloud }}.pkr.hcl