Merge branch 'add_vmware' into 'main'

Add Hyper-V to CI
Despite the source branch name, we were able to bring up Hyper-V but not yet VMWare automated builds.

See merge request greg/vms!2
This commit is contained in:
Greg Hellings
2023-12-20 04:36:11 +00:00
4 changed files with 56 additions and 23 deletions
+37 -17
View File
@@ -11,28 +11,32 @@ stages:
- pipeline: $PARENT_PIPELINE_ID - pipeline: $PARENT_PIPELINE_ID
job: distros job: distros
artifacts: true artifacts: true
- pipeline: $PARENT_PIPELINE_ID
job: generate
artifacts: true
tags: tags:
- ${tag} - ${tag}
script: | variables: &variables
set -exo pipefail PACKER_LOG: 1
export PACKER_LOG=1 COMMAND: >
if [ -f "${distro}.sh" ]; then packer build ${only}
./"${distro}.sh" -var-file="${distro}"
fi -var build=${BUILD}
packer init sources -var cpus=2
packer build "${only}" \ -var memory=4096
-var-file="${distro}" \ -except=upload
-var "build=${BUILD}" \ sources
-var "cpus=2" \ before_script:
-var "memory=4096" \ - packer init sources
-var "http_port_min=${HTTP_PORT_MIN:-8000}" \ - echo $COMMAND
-var "http_port_max=${HTTP_PORT_MAX:-9000}" \ script:
-except=upload \ - echo $COMMAND > build.sh
sources - bash build.sh
qemu.amd64: qemu.amd64:
extends: .build extends: .build
variables: variables:
<<: *variables
only: "-only=qemu.amd64" only: "-only=qemu.amd64"
tag: qemu tag: qemu
parallel: parallel:
@@ -41,7 +45,23 @@ qemu.amd64:
virtualbox-iso.amd64: virtualbox-iso.amd64:
extends: .build extends: .build
variables: variables:
only: "-only=virtualbox-iso.amd64" <<: *variables
only: '-only="virtualbox-iso.amd64"'
tag: vbox tag: vbox
parallel: parallel:
matrix: [] matrix: []
hyperv-iso.amd64:
extends: .build
variables:
<<: *variables
only: '-only="hyperv-iso.amd64"'
tag: hyperv
parallel:
matrix: []
cache:
paths:
- C:\Users\gregh\AppData\Roaming\packer.d\plugins\
script:
- echo $env:COMMAND > build.ps1
- powershell .\build.ps1
+15 -6
View File
@@ -1,20 +1,29 @@
stages: stages:
- generate
- lint - lint
- trigger - trigger
generate:
stage: generate
artifacts:
paths:
- distros/**/*.pkrvars.hcl
script: |-
for vars in $(find distros/ -name '*.pkrvars.hcl.sh'); do
"./${vars}"
done
validate: validate:
stage: lint stage: lint
needs:
- generate
cache: cache:
paths: paths:
- /var/lib/gitlab-runner/.config/packer/plugins/ - /var/lib/gitlab-runner/.config/packer/plugins/
script: |- script: |-
set -exo pipefail set -exo pipefail
packer init sources packer init sources
for vars in $(find distros/ -name '*.pkrvars.hcl*'); do for vars in $(find distros/ -name '*.pkrvars.hcl'); do
if [[ "${vars}" == *.sh ]]; then
"./${vars}"
vars=${vars%.sh}
fi
packer validate -except=upload -var-file=${vars} sources/ packer validate -except=upload -var-file=${vars} sources/
done done
@@ -25,7 +34,7 @@ shell:
shellcheck $(find . -name '*.sh') shellcheck $(find . -name '*.sh')
distros: distros:
stage: lint stage: generate
artifacts: artifacts:
reports: reports:
dotenv: build.env dotenv: build.env
+2
View File
@@ -16,3 +16,5 @@ rawhide:
provider: hyperv-iso provider: hyperv-iso
- arch: amd64 - arch: amd64
provider: virtualbox-iso provider: virtualbox-iso
- arch: amd64
provider: vmware-iso
+2
View File
@@ -12,4 +12,6 @@ class Provider:
return "qemu" return "qemu"
elif self.name.startswith("virtualbox"): elif self.name.startswith("virtualbox"):
return "virtualbox" return "virtualbox"
elif self.name.startswith("hyperv"):
return "hyperv"
return None return None