jobs
A pipeline can consist of multiple jobs.
jobs.<job_id>
Use jobs.<job_id> to give jobs an ID, unique within a pipeline. <job_id> can contain letters, digits, hyphens (-), and underscores (_), with a maximum of 32 characters.
jobs: job1: name: first job job2: name: second job
This example indicates that there are two jobs, whose unique identifiers are job1 and job2.
jobs.<job_id>.name
Use jobs.<job_id>.name to define a job name. The name is displayed on the CodeArts Pipeline UI.
jobs: job1: name: first job job2: name: second job
This example indicates that the names of job1 and job2 are first job and second job.
jobs.<job_id>.needs
Use jobs.<job_id>.needs to specify which job must succeed before you run a new one.
jobs: job1: name: first job job2: needs: [ job1 ] name: second job
This example indicates that job2 will run only after job1 is complete successfully.
jobs.<job_id>.if
Use jobs.<job_id>.if to define the job running condition. For details about the conditional expression, see Example 1: Using an Expression to Specify the Execution Condition.
jobs: job1: name: first job job2: needs: [ job1 ] if: ${{ always() }} name: second job
This example indicates that job2 will always run after job1 is complete, regardless of whether it is successful.
jobs.<job_id>.steps
A job can consist of multiple steps. Each step can run an extension.
jobs.<job_id>.steps<*>.name
Use jobs.<job_id>.steps<*>.name to define a job name, which is displayed on the CodeArts Pipeline UI.
jobs.<job_id>.steps<*>.uses
Use jobs.<job_id>.steps<*>.uses to specify the extension used in a step.
jobs: demo_job: name: simple demo job steps: - name: simple custom step uses: custom_plugin@1.0.0
This example indicates that a step uses an extension whose name is custom_plugin and version is 1.0.0.
YAML Syntax for the Pipeline Official Extensions
- Build
The following example calls the Build extension to use CodeArts Build capabilities.
uses: CodeArtsBuild with: jobId: 878b4d13cb284d9e8f33f988a902f57c artifactIdentifier: my_pkg customParam: value
- jobId: ID of the build task. To obtain the ID, copy the 32 digits and letters at the end of the browser URL on the build task details page.
- artifactIdentifier: Build artifact identifier.
- customParam: Parameter value defined in the build task. There may be zero to multiple values.
- TestPlan
The following example calls the TestPlan extension to use CodeArts TestPlan capabilities.
uses: CodeArtsTestPlan with: jobId: vb180000vnrgoeib environmentModel: 1 environmentId: 7c2eff2377584811b7981674900158e8
- jobId: ID of the API test task.
- environmentModel: Parameter source. The value 0 indicates that new parameters will be used, and the value 1 indicates that the global parameters of the selected environment will be used.
- environmentId: Environment ID when environmentModel is set to 1.
- Deploy
The following example calls the Deploy extension to use CodeArts Deploy capabilities.
uses: CodeArtsDeploy with: jobId: 9c5a5cda6ffa4ab583380f5a014b2b31 customParam: value
- jobId: ID of the deployment task.
- customParam: Parameter value defined in the deployment task. There may be zero to multiple values.
- Check
The following example calls the Check extension to use CodeArts Check capabilities.
uses: CodeArtsCheck with: jobId: 43885d46e13d4bf583d3a648e9b39d1e checkMode: full|push_inc_full||push_multi_inc_full
- jobId: ID of a code check task.
- checkMode: Check mode.
- full: Checks all code.
- push_inc_full: Checks all files changed in this code commit.
- push_multi_inc_full: Checks all files changed between this code commit and the last successful code commit.
- CreateTag
The following example calls the CreateTag extension to create and push a tag for code repositories.
uses: CreateTag with: tagName: v1
tagName: Tag name.
- Subpipeline
The following example calls the Subpipeline extension to configure other pipelines in a project.
uses: SubPipeline with: pipelineId: 80ea2d9ffba94c20b9a0a0be47d3a0d8 branch: master
- pipelineId: ID of the called pipeline.
- branch: (Optional) Branch used for running the sub-pipeline.
- The default branch of the sub-pipeline is used if this parameter is not set.
- You can reference a parameter or context to define branch. For example, if you want to run the parent pipeline source, and the code source alias is my_repo, the reference format is ${{sources.my_repo.target_branch}}.
- JenkinsTask
The following example calls the JenkinsTask extension to configure a Jenkins task.
uses: Jenkins with: endpoint: eac965b206e74e2b898a24a4375b6df6 jobName: job params: '{ \"key\":\"value\" }' async: true|false description: description
- endpoint: ID of the Jenkins endpoint.
- jobName: Jenkins job name.
- params: Parameters (in JSON format) transferred for starting the job.
- async: Whether to execute the job asynchronously.
- description: Execution description.
- PipelineSuspension
The following example calls the PipelineSuspension extension to suspend the current pipeline.
uses: SuspendPipeline
- DelayedExecution
The following example calls the DelayedExecution extension. It can pause pipeline for a period of time or until a specified time. You can manually resume or stop a pipeline, or delay the execution for a maximum of three times.
uses: Delay with: timerType: delay|scheduled delayTime: 300 scheduledTime: '00:00' timeZone: China Standard Time
- timerType: Delay type. delay indicates pausing a pipeline for a period of time. scheduled indicates pausing a pipeline until a specified time.
- delayTime: Time duration (in seconds) when timerType is set to delay.
- scheduledTime: Exact time when timerType is set to scheduled.
- timeZone: Time zone. Available values are listed in the following table.
Table 1 Time zone Available Value
Time Zone
GMT Standard Time
GMT
South Africa Standard Time
GMT+02:00
SE Asia Standard Time
GMT+07:00
Singapore Standard Time
GMT+08:00
China Standard Time
GMT+08:00
Pacific SA Standard Time
GMT-04:00
E. South America Standard Time
GMT-03:00
Central Standard Time (Mexico)
GMT-06:00
Egypt Standard Time
GMT+02:00
Saudi Arabia Standard Time
GMT+03:00
- ManualReview
The following example calls the ManualReview extension to create manual review tasks by assigning one person or one group.
uses: Checkpoint with: mode: members|roles approvers: 05d8ca972f114765a8984795a8aa4d41 roles: PROJECT_MANAGER checkStrategy: all|any timeout: 300 timeoutStrategy: reject|pass comment: comment
- mode: Review mode. members indicates that the review is performed by member, and roles indicates that the review is performed by role.
- approvers: User IDs of the approvers when mode is set to members. Use commas (,) to separate multiple user IDs.
- role: Roles when the mode is set to roles. For details about the options, see Table 2. Use commas (,) to separate multiple roles.
- checkStrategy: Strategy used when the mode is set to members. all indicates that the application can be approved only by all users. any indicates that the application can be approved by any user.
- timeout: Review timeout, in seconds.
- timeoutStrategy: Strategy used when the review times out. reject indicates that the pipeline is stopped to run. pass indicates that the pipeline can continue to run.
- comment: Review description.
Table 2 Review roles Role
YAML Identifier
Project creator
PROJECT_CREATOR
Project manager
PROJECT_MANAGER
Developer
DEVELOPER
Test manager
TESTING_MANAGER
Tester
TESTER
Participant
PARTICIPANT
Viewer
VIEWER
Operation manager
OPERATION_MANAGER
Product manager
PRODUCT_MANAGER
System engineer
SYSTEM_ENGINEER
Committer
COMMITTER
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