使用更新版本的 Packer 的最简单方法?

Simplest way to use updated version of Packer?

使用最新版 Packer 的最简单方法(使用 VSTS 时)是什么?

我在尝试使用 "Build Immutable Image (Preview)" 构建步骤时不断收到此错误。我知道我可以安装我自己的代理,并且有正确的 Packer 版本...但如果有更简单的方法 - 使用托管代理,那就更好了。

Packer validate command failed. This could happen if task does not support packer version

Packer不需要安装在build agent上,只需要在Build immutable image task之前添加到路径环境中即可,可以在source control和map中添加packer.exe来构建代理或在构建期间下载它(例如通过 Node.js、PowerShell)。

例如(将其添加到源代码管理:工具文件夹):

  1. 添加 PowerShell 任务(类型:内联脚本)
  2. 参数:-sd $(build.sourcesdirectory)

脚本:

param(
[string]$sd
)
$tools= "$sd\tools";
Write-Host $tools
Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};${tools}";

另一方面,有源代码:PackerBuild