Updated on 2024-06-06 GMT+08:00

Registering an Extension

Procedure

  1. Log in to the CodeArts homepage.
  2. Choose Services > Extensions from the top navigation bar.
  3. Click .
  4. Set basic information. For details, see Table 1.
    Table 1 Parameter description

    Parameter

    Description

    Icon

    Icon of the extension. Upload an image in PNG, JPEG, or JPG format, with a file size no more than 512 KB (recommended: 128 x 128 pixels). If no image is uploaded, the system generates an icon.

    Name

    Name of the extension.

    Unique Identifier

    ID of the extension. Once set, this parameter cannot be changed.

    Type

    Type of the extension, which can be Build, Check, Test, Deploy, or Normal. Once set, this parameter cannot be changed.

    Description

    Purposes and functions of the extension. The description can be edited.

  5. Click Next. On the Version Information page, set the version and description.
    • Version of the extension, in X.X.X format. Each digit ranges from 0 to 99.
    • Version information of the extension cannot be modified later.
  6. Click Next. The Input Configuration page is displayed.

    You can drag and drop widgets to generate visual forms, which can streamline pipeline contexts. Multiple preset widgets are available: Single-line Text Box, Digit, Single-selection Drop-down List, Multi-selection Drop-down List, Option Button, Switch, Multi-line Text Box, Metrics, and so on.

    Drag the widgets to the middle area. Click a widget and set the widget configurations on the right. For details, see Table 2.

    Table 2 Parameter description

    Category

    Property

    Description

    Widget

    Basic

    Unique Identifier

    Unique ID of the widget. The ID is used to obtain widget input.

    All

    Title

    Name of the widget. The name will be displayed on the pipeline job orchestration page.

    All

    Tips

    Description of the widget. The description will be displayed as preview.

    Single-line Text Box, Digit, Single-selection Drop-down List, Multi-selection Drop-down List, Option Button, Switch, and Multi-line Text Box

    Accuracy

    Number of decimal places allowed in a widget value: 0 to 4.

    Digit

    Default Value

    Default value of the widget.

    Single-line Text Box, Digit, Switch, Multi-line Text Box, and Metrics

    Verification

    Mandatory

    Whether the widget content is mandatory. Error messages can be set.

    Single-line Text Box, Digit, Single-selection Drop-down List, Multi-selection Drop-down List, Option Button, and Multi-line Text Box

    RegEx Validation

    Verifies the widget content. You can set error messages.

    Single-line Text Box, Digit, Single-selection Drop-down List, Multi-selection Drop-down List, and Multi-line Text Box

    Word limit

    Max. widget characters.

    Multi-line Text Box

    Option

    Custom

    Options supported by the widget:

    • Label: content displayed on the extension configuration page.
    • Value: value delivered when the extension is running.

    In addition to manual configuration, set the options by:

    • APIs: Configure URLs to obtain option contents. Click next to Custom. The API dialog box is displayed. You can configure parameters after enabling the function. For details, see Table 3.
    • Context: Configure data source to obtain the URL of the pipeline source or IDs of build jobs. Click next to Custom. The context dialog box is displayed. You can configure parameters after enabling the function.

    Single-selection Drop-down List, Multi-selection Drop-down List, and Option Button

    Threshold

    Configure the output metrics of the extension. After the configuration, choose All Account Settings > Policy Management > Rules to create a rule and apply the rule to the pipeline pass conditions.

    Metrics

    Advanced

    Display

    Whether the widget is visible. You can set conditions.

    Single-line Text Box, Digit, Single-selection Drop-down List, Multi-selection Drop-down List, Option Button, Switch, and Multi-line Text Box

    Disable

    Whether to disable the widget. Conditions can be set.

    Single-line Text Box, Digit, Single-selection Drop-down List, Multi-selection Drop-down List, Option Button, Switch, and Multi-line Text Box

    Table 3 Parameter description

    Parameter

    Description

    Linked Attribute

    Associates the selected widgets with the API to transfer parameters. When a widget value is changed, the new value is used to call the API again.

    URL

    Only HTTPS protocol is supported.

    Returned Data Path

    The widget used must be list data. In the following response body example, the returned data path is result.parameters.

    {
        "result": {
            "total": 2,
            "parameters": [
                {
                    "id": 3353753,
                    "name": "parameters01"
                },
                {
                    "id": 3353697,
                    "name": "parameters02"
                }
            ]
        },
        "status": "success"
    }

    Option Value

    Set this parameter to the value of the corresponding field in the returned data path. This parameter is delivered when the extension is running.

    Option Name

    Set this parameter to the value of the corresponding field in the returned data path. This parameter is displayed on the extension configuration page.

    Remote Search

    Enable this function to add a remote search field. For extension search, the entered value will be used as the value of the remote search field to call the API again.

    You can also use the Metrics widget to configure the extension output:

    1. Drag the Metrics widget to the middle area. This widget is not displayed by default and is used only for parsing output metrics after pipeline execution is complete.
    2. Configure Threshold for the Metrics widget. The threshold information can be referenced in rules and policies and finally applied to pipelines.

      The parameters are described in the following table.

      Parameter

      Description

      Group

      Threshold group, which is user-defined. Configure the extension and use it in a rule/policy for a pipeline.

      Key

      Parses the ${STEP_ID}_metrics.json file of the extension code logic. After the pipeline is executed, this value is used for match in the file.

      Name

      Name to display as a threshold check item here, and then display in a policy and a pipeline exit condition.

      Value

      Default condition for a threshold check.

  7. Click Next. On the displayed page, add the ExecuteShellCommand extension and enter the shell command.

    The commands indicate the actual service logic implementation process of an extension. For more input and output configurations, see Developing Extensions Using Low Code.

  8. Click Next. On the displayed page, click Add Configuration to add an output. You can use the shell command in the previous step to output data.

  9. Click Release or Release Draft to complete the registration.

    There are draft release and official release.

    • Official release

      An official extension has a unique version number. All members of the current tenant can use this version in a pipeline.

    • Draft release
      • You can configure a draft extension in a pipeline for debugging. After debugging, the draft extension can be officially released, so that other members of the current tenant can use the extension.
      • All draft versions are marked with Draft.
      • Only one draft is allowed. If there is already a draft, no more versions can be created until you officially release or delete the draft.
      • Drafts can be directly deleted.
  10. (Optional) Update the extension.
    1. After the extension is registered, click its card to view details.
    2. Click Create Version. Or, clone an existing extension version and click to view the historical configurations. You can modify the extension based on the cloned version.