Updated on 2024-12-16 GMT+08:00

Orchestrating Pipeline Jobs

A job is the minimum manageable execution unit in a pipeline. Jobs can be orchestrated in serial and parallel mode in a stage.

  1. Access the CodeArts Pipeline homepage.
  2. On the pipeline list page, search for the target pipeline, click in the Operation column, and click Edit.
  3. On the Task Orchestration page, click Job under a stage.

    • Click under a job to add a serial job. For example, a build job and deployment job must be executed sequentially.
    • Click Parallel Job to add a parallel job. For example, a code check job and a build job can be executed at the same time.

  4. Configure extensions for the job by referring to the following table.

    Table 1 Job configuration

    Operation

    Description

    Adding an extension

    There are five types of extensions: build, code check, deployment, test, and normal extensions. You can filter or search for extensions by type. For more information, see Managing Pipeline Extensions.

    Move the cursor to an extension card and click Add. Configure the following information:

    • Enter an extension name.
    • Select a task to be called. You can search for a task. If no proper task is available, create one as prompted.
    • If the called job has parameters, the parameters will be displayed. Configure parameters as needed.
    • You can add only one extension with flag Job to a single job. 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 jobs.

    Deleting an extension

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

    Replacing an extension

    Move the cursor to an extension card, click , and select Replace to replace the extension. Or, click Replace Extension above the extension name to choose another extension.

    Sorting extensions

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

    Configuring jobs

    Set the job ID, executor, and execution condition.

    • Job ID: The job ID should be unique. Enter only letters, digits, hyphens (-), and underscores (_) with a maximum of 128 characters.
    • You can use the built-in executor or customize one.
      • Built-in executor: provided by CodeArts Pipeline with out-of-the-box availability.
      • Custom executor: allows you to configure tools and running environments as needed. Before using a custom executor, add an agent pool. For details, see Agent Pools.
      NOTE:

      You only need to configure executors for non-job-level extensions.

    • Select Job
      • Always: Job will always be selected for execution and cannot be canceled.
      • Disabled: Job cannot be selected for execution.
      • Selected by default: Job is selected for execution by default.
      • Not selected by default: Job is not selected for execution by default.
    • Execution conditions are the triggers for executing jobs in a pipeline.
      • Even when previous job is not selected: The current job is executed if the previous job is completed or not selected.
      • When previous job succeeds: The current job is executed only when the previous job is successfully executed.
      • If previous job fails: The current job is executed only when the previous job fails.
      • Always: The current job is always executed regardless of the previous job's final state (failed, completed, canceled, or ignored).
      • With expression: When the previous job is COMPLETED, FAILED, CANCELED, and IGNORED and the expression result is true, the current job will be executed. The expression is in the format of ${{value}} and can be any combination of contexts, operators, functions, or literals. For details, see Example 1: Using an Expression to Specify the Execution Condition.

        Example:

        If the current job is executed regardless of whether the previous job (ID: job_1) succeeded or failed, the expression can be as follows:

        ${{ jobs.job_1.status == 'COMPLETED' || jobs.job_1.status == 'FAILED' }}

  5. After configuring the job, click OK. After the job is added, you can edit, clone, delete, or move the job.

    Table 2 Job management

    Operation

    Description

    Editing a job

    Click a job card to edit the job.

    Cloning a job

    Click on the job card to clone a serial job.

    Deleting a job

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

    Sorting jobs

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

    NOTE:

    Job sequence cannot be adjusted when jobs are executed in parallel.

  6. After the configuration, save the pipeline.