Function Compute provides the versioning feature to help you efficiently manage services, functions, and triggers. You can use this feature to publish multiple versions of a service to implement continuous integration and publish in software development lifecycles. This topic describes how to publish, view, and delete a version in the Function Compute console.

What is a version?

Function Compute provides service-level versioning feature, which allows you to publish one or more versions for a service. A version is similar to a service snapshot that contains the information such as the service settings, and the code and settings of functions that belong to the service. A version does not contain trigger information. When you publish a version, the system generates a snapshot for the service and assigns a version number that is associated with the snapshot for future use.

If you do not use the versioning feature, every change in a service affects the production environment. This way, you cannot control the time to publish the latest versions. If you use the versioning feature, you can use a stable service version to respond to online requests after the test results become stable. In addition, you can continue to develop and test the LATEST version. The following figure shows the mechanism for the versioning feature.

version

Precautions

  • A new service has only one LATEST version. Before you publish any version of the service, the LATEST version is the only service version that you own. The LATEST version cannot be deleted.
  • A published version cannot be modified. The version number monotonically increases and cannot be reused.

Prerequisites

Procedure

  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where the service resides.
  4. On the Services page, click the desired service. In the left-side navigation pane, click Versions.
  5. On the Versions page, click Publish Version. In the Publish New Version of Service panel, enter the description of the version that you want to publish, and then click OK.
    After the version is published, you can view the published version on the Versions page. You can also delete the versions that are no longer used. You can set a specified version to the major version or canary version of an alias, and then you can click Logstore in the Actions column to go to the Log Service console to view logs.
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. Therefore, we recommend that you remove the aliases and triggers that point to this version before you delete the version. Otherwise, an error occurs when you call the alias that points to the version.

References

Aside from the Function Compute console, you can also use Serverless Devs to configure versions for a service. For more information, see Basic features.