Configuring the Azure DevOps pipeline
To configure the pipeline in Azure DevOps
- On the Azure DevOps dashboard, click Pipelines to expand it.
- In the upper right-hand corner of the Pipelines area, click New Pipeline.
- From the list, select your repository type.
- From the list, select your repository name.
- On Configure your pipeline tab, perform one of the following actions:
- To create a new pipeline:
- Click Starter pipeline.
- Click Rename and rename the pipeline.
- In the upper-right corner, click Variables and define the pipeline variables.
- Click either Save or Save and run.
- To open an existing pipeline:
- Click Existing Azure Pipelines YAML file.
- In the Select an existing YAML file dialog box, from the menu, select the branch and path of the existing pipeline, and click Continue.
- Click Rename and rename the pipeline.
- In the upper-right corner, click Variables and define the pipeline variables.
- Click either Run or Save.
- To create a new pipeline:
Customizing your pipeline content for BMC AMI DevOps
Define the pipeline’s trigger, resources, container, and pool as configured in your environment.
In this example, the image specified is your path location for the BMC AMI DevOps Universal Connector image, and you must use the -u root option to pass into the container host.
You can specify whether to use variable groups, which are defined in Azure DevOps.
Define the pipeline step scripts as follows:
To display text in logs, use the Linux echo command.
To replace variable values, use the Linux sed -i command. This applies to group and pipeline variables defined in Azure DevOps. You must provide the absolute path of the config YAML file in which the variable is used.
To concatenate the config YAML file in log and preview the contents, use the Linux cat command.
To run the steps from the config YAML file, specify the step stepName and the config YAML file with its repository path. If config YAML file resides in the repository root path, then the path is not required. You use the step command to run the application step from the Azure DevOps Pipeline workflow configuration file. The arguments for this command are application step name, config YAML file path, and debug flag.
To use the debug parser option, specify true after the step's config file.To print the step name in the pipeline log, specify displayName: and the 'stepName' enclosed in single quotation marks.
To retain and access job output from your pipeline run, use the Azure DevOps task, PublishPipelineArtifact@1, in your pipeline yaml file.
- Set the targetPath to the workspace relative path (.) to get the files from the pipeline workspace.
- Set the artifact to create the artifact folder.
- Set condition to succeededOrFailed(), so that it will retain the artifacts archive no matter the previous step result.
After the pipeline runs, in the beginning of the pipeline job console log, it produces an artifact link to the folder and saves the output files from the job and repository files.
You can define the file, .artifactignore, in your repository to list files and folders that you want to ignore during the publish task. For more information on .artifactignore file and PublishPipelineArtifact@1 task, see the Azure DevOps documentation.
The example for a sample pipeline step script is as follows:The detailed explanation of the syntax used in the above example is as follows:
The example for the step command for an application step with one mandatory argument is as follows:
In this example, the argument <arg> is a required application step name.
The example for the step command with the default configuration file config.yml that is maintained under the root directory is as follows:
The example for step command for an application step with more than one argument is as follows:
In this example, the arguments are defined as follows:
- <arg1> — Required application step name.
- <arg2> — Optional configuration YAML file path and file name.
- <arg3> — Optional Debug flag set as Boolean. The default value is false.
The example for the step command with user-defined configuration YAML file that is maintained under the root directory is as follows:
The example for the step command with user-defined configuration YAML file that is maintained under a directory or sub-directory is as follows:
Defining a variable in the pipeline
You can define variables in the pipeline as pipeline variables or a variable group
For more information, see Variables-for-Universal-Connector.