Code Pipeline source code download template for GitLab CI/CD
This topic describes how to set up a GitLab Runner and download the BMC AMI DevX Code Pipeline source code template for GitLab CI/CD. You can use the downloaded source code for SonarQube analysis, reporting, and to populate a Git repository.
Prerequisites
To use this template, you need the following:
- BMC AMI DevX Workbench CLI (installed on the GitLab self-managed runner)
- BMC AMI DevX Code Pipeline Source Code Download template for GitLab CI/CD:
BMC AMI DevX Common Configuration GitLab CI/CD template:
(For Linux only), Install jq
To set up GitLab Runner
Go to GitLab Runner, select the desired operating system from the list depending on your system infrastructure, and follow the steps mentioned on the page to download the runner.
Alternatively, you can download the runner by performing the following steps:
- On the GitLab home page, select Project in the Your Work pane.
- Select Settings > CI/CD.
- On the CI/CD page, select Runner > Expand > New Project Runner and follow the instructions mentioned on the page.
After installing and registering the runner, the runner is displayed in the Assigned Project Runners section.
To use the Code Pipeline source code download template for GitLab CI/CD in your pipeline
You can use this template to download source codes from the BMC AMI DevX Code Pipeline mainframe.
Download the following templates to your root directory:
Template
Source location
BMC AMI DevX Source Code Download for Code Pipeline template
BMC AMI DevX Common Configuration template
The Code Pipeline template for Gitlab CI/CD is dependent on the BMC AMI DevX Common Configuration GitLab CI/CD template for providing configuration options.
- On the GitLab homepage in the Your Work pane, select Settings>CI/CD.
- On the CI/CD page, select Variable > Expand > Add Variable.
- In the Add Variable dialogue box, enter the following:
- In the Key field, enter HOST_CONNECTIONS. For more information about HOST_CONNECTIONS, refer .
In the Value field, enter a value you want. A sample variable is as follows:
{
"hostconnections": [
{
"host": "cw09.bmc.com:47623",
"description": "TPZP",
"protocol": "NONE",
"code_page": "1047 - Latin 1 (Open Systems)",
"timeout": "30",
"ces_url": "http://cw01.bmc.com:2020"
},
{
"host": "cw09.bmc.com:47624",
"description": "TPTP",
"protocol": "NONE",
"code_page": "1047 - Latin 1 (Open Systems)",
"timeout": "30",
"ces_url": "http://cw01.bmc.com:2020"
}
],
"windows_CLI": "C:\\Topaz-CLI-installed-versions\\TopazCLI-GA-20.14.03",
"linux_CLI": "/home/gitlab-runner/TopazCLI-GA-20.14.03"
}- In the Type field, select File from the list.
Key considerations
Remember the following important considerations when using the template:
Add the BMC AMI DevX Source Code Download for Code Pipeline template to an existing `.gitlab-ci.yml` file by using the include keyword. Refer .
include:
local: bmc-codepipeline-scm.ymlTo use BMC AMI DevX Source Code Download for Code Pipeline in your job, you must extend predefined job templates as follows:
Operating system
Operation
Predefined template job
Windows
Download source from Container
.codepipeline_container_source
Download source from Repository
.codepipeline_repository_source
Linux
Download source from Container
.codepipeline_container_source_linux
Download source from Repository
.codepipeline_repository_source_linux
Pass variables with the jobs, as follows:
Downloading source code from ContainersMandatory or Optional?
Variable name
Description
Mandatory
SELECTED_HOSTNAME
Describes the HOST_CONNECTIONS variable to select a unique host connection.
USER_ID
Specifies the username.
USER_PASSWORD
Specifies the string of characters for authentication.
SOURCE_DOWNLOAD_LOCATION
Specifies the absolute directory path to which to download the source code.
CODEPIPELINE_CONTAINER_NAME
Specifies the Code Pipeline container name.
CODEPIPELINE_CONTAINER_TYPE
Indicates the container type to download. It has the following elements:
- 0 —Assignment
- 1—Release
- 2—Set
Optional
CODEPIPELINE_RUNTIME_CONFIGURATION
Specifies the host runtime configuration. For valid values, see Code Pipeline administrator.
CODEPIPELINE_SERVER_LEVEL
Specifies the Code Pipeline server level.
CODEPIPELINE_COMPONENT_TYPE
Specifies the Code Pipeline component type.
FORCE_DOWNLOAD_OF_UNCHANGED_SOURCE
Specifies whether to keep the workspace in sync. The default value is false.
DOWNLOAD_RELATED_INCLUDES
Specifies whether to download the references. The default value is false.
Downloading source code from Repository
Mandatory or Optional?
Variable name
Description
Mandatory
SELECTED_HOSTNAME
Describes the HOST_CONNECTIONS variable to select a unique host connection.
USER_ID
Specifies the username.
USER_PASSWORD
Specifies the string of characters for authentication.
SOURCE_DOWNLOAD_LOCATION
Specifies the target folder to which to download the source code.
CODEPIPELINE_STREAM
Specifies the Code Pipeline server name.
CODEPIPELINE_APPLICATION
Specifies the Code Pipeline server application.
CODEPIPELINE_SERVER_LEVEL
Specifies the Code Pipeline server level.
CODEPIPELINE_LEVEL_OPTION
Specifies the Code Pipeline server options:
- 0—Selected level only
- 1—First found in level and above
Optional
CODEPIPELINE_RUNTIME_CONFIGURATION
Specifies the Code Pipeline server configuration.
CODEPIPELINE_SUB_APPLICATION
Specifies the Code Pipeline server subapplication
CODEPIPELINE_COMPONENT_TYPES
Specifies the Code Pipeline component type.
APPLICATION_ROOT_FOLDER_NAMES
A comma-separated list of the component types to filter (for example, 'COB, COPY, JOB, JAVA'). A Space is required after comma. If the Application Root Folders filter is enabled, filtering is constrained to components outside a folder structure.
FORCE_DOWNLOAD_OF_UNCHANGED_SOURCE
Specifies whether to keep the workspace in sync. The default value is false.
DOWNLOAD_RELATED_INCLUDES
Specifies whether to download the references. The default value is false.
DOWNLOAD_WITH_COMPILE_ONLY
Specifies whether the download includes the Compile Only component for a repository download. The default value is false.