Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

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

Settable at release time property is checked since we want to pass the values through FlexDeploy runtime.

...

Navigate inside the Release pipeline Stages, for each environment we need to select the Pre-deployment conditions and set the trigger as Manual only. This will ensure that this stages has to be explicitly triggered ( FlexDeploy in our case) to initiate the deployment. If this is not selected once the Release is created the env-wise deployment shall happen automatically.

...

Both Storage Account Name & Blob Container name we are going to pass dynamically.

  1. We are passing variable varPassedWhileReleaseTrigger against Azure Storage Account. We have already mentioned in last to last step regarding this variable.

  2. We are passing variable varPassedWhileStageTrigger against Container name for each env stage execution. Both values needs to be passed from FlexDeploy.

...

First, an Azureaccount 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.

...

Below is a sample build workflow to publish the artifacts generated to Azure DevOps Artifacts Source.

...

Step: Clone Git Repository

This step will clone the Git repository codebase into the project execution working directory. The Git URL will be retrieved from Source Control configured under Project Configuration.

...

Step: Copy the files generated to Artifacts Directory

.xml -extension files(if applicable/present) will be moved to FlexDeploy Artifact directory. *.xml is added under File Filter to selective move files with xml extension only. This will create FlexDeploy artifact object with the files.

...

Input Name

Value on this tutorial

Mandatory

Description

File Filter

*.xml

No

Wildcard compatible expression to select file(s). You can enter multiple filter expressions separated by ##. Leave empty to select all files. The ## performs an OR expression. This will filter Files or Directory names but not the path. (e.g. for "/this/is/a/test/path" if you use "path" it will filter it, if you use "/this/is/a/test/path" it will not)

Source Path

Temp directory

Yes

The source directory to copy file(s) from. The FD_TEMP_DIR and FD_ARTIFACTS_DIR variables work great in this field.

Target Path

Artifacts directory

Yes

The target directory where file(s) are to be transferred. The FD_TEMP_DIR and FD_ARTIFACTS_DIR variables work great in this field.

Step: Publish the Artifacts to Azure DevOps Artifacts Source

Below given are the Azure plugin (publishArtifacts operation) configurations.

...

  1. Go to the Properties tab of the Workflow.

  2. We can add an existing property or create a new one. Select Create

  3. Properties must each have a unique code. Give a meaningful code for the new property.

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

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

...

One important thing to understand here is, for each new Release in Azure DevOps, the generated EnvirontmentId is unique even through the Target Environments(e.g. Dev, SIT, Prod) are same. Above workflow creates the Release in Azure DevOps and also returns the created Release Idand corresponding Environment Details as Workflow Output variables.

...

Let’s try to understand the else block which is applicable for all other higher environments.

Another key thing to understand here is - Release Idand 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.

...

Step: If pipeline environment is ‘Dev’

Validates if the Deploy is triggered on Dev environment. If Environment is Dev, proceed with create Release.

...

Step: Create Release instance for Azure DevOps Release pipeline( If block)

Below given are the Azure plugin (createRelease operation) configurations.

...

As can be observed from highlighted Output, the RELEASE_ID & ENV_DETAILS are captured from plugin Output.

...

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.

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):

...

Step: Parse Environment specific Id

Based on the current Environment Code, this method will capture the Release stage Environment ID.

...

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

Step: Trigger deployment of Azure DevOps Release based on environment

Based on the given Release ID, Release Environment ID, Project Name this method will trigger the respective environment stage that is set as 'Manual'.

...

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 .

...

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 30 sec) 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.

...

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.

...

Property Name

Mandatory

Value for this tutorial

Description

Artifacts Payload

Optional

Code Block
languagejson
[
  {
    "type": "PackageManagement",
    "alias": "_${{PACKAGE_NAME}}",
    "instanceReference": {
      "id": "${{FD_PROJECT_VERSION}}",
      "name": "${{FD_PROJECT_VERSION}}"
    },
    "definitionReference": {
      "definition": {
        "name": "${{PACKAGE_NAME}}"
      },
      "feed": {
        "name": "${{FEED_NAME}}"
      },
      "packageType": {
        "id": "upack",
        "name": "Universal"
      }
    }
  }
]

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

Code Block
languagejson
{
  "varPassedWhileStageTrigger": {
    "value": "${{CONTAINER_NAME}}"
  },
  "file_replacement_prop_port": {
    "value": "${{CONFIG_PORT}}"
  }
}

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

Code Block
languagejson
{
  "varPassedWhileReleaseTrigger": {
    "value": "azDevOpsstgaccnt1"
  }
}

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

  1. Navigate to Execution tab and click on Execute to submit the Build Request form.

  2. The Build Request Form will appear and we need to select the environment.

  3. Select main as branch name.

  4. Submit the request, this will initiate the AzDevOpsBuildFlow workflow.

...