I am using "Build immutable image" deploy task in VSTS with user provided Packer template to build a custom Azure ami to deploy to VMSS (similar to what instructed in this link)
In the provisioner section of my packer template there's a folder named Deploy (which is in same directory as the template) that needs to be uploaded which contains all the scripts and certificates that will run by packer provisioners to create custom image.
"provisioners": [
{
"type": "windows-shell",
"inline": [
"cmd /c \"mkdir c:\\\\PackerTemp\""
]
},
{
"type": "file",
"source": "./Deploy",
"destination": "c:\\PackerTemp"
},
{
"type": "powershell",
"inline": [
"Start-Process powershell -ArgumentList \"C:\\\\PackerTemp\\\\Deploy\\\\InstallIIS.ps1\" -NoNewWindow -Wait"
]
},
{
"type": "powershell",
"inline": [
"Start-Process powershell -ArgumentList \"C:\\\\PackerTemp\\\\Deploy\\\\InstallCertificate.ps1\" -NoNewWindow -Wait"
]
}
Above works fine when building locally. However, when building with VSTS, VSTS copies only the template file to temporary location and executes from temporary location without actually copying the entire directory.
2017-06-26T04:16:15.4579904Z Original template location:
d:\a\r1\a\PackerExperiment\drop\PackerTemplate\firstPackerTry.json
2017-06-26T04:16:15.4579904Z Copying original template from
d:\a\r1\a\PackerExperiment\drop\PackerTemplate\firstPackerTry.json to
temporary location d:\a\_temp\1498450573956
2017-06-26T04:16:15.4599904Z Copied template file to a temporary location:
d:\a\_temp\1498450573956
Hence the image building task fails with the error
* Bad source './Deploy': GetFileAttributesEx ./Deploy: The system cannot find the file specified.
I couldn't find much information. Is there a way around this problem? I'm new to VSTS and Packer
Any help / suggestions would be greatly appreciated.