Azure DevOps Task Name Azure DevOps Phase
Expose Habitat Build Variables Build

Summary

Exposes the last build variables to the Azure DevOps agent

Description

Depending on the platform, this task will read the contents of the results/last_build.env (Linux) or results/last_build.ps1 (Windows) file and expose the values as environment variables that can be used in subsequent tasks.

NOTE: This is a change from version 3.x onwards. In previous versions the full path to the build environment file needed to be specified. Now just the path to the directory is required.

Optionally, by selecting the ‘Set Build Number’ parameter, the build will changes its build number to whatever Habitat generated for the build. This makes it easy to track a package that has been deployed with the build that created it.

When this task is used in a Release pipeline it is possible to specify the tags that are to be applied to the image after export. The values that are to be added to this file are set in the ‘Image Names’ in the Advanced section. Using this task makes it very easy to use the Docker tasks that are available in Azure DevOps to upload to a registry.

Settings

Setting Group Required Default Value Description
Display name   yes Install Habitat Set the display name for this task
Build Environment File   yes $(Build.SourcesDirectory)/results Path to the directory containing the build variables
Set Build Number   no false Set the Azure DevOps build number to that generated by the Habitat build
Write Image Names   no false Write out a file that will be used by other tasks to reference the Docker image after an export
Image Names Advanced no $(pkg_origin)/$(pkg_name) List of tags referring to the Docker image
Image Names Filename Advanced yes $System.DefaultWorkingDirectory)/image.names Path to the file that will be created with the tag names

Screenshot

Expose Build Variables