Configuring Parameters
By default, the codeBranch parameter and predefined parameters are generated for a build task. You can modify the type and value of codeBranch and add custom parameters as required.
Predefined Parameters
The values of predefined parameters are automatically generated by the system and do not need to be defined, as shown in Table 1. You can use ${Parameter name} to reference the parameters in the code.
Parameter |
Description |
---|---|
BUILDNUMBER |
Build ID in the format of date.times that this build task is run on that day. For example: 20200312.3. |
TIMESTAMP |
Build task running timestamp. For example: 20190219191621. |
INCREASENUM |
Total number of times that the build task is run. The value starts from 1 and is incremented by 1 each time the task is run. |
PROJECT_ID |
ID of the project where the build task is located. |
WORKSPACE |
Root directory of the source code pulled by the build task, also known as the workspace. |
GIT_TAG |
Code tag name. This parameter only has a value if you have specified the downloaded code by tag. |
COMMIT_ID_SHORTER |
First eight digits of the code commit ID. This parameter only has a value if you have specified the downloaded code by commit ID. |
COMMIT_ID |
Code commit ID. For example: b6192120acc67074990127864d3fecaf259b20f5. |
Adding Custom Parameters
On the page for configuring the build task, click the Parameters tab. On the displayed page, click Create Parameter, and set parameters according to Table 2.
Name |
Type |
Default Value |
Private Parameter |
Runtime Settings |
Params Description |
---|---|---|---|---|---|
Name of a custom parameter. The value can contain a maximum of 128 characters, including letters, digits, and underscores (_).
NOTE:
|
String |
Default value of the custom parameter. Max. 8,192 characters. |
Specify whether the parameter is private or not. If the parameter is private, the system encrypts the input parameter for storage and only decrypts the parameter for usage. Private parameters are not displayed in run logs. |
Specify whether to set this parameter when running the build task. If Runtime Settings is enabled, the parameter value can be changed when you click to run the build task, and the system reports the parameter to CodeArts Pipeline. |
Enter additional information to describe the parameter. Max. 1,024 characters. |
Enumeration |
In the displayed dialog box, enter enumerated values in the Value text box. Each parameter value must end with a semicolon (;). Max. 8,192 characters. Once you have set the enumerated values, select a default value for the parameter from the Default Value drop-down list box. |
||||
Auto Increment |
Default value of the custom parameter. Max. 8,192 characters. |
Using Parameters
The following section describes how to use custom parameters, as shown in Figure 1.
- On the page for configuring the build task, click the Build Actions tab, enter ${myparam} in the Version field of the Upload to Release Repo action, and click Save and Run.
- In the displayed dialog box, change the value of myparam to 1.0.1.2 and click Confirm. Wait until the build task is completed.
Figure 2 Setting the runtime parameters
- Go to the release repo and find the resulting build package. The version number is the modified value of myparam.
Figure 3 Viewing the build package
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