活动
PackerBuild@0 - 生成计算机映像 v0 任务
使用此任务使用 Packer 生成计算机映像,该映像可用于 Azure 虚拟机规模集部署。
备注
# Build machine image v0
# Build a machine image using Packer, which may be used for Azure Virtual machine scale set deployment.
- task: PackerBuild@0
inputs:
templateType: 'builtin' # 'builtin' | 'custom'. Required. Packer template. Default: builtin.
#customTemplateLocation: # string. Required when templateType = custom. Packer template location.
#customTemplateParameters: '{}' # string. Optional. Use when templateType = custom. Template parameters. Default: {}.
# Azure Details
ConnectedServiceName: # string. Required when templateType = builtin. Azure subscription.
location: # string. Required when templateType = builtin. Storage location.
storageAccountName: # string. Required when templateType = builtin. Storage account.
azureResourceGroup: # string. Required when templateType = builtin. Resource group.
# Deployment Inputs
baseImageSource: 'default' # 'default' | 'customVhd'. Required when templateType = builtin. Base image source. Default: default.
#baseImage: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows' # 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2016-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2012-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:windows' | 'Canonical:UbuntuServer:14.04.4-LTS:linux' | 'Canonical:UbuntuServer:16.04-LTS:linux' | 'RedHat:RHEL:7.2:linux' | 'RedHat:RHEL:6.8:linux' | 'OpenLogic:CentOS:7.2:linux' | 'OpenLogic:CentOS:6.8:linux' | 'credativ:Debian:8:linux' | 'credativ:Debian:7:linux' | 'SUSE:openSUSE-Leap:42.2:linux' | 'SUSE:SLES:12-SP2:linux' | 'SUSE:SLES:11-SP4:linux'. Required when baseImageSource = default && templateType = builtin. Base image. Default: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows.
#customImageUrl: # string. Required when baseImageSource = customVhd && templateType = builtin. Base image URL.
#customImageOSType: 'windows' # 'windows' | 'linux'. Required when baseImageSource = customVhd && templateType = builtin. Base image OS. Default: windows.
packagePath: # string. Required when templateType = builtin. Deployment Package.
deployScriptPath: # string. Required when templateType = builtin. Deployment script.
#deployScriptArguments: # string. Optional. Use when templateType = builtin. Deployment script arguments.
# Advanced
#additionalBuilderParameters: '{}' # string. Optional. Use when templateType = builtin. Additional Builder parameters. Default: {}.
#skipTempFileCleanupDuringVMDeprovision: true # boolean. Optional. Use when templateType = builtin. Skip temporary file cleanup during deprovision. Default: true.
# Output
#imageUri: # string. Image URL.
# Build Machine Image v0
# Build machine image using Packer. This image can be used for Azure Virtual machine scale set deployment.
- task: PackerBuild@0
inputs:
templateType: 'builtin' # 'builtin' | 'custom'. Required. Packer template. Default: builtin.
#customTemplateLocation: # string. Required when templateType = custom. Packer template location.
#customTemplateParameters: '{}' # string. Optional. Use when templateType = custom. Template parameters. Default: {}.
# Azure Details
ConnectedServiceName: # string. Required when templateType = builtin. Azure subscription.
location: # string. Required when templateType = builtin. Storage location.
storageAccountName: # string. Required when templateType = builtin. Storage account.
azureResourceGroup: # string. Required when templateType = builtin. Resource group.
# Deployment Inputs
baseImageSource: 'default' # 'default' | 'customVhd'. Required when templateType = builtin. Base image source. Default: default.
#baseImage: 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows' # 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2016-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2012-Datacenter:windows' | 'MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:windows' | 'Canonical:UbuntuServer:14.04.4-LTS:linux' | 'Canonical:UbuntuServer:16.04-LTS:linux' | 'RedHat:RHEL:7.2:linux' | 'RedHat:RHEL:6.8:linux' | 'OpenLogic:CentOS:7.2:linux' | 'OpenLogic:CentOS:6.8:linux' | 'credativ:Debian:8:linux' | 'credativ:Debian:7:linux' | 'SUSE:openSUSE-Leap:42.2:linux' | 'SUSE:SLES:12-SP2:linux' | 'SUSE:SLES:11-SP4:linux'. Required when baseImageSource = default && templateType = builtin. Base image. Default: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows.
#customImageUrl: # string. Required when baseImageSource = customVhd && templateType = builtin. Base image URL.
#customImageOSType: 'windows' # 'windows' | 'linux'. Required when baseImageSource = customVhd && templateType = builtin. Base image OS. Default: windows.
packagePath: # string. Required when templateType = builtin. Deployment Package.
deployScriptPath: # string. Required when templateType = builtin. Deployment script.
#deployScriptArguments: # string. Optional. Use when templateType = builtin. Deployment script arguments.
# Advanced
#additionalBuilderParameters: '{}' # string. Optional. Use when templateType = builtin. Additional Builder parameters. Default: {}.
#skipTempFileCleanupDuringVMDeprovision: true # boolean. Optional. Use when templateType = builtin. Skip temporary file cleanup during deprovision. Default: true.
# Output
#imageUri: # string. Image URL.
templateType
- Packer 模板
string
. 必需。 允许的值: builtin
(自动生成) , custom
(用户提供的) 。 默认值:builtin
。
指定是希望任务自动生成 Packer 模板,还是使用你提供的自定义模板。
customTemplateLocation
- Packer 模板位置
string
. 当 templateType = custom
时,需要此选项。
指定用户提供的自定义模板的路径。
customTemplateParameters
- 模板参数
string
. 可选。 在 时 templateType = custom
使用 。 默认值:{}
。
指定将传递给 Packer 以生成自定义模板的参数。 这应映射到 variables
自定义模板中的 节。 例如,如果模板有一个名为 的 drop-location
变量,则在此处添加一个参数,其中包含要使用的名称和 drop-location
值。 还可以将该值链接到发布变量。 若要查看/编辑网格中的其他参数,请单击文本框旁边的 。…
ConnectedServiceName
- Azure 订阅
string
. 当 templateType = builtin
时,需要此选项。
指定用于烘焙和存储计算机映像的 Azure 资源管理器 订阅。
location
- 存储位置
string
. 当 templateType = builtin
时,需要此选项。
指定用于存储生成的计算机映像的位置。 此位置还用于创建临时 VM,以便生成映像。
storageAccountName
- 存储帐户
string
. 当 templateType = builtin
时,需要此选项。
指定用于存储生成的计算机映像的存储帐户。 此存储帐户必须预先存在于所选位置。
azureResourceGroup
- 资源组
string
. 当 templateType = builtin
时,需要此选项。
指定包含所选存储帐户的 Azure 资源组。
baseImageSource
- 基础映像源
string
. 当 templateType = builtin
时,需要此选项。 允许的值: default
(库) 、 customVhd
(自定义) 。 默认值:default
。
指定基础映像的源。 可以从精选的 OS 映像库中进行选择,也可以提供自定义映像的 URL。
baseImage
- 基础映像
string
. 当 baseImageSource = default && templateType = builtin
时,需要此选项。 允许的值: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows
(Windows 2012-R2-Datacenter) 、 MicrosoftWindowsServer:WindowsServer:2016-Datacenter:windows
(Windows 2016-Datacenter) 、 MicrosoftWindowsServer:WindowsServer:2012-Datacenter:windows
(Windows 2012-Datacenter) 、 MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:windows
(Windows 2008-R2-SP1) 、 Canonical:UbuntuServer:14.04.4-LTS:linux
(Ubuntu 14.04.4-LTS) 、 Canonical:UbuntuServer:16.04-LTS:linux
(Ubuntu 16.04-LTS) 、 RedHat:RHEL:7.2:linux
(RHEL 7.2) , RedHat:RHEL:6.8:linux
(RHEL 6.8) 、 OpenLogic:CentOS:7.2:linux
(CentOS 7.2) 、 OpenLogic:CentOS:6.8:linux
(CentOS 6.8) 、 credativ:Debian:8:linux
(Debian 8) 、 credativ:Debian:7:linux
(Debian 7) 、 SUSE:openSUSE-Leap:42.2:linux
(openSUSE-Leap 42.2) 、 SUSE:SLES:12-SP2:linux
(SLES 12-SP2) SUSE:SLES:11-SP4:linux
(SLES 11-SP4) 。 默认值:MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows
。
从 OS 映像的特选列表中进行选择。 这用于在捕获计算机映像之前安装必备 () 和应用程序 () 。
customImageUrl
- 基础映像 URL
string
. 当 baseImageSource = customVhd && templateType = builtin
时,需要此选项。
指定基础映像的 URL。 这用于在捕获计算机映像之前安装必备 () 和应用程序 () 。
customImageOSType
- 基础映像 OS
string
. 当 baseImageSource = customVhd && templateType = builtin
时,需要此选项。 允许的值:windows
、linux
。 默认值:windows
。
packagePath
- 部署包
string
. 当 templateType = builtin
时,需要此选项。
指定相对于 $(System.DefaultWorkingDirectory)
的部署包目录的路径。 支持小型匹配模式。 示例路径: FrontendWebApp/**/GalleryApp
。
deployScriptPath
- 部署脚本
string
. 当 templateType = builtin
时,需要此选项。
指定 Windows) 的 powershell 脚本 (的相对路径,或部署包的 Linux) 的 shell 脚本 (。 此脚本应包含在上面选择的包路径中。 支持小型匹配模式。 示例路径: deploy/**/scripts/windows/deploy.ps1
。
deployScriptArguments
- 部署脚本参数
string
. 可选。 在 时 templateType = builtin
使用 。
指定要传递给部署脚本的参数。
additionalBuilderParameters
- 其他生成器参数
string
. 可选。 在 时 templateType = builtin
使用 。 默认值:{}
。
在自动生成的 Packer 模板模式下,该任务使用 Azure 生成器创建 Packer 模板。 此生成器用于生成计算机映像。 可以将键添加到 Azure 生成器,以自定义生成的 Packer 模板。 例如,如果使用的是 CentOS 基础映像,并且需要有一个 tty 才能运行 sudo,则设置 ssh_tty=true
。
若要查看或编辑网格中的其他参数,请单击 …
文本框旁边的 。
skipTempFileCleanupDuringVMDeprovision
- 在取消预配期间跳过临时文件清理
boolean
. 可选。 在 时 templateType = builtin
使用 。 默认值:true
。
在取消预配 VM 期间, 跳过对上传到 VM 的临时文件的清理。 有关详细信息,请参阅 Azure 虚拟机映像生成器。
imageUri
- 图像 URL
string
.
指定存储生成的计算机映像 URL 的输出变量的名称。
除了任务输入,所有任务都有控制选项。 有关详细信息,请参阅 控制选项和常见任务属性。
无。
使用此任务通过 Packer 生成计算机映像。 此映像可用于 Azure 虚拟机规模集部署。
备注
如果要启用详细日志,请导航到“管道”>“编辑”>“变量”,然后添加新变量 PACKER_LOG 并将其值设置为 1。