Help Center > > User Guide> Image Management> Adding a Trigger

Adding a Trigger

Updated at: Dec 15, 2019 GMT+08:00

Cloud Container Engine (CCE) creates containerized applications from the images in SWR. When an image is updated, the new image will be automatically deployed to update the application that uses the image.

This could be realized by adding a trigger to the desired images.

Prerequisite

A containerized application has been created on CCE from an image in SWR.

If no applications are available, log in to the CCE console to create one. For details, see Creating a Deployment or Creating a StatefulSet.

Procedure

  1. Log in to the SWR console.
  2. In the navigation pane on the left, choose My Images, and click the desired image to enter its details page.
  3. Click the Triggers tab and then click . 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

    A trigger name must be 1 to 64 characters starting with a letter. It cannot end with an underscore (_) or a hyphen (-). Only letters, digits, underscores, and hyphens are allowed. Consecutive underscores or hyphens are prohibited.

    Condition

    The following trigger conditions are supported:

    • All trigger: Trigger image deployment when any image tags are generated or updated.
    • Specific tag trigger: Trigger image deployment when a specified image tag is generated or updated.
    • Regular trigger: Trigger image deployment when an image tag that meets the regular expression is generated or updated.

    In this section, All trigger is selected as an example. Therefore, image deployment is triggered when any image tags are generated or updated.

    Operation

    Operation that will be triggered when the preset conditions are met. Currently, only container image update is supported. You need to specify the application to be updated and its container image.

    Status

    Select Enable.

    Select Application

    Select the container whose image is to be updated.

Verifying the Trigger

In this example, All trigger is selected. Therefore, application deployment will be triggered when any image tags are generated or updated.

  1. Push an image with a new tag to the SWR repository. You can view the new image tag on the image details page.

    Figure 2 Viewing the new image tag

  2. Log in to the CCE console. In the navigation pane on the left, choose Workloads. Click the name of the workload that is created from the image with an earlier tag.
  3. On the Instances tab page, you can see that an application instance is being created from the image with the new tag. When the creation is complete, the application has been updated.

    Figure 3 Application updated

    Access the workload using the access address displayed on the Access Mode page of the CCE console. Then you can view the updated workloadapplication information.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel