mirror of
https://github.com/openoms/joininbox.git
synced 2026-08-17 13:07:15 +02:00
60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
name: Packer Syntax Check
|
|
|
|
concurrency:
|
|
group: packer-syntax-check-${{ github.head_ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ]
|
|
paths:
|
|
- '.github/workflows/packer-syntax-check.yml'
|
|
- 'ci/amd64/**/*.pkr.hcl'
|
|
- 'ci/amd64/**/*.pkrvars.hcl'
|
|
- 'ci/amd64/packer.build.amd64-debian.sh'
|
|
- 'ci/arm64-rpi/**/*.pkr.hcl'
|
|
- 'ci/arm64-rpi/**/*.pkrvars.hcl'
|
|
- 'ci/arm64-rpi/arm64-rpi.sh'
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
paths:
|
|
- '.github/workflows/packer-syntax-check.yml'
|
|
- 'ci/amd64/**/*.pkr.hcl'
|
|
- 'ci/amd64/**/*.pkrvars.hcl'
|
|
- 'ci/amd64/packer.build.amd64-debian.sh'
|
|
- 'ci/arm64-rpi/**/*.pkr.hcl'
|
|
- 'ci/arm64-rpi/**/*.pkrvars.hcl'
|
|
- 'ci/arm64-rpi/arm64-rpi.sh'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
validate-packer-syntax:
|
|
name: Validate Packer Syntax
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Packer
|
|
uses: hashicorp/setup-packer@v3
|
|
|
|
- name: Show Packer version
|
|
run: packer version
|
|
|
|
- name: Validate amd64 templates (syntax only)
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
mapfile -t templates < <(find ci/amd64 ci/arm64-rpi -type f \( -name '*.pkr.hcl' -o -name '*.pkrvars.hcl' \) | sort)
|
|
|
|
if [ ${#templates[@]} -eq 0 ]; then
|
|
echo "No Packer templates found under ci/amd64 or ci/arm64-rpi"
|
|
exit 1
|
|
fi
|
|
|
|
for template in "${templates[@]}"; do
|
|
echo "Validating $template"
|
|
packer validate -syntax-only "$template"
|
|
done
|