Table of Contents |
---|
Objective
The goal of the this tutorial is to demonstrate on how to integrate an Azure DevOps Release 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 create the release and trigger the release stage execution 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 |
Azure DevOps Release Definition Id | The ID of the Release Definition. | Yes |
Azure DevOps Release Artifacts Payload | Provide Artifacts Metadata JSON payload. | No |
Azure DevOps Project Name | The Name of the Project. | Yes |
Azure DevOps Release Variables List | Provide variables JSON payload or double hash (##) separated variable key-value pairs of variable-group. e.g. var1:value1##var2:value2 | No |
Azure DevOps Release Properties List | Provide properties collection JSON payload. | No |
Azure DevOps Release Environment Variables List | Provide variables JSON payload or double hash (##) separated variable key-value pairs of variable-group. e.g. var1:value1##var2:value2. (String) | No |
Azure DevOps API Version | The API version of the Azure DevOps REST API. Defaults to 7.0. | Yes |
Azure DevOps Release
...
Pipeline Configurations
Azure Storage Account is going to be static in our case, hence this will be passed during Release creation through varPassedWhileReleaseTrigger. Check the Scope for this variable is Release.
Where the target Blob container is different env-wise. Hence we are going to pass the container names through varPassedWhileStageTrigger for each env stage execution. Check the Scope for this variable is Dev, QA & Prod, since they are env-specific.
...
Note : This is just for showcasing the capability of passing dynamic variables, you can always have the values static in case the are not changing.
...
Configure Cloud Account
First, an Azureaccount needs to be configured under Integrations. FlexDeploy will
...
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
Update the Personal Access Token value under Secret Text. This is to make sure no one else can retrieve the password
...
Build Workflow
Technical steps involved:
FlexDeploy shall will download the code from scm, create the artifact object with selective files (.xml) and upload the package in Azure DevOps Artifact repository.
Navigate to
...
Workflows and create a
...
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 tab.
Navigate through the plugin operations and find the desired one.
In our workflow execution, 3 plugin operations being used to achieve our goal.
...
Below given is a logical explanation of build workflow to publish the artifacts generated to Azure DevOps Artifacts Source.
...
build workflow using the button as highlighted below.
...
Below is a sample build workflow to publish the artifacts generated to Azure DevOps Artifacts Source.
...
Step: Clone Git Repository
...
We'll start by creating a Workflow Property for the Feed Name, Package Name and Project Name.
Go back to the Main Properties tab of the Workflow.
Under Workflow Properties, use Add option to add the properties.
From the Add menu, we We can add an existing property , or create a new one. Select New Property Create
Properties must each have a unique code, give . 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 Project/Target property association screen.
Select the property scope, this . This defines where the property will be configured. We're using Project because this property can be overridden at project level.
...
The properties scope can be Target as well. In case any property value is environment specific (e.g. Project Name is different for each environment), then the scope should be set as Target. This will
...
change based on requirement.
...
Click on save and Activate the workflow.
...
Deploy Workflow
Technical steps involved:
FlexDeploy shall create the Azure DevOps Release pipeline instance. The new Release instance will be created from the pipeline first/lowest pipeline environment only (Dev in this case). The same Release pipeline shall be leveraged to deploy across all environments.
It can optionally pass variable/properties details as well.
FlexDeploy till now has just created the Release instance. It will capture Azure DevOps Environment Id & other relevant details from create Release step.
Next FlexDeploy will initiate the Release stage deployment env-wise.
It will also pass required environment to initiate deployment along with env-specific variables.
Release pipeline can use the package uploaded by Build workflow in Azure DevOps Artifact repo.
FlexDeploy can also optionally check(preferably) the completion status of Release execution env-wise.
Similar to Build Workflowbuild workflow, following follow the same steps we are creating to create the deploy workflow. The Workflow Group and Subgroup define the folder hierarchy. Once the workflow is created, it should appear as given below. No constraint on workflow or folder naming convention.
...
The steps of the workflow execution can be configured through on the Definition sectiontab.
...
Let’s try to understand the if block which is applicable only for the environment Dev (first/lowest env inside within pipeline). Below given is the logical flow.
createRelease operation returns the Release Id and Environment Details specific to the newly created Release. Environment Details basically return unique ids for each configured environment, against the created Release instance.
...
Another key thing to understand here is - Release Id and corresponding Environment Details are created only during Dev environment execution. However same details are need for all other environments as well. That's why we have 2 workflow input parameters to propagate the same. And this will be the job of pipeline to capture the Workflow Output variable from Dev Environment and pass those values as workflow input to all other environments.
...
Below given is the logical flow for else block.
...
Step: If pipeline environment is ‘Dev’
...
As can be observed from highlighted Output, that the RELEASE_ID & ENV_DETAILS are captured from plugin Output.
createRelease Operation relevant Input details
Input Name | Mandatory | Description |
---|---|---|
Release Definition Id | Yes | The ID of Release Definition |
Release Artifact Payload | No | Provide Artifacts Metadata JSON payload. |
Project Name | Yes | The Name of the Project. |
Variables List | No | Provide double hash (##) separator variable key-value pairs of variable-group.( e.g. var1:value1##var2:value2. ) |
Step: Assign Release Id captured during createRelease operation (else block):
Substring is to remove the quote sign( ' ) around the Release Id.
...
is to remove the quote sign( ' ) around the Release Id.
The full Expression value is RELEASE_ID_INP.substring(1,RELEASE_ID_INP.length()-1)
...
Step: Assign Environment Details captured during createRelease operation (else block):
...
Based on the current Environment Code, this method will capture the Release stage Environment ID.n.b.
It’s essential that
...
the Azure DevOps environment name is exactly same as the
...
environment name configured in FlexDeploy.
...
Otherwise the below step
...
won't work properly.
...
Parse Json Inputs:
Input Name | Value for this tutorial | Mandatory | Description |
---|---|---|---|
JSON Source | Yes | JSON Source to parse. | |
JSONPath Expression | '$..[?(@.name==\''+FD_ENVIRONMENT_NAME+'\')].id' | Yes | The JSONPath expression to use to find a value in the JSON Source |
...
We'll start by creating a Workflow Property for the Feed Name, Package Name and Project Name.
Go back to the Main Properties tab of the Workflow
Under Workflow Properties, choose open the Add men.
From the Add menu, we We can add an existing property , or create a new one. Select New Property 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 Target 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 and Target to capture environment level properties.
...
Note: It may appear interesting that we are using 2 Target variables (CONFIG_PORT & CONTAINER_NAME) however we haven’t used them in the workflow. We wanted to pass these details dynamically to Azure DevOps Release based on env-specific value configured under Topology-->Target Properties. Further details can be found under Topology and Project Properties .
Anchor | ||||||
---|---|---|---|---|---|---|
|
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.
...
Also Container Name is set here which is a env specific value.
...
Target Properties details
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”. |
Git Path | Optional | Path to the Git Executable. Required only if git is not on PATH. |
Create the Azure DevOps Create Release 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 | Deploy Through Az DevOps Project | 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
...
Anchor | ||||||
---|---|---|---|---|---|---|
|
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.
...
Project Properties details
Property Name | Mandatory | Value for this tutorial | Description | |||||
---|---|---|---|---|---|---|---|---|
Artifacts Payload | Optional |
| Provide the Artifacts Metadata payload. We are using Property Replacement here to capture the FEED_NAME, PACKAGE_NAME values. This is extremely essential part of the deployment. As we can see from the payload, through this property we are passing all package related details. Feed name, package name, package version. Azure DevOps Release pipeline will use these details to download the right package from Artifact repository and continue with the execution. | |||||
Env specific Variables List | Optional |
| Provide JSON payload or double-hash (##) separated list of variables to trigger the Manual Release Environment Stage. We are passing CONTAINER_NAME & CONFIG_PORT as part of env specific variables. These are configured under Topology and will be replaced dynamically by FlexDeploy while passing to Release Pipeline. Check section Topology for the values being set. | |||||
Feed Name | Yes | demoFeed | The Name of the Feed. | |||||
Package Name | Yes | demo-package | The Name of the Package. | |||||
Project Name | Yes | demoproject1 | The Name of the Project. | |||||
Release Definition Id | Yes | 1 | The ID of the Release Definition. | |||||
Create Release Variables List | Optional |
| Provide JSON payload or double-hash (##) separated list of variables to Create the Release. This is the variable we are passing one time during Release creation. This can also be dynamically replaced same way as mentioned in Env specific Variables List |
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 select the environment.
Select main as branch name.
Submit the request, this will initiate the AzDevOpsBuildFlow workflow.
...
Navigate to steps tab in order to view the workflow steps. Click on the link to view the plugin logs.
...
Deploy Execution
Navigate to back to the Execution tab and click on icon shown as below to submit the Deploy Request form.
...
Upon submission, the deploy workflow is initiated and the workflow steps are executed on the Azure DevOps instance in the Dev environment, utilizing the Localhost endpoint. Upon completion of the workflow, the execution status will be successful.
...
Post deployment - 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_REL_ENV_WEB_URL in Azure DevOps Platform.
...
Azure DevOps Release Deployment
...
Congratulations! You have successfully completed the Azure DevOps Create Release and Update Release Environment Status tutorial.
...