ci: add .gitlab-ci.yml to automatically build the images
Signed-off-by: Vojtěch Mareš <vojtech@mares.cz>
This commit is contained in:
parent
1fca078455
commit
ce8bc62861
1 changed files with 38 additions and 0 deletions
38
.gitlab-ci.yml
Normal file
38
.gitlab-ci.yml
Normal 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"
|
||||
Reference in a new issue