-
-
Notifications
You must be signed in to change notification settings - Fork 174
62 lines (54 loc) · 1.78 KB
/
orka-templates.yml
File metadata and controls
62 lines (54 loc) · 1.78 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Check ORKA Packer Templates
on:
push:
paths:
- 'orka/**/*.pkr.hcl'
pull_request:
paths:
- 'orka/**/*.pkr.hcl'
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
- name: Set up Packer
uses: hashicorp/setup-packer@1aa358be5cf73883762b302a3a03abd66e75b232 #v3.1.0
- name: Create dummy Packer variables file
working-directory: orka/templates
run: |
cat > variables.auto.pkrvars.hcl <<'EOF'
orka_endpoint = "https://mock-orka-endpoint"
xcode_version = "mock-xcode_version"
macos_version = "mock-macos_version"
orka_source_image = "mock-orka_source_image"
ssh_new_password = "mock-ssh_new_password"
ssh_image_password = "mock-ssh_image_password"
ssh_new_public_key = "mock-new_public_key"
EOF
- name: Mock secret files for validate
working-directory: orka/templates
run: |
mkdir -p files/secrets
: > "files/secrets/Apple Developer ID Node.js Foundation.p12"
: > "files/secrets/id_rsa"
- name: Initialize Packer
env:
ORKA_AUTH_TOKEN: 'mock-orka-auth-token'
run: |
for file in $(find . -name '*.pkr.hcl'); do
echo "Initializing $file"
packer init $file || exit 1
done
working-directory: orka/templates
- name: Validate Packer templates
env:
ORKA_AUTH_TOKEN: 'mock-orka-auth-token'
working-directory: orka/templates
run: |
for file in $(find . -name '*.pkr.hcl'); do
echo "Validating $file"
packer validate -var-file=variables.auto.pkrvars.hcl "$file" || exit 1
done