This topic shows you how to use a GitHub or Gitee code repository to implement a continuous integration or continuous delivery (CI/CD) deployment on a template-based application in the Function Compute console.

Prerequisites

The following services are activated:

Procedure

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Application Center. In the Application Templates section of the Application Center page, move the pointer over the template based on which you want to deploy an application and click Configure and Deploy.
  4. On the Create Template Application page, set the parameters as required and click Deploy.
    CICD

    The following section describes the parameters:

    • Application Name: the name of the application.
    • Deployment Method: the method in which the application is to be deployed. Set the parameter to Deploy from Code Repository and select a code repository type.
      Notice
      • When you use GitHub or Gitee to deploy an application in the Function Compute console for the first time, you must authorize Function Compute to manage your code repository that is hosted on GitHub or Gitee. After you select a code repository type, the authorization page appears. Complete the authorization as prompted.
      • To use Apsara Devops to implement the CI/CD deployment, you must manually configure a code repository and a pipeline. For more information, see Use Apsara Devops Flow 2020 to deploy a function.
      • Parameters that you need to set vary between application templates. Set the parameters based on the actual interface.
      • Code Repository Name: the name of the code repository that is used to deploy the application.
      • Private Repository: specifies whether the code repository is visible to other users. If you select Private Repository, the code repository is visible only to you.
      • CI/CD Tool: the tool that is used for the CI/CD deployment. To use Apsara Devops to implement the CI/CD deployment, you must manually configure a code repository and a pipeline. For more information, see Use Apsara Devops Flow 2020 to deploy a function.
  5. Create secrets or environment variables for your code repository to complete the CI/CD deployment.
    • GitHub
      1. Log on to GitHub.
      2. Go to the details page of the code repository that you use and click the Settings tab.
      3. In the left-side navigation pane of the Settings tab, click Secrets.
      4. In the upper-right corner of the Actions secrets page, click New repository secret.
      5. Set the parameters for creating a secret and click Add secret.Github

        Create the following secrets as instructed:

        • ALIYUN_ACCESS_KEY_ID: the AccessKey ID of the Alibaba Cloud account or RAM user that you use.
        • ALIYUN_ACCESS_KEY_SECRET: the AccessKey secret of the Alibaba Cloud account or RAM user that you use.
        • ALIYUN_ACCOUNT_ID: the ID of the Alibaba Cloud account that you use. If you use a RAM user, specify the ID of the Alibaba Cloud account to which the RAM user belongs.

What to do next

After the application is deployed, you can view the overview, events, monitoring data, and resources of the application in the Function Compute console. For more information, see Manage web applications.