Since the builds themselves get run in a big parallel morass of nonsense, this causes cache clobbering all over. So now I move the downloading to the pre-trigger stage and hopefully we can use the pre-download step to cache things properly. Hopefully this will also prevent issues where dynamically generated download files are missing for later runs.
107 lines
2.1 KiB
YAML
107 lines
2.1 KiB
YAML
# vim: set ft=yaml:
|
|
stages:
|
|
- build
|
|
- release
|
|
|
|
.build:
|
|
stage: build
|
|
cache:
|
|
- key:
|
|
files:
|
|
- sources/build.pkr.hcl
|
|
paths:
|
|
- ./packer_config/
|
|
- key: isofiles
|
|
paths:
|
|
- 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: ./cache/
|
|
PACKER_LOG: 1
|
|
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:
|
|
- 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 $env:COMMAND > build.ps1
|
|
- echo 'if (-not $?) { throw "Error in build"}' >> build.ps1
|
|
- pwsh .\build.ps1
|
|
after_script: |-
|
|
if ( "$CI_JOB_STATUS" -eq "success" ) {
|
|
xonsh test.xsh
|
|
}
|
|
|
|
"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}
|
|
|