Configuring Pipeline Parameters
Pipeline parameters can be transferred among jobs. By configuring pipeline parameters, you can streamline data of build, deployment, and API test jobs. Parameters include:
- Predefined Parameters: They cannot be configured, deleted, or edited.
- Custom Parameters: You can add parameters of string, enumeration, or auto-increment type.
- Parameter Groups: You can associate all pipelines in the project with a parameter group.
- If a code source alias is set, the repository-related system parameter will be generated based on the alias. If no alias is set, the repository name is used as the alias to generate system parameters, for example, Alias_TAG indicates the repository tag name.
- If a pipeline is associated with multiple parameter groups and parameters with the same name exist, the value of the parameter in the last associated parameter group will be used.
- The parameter reference format is ${Parameter name}. Enter $ in the text box and the parameter list will be displayed.
Predefined Parameters
Parameter |
Description |
---|---|
TIMESTAMP |
Pipeline execution timestamp. For example, 20211222124301. |
PIPELINE_TRIGGER_TYPE |
Pipeline trigger type, which includes Manual, Scheduler, RollBack, and Webhook (CreateTag, Note, Issue, MR, and Push). |
PIPELINE_NAME |
Pipeline name. |
REPO_URL |
Code repository address (HTTPS). |
EXECUTE_USER |
The user who executes the pipeline. |
PASS_CONDITIONS_LINK |
Pipeline execution details link. |
PIPELINE_RUN_ID |
Pipeline run ID. |
MERGE_ID |
Merge request ID. |
WEBHOOK_PAYLOAD |
Webhook request payload information. |
Repo01_REPOSITORY_NAME |
Repository name. |
Repo01_SOURCE_BRANCH |
Name of the source branch for repository operations. |
Repo01_TARGET_BRANCH |
Name of the target branch for repository operations. |
Repo01_TAG |
Repository tag name. |
Repo01_COMMIT_ID |
The last commit ID before execution. |
Repo01_COMMIT_ID_SHORT |
The last short commit ID before execution. |
Repo01_REPO_URL |
Code repository address (HTTPS). |
Configuring Custom Parameters
You can create and configure pipeline custom parameters.
- Access the CodeArts Pipeline homepage.
- On the pipeline list page, search for the target pipeline, click in the Operation column, and click Edit.
- Switch to the Parameter Configuration tab page.
- On the displayed page, click Create now to configure parameters. Or click Create Parameter to add new parameters.
Table 2 Custom parameters Parameter
Description
Name
Enter only letters, digits, and underscores (_) with a maximum of 128 characters.
NOTE:The specified name cannot be the same as that of a predefined parameter.
Type
Parameter types include String, Auto-Increment, and Enumeration.
Default
Default value of the parameter.
- String: The value contains no more than 8,192 characters.
- Auto-Increment: The value contains no more than 8,192 characters.
NOTE:
If an auto-increment parameter is referenced in a pipeline, its value (which ends with a digit) is incremented by 1 each time the pipeline runs.
- Enumeration: Enter letters, digits, hyphens (-), underscores (_), commas (,), periods (.), and slashes (/) with a maximum of 8,192 characters.
After you select Enumeration, the Enumeration dialog box is displayed. You can set optional values. After the setting is complete, you can click the Default drop-down list box to select a value. Or, you can click Enumeration to change the value.
Private Parameter
If a parameter is private, the system encrypts the parameter for storage and decrypts the parameter for usage. Private parameters are not displayed in run logs.
Runtime Setting
If Runtime Setting is enabled, you can change the value of the parameter during execution configuration.
Description
Enter a maximum of 512 characters.
- You can create a maximum of 20 custom parameters.
- You can click to delete a parameter.
- After the configuration, save the pipeline.
Configuring a Parameter Group
- Access the CodeArts Pipeline hompage through a project.
- Click the Parameter Groups tab and then click Create Group.
- On the displayed page, set parameters.
Figure 1 Creating a parameter group
Table 3 Parameter group description Basic Information
Description
Project
Project to which the parameter group belongs. The project cannot be changed.
Name
Enter only letters, digits, and underscores (_) with a maximum of 128 characters.
Description
Enter a maximum of 512 characters.
Custom parameter list
Click Create now to create custom parameters. For details, see Configuring Custom Parameters.
You can create a maximum of 5 parameter groups and add a maximum of 20 custom parameters to a group.
- Click OK to create a parameter group.
- Go to the pipeline editing page, choose Parameter Configuration > Parameter Groups.
- Click Associate Now, select a parameter group, and click Confirm to associate the pipeline with the parameter group.
- Expand the group to check parameter details.
- Click in the Operation column to diassociate with the parameter group.
Figure 2 Associating with a parameter group
- After the configuration, save the pipeline.
Using a Parameter in a Pipeline
This section describes how to configure the releaseversion parameter in a pipeline and transfer the parameter to a build job.
- Create a build task.
- On the Parameters tab page, add the releaseversion parameter, set the default value, and enable Runtime Settings.
Figure 3 Creating a build task parameter
- On the Build Actions tab page, select Upload to Release Repos and set Release Version as a reference parameter. After you enter $ in the text box, a parameter list is displayed. Select the releaseversion parameter created in the previous step.
Figure 4 Referencing a build task parameter
$ will not trigger the display of parameter groups.
- Save the build job.
- Create a pipeline using a blank template, add the Build extension and select the created build job. The parameter releaseversion is displayed.
Figure 5 Configuring a build task parameter
- Move the cursor to the releaseversion parameter to set it as a pipeline parameter. Alternatively, click OK, switch to the Parameter Configuration tab page, create the pipeline parameter releaseversion, set Type to Auto-increment or String, set a default value, and enable Runtime Setting.
Figure 6 Creating a pipeline parameter
- Switch back to the Task Orchestration tab page, and edit the added build job. Use $ to reference the releaseversion parameter in the build job.
Figure 7 Referencing a pipeline parameter
- Only text parameters for which Runtime Settings is enabled will be displayed.
- You can move the cursor to a parameter name to quickly set the parameter as a pipeline parameter.
- Save the information and click Save and Execute. In the displayed dialog box, you can check the parameter information.
The parameter value is the default value specified when you added the parameter. You can change the value. If you change it, the new value will be used in the build job.
- Click Execute to execute the pipeline.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot