kind: pipeline type: kubernetes name: 'Packer Build' volumes: - name: output claim: name: flexvolsmb-drone-output - name: scratch claim: name: flexvolsmb-drone-scratch steps: - name: Debugging information image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: - yamllint --version - packer --version - qemu-img --version - ovftool --version - pwsh --version - name: Windows Server 2019 image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: - sed -i -e "s/<>/$${PRODUCTKEY}/" packer/preseed/Server2019/Autounattend.xml - | sed -i -e "s/<>/$${WINRM_PASSWORD}/g" \ packer/preseed/Server2019/Autounattend.xml \ packer/preseed/Server2019/Sysprep_Unattend.xml - | yamllint -d "{extends: relaxed, rules: {line-length: disable}}" scripts - | packer init -upgrade \ ./packer - | packer validate \ -var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \ -var vm_guestos=server2019 \ -var repo_username=$${REPO_USERNAME} \ -var repo_password=$${REPO_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var winrm_password=$${WINRM_PASSWORD} \ ./packer - | packer build \ -on-error=cleanup -timestamp-ui \ -var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \ -var vm_guestos=server2019 \ -var repo_username=$${REPO_USERNAME} \ -var repo_password=$${REPO_PASSWORD} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var winrm_password=$${WINRM_PASSWORD} \ ./packer environment: VSPHERE_PASSWORD: from_secret: vsphere_password WINRM_PASSWORD: from_secret: winrm_password REPO_USERNAME: from_secret: repo_username REPO_PASSWORD: from_secret: repo_password PRODUCTKEY: from_secret: prodkey_server2019 # PACKER_LOG: 1 volumes: - name: output path: /output - name: scratch path: /scratch - name: Remove temporary resources image: bv11-cr01.bessems.eu/library/packer-extended pull: always commands: - | pwsh -file scripts/Remove-Resources.ps1 \ -VMName $DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \ -VSphereFQDN 'bv11-vc.bessems.lan' \ -VSphereUsername 'administrator@vsphere.local' \ -VSpherePassword $${VSPHERE_PASSWORD} environment: VSPHERE_PASSWORD: from_secret: vsphere_password volumes: - name: scratch path: /scratch when: status: - success - failure - name: Trigger downstream builds image: plugins/downstream settings: server: https://ci.spamasaurus.com token: from_secret: drone_token fork: true repositories: - djpbessems/Packer.Images@ADCS - djpbessems/Packer.Images@ADDS