tests: lint the packer config in CI

This commit is contained in:
Jose Diaz-Gonzalez
2023-02-16 14:19:42 -05:00
parent 96c737eae4
commit 6c099c4ad0
2 changed files with 26 additions and 0 deletions

View File

@@ -34,6 +34,21 @@ jobs:
config: '.github/linters/.markdown-lint.yml'
args: './README.md'
packer:
name: packer
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup packer
uses: hashicorp/setup-packer@main
with:
version: latest
- name: Run packer init
run: "make image/init/digitalocean"
- name: Run `packer validate`
run: "make image/validate/digitalocean"
shellcheck:
name: shellcheck
runs-on: ubuntu-20.04

View File

@@ -1,3 +1,7 @@
ifndef PKR_VAR_dokku_version
PKR_VAR_dokku_version = $(shell grep Version debian/control | cut -d' ' -f2)
endif
/tmp/build-dokku/var/lib/dokku/GIT_REV:
mkdir -p /tmp/build-dokku
mkdir -p /tmp/build-dokku/usr/share/bash-completion/completions
@@ -31,3 +35,10 @@ ifdef DOKKU_GIT_REV
else
git rev-parse HEAD > /tmp/build-dokku/var/lib/dokku/GIT_REV
endif
.PHONY: image/init/digitalocean
image/init/digitalocean:
packer init contrib/images/digitalocean/packer.pkr.hcl
.PHONY: image/validate/digitalocean
image/validate/digitalocean:
packer validate -var 'dokku_version=${PKR_VAR_dokku_version}' contrib/images/digitalocean/packer.pkr.hcl