2021-01-23 14:59:06 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: kubernetes
|
|
|
|
name: 'Packer Build'
|
|
|
|
|
2021-02-13 08:59:16 +00:00
|
|
|
volumes:
|
|
|
|
- name: output
|
|
|
|
claim:
|
|
|
|
name: flexvolsmb-drone-output
|
2021-02-13 09:16:18 +00:00
|
|
|
- name: scratch
|
2021-02-13 08:59:16 +00:00
|
|
|
claim:
|
2021-02-13 09:48:44 +00:00
|
|
|
name: flexvolsmb-drone-scratch
|
2021-02-13 08:59:16 +00:00
|
|
|
|
2021-01-23 14:59:06 +00:00
|
|
|
steps:
|
|
|
|
- name: Windows Server 2019
|
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
|
|
commands:
|
|
|
|
- sed -i -e "s/<<img-productkey>>/$${PRODUCTKEY}/" packer/preseed/Server2019/Autounattend.xml
|
|
|
|
- |
|
|
|
|
sed -i -e "s/<<img-password>>/$${WINRM_PASSWORD}/g" \
|
|
|
|
packer/preseed/Server2019/Autounattend.xml \
|
|
|
|
packer/preseed/Server2019/Sysprep_Unattend.xml
|
|
|
|
- |
|
|
|
|
packer validate \
|
|
|
|
-var-file=packer/variables.vsphere.json \
|
|
|
|
-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/windowsserver2019.json
|
|
|
|
- |
|
|
|
|
packer build \
|
2021-02-13 08:59:16 +00:00
|
|
|
-on-error=cleanup -timestamp-ui \
|
2021-01-23 14:59:06 +00:00
|
|
|
-var-file=packer/variables.vsphere.json \
|
|
|
|
-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/windowsserver2019.json
|
|
|
|
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
|
2021-02-13 09:16:18 +00:00
|
|
|
- name: scratch
|
2021-02-13 09:46:43 +00:00
|
|
|
path: /scratch
|
2021-02-14 12:22:34 +00:00
|
|
|
- name: Remove temporary resources
|
|
|
|
image: bv11-cr01.bessems.eu/library/packer-extended
|
|
|
|
commands:
|
|
|
|
- |
|
|
|
|
pwsh -file scripts/Remove-Resources.ps1 \
|
2021-02-14 21:19:03 +00:00
|
|
|
-VMName $DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \
|
2021-02-14 12:22:34 +00:00
|
|
|
-VSphereFQDN 'bv11-vc01.bessems.lan' \
|
|
|
|
-VSphereUsername 'administrator@vsphere.local' \
|
2021-02-14 21:19:03 +00:00
|
|
|
-VSpherePassword $${VSPHERE_PASSWORD}
|
2021-02-14 12:22:34 +00:00
|
|
|
environment:
|
|
|
|
VSPHERE_PASSWORD:
|
|
|
|
from_secret: vsphere_password
|
|
|
|
volumes:
|
|
|
|
- name: scratch
|
|
|
|
path: /scratch
|
2021-02-15 11:12:20 +00:00
|
|
|
when:
|
|
|
|
status:
|
|
|
|
- success
|
|
|
|
- failure
|
2021-01-23 14:59:06 +00:00
|
|
|
- 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
|