Updated on 2025-04-30 GMT+08:00

Triggers

Scenarios

You can create a trigger to automatically execute the defined HTTP POST requests. For example, when an image is pushed, the CI/CD pipeline will automatically pull and deploy the image to a cluster. In this way, you can quickly connect to the CI/CD pipeline for container DevOps.

Image push can trigger a request.

Creating a Trigger

  1. Log in to the SWR console. In the upper left corner, switch to your region. Click a repository name to go to its details page.
  2. In the navigation pane, choose O&M Center > Triggers.
  3. Click Add Trigger in the upper right corner.
  4. In the displayed dialog box, configure the parameters.

    Table 1 Parameter description

    Parameter

    Description

    Example

    Name

    Trigger name.

    TriggerRule

    Namespace

    Namespace where a trigger will be created.

    library1

    Application Scope

    Image: You can use a regular expression to specify images. Alternatively, you can click to select images.

    The regular expression can be nginx-* or {repo1, repo2}.

    • *: matches any field that does not contain the path separator /.
    • **: matches any field that contains the path separator /.
    • ?: matches any single character except /.
    • {option 1, option 2, ...}: matches any of the options.

    Tag: Image tag. You can use a regular expression to specify tags. The matching rules are the same with those for images.

    nginx-*

    Trigger Action

    You can set the following action as a trigger:

    • Pushing an image

    Pushing an image

    Remote Certificate Verification

    If you select this option, the system will check whether the remote certificate is released by an authorized organization. If you do not, it will not be checked.

    -

    Request Address Type

    • Private network
    • Public network

    Private network

    Request Address

    IP address the trigger will send a POST request to.

    CAUTION:

    The IP address must fall into the default VPC network CIDR block you specified when you purchased the repository.

    -

    Request Header

    When a trigger sends a POST request, the header information can be in Key:Value format. Example: Authentication: xxxxxxx.

    Use semicolons (;) to separate multiple headers, for example, param1:value1;param2:value2.

    -

    Figure 1 Creating a trigger

  5. Click OK.

Managing Triggers

You can manage your triggers as follows.

  • Enable or disable a trigger. indicates a trigger is enabled and indicates the trigger is disabled. A new trigger is enabled by default.
  • Modify a trigger. All parameters except Namespace and Request Address can be modified.
  • Delete a trigger.
  • View a trigger. When the action specified in a trigger is executed, the trigger will send a request. You can click to view trigger records.
    Table 2 Trigger records

    Parameter

    Description

    Trigger Action

    Action that triggers a request.

    Trigger Resource

    Repository resource on which the action was performed.

    Status

    Status of the Webhook request sent by a trigger.

    Created

    Time when the Webhook request was sent.

    Figure 2 Managing triggers