...
There are pre-requisite permissions that needs to be included in order to publish any Artifacts to the Azure DevOps Artifacts Source. Especially, the Azure DevOps Build service must have the ‘contributor’ permission to publish the Universal Packages. This basically ensured the Build pipeline can interact with Azure DevOps Artifact. Below given are the steps,
...
Select the <Project Name> Build Service from the user/group drop-down and set the role as contributor (contributor will have both read and write access).
...
Next, we will configure the Universal package task.
Command - Select the Publish operation from the dropdown.
Destination Directory - The directory location where the artifacts are generated by the Pipeline Execution Ant task (previous step).
Feed - The Name of the Azure DevOps Artifact Feed.
Package Name - The Name of the Package that will be published to the Feed.
Version - The Version of the package to be published. We shall mark this value as custom, since we are going to update this dynamically.
Click on add. The below screenshot shows how the universal package job is added to the YAML script.
...
Once Added the UniversalPackage task will be added in the pipeline.
...
Now, updating the universal package code snippet based on our requirement .We have added the packageName & packageVersion variable against the Feed Package name and corresponding version. We are going to pass these values through FlexDeploy.
...
Azure DevOps Access Token is a password (Personal Access Token) field and hence needs to be kept hidden. Create a new credential named Azure DevOps access token.
Update the Personal Access Token value under Secret Text. This is to make sure no one else can retrieve the password. Ref on how to generate PAT in Azure DevOps: https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows#create-a-pat
Click in Save.
...
Go to the Properties tab of the Workflow
We can add an existing property or create a new one. Select Create
Properties must each have a unique code, give a meaningful code for the new property.
A property Display Name does not have to be unique and can contain spaces. This is the name that will be displayed on the properties association screen.
Select the property scope, this defines where the property will be configured. We're using Project because this property can be overridden at project level.
...
We are using multiple Project properties, not all of them are mandatory.
Build Pipeline operation
This step will trigger the Pipeline Build. As we configured the Universal Publish step in the YAML script in Azure DevOps, this workflow will publish the package Name and package version that we provided in the Azure DevOps Artifacts Source.
...
Input Name | Mandatory | Description |
---|---|---|
Build Definition Id | No | The Name of the definition to queue. |
Build Definition Name | No | The Id of the definition to queue. (Provide Either the Definition Id or Definition Name as input.) |
Queue Id | No | The Queue Id of the pool that will be used to queue the build. |
Commit Id | No | The Commit ID of the branch to build. |
Branch Name | No | The Name of the Branch to build. Required if there is not a default branch set up on the definition |
Variables List | No | Provide double hash (##) separator variable key-value pairs of variable-group.( e.g. var1:value1##var2:value2. ) |
Project Name | Yes | The Name of the Project. |
Package Name | Yes | The Name of the package. |
Additional Parameters | No | Add any additional parameters not listed above, which will be appended to the Build Pipeline CLI Command. (e.g. --debug, --query etc. ) |
Download the Artifacts from Azure DevOps Artifacts Source
Below given are the Azure plugin (downloadArtifacts operation) configurations. Some relevant details are provided so that FlexDeploy can download the generated package version from previous step and save it as an artifact.
...
Navigate to the link that is returned as output variable in the above screenshot. Now, click on Job and check the Universal Packages step. We can see that the package named demo-package with version 1.0.4 is publishing.
...
Navigate to Artifacts Source as shown below. We can see that the demo-package with version details is published to the Artifacts Source in Azure DevOps.
...