93 lines
1.9 KiB
YAML
93 lines
1.9 KiB
YAML
# vim: set ft=yaml:
|
|
stages:
|
|
- build
|
|
- release
|
|
|
|
.build:
|
|
stage: build
|
|
cache:
|
|
- key:
|
|
files:
|
|
- sources/build.pkr.hcl
|
|
paths:
|
|
- ./packer_config/
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
variables:
|
|
EXCEPT: ''
|
|
- if: $CI_COMMIT_TAG =~ "/^$/"
|
|
variables:
|
|
EXCEPT: '-except=upload'
|
|
needs:
|
|
- pipeline: $PARENT_PIPELINE_ID
|
|
job: continue
|
|
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
|
|
script:
|
|
- nix run ".#\"${buildcmd}\"" || exit 1
|
|
|
|
qemu.amd64:
|
|
extends: .build
|
|
variables:
|
|
<<: *variables
|
|
only: "-only=qemu.amd64"
|
|
tag: qemu
|
|
parallel:
|
|
matrix: QEMU_MATRIX
|
|
|
|
virtualbox-iso.amd64:
|
|
extends: .build
|
|
variables:
|
|
<<: *variables
|
|
only: '-only="virtualbox-iso.amd64"'
|
|
tag: vbox
|
|
parallel:
|
|
matrix: VBOX_MATRIX
|
|
|
|
hyperv-iso.amd64:
|
|
extends: .build
|
|
variables:
|
|
<<: *variables
|
|
only: '-only="hyperv-iso.amd64"'
|
|
tag: hyperv
|
|
COMMAND: >
|
|
packer build ${only}
|
|
-var-file="${distro}"
|
|
-var build=${BUILD}
|
|
-var cpus=2
|
|
-var memory=4096
|
|
${EXCEPT}
|
|
sources
|
|
parallel:
|
|
matrix: HYPERV_MATRIX
|
|
script:
|
|
- packer init sources
|
|
- echo $env:COMMAND > build.ps1
|
|
- echo 'if (-not $?) { throw "Error in build"}' >> build.ps1
|
|
- pwsh .\build.ps1
|
|
|
|
"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: continue
|
|
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}
|
|
|