title | description | ms.date | monikerRange |
---|---|---|---|
PackerBuild@0 - Build machine image v0 task |
Build a machine image using Packer, which may be used for Azure Virtual machine scale set deployment (task version 0). |
04/29/2024 |
<=azure-pipelines |
:::moniker range="<=azure-pipelines"
Use this task to build a machine image using Packer, which may be used for Azure Virtual machine scale set deployment.
[!INCLUDE workload-identity]
:::moniker-end
:::moniker range=">=azure-pipelines-2019.1"
# 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.
:::moniker-end
:::moniker range="=azure-pipelines-2019"
# 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.
:::moniker-end
:::moniker range="<=azure-pipelines"
templateType
- Packer template
string
. Required. Allowed values: builtin
(Auto generated), custom
(User provided). Default value: builtin
.
Specifies whether you want the task to auto generate a Packer template or use a custom template provided by you.
:::moniker-end
:::moniker range="<=azure-pipelines"
customTemplateLocation
- Packer template location
string
. Required when templateType = custom
.
Specifies the path to a custom user-provided template.
:::moniker-end
:::moniker range="<=azure-pipelines"
customTemplateParameters
- Template parameters
string
. Optional. Use when templateType = custom
. Default value: {}
.
Specifies parameters which will be passed to Packer for building a custom template. This should map to the variables
section in your custom template. For example, if the template has a variable named drop-location
, then add a parameter here with the name drop-location
and a value which you want to use. You can link the value to a release variable as well. To view/edit the additional parameters in a grid, click on …
next to the text box.
:::moniker-end
:::moniker range="<=azure-pipelines"
ConnectedServiceName
- Azure subscription
string
. Required when templateType = builtin
.
Specifies the Azure Resource Manager subscription for baking and storing the machine image.
:::moniker-end
:::moniker range="<=azure-pipelines"
location
- Storage location
string
. Required when templateType = builtin
.
Specifies the location for storing the built machine image. This location will also be used to create a temporary VM for the purpose of building an image.
:::moniker-end
:::moniker range="<=azure-pipelines"
storageAccountName
- Storage account
string
. Required when templateType = builtin
.
Specifies the storage account for storing the built machine image. This storage account must be pre-existing in the location selected.
:::moniker-end
:::moniker range="<=azure-pipelines"
azureResourceGroup
- Resource group
string
. Required when templateType = builtin
.
Specifies the Azure Resource group that contains the selected storage account.
:::moniker-end
:::moniker range="<=azure-pipelines"
baseImageSource
- Base image source
string
. Required when templateType = builtin
. Allowed values: default
(Gallery), customVhd
(Custom). Default value: default
.
Specifies the source of a base image. You can either choose from a curated gallery of OS images or provide a URL of your custom image.
:::moniker-end
:::moniker range="<=azure-pipelines"
baseImage
- Base image
string
. Required when baseImageSource = default && templateType = builtin
. Allowed values: 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). Default value: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:windows
.
Chooses from a curated list of OS images. This is used for installing pre-requisite(s) and application(s) before capturing a machine image.
:::moniker-end
:::moniker range="<=azure-pipelines"
customImageUrl
- Base image URL
string
. Required when baseImageSource = customVhd && templateType = builtin
.
Specifies the URL of a base image. This is used for installing pre-requisite(s) and application(s) before capturing a machine image.
:::moniker-end
:::moniker range="<=azure-pipelines"
customImageOSType
- Base image OS
string
. Required when baseImageSource = customVhd && templateType = builtin
. Allowed values: windows
, linux
. Default value: windows
.
:::moniker-end
:::moniker range="<=azure-pipelines"
packagePath
- Deployment Package
string
. Required when templateType = builtin
.
Specifies the path for the deployment package directory relative to $(System.DefaultWorkingDirectory)
. Supports a minimatch pattern. Example path: FrontendWebApp/**/GalleryApp
.
:::moniker-end
:::moniker range="<=azure-pipelines"
deployScriptPath
- Deployment script
string
. Required when templateType = builtin
.
Specifies the relative path to a powershell script (for Windows) or a shell script (for Linux) which deploys the package. This script should be contained in the package path selected above. Supports a minimatch pattern. Example path: deploy/**/scripts/windows/deploy.ps1
.
:::moniker-end
:::moniker range="<=azure-pipelines"
deployScriptArguments
- Deployment script arguments
string
. Optional. Use when templateType = builtin
.
Specifies the arguments to be passed to the deployment script.
:::moniker-end
:::moniker range="<=azure-pipelines"
additionalBuilderParameters
- Additional Builder parameters
string
. Optional. Use when templateType = builtin
. Default value: {}
.
In an auto-generated Packer template mode, the task creates a Packer template with an Azure builder. This builder is used to generate a machine image. You can add keys to the Azure builder to customize the generated Packer template. For example, setting ssh_tty=true
in case you are using a CentOS base image, and you need to have a tty to run sudo.
To view or edit the additional parameters in a grid, click on …
next to text box.
:::moniker-end
:::moniker range="<=azure-pipelines"
skipTempFileCleanupDuringVMDeprovision
- Skip temporary file cleanup during deprovision
boolean
. Optional. Use when templateType = builtin
. Default value: true
.
During the deprovisioning of a VM, skips the cleanup of temporary files uploaded to the VM. For more information, refer to Azure Virtual Machine Image Builders.
:::moniker-end
:::moniker range="<=azure-pipelines"
imageUri
- Image URL
string
.
Specifies a name for the output variable which stores the generated machine image URL.
:::moniker-end
All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.
:::moniker range="<=azure-pipelines"
None.
:::moniker-end
Use this task to build a machine image using Packer. This image can be used for Azure Virtual machine scale set deployment.
Note
If you want to enable detailed logs, navigate to Pipelines > Edit > Variables, and then add a new variable PACKER_LOG and set its value to 1.
:::moniker range="<=azure-pipelines"
Requirement | Description |
---|---|
Pipeline types | YAML, Classic build, Classic release |
Runs on | Agent, DeploymentGroup |
Demands | None |
Capabilities | This task does not satisfy any demands for subsequent tasks in the job. |
Command restrictions | Any |
Settable variables | Any |
Agent version | 2.0.0 or greater |
Task category | Deploy |
:::moniker-end