When the service of the LATEST version becomes stable, you can publish the service of this stable version to serve online requests. In addition, you can continue to develop more features over the LATEST version.

Prerequisites

Prepare a function

Publish a version

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select your region.
  3. In the left-side navigation pane, click Service/Function.
  4. Click the target service and choose Versions > Publish New Version.version_release
  5. In the Publish New Version from LATEST dialog box, enter the version description and click OK.
    You can view the published version in the version list. version-list

Run a function for a service of a new version in the Function Compute console

  1. On the Service/Function page, find the target service named service.
  2. In the upper-right corner of the function list, select the new version ID from the Service Version drop-down list.
    choose-version
  3. Click the target function named function. On the page that appears, click the Code tab.
  4. Click Invoke.
    After the function code is executed, you can view the execution log at the lower part of the page. In the log, you can see that the value of the qualifier field that indicates the version information is 1 and the versionId field that indicates the parsing result is 1. The log shows that the executed function belongs to the service of version 1. version1-log

Run a function for a service of a new version by calling the Function Compute API

To enable the system to call a function for a service of a specified version, you can append a period (.) as a separator to serviceName in the request path and use qualifier to specify the version. The request is in the following format:

POST /services/{serviceName}.{qualifier}/functions/{functionName}/invocations
The sample request is as follows:
POST /services/{service}.{qualifier}/functions/{function}/invocations

What to do next

Switch traffic by using an alias