Alibaba Cloud Function Compute supports the versioning feature to help you efficiently manage functions and triggers. You can publish multiple versions of a function to implement continuous integration and deployment (CI/CD) in the software development lifecycle and ensure the stability and reliability of the function.
What is a version?
Function Compute provides the function-level versioning feature to allow you to publish one or more versions for a function. A version is similar to a function snapshot that contains information such as function settings and function code. A version does not contain trigger information. When you publish a version, the system creates a snapshot for the function and assigns a version number to the snapshot for easy reference.
Without versions, any alteration to a function immediately impacts the production environment, and you cannot control the time to deploy updates. With versions, you can publish a new version to respond to online requests after a beta version proves to be stable for a period of time. This way, you can continue to develop and test applications on the LATEST version without affecting the production environment. The following figure shows the working mechanism of the versioning feature.
Considerations
A newly created function comes with the default LATEST version. Before you publish any versions, the LATEST version is the sole version of the function and cannot be deleted.
A published version cannot be modified. The version number monotonically increases and cannot be reused.
Before you start
Publish a version
Log on to the Function Compute console. In the left-side navigation pane, click Functions.
In the top navigation bar, select a region. On the Functions page, click the function that you want to manage.
Click the Versions tab. On the Versions tab, click Publish Version. In the Publish Version panel, enter the version description and click OK.
After the version is published, you can view the version in the Versions tab. You can also delete the versions that you no longer need and set a version as the major or canary release version of an alias as prompted.
When you delete a version, only the function and configurations of the version are deleted. The aliases that point to the version and triggers of the version are retained. Therefore, we recommend that you remove the aliases that point to the version and triggers of the version before you delete the version. Otherwise, an error occurs when you call the alias that points to the version.
More information
For more information about how to set a specified version as the major or canary release version of an alias, see Manage aliases and Use versions and aliases to implement canary release.