Adding a Trigger
SWR works with Cloud Container Engine (CCE) and Cloud Container Instance (CCI) to achieve automatic application update. When images are updated, these new images can be automatically deployed to update the applications that use these images. The only thing you need to do is to add a trigger to the desired images. In this way, every time the images are updated, they will trigger automatic operations like updating the applications deployed with these images.
Prerequisite
A containerized application has been created on CCE or CCI from an image in SWR.
To create an application on CCE, see Creating a Deployment or Creating a StatefulSet. To create an application on CCI, see Deployment.
Procedure
- Log in to the SWR console.
- In the navigation pane on the left, choose My Images, and click the desired image to enter its details page.
- Click the Triggers tab, then click Add Trigger. On the page displayed, configure the following parameters according to Table 1 and click OK. Figure 1 Adding a trigger
Table 1 Trigger Parameter
Description
Name
The name should be 1 to 64 characters, starting 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.
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 or CCI.
NOTE:Currently, the CCI trigger type is supported only in CN North–Beijing1 and CN North–Beijing4 regions.
Application
Select the container whose image is to be updated.
Verifying the Trigger
In this example, the condition All tags is selected. Therefore, the application deployment will be triggered when any image tags are generated or updated.
- When the Trigger Type is set to CCE, log in to the CCE console. In the navigation pane on the left, choose Workloads. Click the target workload to enter its detailed page. On the Pods tab page, you can see that an application pod is being created from the image with the new tag. When the creation is complete, the application has been updated.Figure 3 CCE application updated
Access the application using the access address displayed on the Services tab page. Then you can view the updated application information.
- When the Trigger Type is set to CCI, log in to the CCI console. In the navigation pane on the left, choose Workloads > Deployments. Click the target Deployment to enter its detailed page. In the Pod List, you can see that an application pod is being created. When the creation is complete, the application has been updated.Figure 4 CCI application updated
Access the application using the access address displayed in the Access Settings area. Then you can view the updated application information.
Last Article: Sharing Private Images
Next Article: Adding an Image Retention Policy
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.