Updated on 2023-11-28 GMT+08:00

Configuring a Pipeline

Procedure

  1. Log in to CodeArts Pipeline.
  2. On the Pipelines tab page, search for the target pipeline, click in the Operation column, and click Edit.

    On the displayed page, you can modify the basic information (name and description), task orchestration, parameter configuration, execution plan, permissions, and notifications.

  3. Click Save.

Task Orchestration

On the Task Orchestration tab page, you can configure the pipeline source, stages, pass conditions, and tasks.

  • Configuring a Pipeline Source

    Click the area where the repository is located in the pipeline source stage. The Edit Pipeline Source dialog box is displayed. You can modify the pipeline source information.

  • Configuring a Stage

    On the Task Orchestration tab page, click or to add a stage to the pipeline. After a stage is added, you can edit, delete, copy, or move the stage.

    Table 1 Configuring a stage

    Operation

    Description

    Editing a stage

    Click . In the dialog box displayed, you can configure the stage name and whether the stage is always running.

    NOTE:

    Always Running: Option Yes will select all the tasks in this stage and execute them, which cannot be canceled. Option No will select the tasks in this stage but you can cancel their execution.

    Deleting a stage

    Click and confirm the deletion as prompted.

    Copying a stage

    Click to copy a pipeline stage.

    Sorting stages

    Click to adjust the stage sequence.

    Setting stage entry

    Click . In the dialog box displayed, configure the stage entry type.

    • Automatic (default): The pipeline automatically enters this stage and continues to run.
    • Manual: The pipeline can continue to run only after manual confirmation.
  • Configuring a Task

    After a stage is added, you can add tasks to each stage. After a task is added, you can edit, copy, delete, or move the task.

    Table 2 Configuring a task

    Operation

    Description

    Adding a task

    • Click to add a task to an empty stage.
    • Click under a task to add a task orchestrated with the task in serial mode.
    • Click to add a task orchestrated with an existing task in parallel mode.
    NOTE:
    • Serial execution: Tasks are executed in sequence. For example, build tasks and deployment tasks must be executed sequentially.
    • Parallel execution: Tasks are executed at the same time. For example, a code check task and a build task can be executed at the same time.

    Editing a task

    Click a task card to edit the task.

    Copying a task

    Click on the task card to copy a task orchestrated with this task in serial mode.

    Deleting a task

    Click on the task card and confirm the deletion as prompted.

    Sorting tasks

    Click, hold, and move a task card to adjust the task sequence.

    NOTE:

    The sequence cannot be adjusted when tasks are executed in parallel.

    When you add or edit a task, a dialog box is displayed. You can configure an extension for the task.

    Table 3 Configuring an extension for a task

    Operation

    Description

    Adding an extension

    There are five types of extensions for build, code check, deployment, test, and general purposes. You can filter or search for extensions by type. Move the cursor to the extension card and click Add to add the extension to a task.

    Set parameters as required.

    • Enter an extension name.
    • Select the task to be invoked. If no proper task is available, create a task as prompted.
    • If the invoked task has parameters, the parameters are displayed. Set the parameters as required.
    • The extension name is followed by a flag. Only one extension with flag Job can be added to a single task. Extensions with flag draft indicate that they are draft extensions.
    • The extension for suspending a pipeline can only be added to stages that do not contain parallel tasks.

    Deleting an extension

    Move the cursor to the extension card and click and select Delete to delete the extension.

    Sorting extensions

    Click, hold, and move an extension card to adjust the extension sequence.

  • Configuring a Pass Condition

    Click under a stage. In the dialog box displayed, move the cursor to the pass condition cards and click Add to add a pass condition for the current stage and a policy for the condition.

    • Currently, only standard policy pass conditions can be added.
    • Policy: Add standard policy pass conditions. You can select those already created for the current project or tenant.

      A policy is a set of rules. Each rule corresponds to a condition template of the output metric value in the extension. By predefining a policy, you can easily apply the same pass condition to multiple pipelines. For details, see Overview.

      • A pass condition can be set exclusively for each stage of a pipeline and is valid only for the corresponding stage.
      • Multiple pass conditions can be configured for the same stage.

Setting Parameters

Switch to the Parameter Configuration tab page, and add parameters for the pipeline. For details, see Managing Parameters.

Pipeline parameters include custom and system-predefined parameters. The custom parameter types include string, enumeration, and auto-increment.

Configuring an Execution Plan

Switch to the Execution Plan tab page, and configure an execution plan (event trigger or scheduled task) for the pipeline. Triggering events include code commits, merge request, and tag creation.

  • Triggered upon code commits (Repo)

    The related pipeline is automatically executed when code is committed in an associated code repository, and the related branch and path of changed files meet inclusion and exclusion policies.

    • Branch inclusion: If the target branch to which the code is committed is included, the matching is successful.
    • Branch exclusion: If the target branch to which the code is committed is excluded, the matching fails.
    • Path inclusion: If any changed file (if path exclusion is configured, the changed file must not be excluded) is included, the matching is successful.
    • Path exclusion: If all changed files are excluded, the matching fails.

  • Triggered upon merge request (Repo)

    Merge request event triggering: monitors events triggered by an MR. The related pipeline is automatically executed when code is committed in an associated, updated, merge, or re-opened event in the associated code repository, and the related branch and path of changed files meet inclusion and exclusion policies.

    • Branch inclusion: If the requested target branch is included, the matching is successful.
    • Branch exclusion: If the requested target branch is excluded, the matching fails.
    • Path inclusion: If any changed file (if path exclusion is configured, the changed file must not be excluded) is included, the matching is successful.
    • Path exclusion: If all changed files are excluded, the matching fails.

  • Triggered upon tag creation (CodeArts Repo)

    The related pipeline is automatically executed when a tag is created in an associated code repository and the created tag meets inclusion and exclusion policies.

    • Tag inclusion: If the tag created in the code repository is included in the tag, the matching is successful.
    • Tag exclusion: If a tag created in the code repository is in the exclusion tag, the matching fails.

  • The branch is matched first, and then the path (if configured) is matched. If the matching is successful, the pipeline is triggered.
  • Branch exclusion takes precedence over branch inclusion. That is, when the target branch is included and excluded at the same time, the matching fails.
  • Path exclusion takes precedence over path inclusion. That is, the excluded paths are matched first. If not all the changed files are excluded, the included paths are matched. If the included path is not configured, the matching is successful. If the included path is configured and any of the changed files is included, the matching is successful.
  • Tag exclusion takes precedence over tag inclusion. That is, if a tag is included and excluded at the same time, the matching fails.
  • Scheduled Execution

    Click to add a scheduled task. Click Enable, set date and time, and click OK. The trigger takes effect after the pipeline is saved. The pipeline is executed at the specified time.

    You can add a maximum of 10 scheduled tasks.

Managing Permissions

Switch to the Permissions tab page, and configure permissions for the pipeline as required, including role permissions and user permissions.

  • If the role permissions are not changed, they are the same as those in the project settings.
  • The permissions of the project creator and pipeline creator cannot be changed.
  • User permissions take precedence over role permissions.

    By default, user permissions are automatically synchronized after role permissions are configured for a user. If user permissions are configured, the user permissions overwrite the role permissions of the user.

Role Permissions

You can click or to specify whether a role has the permissions to view, execute, edit, and delete pipelines.

User Permissions

You can click or to specify whether a user has the permissions to execute, edit, and delete pipelines.

  • The view permission allows you to view the pipeline running details.
  • The edit permission allows you to orchestrate pipeline tasks.

Notification Subscription

Switch to the Notifications tab page and configure event notifications for the pipeline as required. When a pipeline is deleted, fails to run, or is successfully run, or configurations are updated, you can configure pop-up notifications and email to notify related personnel.

Click to enable the notification or click to disable it.

  • By default, pop-up notifications are sent, and email notifications are not sent.
  • You can click in the upper right corner of the pipeline homepage and view the notification messages on the Notice dialog box.