Files
vms/.gitlab-ci-build.yml.in
T
2024-01-10 10:43:23 -06:00

106 lines
2.2 KiB
YAML

# vim: set ft=yaml:
stages:
- build
- release
.build:
stage: build
cache:
- key:
files:
- sources/build.pkr.hcl
paths:
- ./packer_config/
- paths:
- packer_cache/*.iso
rules:
- if: $CI_COMMIT_TAG
variables:
EXCEPT: ''
- if: $CI_COMMIT_TAG =~ "/^$/"
variables:
EXCEPT: '-except=upload'
needs:
- pipeline: $PARENT_PIPELINE_ID
job: distros
artifacts: true
- pipeline: $PARENT_PIPELINE_ID
job: generate
artifacts: true
tags:
- ${tag}
variables: &variables
PACKER_CONFIG_DIR: ./packer_config/
PACKER_CACHE_DIR: ./packer_cache/
PACKER_LOG: 0
COMMAND: >
packer build ${only}
-var-file="${distro}"
-var build=${BUILD}
-var cpus=2
-var memory=4096
${EXCEPT}
sources
before_script:
- packer init sources
- echo $COMMAND
script:
- export EFI_DIR="$(dirname "$(find /nix/store -name OVMF_VARS.fd | head -1)")/"
- echo $COMMAND > build.sh
- bash build.sh || exit 1
qemu.amd64:
extends: .build
variables:
<<: *variables
only: "-only=qemu.amd64"
tag: qemu
parallel:
matrix: []
virtualbox-iso.amd64:
extends: .build
variables:
<<: *variables
only: '-only="virtualbox-iso.amd64"'
tag: vbox
parallel:
matrix: []
after_script: |-
if [ "$CI_JOB_STATUS" == "success" ]; then
xonsh test.xsh
fi
hyperv-iso.amd64:
extends: .build
variables:
<<: *variables
only: '-only="hyperv-iso.amd64"'
tag: hyperv
parallel:
matrix: []
script:
- echo $COMMAND > build.sh
- bash build.sh || exit 1
after_script: |-
if [ "$CI_JOB_STATUS" == "success" ]; then
xonsh test.xsh
fi
"Create release":
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script: echo "Tagging as released"
needs:
- pipeline: $PARENT_PIPELINE_ID
job: distros
artifacts: true
release:
tag_name: '$CI_COMMIT_TAG'
description: >-
Release $CI_COMMIT_TAG, found on [Vagrant Cloud](https://app.vagrantup.com/boxen/)
as version v${BUILD}