Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Objective

The goal of the tutorial is to demonstrate on how to initiate an Azure DevOps Build pipeline. Post trigger, it will check for Build pipeline completion status as well.

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

Build Definition Id

The ID of the Build Definition.

Yes

Project Name

The Name of the Project.

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.

Yes

Feed Name

The Name or ID of the Feed.

Package Version

The Version of the Package to download the Artifact from Artifacts Source. – is it correct?

Queue Id

The Queue ID of the pool that will be used to queue the build.

Commit Id

The Commit ID of the branch to build.

Branch Name

The Name of the Branch to build.

Additional Parameters

Provide Artifacts Metadata JSON payload.

Variables List

Provide double hash (##) separated variable key-value pairs of variable-group. e.g. var1:value1##var2:value2

Package Path

Absolute directory path to place the artifacts. If not specified, then it will place the files in the FD_ARTIFACTS_DIR.

Pre-requisite

There are pre-requisite permissions that needs to be included inorder to publish any Artifacts to the Azure DevOps Artifacts Source. Especially, The user must have the ‘<Project Name> Build Service’ permission to publish the Universal Packages.

Step-i) Navigate to the Feed Settings

  • Make sure you are in correct Project. Click on the Artifacts and select the feed from the dropdown to give the permissions. Then click on the Feed settings (gear icon).

Step-ii) Navigate to the Permissions tab.

  • Click on the Add users/groups button

Step-iii) Add the Permissions

  • Select the <Project Name> Build Service user/group from the drop-down and set the role as contributor (contributor will have both read and write access).

YAML Script

To update the Yaml script, follow the below steps:

  1. Click on the Pipelines to navigate to the Pipeline Definition ( yaml script )

  2. Create the variables $packageName , $packageVersion under pipeline definition

    1. Click on the variables button

    2. Click on the new variables button.

    3. Update the values

      1. Name of the variable

      2. Value of the variable : Skipping this value as we are passing that value in Flexdeploy

      3. Make sure to check the ‘Let users override this value when running this pipeline’ checkbox

    4. Create another variable for $packageVersion by clicking on the '+' icon

    5. Similarly, update the name ( packageVersion ) and check on the ‘Let users override this value when running this pipeline’ checkbox.

  3. Now, on the right-hand pane, on the search box filter for Universal Package.

  4. Click on the Universal Package to add the task to the existing Yaml script.

    1. Command - Select the publish from the dropdown.

    2. Destination Directory - The directory location where the artifacts are generated by the Pipeline Execution.

    3. Feed - The Name of the Feed.

    4. Package Name - The Name of the Package.

    5. Version - The Version of the package to be published.

  5. Click on add. The below screenshot shows how the universal package job is added to the yaml script.

  6. Now, updating the universal package code snippet based on your requirement and Click on the Save button to save the yaml script. Its highlighted as 1-5 , then there should be some explanation… add the script(only universal package) here as code snippet.

Sample Code Snippet:

- 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 account needs to be configured under Integrations. FlexDeploy will

  1. Select Integrations from the Menu.

  2. Navigate to the Cloud tab from the left-hand pane.

  3. Create a new Cloud account of the provider type “AzureDevOps” with the “+ Create” button.

It should have a Organization URL and Personal Access Token configured in it.

  1. Azure DevOps Access Token is a password (Personal Access Token) field and hence needs to be kept hidden. To update the same click on the pencil icon as shown below

  2. Update the Personal Access Token value under Secret Text. This is to make sure no one else can retrieve the password

Build Workflow

Navigate to the Workflows tab and create a workflow using the “+”(Click to create new Workflow) button

Next, create one Build workflow as shown below. The Workflow Type field defines the type of workflow.

Build Workflow

  1. Navigate to the Workflows tab

  2. Select the “+” button from the left-hand pane to create a new workflow with type as Build.

The Workflow Group and Subgroup define the folder hierarchy. Once the workflow is created, it should look like the below. No constraint on workflow or folder naming convention.

The steps of the workflow execution can be configured through the Definition section.

Below given is a sample build workflow to trigger the Pipeline Build and download the artifacts generated from Azure DevOps Artifacts Source to FlexDeploy Artifacts Directory.

You are saying download but mentioning publishArtifacts..they are just the opposite

Step-i: Build Pipeline

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.

Again highlighted from 1-9 ..without any explanation

How exactly Branch is fitting here? You are not using in your build pipeline…also you are downloading from Git..

You can remove non essential parameter’s from checklist

Download artifact section missing

Build Workflow Properties

We'll start by creating a Workflow Property for the Feed Name, Package Name and Project Name.

  1. Go back to the Main tab of the Workflow

  2. Under Workflow Properties, choose open the Add men.

  3. From the Add menu, we can add an existing property, or create a new one. Select New Property

  4. Properties must each have a unique code, give a meaningful code for the new property

  5. A property display name does not have to be unique and can contain spaces. This is the name that will be displayed on the Target screen

  6. 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

Step-ii: Download the Artifacts from Azure DevOps Artifacts Source

Below given is the Azure plugin(downloadArtifacts operation) configurations.

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 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)
eg: /u01/azure/bin

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

  1. To configure Project specific settings one can navigate to the Project Configuration tab as shown above.

  2. Next, select the PROPERTIES option from the left-hand pane.

  3. Click on Save.

Property Name

Mandatory

Value for this tutorial

Description

Branch Name

Optional

The Name of the Branch to build.

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.

The Build Request Form will appear and we need to:

  1. select the environment we want to generate and publish the Artifacts.

  2. submit the request, this will initiate the AzureDevOpsBuildFlow workflow.

Upon submission, the build workflow is initiated and the workflow steps are executed on the AzureInstance target group in the DEV environment, utilizing the Localhost endpoint to generate the Artifacts and publish Artifacts using buildPipeline operation and downloadArtifacts will download the generated artifacts based on the package Name and package Version from the Azure DevOps Artifacts Source to the FlexDeploy Artifacts Directory, if package path is given as empty . Upon completion of the workflow, the execution status will be successful.

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.

Congratulations! You have successfully completed the Azure DevOps Build Pipeline tutorial.

Now that you have configured FlexDeploy for one Azure DevOps Pipeline Build Flow, it is extremely easy to replicate the same for other Pipeline Flow. Simply use the Copy Project feature and a new project will be created with all of the configuration completed already. You just need to make the necessary configuration changes.

  • No labels