Help Center> CodeArts Pipeline> Best Practices> On-demand Feature Release in Microservices
Updated on 2024-06-03 GMT+08:00

On-demand Feature Release in Microservices

CodeArts Pipeline provides the microservice model for enterprises. Each microservice is independently developed, verified, deployed, and rolled out, accelerating requirement release. This model also lets enterprises organize teams by function, optimize management models, and improve operation efficiency.

Using this model, you can create change-triggered pipelines to associate them with change resources and release changes for quick project delivery.

Procedure

The following describes how to use a change-triggered pipeline to fix a bug for quick release.

Step 1: Create a Microservice

Step 2: Create a Change-triggered Pipeline

Step 3: Create a Change

Step 4: Execute a Change-triggered Pipeline

Preparations

Step 1: Create a Microservice

  1. Log in to CodeArts.
  2. Search for the project created in Preparations and access the project.
  3. In the navigation pane on the left, choose CICD > Pipeline.
  4. Click the Microservices tab.
  5. Click Create Microservice. On the displayed page, configure parameters.

    Table 1 Microservice parameters

    Parameter

    Description

    Project

    Keep the default value, which is the project of the microservice.

    Microservice Name

    Enter microservice01.

    Pipeline Source

    Select the pipeline source. Only Repo is supported.

    Repository

    Select the repository test01 created in Preparations.

    Default Branch

    Select master.

    Language

    Select Java.

    Description

    (Optional) Enter a microservice description.

  6. Click OK.

Step 2: Create a Change-triggered Pipeline

  1. In the microservice list, click a microservice name. The Overview page is displayed.
  2. Switch to the Pipelines tab.
  3. Click Create Pipeline. On the displayed page, configure parameters.

    Table 2 Pipeline parameters

    Parameter

    Description

    Project

    Keep the default value, which is the project of the pipeline.

    Name

    Use the default name.

    Pipeline Source

    Keep the default value, which is the same as that of the microservice.

    Repository

    Keep the default value, which is the same as that of the microservice.

    Default Branch

    Keep the default value, which is the same as that of the microservice.

    Repo HTTPS Authorization

    This is mandatory if you enabled Change-based Trigger. Select the authorization endpoint https_endpoint created in Preparations.

    Alias

    (Optional) If an alias is set, the system parameters are generated for the repository.

    Change-based Trigger

    Enable it to set current pipeline to a change-triggered one. It is enabled in this example.

    Description

    (Optional) Describe the pipeline.

    Change-triggered pipelines can only be triggered by changes. A microservice can only have one change-triggered pipeline.

  4. Click Next and select the Get-Started template. The code check, build, and deployment stages are generated. You can orchestrate the pipeline as needed.
  5. Click Save.

Step 3: Create a Change

  1. Access the created microservice.
  2. Click the Changes tab.
  3. Click Create Change. On the displayed page, configure parameters.

    Table 3 Change parameters

    Parameter

    Description

    Change Subject

    Enter bugfix.

    Repository

    Keep the default value, which is the same as that of the microservice.

    Branch

    Select Pull new from default and enter a branch name, or select Associate with existing to select an existing branch. Here we pull a new branch from the default branch, and enter the name bugfix.

    Associated Work Item

    Select the work item BUGFIX created in Preparations.

  4. Click OK.

    After the change is created, the system creates a feature branch based on the microservice default branch. You can commit code to the newly pulled branch.

Step 4: Run a Change-triggered Pipeline

After the code is updated, you can execute the change-triggered pipeline.

  1. On the change list page, click the change name.
  2. Click Submit for Release in the upper right corner. In the displayed dialog box, confirm the release.

    Figure 1 Submitting for release

  3. Click OK. The release list page is displayed.

    Figure 2 Releases

  4. Click Run in the upper right corner. In the displayed dialog box, select the submitted change, configure runtime parameters, execution stages, and jobs as needed.
  5. Click Run.

    During pipeline running, the MergeReleaseBranch and MergeDefaultBranch stages are automatically generated. The newly pulled feature branch is merged to the integration branch.

    After the code check, build, and deployment jobs are successfully executed, the pipeline proceeds to the MergeDefaultBranch stage with a confirmation dialog box displayed.

  6. Click Continue. After the MergeDefaultBranch stage is executed, the system:

    • Updates the change status to Released.
    • Updates the status of the BUGFIX work item to Closed.
    • Merges the code on the release branch to the default branch.

    A change release has been completed.