Function Compute provides the versioning feature to help you manage services, functions, and triggers in an efficient manner. You can use this feature to publish multiple versions of a service to implement continuous integration (CI) and continuous delivery (CD) in software development lifecycles. This topic describes how to manage versions in the Function Compute console.
What is a version?
Function Compute provides the 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 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.
- A new service has only one LATEST version. Before you publish any version of the service, the LATEST version is the only 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.
Publish a version
- Log on to the Function Compute console. In the left-side navigation pane, click Services & Functions.
- In the top navigation bar, select the region where the service resides.
- On the Services page, click the desired service. In the left-side navigation pane, click Versions.
- 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 you no longer need and set the specified version as the primary or canary version of the alias as prompted.
Aside from the Function Compute console, you can also use Serverless Devs to configure versions for a service. For more information, see Serverless Devs commands.