Skip to content

PLT-338 Fixes for AL2023 image in packer for github actions runners #18

PLT-338 Fixes for AL2023 image in packer for github actions runners

PLT-338 Fixes for AL2023 image in packer for github actions runners #18

name: GitHub Actions runner images
on:
pull_request:
paths:
- .github/workflows/github-actions-runner-images.yml
- packer/github-actions-runner/**
schedule:
- cron: "0 0 * * 1" # 00:00 on Monday each week
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
defaults:
run:
working-directory: packer/github-actions-runner
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-packer@v2.0.1
- uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::${{ secrets.BCDA_ACCOUNT }}:role/delegatedadmin/developer/bcda-mgmt-github-actions
aws-region: ${{ vars.AWS_REGION }}
- uses: cmsgov/ab2d-bcda-dpc-platform/actions/aws-params-env-action@main
with:
params: |
PKR_VAR_ami_account=/gold-image/account
PKR_VAR_s3_tarball=/github-runner/s3-tarball
PKR_VAR_vpc_id=/github-runner/vpc
PKR_VAR_subnet_id=/github-runner/subnet
SECURITY_GROUPS=/github-runner/security-groups
- name: packer build
env:
PACKER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TMPDIR: /home/ec2-user/
run: |
packer init .
# Security groups must be set by flag since they're a list
packer validate -evaluate-datasources -var "security_group_ids=$SECURITY_GROUPS" .
${RUNNER_DEBUG:+"PACKER_LOG=1"} packer build -var "security_group_ids=$SECURITY_GROUPS" .