All Products
Search
Document Center

Function Compute:Use Serverless Application Center to implement CI/CD on existing Function Compute projects

Last Updated:Dec 09, 2025

If you manually update the code and configurations of existing functions in Function Compute and then publish the functions, the manual operations are cumbersome and may cause errors. You can use Serverless Application Center to implement continuous integration and continuous deployment (CI/CD) on existing projects in Function Compute. This helps improve developer experience and mitigate risks caused by manual operations. Serverless Application Center provides custom pipelines. Programmable and automatic build and release capabilities and the manual approval feature are introduced to build and deploy projects on the cloud.

Prerequisites

  • You have created a function. For more information, see Create a function.

    This topic describes how to deploy a Node.js application by using Serverless Application Center.

  • Your function code is managed by using Git.

    Serverless Application Center is adapted to a variety of common scenarios, such as GitHub, Gitee, Codeup, and on-premises GitLab. The function code in this example is managed by using GitHub.

Step 1: Prepare build commands and confirm the version of your build tool

Prepare build commands

Serverless Application Center provides execution environments that are required to build functions. However, adaptive build and packaging capabilities are not provided. You can run the same build and packaging commands on the cloud as on-premises machines. Take note that Linux environments are used on the cloud. The build methods are different if your on-premises machine runs on Windows. For more information about how to develop and build functions, see Overview.

This topic uses Node.js as an example. The following code snippet shows the command to run on an on-premises machine. Prepare your build commands based on your actual function code. The build commands are used when you configure pipelines in Serverless Application Center.

# In most cases, the install command is used as the build command if you use npm as the build tool. You can also add custom features 
You can also add custom features based on your business requirements.
npm install ./code --production --registry=https://registry.npmmirror.com
# Run the zip command to package code. Serverless Devs also supports automatic packaging. 
# We recommend that you use the zip command for packaging to prevent packaging content that you no longer need. 
# In this example, the ZIP file is stored in the root directory. You can also store it in another directory based on your business requirements. 
zip code.zip -r ./code/*

Confirm the version of your build tool

Serverless Application Center integrates build tools of multiple version in the build environment. You can switch the versions based on your business requirements. This topic uses Node.js 16, which is used when you configure pipelines in Serverless Application Center.

Step 2: Prepare the s.yaml file

You can use the s.yaml file to define functions. We recommend that you store the s.yaml file in a code repository and use Serverless Devs for deployment.

For existing functions in Function Compute, perform the following steps to prepare the s.yaml file:

  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. On the Function Details page, click the Code tab and choose Export Function > Export Configuration. In the Export Configuration message, click OK to download the s.yaml file to your local device.

  4. Modify the s.yaml file, store the modified s.yaml file in the root directory, and then commit it to the Git repository of your function code.

    The following figure shows an example s.yaml file downloaded to your on-premises machine. The following items show how to modify the file:

    1. Remove the access: '{{ access }}' line.

    2. Set the codeUri parameter to the actual path of build artifacts, such as ./code.zip. For more information about the path of build artifacts, see the Prepare build commands section of this topic.

    image.png

To define multiple functions, export the corresponding s.yaml files and assemble the files. For more information about the syntax of the s.yaml file and how to declare multiple functions, see the YAML syntax and permission management section of the "Common commands of Serverless Devs" topic.

Step 3: Create an application in Serverless Application Center

  1. Log on to the Function Compute console. In the left-side navigation pane, choose More Features > Applications. On the Applications page, click Create Application.

  2. On the Create Application page, select Import an Application from a Repository, set Repository Type to GitHub, and then configure the destination repository.

    If you did not grant permissions to Serverless Application Center, log on to the GitHub console and grant the permissions.

  3. In the Environment Configurations section, configure environment settings. The following items describe how the parameters are configured in this topic.

    • Pipeline Configuration Plan: Custom Configuration.

    • Application Deployment and Trigger Mode: Push to the specified branch trigger.

    • Select a Pipeline Environment: Default Environment.

  4. Click Create and Deploy Default Environment to create the application.

Step 4: Configure a pipeline in Serverless Application Center

The first deployment of the created application may fail. You must modify build and deployment tasks of the pipeline so that the build operation can be completed as expected. For more information about pipelines and how to use pipeline, see Terms and Manage pipelines.

On the details page of the application, click the Pipeline Management tab. In the Pipeline Details section, modify the YAML file and click Save. The following modifications are made on the YAML file in this example:

  • Use the pipeline plug-in to initialize Serverless Devs and pull code.

  • Use runtime-setup to specify the version of the build tool. For more information about how to query versions of the build tool, see the Confirm the version of your build tool section of this topic.

  • Use the Object Storage Service (OSS) cache plug-in to configure a cache path and accelerate npm build.

  • Use the prepared build commands to build the code.zip package. For more information about how to obtain build commands, see the Prepare build commands section of this topic.

  • Use the build plug-in to deploy resources.

image.png

Step 5: Use Git pushes to verify whether continuous deployment can be implemented

Push the modified code to the master branch of the code repository to trigger the pipeline and automatically deploy it to Function Compute.

  • On the Pipeline Management tab, you can view the execution details in the Pipeline Execution History section.

    image.png

  • You can click a function resource that is deployed by using Serverless Application Center to view updates of function code.

    Note

    For code that does not support online editing, you cannot view updates of the function code.

    In the Resource Information section of the Environment Details tab, click the function that you want to manage. Choose the Code tab of the Function Details tab, you can view updated code that is pushed by Git.

References