All Products
Search
Document Center

Function Compute:Manage versions

Last Updated:Mar 18, 2025

Function Compute supports the versioning feature to help you efficiently manage functions and triggers. You can publish multiple versions of a function to implement continuous integration and continuous deployment (CI/CD) throughout the software development lifecycle and ensure the stability and reliability of the function.

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 a snapshot that includes the function code and configurations, but excludes resource attributes, such as triggers, asynchronous task configurations, and provisioned instance policies. Triggers and asynchronous tasks can be independently configured on versions, while provisioned instance policies must be managed through aliases. When you publish a version, Function Compute automatically assigns a version number to the current snapshot, creating an immutable version entity.

Without versioning, any alterations to your function immediately affect the production environment, leaving no control over the timing for deploying updates. The versioning feature allows you to publish a stable function version after testing to serve online requests while continuing development and testing on the LATEST version of the function. The following diagram illustrates this mechanism.

image

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

The following table lists the configuration items that can be associated with versions and/or aliases. A support indicates that the configuration item supports binding to a version or an alias, while a unsupport signifies that it does not support binding.

Configuration items

Version

Alias

Code logic

support

unsupport

Runtime

support

unsupport

Instance specifications, instance concurrency, instance lifecycle hook

support

unsupport

Auto scaling policy

unsupport

support

Trigger

support

support

Asynchronous task

support

support

Layer, environment variable, logging, network, storage, health check, custom DNS, permissions (role)

support

unsupport

Considerations

  • A newly created function comes with the default LATEST version. Before you publish any versions, the LATEST version is the sole version of the function and cannot be deleted.

  • A published version cannot be modified. The version number monotonically increases and cannot be reused.

Prerequisites

Publish a version

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

  2. In the top navigation bar, select a region. On the Functions page, click the function that you want to manage.

  3. Click the Versions tab. On the Versions tab, click Publish Version. In the Publish Version panel, enter the version description and click OK.

    After a version is published, you can find it in the Versions tab. You can delete the versions that you no longer need and also set a version as the major or canary release version of an alias as prompted.

Note

When you delete a version, only the function and configurations within that version are removed. The aliases pointing to the version and the version's triggers are retained. Therefore, we recommend that you first remove any aliases and triggers associated with the version before deleting it. Otherwise, an error will occur if you try to call an alias that points to the version.

References