Help Center/ CodeArts Pipeline/ User Guide/ Configuring a Change-triggered Pipeline
Updated on 2024-12-16 GMT+08:00

Configuring a Change-triggered Pipeline

Microservices are a software governance architecture. A complex software project consists of one or more microservices. Microservices in the system are loosely coupled. Each microservice is independently developed, verified, deployed, and released. Changes can be used to meet requirements and fix vulnerabilities. A change belongs to only one microservice. In microservices, you can create change-triggered pipelines to associate them with change resources and release changes for quick project delivery.

Microservices have the following benefits:

  • Specialized: Each microservice focuses on a specific function. It is relatively easy to develop and maintain a single microservice.
  • Independently deployable: A microservice is independently deployed and updated without affecting the whole system.
  • Diversified technologies: For microservices architectures, different services communicate over RESTful APIs. You can choose the desired technology for each service.

A change-triggered pipeline has the following features:

  • A microservice can have only one change-triggered pipeline.
  • An integration branch is automatically created during the execution of the change-triggered pipeline. After successful execution, the branch content is merged to the master branch.
  • After successful execution, the change status is automatically updated.
  • Only one pipeline instance can run at one time.
  • The change-triggered pipeline cannot be triggered by an event or at a specified time.

Creating a Microservice

  1. Access the CodeArts Pipeline homepage through a project.
  2. Click the Microservices tab.
  3. Click Create Microservice. On the displayed page, configure parameters.

    Table 1 Microservice parameters

    Parameter

    Description

    Project

    Project to which the microservice belongs. The project cannot be changed.

    Microservice Name

    The name can contain a maximum of 128 characters, including letters, digits, and underscores (_).

    Code Source

    Source of the code repository. Only Repo is supported.

    NOTE:

    If you set Code Source to None, after the microservice is created, you can click its name to associate it with a code source on the Overview page.

    Repository

    Code repository associated with the microservice. Select a created code repository.

    NOTE:

    A repository can be associated with only one microservice.

    Default Branch

    Default branch associated with a microservice. This branch will be used when a change-triggered pipeline is executed.

    NOTE:

    After the change-triggered pipeline is executed, all changed feature branches will be merged into the default branch.

    Language

    The development language of the microservice. Available languages: Java, Python, Node.js, Go, .Net, C++, and PHP.

    Description

    Enter a maximum of 1,024 characters.

  4. Click OK. The Overview page is displayed.

    Information such as the creator, creation time, and repository of the microservice is displayed. You can edit the language, repository, and description.

    When you change the code repository, if there are unclosed changes or running pipelines in the microservice, the Data Processing window will be displayed. In that case, close all changes and stop all running pipelines.

  5. Return to the microservice list to review the created microservice, as shown in the following table.

    Table 2 Microservice list

    Item

    Description

    Microservice

    Microservice name.

    Creator

    Name of the user who created the microservice.

    Created

    Time when the microservice was created. You can move the cursor to the Created column and click to sort microservices by creation time.

    Status

    Status of a microservice. After a microservice was created, it is in an activated status.

    Operation

    Click to favorite a microservice. After the microservice is favorited, the icon changes to . You can click the icon again to unfavorite the microservice. Also, you can click to delete the microservice.

    NOTE:

    If a microservice is deleted, all changes and pipelines in the microservice will be deleted.

    • The microservice list displays all microservices of the project.
    • You can enter a microservice name in the search box to search for it.

Creating a Change-triggered Pipeline

  1. Access the CodeArts Pipeline homepage through a project.
  2. Click the Microservices tab.
  3. Click a microservice name. The Overview page is displayed.
  4. Switch to the Pipelines tab.
  5. Click Create Pipeline. On the displayed page, configure parameters.

    Table 3 Pipeline parameters

    Parameter

    Description

    Project

    Project to which the microservice belongs.

    Name

    Pipeline name, which is generated based on the creation time by default. Enter only letters, digits, underscores (_), and hyphens (-) with a maximum of 128 characters.

    Code Source

    Source of the code repository. Only Repo is supported.

    Repository

    Name of the repository associated with the microservice.

    NOTE:

    If you change the code repository of a microservice, the repository for all pipelines of the microservice will also be changed.

    Default Branch

    The default branch associated with the microservice.

    NOTE:

    If you change the default branch of a microservice, the default branch for all pipelines of the microservice will also be changed.

    Repo Endpoint

    Configure an endpoint to elevate permissions on repository operations. Endpoints are used for change-triggered pipelines and repository operation extensions. Click Create one to create a Repo endpoint. For details, see Creating Service Endpoints.

    NOTE:

    If you use an incorrect username or password when creating this endpoint, the pipeline will fail to run. For details, see FAQs.

    Alias

    Repository alias. Enter only letters, digits, and underscores (_) with a maximum of 128 characters.

    After an alias is set, a system parameter will be generated. For example, Alias_REPOSITORY_NAME indicates the repository name. You can check the generated parameters on the Parameter Configuration page and reference them in a pipeline in the format of ${Parameter name}.

    Change-based Trigger

    If Change-based Trigger is enabled for a pipeline, this pipeline is marked with .

    NOTE:

    A microservice can have only one change-triggered pipeline.

    Description

    Enter a maximum of 1,024 characters.

  6. Click Next. On the displayed page, select a template or select Blank Template.
  7. Click OK, orchestrate the pipeline, and click Save.

Creating a Change

You can manage changes in the microservice.

  1. Access the CodeArts Pipeline homepage through a project.
  2. Click the Microservices tab.
  3. Click a microservice name. The Overview page is displayed.
  4. Click the Changes tab.

    All changes are displayed. You can click All Changes and select My Changes to filter changes created by the login user.

  5. Click Create Change. On the displayed page, set parameters.

    Table 4 Change parameters

    Parameter

    Description

    Change Subject

    Name of the change. Enter a maximum of 256 characters.

    Repository

    Name of the repository associated with the microservice. The repository cannot be changed.

    Branch

    You can pull a new branch from the default branch or associate with an existing branch.

    NOTE:

    After the change is released through the change-triggered pipeline, the code branch will be automatically merged to the default branch of the microservice.

    Associated Work Item

    Select started or ongoing work items in CodeArts Req.

  6. Click OK. The change details page is displayed.

    The details page displays the change overview, associated work items, and operation history. You can submit the change for release, exit release, or cancel the change.

    Figure 1 Change details
    • A change's lifecycle includes developing, to be released, releasing, and released.
    • For a change in the Developing status, click Edit Work Item to modify the associated work item.

    The following describes how to submit a change for release, exit release, and cancel the change.

    • Submit for release

      For a change in the Developing status, click Submit for Release. The Submit for Release dialog box is displayed.

      • If the microservice does not have a change-triggered pipeline, create one by referring to Creating a Change-triggered Pipeline.
      • If there is a change-triggered pipeline, click OK to submit the change.

      After the change is submitted, the change status changes from Developing to To be released.

    • Exit release

      For a change in the To be released or Releasing status, click Exit Release to exit the release. The change status will change to Developing.

      For a change in the Releasing status, if the change-triggered pipeline is running, you cannot exit release.

    • Cancel a change

      For a change in the Developing status, click Cancel Change.

      In the displayed dialog box, click OK. The change status changes to Canceled and the change will be deleted.

Executing a Change-triggered Pipeline

  1. Access the CodeArts Pipeline homepage through a project.
  2. Click the Microservices tab.
  3. Click a microservice name. The Overview page is displayed.
  4. Switch to the Pipelines tab.
  5. Click a pipeline name. The pipeline Execution History page is displayed.
  6. Click Execute in the upper right corner and perform the execution configuration.

    Figure 2 Execution configurations for a change-triggered pipeline
    • Changes: Changes in To be released or Releasing status are displayed. Select one or more changes.
    • Runtime Parameters: (Optional) Set runtime parameters and then save them. For details, see Using a Parameter in a Pipeline.
    • Execution Stages: Select one or more jobs to execute. By default, all jobs are selected for execution.
    • Description: Describe the debugging about the execution.

  7. After the configurations, click Execute. The pipeline details page is displayed.

    Figure 3 Executing a change-triggered pipeline

    When the change-triggered pipeline is running, there are MergeReleaseBranch and MergeDefaultBranch stages.

    • MergeReleaseBranch: The change-triggered pipeline automatically pulls a new branch from the master branch and integrates all change feature branches into the new branch.
    • MergeDefaultBranch: The new branch is merged to the master branch.

  8. After the execution is complete, you can check the execution result.

    After the pipeline was successfully executed, the status of all selected changes changed to Released.

    • Click the pipeline name to go to its details page.
      • Click View More on the pipeline source card. In the displayed dialog box, review the selected changes.
      • Click a change name to go to its details page.
    • Click the Releases tab.
      • All changes in the To be released and Releasing statuses are displayed.
      • You can enter a keyword in the search box to search for a change.
      • Click in the Operation column. In the displayed dialog box, click OK. The change status will become Developing.

      For a change in the Releasing status, you can exit the release only after the change-triggered pipeline execution is complete or stopped.