Manage versions

更新时间:
复制 MD 格式

Function Compute supports function versioning to help you implement continuous integration and continuous deployment (CI/CD) throughout the software development lifecycle. You can publish a stable version for production traffic while continuing development on the LATEST version — without affecting live users.

How it works

Version control in Function Compute operates at the function level. Publishing a version captures the current code and configuration as an immutable snapshot. Once published, a version cannot be modified, and its version number monotonically increases and cannot be reused.

The snapshot includes:

  • Core function settings: runtime, handler, and startup command

  • Instance configuration: instance type, instance concurrency, and instance lifecycle hooks

  • Associated resources: layers, environment variables, logging, network, storage, health checks, custom DNS, and permissions (role)

Switching between versions requires no changes to function code or configuration.

The following diagram illustrates how versions and the LATEST version coexist.

image

What's not included in the snapshot

Triggers and asynchronous task settings are excluded from the version snapshot. You must configure them independently for each version after publishing. Auto scaling policies apply only at the alias level — configure them on an alias, not on a version directly.

The following table shows which configuration items can be bound to versions and aliases.

Configuration itemVersionAlias
Code logicsupportunsupport
Runtimesupportunsupport
Instance specifications, instance concurrency, instance lifecycle hooksupportunsupport
Auto scaling policyunsupportsupport
Triggersupportsupport
Asynchronous tasksupportsupport
Layer, environment variable, logging, network, storage, health check, custom DNS, permissions (role)supportunsupport

Usage notes

  • Every function starts with the LATEST version. Before you publish any versions, LATEST is the only version and cannot be deleted.

  • A published version is immutable. Its version number increments automatically and cannot be reused.

Prerequisites

Before you begin, ensure that you have:

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 target function.

  3. Click the Versions tab, then click Publish Version.

  4. In the Publish Version panel, enter a version description and click OK.

The new version appears in the Versions tab. From there, you can delete versions you no longer need, or set a version as the major or canary release version of an alias.

A newly published version has no triggers. Configure triggers for the version independently after publishing.
Warning

Before deleting a version, remove all aliases and triggers associated with it. Deleting a version removes only the function code and configuration — aliases pointing to the version and its triggers are retained. Calling an alias that points to a deleted version returns an error.

What's next