Function Compute provides a wide variety of triggers to allow users to manage different event sources in a unified manner in an event-driven computing model. You can find more details in Trigger. You can specify the version and alias in the trigger through “qualifier” property, and if the rules defined by the trigger are met, the event source invokes the function under the specified version or alias.
The following triggers support versioning:
|CDN events trigger|
|Log Store trigger|
|API Gateway trigger|
Please refer trigger type for more trigger information.
In the basic information of the trigger, the “qualifier” is an optional field, to store the service version pointed to by the trigger. The value can be either a version or an alias. If not specified, the trigger points to the LATEST version. Note that the trigger itself does not have a version, the trigger can point to a specific service version or alias.
The qualifier is set when the trigger is created and modified. For detailed trigger operation, please refer to Addition and deletion of the trigger.
When creating trigger(which supports versioning), specify version number or alias name in “Version/Alias” field.
// Create Trigger
fcli trigger create -s myService -f myFunction -q prod -t myTrigger
// Update Trigger
fcli trigger update -s myService -f myFunction -q 1 -t myTrigger
With aliases and triggers, your CI and CD process can be better integrated with Function Compute. Here is the recommended workflow:
- Create a service and keep working on the LATEST version.
- When the LATEST version is ready, publish a version.
- Create an alias Prod pointing to the version, and create a trigger pointing to the alias Prod.
- Continue to develop on the LATEST version and publish new version when it is stable.
- Update the alias Prod pointing to the new version, then all the events matching trigger rules will invoke the new version.