diff --git a/.drone.yml b/.drone.yml index 25a743c..a95f57d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,7 +9,7 @@ steps: - | packer validate \ -var-file=packer/variables.vsphere.json \ - -var vm_name=${DRONE_COMMIT_SHA:0:10}-$DRONE_BUILD_NUMBER \ + -var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var winrm_password=$${WINRM_PASSWORD} \ packer/adds.json @@ -17,7 +17,7 @@ steps: packer build \ -on-error=cleanup \ -var-file=packer/variables.vsphere.json \ - -var vm_name=${DRONE_COMMIT_SHA:0:10}-$DRONE_BUILD_NUMBER \ + -var vm_name=$DRONE_BUILD_NUMBER-${DRONE_COMMIT_SHA:0:10} \ -var vsphere_password=$${VSPHERE_PASSWORD} \ -var winrm_password=$${WINRM_PASSWORD} \ packer/adds.json diff --git a/packer/adds.json b/packer/adds.json index cdb1259..b91c154 100644 --- a/packer/adds.json +++ b/packer/adds.json @@ -65,8 +65,9 @@ { "type": "shell-local", "inline": [ - "pwsh -file scripts/Update-OvfConfiguration.ps1 \\", - " -OVFFile './output-adds/adds-{{user `vm_name`}}.ovf'", + "pwsh -command \"& scripts/Update-OvfConfiguration.ps1 \\", + " -OVFFile './output-adds/adds-{{user `vm_name`}}.ovf' \\", + " -Parameter @{'appliance.name'='ADDS';'appliance.version'='{{user `vm_name`}}'}\"", "pwsh -file scripts/Update-Manifest.ps1 \\", " -ManifestFileName './output-adds/adds-{{user `vm_name`}}.mf'", "ovftool --acceptAllEulas --allowExtraConfig --overwrite \\", diff --git a/scripts/Update-OvfConfiguration.yml b/scripts/Update-OvfConfiguration.yml index e8cf746..16e9480 100644 --- a/scripts/Update-OvfConfiguration.yml +++ b/scripts/Update-OvfConfiguration.yml @@ -143,4 +143,20 @@ PropertyCategories: Configurations: - secondary - standalone - UserConfigurable: true \ No newline at end of file + UserConfigurable: true +AdvancedOptions: +- Key: appliance.name + Value: "{{ appliance.name }}" + Required: false +- Key: appliance.version + Value: "{{ appliance.version }}" + Required: false + +--- +Variables: +- Name: appliance.name + Expression: | + $Parameter['appliance.name'] +- Name: appliance.version + Expression: | + $Parameter['appliance.version']