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.
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 item | Version | Alias |
|---|---|---|
| Code logic | ||
| Runtime | ||
| Instance specifications, instance concurrency, instance lifecycle hook | ||
| Auto scaling policy | ||
| Trigger | ||
| Asynchronous task | ||
| Layer, environment variable, logging, network, storage, health check, custom DNS, permissions (role) |
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:
A function. For more information, see Create a function
Publish a version
Log on to the Function Compute console. In the left-side navigation pane, click Functions.
In the top navigation bar, select a region. On the Functions page, click the target function.
Click the Versions tab, then click Publish Version.
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.
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
To set a version as the major or canary release target of an alias, see Manage aliases and Use versions and aliases to implement canary release.
To publish versions using the CLI, see User guide for version in the Serverless Devs documentation.