Function Compute supports version management to help you manage services, functions, and triggers more efficiently. You can use the version management feature to publish multiple versions of services to implement continuous integration and release in the software development lifecycle. 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 version control features to enable you to publish one or more versions of your own services. A version is equivalent to a snapshot of a service. It includes configurations of the service and the code and configurations of functions created for the service, but does not include triggers. When you publish a version, the Function Compute instance generates a snapshot for the service and automatically assigns a version number to associate with the snapshot for future use.

If you do not have the version feature, every change you make on the service will affect the production environment and you cannot control the timing of the release. With the version feature, you can release the service version after the test is stable, use the stable version to serve online requests, and continue to develop and test on the LATEST version. The implementation principle is shown in the following figure.

version

Considerations

  • For a newly created service, there is only one LATEST version by default. Before any version is released, the LATEST version is the only service version that you have. The LATEST version cannot be deleted.
  • A published version cannot be modified. and the version number increases monotonically and will not be reused.

Prerequisites

Publish a version

  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 and Functions page, click the target service. In the left-side navigation pane, click Versions.
  5. On the Versions page, click Publish Version. In the New Version panel, enter a version description and click OK.

View a version

  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 and Functions page, click the target service. In the left-side navigation pane, click Versions.
  5. On the Versions page, you can view the version information of the service.
    version-list

Delete a version

Note Deleting a version only deletes functions and configurations in the version, but does not delete aliases or triggers that point to the version. If you call an alias pointing to the current version, an error will be prompted. Therefore, remove the alias and trigger pointing to this version before deleting the version.
  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 and Functions page, click the target service. In the left-side navigation pane, click Versions.
  5. On the Versions page, find the version that you want to delete and click Delete in the Actions column.
    delete-version
  6. In the OK dialog box, read the message and click Delete.

References

In addition to using the console, you can also use Serverless Devs to configure versions for services. For more information, see YAML files and Non-YAML files.