1
0
Fork 0
This repository has been archived on 2025-08-24. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mareshq-hcloud-images/.gitlab-ci.yml
Vojtěch Mareš 62ecce86ad
ci: define PACKER_CONFIG_DIR env var for caching
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
2025-06-13 19:48:28 +02:00

43 lines
854 B
YAML

image:
name: hashicorp/packer:light
entrypoint: [""]
variables:
PACKER_LOG: 1 # enable detailed logging
PACKER_VAR_FILE: "vars.pkrvars.hcl"
PACKER_CONFIG_DIR: $CI_PROJECT_DIR
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
cache:
key: "packer-plugins" # Define a key for Packer plugins
paths:
- "$PACKER_CONFIG_DIR/.packer.d"
build-image:
extends: .parallel
stage: build
variables:
PACKER_FILE: images/$IMAGE/image.pkr.hcl
script:
- |
packer build \
$PACKER_FILE
rules:
- if: $CI_COMMIT_BRANCH == "main"