我正在使用VSTS中的“构建不可变映像”部署任务和用户提供的打包程序模板来构建一个自定义Azure ami以部署到VMSS (类似于此link中的说明)
在我的packer模板的provisioner部分中,有一个名为Deploy (与模板在同一目录中)的文件夹需要上传,其中包含所有脚本和证书,这些脚本和证书将由packer provisioners运行以创建自定义映像。
"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"
]
}当在本地构建时,上面的代码运行良好。但是,当使用VSTS构建时,VSTS仅将模板文件复制到临时位置,并从临时位置执行,而不实际复制整个目录。
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因此,映像构建任务失败,并显示以下错误
* Bad source './Deploy': GetFileAttributesEx ./Deploy: The system cannot find the file specified.我找不到太多信息。有没有办法绕过这个问题?我是VSTS和Packer的新手
如有任何帮助/建议,我们将不胜感激。
发布于 2017-06-27 15:38:20
构建任务目前只复制模板文件,没有设置将其配置为将其他文件夹/文件一起复制。
解决方法是在构建定义中添加“复制文件”任务,以便在“构建不可变映像”任务运行之前将"Deploy“文件夹复制到"d:\a_temp”文件夹。
https://stackoverflow.com/questions/44753659
复制相似问题