- What's New
- Function Overview
- Service Overview
- Getting Started
-
User Guide
- Overview
- Permissions Management
- Basics of Docker
-
Image Management
- Pushing an Image Through a Container Engine Client
- Obtaining a Long-Term Valid Docker Login Command
- Obtaining a Long-Term Valid containerd Pull/Push Command
- Uploading an Image Through the SWR Console
- Pulling an Image
- Setting Image Attributes
- Sharing Private Images
- Adding a Trigger
- Adding an Image Retention Policy
- Image Center
- Organization Management
- User Permissions
- Auditing
- Best Practices
-
API Reference
- Before You Start
- API Overview
- Calling APIs
-
API
- Organization Management
- Image Repository Management
- Image Tag Management
- Shared Account Management
- API Versions
- Organization Permission Management
- Image Permission Management
- Automatic Image Synchronization Task Management
- Trigger Management
- Image Retention Policy Management
- Temporary Login Command
- Quota Management
- Example Applications
- Appendixes
- Change History
- FAQs
- Videos
- SDK Reference
Show all
Adding a Trigger
Scenario
SWR works with Cloud Container Engine (CCE) to achieve automatic application update. When images are updated, these new images can be automatically deployed to update the applications that use these images. You only need to add a trigger to the desired images. Every time these images are updated, they can trigger automatic updates of the applications that use them.
Prerequisite
A containerized application has been created on CCE by using an image from SWR.
To create an application, log in to the CCE console and create a workload.
Procedure
- Log in to the SWR console.
- In the navigation pane on the left, choose My Images, and click the target image.
- Click the Triggers tab, then click Add Trigger. On the page displayed, configure the following parameters according to Table 1 and click OK.
Table 1 Trigger Parameter
Description
Name
The name can contain 1 to 64 characters, and must start with a letter. Only letters, digits, underscores (_), and hyphens (-) are allowed. The name cannot end with an underscore or hyphen. Consecutive underscores or hyphens are not allowed and an underscore cannot be placed next to a hyphen.
Condition
The following trigger conditions are supported:
- All tags: Trigger when any image tags are generated or updated.
- Specific tag: Trigger when a specific image tag is generated or updated.
- Tags matching regular expression: Trigger when an image tag that matches the specified regular expression is generated or updated. The regular expression rules are as follows:
- *: 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 multiple options.
Operation
Operation that will be triggered when the conditions you set are met. Currently, only application update is supported. You need to specify the application to be updated and the container image of the application.
Status
Select Enable.
Trigger Type
Select CCE.
Application
Select the container whose image you want to update.
Example
A Deployment named nginx is created using the Nginx v1 image. The Deployment provides service to external systems with a welcome page displaying Hello, SWR!

- Add a trigger to the Nginx image.
Set Name to All_tags, Condition to All tags, and select the application and all its containers that use the Nginx image.
- Check the image tags. The Nginx image v2 is pushed to SWR. The welcome page of the Deployment created using this new image should display Hello, SoftWare Repository for Container!
- Check whether the deployment is triggered successfully.
On the Triggers tab page, click
and the trigger is successful.
The welcome page of the Deployment displays Hello, SoftWare Repository for Container!
Figure 2 Updated Nginx
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.