All Products
Search
Document Center

Function Compute:Manage versions

Last Updated:Jan 23, 2024

Function Compute supports the versioning feature, which helps you manage services, functions in services, and triggers in an efficient manner. You can release multiple versions of services to implement continuous integration (CI) and continuous delivery (CD) during the lifecycles of software development process. This topic describes the concept of versions and how to manage versions in the Function Compute console.

What is a version?

Function Compute provides service-level versioning, which allows you to publish one or more versions for your service. A version is similar to the snapshot of a service. The version contains the configurations of the service and in-house functions, such as function code and function configurations. Versions do not contain information about triggers. When you publish a version of a service, the system generates a snapshot for the service and assigns a version number that is associated with the snapshot for subsequent use.

If you do not use the versioning feature, all modifications to a service affect the production environment. As a result, you cannot control the time when the latest versions are published. If you use the versioning feature, you can use a stable version to respond to online requests after the test results become stable. You can also continue to develop and test the LATEST version. The following figure shows the mechanism for the versioning feature.

image

Precautions

  • By default, a new service has only one LATEST version. Before you publish a version of the service, the LATEST version is the only version available. Do not delete the LATEST version.

  • After a version is published, do not modify the version. The version number monotonically increases and is unique.

Prerequisites

Publish a version

  1. Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.

  2. In the top navigation bar, select a region.

  3. On the Services page, click the desired service. In the left-side navigation pane, click Versions.

  4. On the Versions page, click Publish Version. In the Publish New Version of Service panel, specify the description of the version and click OK.

    After the version is published, you can view the version on the Versions page. You can also delete the versions that you no longer require and specify a version as the primary or canary version of the alias as prompted.

Note

When you delete a version, only the functions and configurations of the version are deleted. However, the aliases or triggers that point to the version are retained. Before you delete a service, we recommend that you remove the aliases and triggers that point to this version. Otherwise, an error occurs when you call the alias that points to the version.

More information

You can also use Serverless Devs to configure versions for a service. For more information, see Serverless Devs commands.