build: Cleanup virtual machine after builds

This commit is contained in:
2024-06-10 15:59:19 +10:00
parent 88e37bb706
commit 562e0b8167
3 changed files with 5 additions and 235 deletions

View File

@ -83,12 +83,9 @@ jobs:
echo "BUILD_COMMIT=$(echo ${{ gitea.sha }} | cut -c 1-10)" >> $GITHUB_ENV
echo "BUILD_SUFFIX=$(openssl rand -hex 3)" >> $GITHUB_ENV
- name: Run `packer validate`
- name: Validate packer template files
id: validate
run: |
# BUILD_COMMIT=$(echo "${{ gitea.sha }}" | cut -c 1-10)
# BUILD_SUFFIX=$(openssl rand -hex 3)
packer validate \
-only=vsphere-iso.bootstrap \
-var vm_name=${{ gitea.run_number }}-${BUILD_COMMIT}-${BUILD_SUFFIX} \
@ -101,12 +98,10 @@ jobs:
-var k8s_version=${{ steps.get_k8sversion.outputs.result }} \
-var appliance_version=${{ needs.semrel_dryrun.outputs.version }} \
./packer
- name: Run `packer build`
- name: Build packer template
run: |
# BUILD_COMMIT=$(echo "${{ gitea.sha }}" | cut -c 1-10)
# BUILD_SUFFIX=$(openssl rand -hex 3)
packer build \
-on-error=cleanup -timestamp-ui \
-only=vsphere-iso.bootstrap \
-var vm_name=${{ gitea.run_number }}-${BUILD_COMMIT}-${BUILD_SUFFIX} \
-var docker_username=${{ secrets.DOCKER_USERNAME }} \
@ -121,7 +116,6 @@ jobs:
# env:
# PACKER_LOG: 1
# semrel:
# name: Semantic Release
# runs-on: dind-rootless