-
Notifications
You must be signed in to change notification settings - Fork 17
41 lines (34 loc) · 1.1 KB
/
check-image-definitions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
# Check that declared Packer images are valid.
name: Validate Packer images
'on':
- push
- pull_request
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install prerequisites
run: |
sudo apt update -y
# The packer provided by Ubuntu repos is ancient
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install packer
packer plugins install github.com/hashicorp/docker
- name: Validate Packer images
run: |
error=0
for decl in */packer.json; do
pushd "$(dirname "$decl")"
if ! packer validate packer.json; then
echo -n "::error file=$decl,line=1,title=packer validate failed"
echo "::Packer validation failed for $decl."
error=1
fi
popd
done
exit $error