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!
![Click to enlarge](https://support.huaweicloud.com/intl/en-us/eu-west-0-usermanual-swr/en-us_image_0000001154603930.png)
- 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.
- The Nginx v2 image is pushed to SWR. The welcome page of the Deployment created using this new image should display Hello, SoftWare Repository for Container!
Figure 2 Image tag v2
- Check whether the deployment is triggered successfully.
On the Triggers tab page, click
and the trigger is successful.
Figure 3 ResultThe welcome page of the Deployment displays Hello, SoftWare Repository for Container!
Figure 4 Updated Nginx
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot