Table of Contents |
---|
Objective
The goal of the tutorial is to demonstrate on how to integrate Azure DevOps Build pipeline through FlexDeploy.
...
We will walk through each of the FlexDeploy features that will be created and configured to accomplish this goal. By following the steps below, we will be able to Build the Pipeline in Azure DevOps in a very short amount of time.
Checklist
Checklist | Description | Mandatory |
---|---|---|
Azure DevOps Organization URL | The Organization URL of the Azure DevOps. | Yes |
Azure DevOps Personal Access Token | The Personal Access Token to connect to Azure DevOps. | Yes |
Project Name | The Name of the Azure DevOps Project. | Yes |
Build Definition Name | The ID of the Azure DevOps Build Definition Name. | Yes |
Package Name | The Name of the Package to be published to Azure DevOps Artifacts Source | Yes |
API Version | The API version of the Azure DevOps REST API. Defaults to 7.0. | No |
Feed Name | The Name or ID of the Azure DevOps Artifacts Feed. | Yes |
Package Version | The Package version to be stored with in Azure Artifacts. | Yes |
Variables List | Provide double hash (##) separated variable key-value pairs of variable-group. e.g. var1:value1##var2:value2 | No |
Package Path | Absolute directory path to place the artifacts. If not specified, then it will place the files in the FD_ARTIFACTS_DIR variable path. | No |
Provide permission to interact with Artifacts (Pre-requisite)
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).
...
Update Azure DevOps Build pipeline
Our Build pipeline downloads the code from the Git Codebase and uses ant plugin to create a jar file. We want to publish the created artifact to Azure Artifact.
...
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.
...
Sample Code Snippet:
Code Block | ||
---|---|---|
| ||
- task: UniversalPackages@0 inputs: command: 'publish' publishDirectory: '$(System.DefaultWorkingDirectory)/build/jar/ant-sample.jar' feedsToUsePublish: 'internal' vstsFeedPublish: 'helloWorld/AzureFeedTest' vstsFeedPackagePublish: '$(packageName)' versionOption: 'custom' versionPublish: '$(packageVersion)' |
Configure Cloud Account
First, an Azure DevOpsaccount needs to be configured under Integrations. FlexDeploy will use this account to integrate with Azure DevOps.
...
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.
...
Build Workflow
Navigate to the Workflows tab and create a Build workflow using the “+”(Click to create new Workflow) button. The Workflow Type field defines the type of workflow.
...
Click on save and Activate the workflow.
...
Topology
For detailed steps on how to configure the topology and target properties, please refer to Target Groups
Target Properties
Selecting the DEV environment mapped to the Target Group will display the configurable properties/Endpoint and allows to the configure the properties.
Provide the value for AzureDevOpsCloudAccount, AzureCLIPath (optional if set in classPath), Azure DevOps API Version (optional default value is 7.0), Scope of the Feed (optional default value is project used in publish artifacts operation), Number of Iterations (optional, default value is 6), and, Interval Duration (optional default value is 30sec) and map the localhost (FlexDeploy Server) as Endpoint as shown below. Also, the target level properties that we created at the workflow level will be displayed here along with other properties.
...
Target Properties Info
Property Name | Mandatory | Values for this Tutorial | Description |
---|---|---|---|
Azure DevOps Cloud Account | Yes | AZDevOpsIND | The Azure Cloud Account Name configured. |
Absolute path of Azure CLI | Optional |
| The path to the directory where Azure CLI is installed. (Optional) |
Number of Iterations | Optional (default is 6) | 6 | The number of iterations to perform the status check. |
Interval between release status check | Optional (default is 30) | 30 | The interval between Azure VM status check. |
Azure DevOps API Version | Optional (default is 7.0) | 7.0 | The API Version of the Azure DevOps REST. |
Server Config File Port | Yes | 8054 | The Port of the Azure Server Config File. |
Az Storage Blob Container Name | Yes | dev-container | The Name of the Azure Blob Container. |
Scope of the Feed | Optional | Project | Scope is “project”, if the feed was created in a project otherwise “organization”. |
Create the Azure DevOps Build Pipeline Flow Project using Blank Project
The assumption is that you have FlexDeploy installed and ready for use. When logged into the FlexDeploy, you will see the Home page. Click on the + icon on the top and click “Create Project” to create a new project.
...
The screen displays the list of blueprints supported by the FlexDeploy. Select a Blank project from the list or you can search for the blueprint in the search filter present in the top.
...
General Configuration
Scroll through this guide to fill in the project information.
...
Project Info
Property Name | Mandatory | Value for this tutorial | Description |
---|---|---|---|
Project Name | Yes | Azure DevOps Build Flow | The Name of the Project. |
Folder | Yes | FlexDeploy / Azure DevOps | This is the Folder path where the Project resides. |
Description | Optional |
| Brief description of the project. |
Project Classification | Yes | Standard | The classification of the project. |
Project configuration
We can see the Folder hierarchy on the top of the project and the project configuration as below
...
Here, we are giving the empty deployment. You can refer to Azure DevOps Create Release Flow and use this build workflow and perform an End-to-End Build and Release Flow in Azure DevOps.
Project Properties
To configure Project specific settings one can navigate to the Project Configuration tab as shown above.
Next, select the PROPERTIES option from the left-hand pane.
Click on Save.
...
Property Name | Mandatory | Value for this tutorial | Description |
---|---|---|---|
Definition Name | Optional | The Name of the Pipeline Definition. Note :Provide Either Definition Id or Definition Name to trigger the build. | |
Feed Name | Yes | AzureFeedTest | The Name of the Feed. |
Package Name | Yes | demo-package | The Name of the Package. |
Project Name | Yes | helloWorld | The Name of the Project. |
Build Definition Id | Yes | 4 | The ID of the Build Pipeline Definition. Note: Provide Either Definition Id or Definition Name to trigger the build. |
Package Version | Yes | FD_PROJECT_VERSION | The Version of the Package to be published and downloaded to. |
Create Release Variables List | Optional | Provide JSON payload or double-hash (##) separated list of variables to Create the Release. |
Build Execution
Navigate to Execution tab and click on Execute to submit the Build Request form.
...
Navigate to steps tab in order to view the workflow steps. Click on the link to view the plugin logs.
...
Reports
With the successful execution of the Build workflow, a text (.txt) file is created, stored in the reports tab. Every execution will generate a new report with execution Id appended to the text file in the Reports tab.
...
Click on the text file generated to see the details. This file captures the details of each instance i.e., Pipeline Definition Name, Pipeline Definition Id, Pipeline Build Status and Pipeline Build Result. User can download the report file generated.
...
Post deployment - Build Pipeline Execution on Azure DevOps
Post Deployment success might take some time to deploy the package with provided version. In case of failure we can easily debug the issue from the log or navigate to the Web URL which is returned as output variable FDAZ_DevOps_OUT_BUILD_PIPELINE_WEB_URL in Azure DevOps Platform.
...
Azure DevOps Build Pipeline Logs
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.
...
Azure DevOps Artifacts Source
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.
...