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

Registering a Custom Extension

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

    Parameter

    Description

    Icon

    Icon of the extension to display. If none is uploaded, a system icon is generated. The icon can be in PNG, JPEG, or JPG format, with a file size less than or equal to 512 KB. The recommended size is 128 x 128 pixels.

    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. This parameter can be modified later.

  5. Click Next and configure version information. For details, see Table 2.

    This page displays the version information of the extension, which cannot be modified later.

    Table 2 Parameter description

    Parameter

    Description

    Version

    Version of the extension, in X.X.X format. Each digit ranges from 0 to 99.

    Description

    Describes the main functions or updates of the specified version.

    Execution Environment

    Only System Container can be set currently.

    System Container

    System container where the extension command is executed.

    Shell Command

    Commands to execute when the pipeline calls the extension.

    NOTE:

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

  6. Click Next and set the input.

    Drag and drop widgets to generate forms and connect pipeline data at lower development costs. Multiple preset controls are available, including Single-line Text Box, Digit, Single-selection Drop-down List, Multi-selection Drop-down List, Option Button, Switch, and Multi-line Text Box.

    Drag the widgets to the middle area. Click a widget and the configurations are displayed on the right. For details about the parameter description, see Table 3.

    Table 3 Parameter description

    Category

    Property

    Description

    Widget

    Basic

    Unique Identifier

    ID of the widget, which is unique and used to obtain widget input during extension logic implementation.

    All

    Title

    Name of the widget for identification, which will be displayed on the pipeline task orchestration page.

    All

    Tips

    Description of the widget, which will be displayed as preview.

    All

    Accuracy

    Number of decimal places supported by the control value. The value ranges from 0 to 4.

    Digit

    Default Value

    Sets the default value of the component.

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

    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, Multi-line Text Box

    RegEx Validation

    Sets the widget content verification. Error messages can be set.

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

    Options

    Custom

    Options supported by the widget:

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

    In addition to manual configuration, set the options by:

    • API: Configure the webapi to obtain options. For details about the API parameters, see Table 4.
    • Context: information from the pipeline source or build tasks

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

    Advanced

    Display

    Whether the widget is visible. Conditions can be set.

    All

    Disable

    Whether to disable the widget. Conditions can be set.

    All

    Table 4 Parameter description

    Parameter

    Description

    Linked Attribute

    Establish the association between other components and APIs. Parameters can be transferred. When the value of a component is updated, the new value is used to call APIs 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

    After this function is enabled, you can add a remote search field. The entered value is used as the value of the remote search field to call the APIs again.

    You can also use the metrics widget to configure 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 the threshold property of the metrics control. The threshold information can be referenced in rules or policies through this extension and then used in a pipeline.

      Parameters:

      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 output file of the extension code logic. After the pipeline is executed, the file is matched based on the value of this parameter.

      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 Release or Release Draft to complete the registration.

    Both draft release and official release are supported.

    • Official release:

      Extensions officially released have an independent version number. All members of the current tenant can use this extension version in a pipeline.

    • Draft release
      • Extension drafts can be configured in a pipeline to debug. After the debug is complete, the drafts can be officially released for other members of the current tenant to use.
      • All draft versions are marked with .
      • 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.
  8. (Optional) Update the extension.
    1. After the extension is registered, click its card to view details.
    2. Click New Version. Or, copy an existing extension version and click to view the historical configuration. Then modify the extension based on a version copy.