1
0
Fork 0

ci: add .gitlab-ci.yml to automatically build the images

Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
Vojtěch Mareš 2025-06-13 19:35:47 +02:00
parent 1fca078455
commit ce8bc62861
Signed by: vojtech.mares
GPG key ID: C6827B976F17240D

38
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,38 @@
image:
name: hashicorp/packer:light
entrypoint: [""]
variables:
PACKER_LOG: 1 # enable detailed logging
PACKER_VAR_FILE: "vars.pkrvars.hcl"
stages:
- validate
- build
.parallel:
parallel:
matrix:
- IMAGE: [ "flatcar" ]
validate:
extends: .parallel
stage: validate
variables:
PACKER_WORKSPACE: images/$IMAGE
script:
- packer init $PACKER_WORKSPACE
- packer fmt -check $PACKER_WORKSPACE
- packer validate $PACKER_WORKSPACE
build-image:
extends: .parallel
stage: build
variables:
PACKER_FILE: images/$IMAGE/image.hcl
script:
- |
packer build \
$PACKER_FILE
rules:
- if: $CI_COMMIT_BRANCH == "main"