All Products
Search
Document Center

Function Compute:Version management

Last Updated:Feb 17, 2025

Function Compute offers a version management feature that enhances the efficiency of managing functions and triggers. This feature allows you to publish multiple function versions, facilitating continuous integration and deployment within the software development lifecycle while ensuring function stability and reliability.

What is a version

Function Compute enables function-level versioning, which allows you to publish one or more versions of your functions. Publishing a version creates an immutable snapshot that includes the function's code and configuration but excludes triggers, asynchronous task configurations, and reserved policy resource properties. Each published version is automatically assigned a unique version number, creating a distinct version entity. You can configure triggers and asynchronous tasks for each version separately, while aliases must be used to manage reserved policies.

Without versioning, any change to a function directly impacts the production environment, and release timings are uncontrollable. Versioning enables you to test and stabilize a function version before deploying it to handle online requests, while continuing development and testing on the LATEST version. The diagram below illustrates this mechanism.

The version snapshot includes essential function information such as the runtime environment, handler, and startup command, along with instance configuration details like instance type, concurrency, and instance lifecycle hook. It also encompasses function layers, environment variables, log configuration, network configuration, storage configuration, DNS configuration, health checks, and permission settings. Switching versions does not require modifications to the function code or these configurations.

The table below compares the configuration items that can be associated with versions and aliases. An support indicates support for binding to the project, while an unsupport signifies no support for binding.

Configuration type

Version

Alias

Code logic

support

unsupport

Runtime environment

support

unsupport

```html Instance type, Single instance concurrency, Instance lifecycle hook configuration

support

unsupport

Rapid mode elastic policy

unsupport

support

Trigger

support

support

Asynchronous task

support

support

Layer, Environment variable, Log configuration, Network configuration, Storage configuration, Health check configuration, DNS configuration, Permission (Role) configuration

support

unsupport

Precautions

  • A new function includes the default LATEST version. Until you publish other versions, the LATEST version is the only one available and cannot be deleted.

  • Once published, a version cannot be altered. Version numbers increase sequentially and are not reusable.

Prerequisites

Publish a version

  1. Log on to the Function Compute console and click Functions in the left-side navigation pane.

  2. In the top menu bar, select a region, and then on the Functions page, click the target function.

  3. Select the Version Management tab. On the version page, click Publish Version, enter the version description in the panel to publish a new version of the function, and then click OK.

    Once the version is published, it will appear in the Version Management tab list. You can delete unnecessary versions and set a specific version as the primary or canary version for an alias as needed.

Note

When deleting a version, only the function and its configurations are removed. Any aliases or triggers pointing to that version remain. It is advisable to detach any aliases and triggers before deleting a version to avoid errors when calling the alias.

References