diff --git a/.gitlab-ci-build.yml.in b/.gitlab-ci-build.yml.in index 0d898dc..864d5c5 100644 --- a/.gitlab-ci-build.yml.in +++ b/.gitlab-ci-build.yml.in @@ -11,28 +11,32 @@ stages: - pipeline: $PARENT_PIPELINE_ID job: distros artifacts: true + - pipeline: $PARENT_PIPELINE_ID + job: generate + artifacts: true tags: - ${tag} - script: | - set -exo pipefail - export PACKER_LOG=1 - if [ -f "${distro}.sh" ]; then - ./"${distro}.sh" - fi - packer init sources - packer build "${only}" \ - -var-file="${distro}" \ - -var "build=${BUILD}" \ - -var "cpus=2" \ - -var "memory=4096" \ - -var "http_port_min=${HTTP_PORT_MIN:-8000}" \ - -var "http_port_max=${HTTP_PORT_MAX:-9000}" \ - -except=upload \ - sources + variables: &variables + PACKER_LOG: 1 + COMMAND: > + packer build ${only} + -var-file="${distro}" + -var build=${BUILD} + -var cpus=2 + -var memory=4096 + -except=upload + sources + before_script: + - packer init sources + - echo $COMMAND + script: + - echo $COMMAND > build.sh + - bash build.sh qemu.amd64: extends: .build variables: + <<: *variables only: "-only=qemu.amd64" tag: qemu parallel: @@ -41,7 +45,23 @@ qemu.amd64: virtualbox-iso.amd64: extends: .build variables: - only: "-only=virtualbox-iso.amd64" + <<: *variables + only: '-only="virtualbox-iso.amd64"' tag: vbox parallel: 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 \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 33d24b8..14f17cd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,20 +1,29 @@ stages: + - generate - lint - trigger +generate: + stage: generate + artifacts: + paths: + - distros/**/*.pkrvars.hcl + script: |- + for vars in $(find distros/ -name '*.pkrvars.hcl.sh'); do + "./${vars}" + done + validate: stage: lint + needs: + - generate cache: paths: - /var/lib/gitlab-runner/.config/packer/plugins/ script: |- set -exo pipefail packer init sources - for vars in $(find distros/ -name '*.pkrvars.hcl*'); do - if [[ "${vars}" == *.sh ]]; then - "./${vars}" - vars=${vars%.sh} - fi + for vars in $(find distros/ -name '*.pkrvars.hcl'); do packer validate -except=upload -var-file=${vars} sources/ done @@ -25,7 +34,7 @@ shell: shellcheck $(find . -name '*.sh') distros: - stage: lint + stage: generate artifacts: reports: dotenv: build.env diff --git a/distros/fedora/supports.yml b/distros/fedora/supports.yml index f2c08c9..05ca9e5 100644 --- a/distros/fedora/supports.yml +++ b/distros/fedora/supports.yml @@ -16,3 +16,5 @@ rawhide: provider: hyperv-iso - arch: amd64 provider: virtualbox-iso + - arch: amd64 + provider: vmware-iso diff --git a/lib/provider.py b/lib/provider.py index dfdc54e..60f2bd4 100644 --- a/lib/provider.py +++ b/lib/provider.py @@ -12,4 +12,6 @@ class Provider: return "qemu" elif self.name.startswith("virtualbox"): return "virtualbox" + elif self.name.startswith("hyperv"): + return "hyperv" return None