Skip to content

Commit

Permalink
Kylesomers/packer ci (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylesomers authored Jun 21, 2024
1 parent 21ea36d commit c7fcfff
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/packer-daily-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ jobs:
run: |
MATRIX_JSON=$(yq e -j '.packer_templates[] | {"file_name": .file_name, "dir": .dir, "description": .description}' .config.yml | jq -s 'reduce .[] as $item ({}; . + {($item.file_name): $item})')
echo "::set-output name=matrix::${MATRIX_JSON}"
echo "MATRIX_JSON: ${MATRIX_JSON}"
outputs:
matrix: ${{ steps.packer-templates-matrix.outputs.matrix }}
packer-ci: # Run Packer validation and build for each template
if: github.repository == 'aws-games/cloud-game-development-toolkit'
needs: get-packer-templates
strategy:
matrix:
config: ${{fromJson(needs.get-packer-templates.outputs.matrix)}}
include: ${{fromJson(needs.get-packer-templates.outputs.matrix)}}
environment: aws-ci
runs-on: ubuntu-latest
steps:
Expand All @@ -59,10 +60,10 @@ jobs:
mv packer /usr/local/bin
rm packer_${PACKER_VERSION}_linux_amd64.zip
- name: Packer Validate and Build
working-directory: ./assets/packer/${{ matrix.config.dir }}
working-directory: ./assets/packer/${{ matrix.dir }}
run: |
echo "Validating Packer template: ${{ matrix.config.description }} - ${{ matrix.config.file_name }}"
cd ${{ matrix.config.dir }}
packer init ${{ matrix.config.file_name }}
packer validate -var 'region="${{ vars.AWS_REGION }}"' -var 'vpc_id="${{ secrets.AWS_VPC_ID_CI }}"' -var 'subnet_id="${{ secrets.AWS_SUBNET_ID_CI }}"' -var 'public_key="${{ secrets.PACKER_CI_PUBLIC_KEY }}"' -var 'template="${{ matrix.config.file_name }}"'
#packer build -var 'region="${{ vars.AWS_REGION }}"' -var 'vpc_id="${{ secrets.AWS_VPC_ID_CI }}"' -var 'subnet_id="${{ secrets.AWS_SUBNET_ID_CI }}"' -var 'public_key="${{ secrets.PACKER_CI_PUBLIC_KEY }}"' -var 'template="${{ matrix.config.file_name }}"'
echo "Validating Packer template: ${{ matrix.description }} - ${{ matrix.file_name }}"
cd ${{ matrix.dir }}
packer init ${{ matrix.file_name }}
packer validate -var 'region="${{ vars.AWS_REGION }}"' -var 'vpc_id="${{ secrets.AWS_VPC_ID_CI }}"' -var 'subnet_id="${{ secrets.AWS_SUBNET_ID_CI }}"' -var 'public_key="${{ secrets.PACKER_CI_PUBLIC_KEY }}"' -var 'template="${{ matrix.file_name }}"'
#packer build -var 'region="${{ vars.AWS_REGION }}"' -var 'vpc_id="${{ secrets.AWS_VPC_ID_CI }}"' -var 'subnet_id="${{ secrets.AWS_SUBNET_ID_CI }}"' -var 'public_key="${{ secrets.PACKER_CI_PUBLIC_KEY }}"' -var 'template="${{ matrix.file_name }}"'

0 comments on commit c7fcfff

Please sign in to comment.