Updated on 2025-12-10 GMT+08:00

Preparing an Environment

This section uses a Linux host as an example to describe how to set up a function CI/CD environment using KooCLI and CodeArts.

ECS

This server functions as a CodeArts task deployment host to deploy and update FunctionGraph functions.

  • Specifications: 1 vCPU | 1 GiB
  • Image: CentOS 8.2 64 bits
  • Other: Configure an EIP because you will need to install the Python library and CodeArts and configure the ECS as a deployment host.
  • CodeArts uses this server as a deployment host through port 22 over SSH. For high security, add the following IP addresses to the security group of the server. Otherwise, authorization will fail.

    42.202.130.147

    49.4.3.11

    122.112.212.206

    139.159.226.153

    49.4.85.127

    124.70.46.237

Configuring a Security Group for the Deployment Host

  1. Go to the Create IP Address Group page.
  2. Set the parameters as prompted. For details about the parameters, see Creating an IP Address Group . Then, click Create Now.
    • Name: Enter ipGroup-clouddeploy.
    • IP Address:
      42.202.130.147
      49.4.3.11
      122.112.212.206
      139.159.226.153
      49.4.85.127
      124.70.46.237
  3. Return to the network console, choose Access Control > Security Groups in the navigation pane on the left, and click Create Security Group. For details about how to configure a security group, see Creating a Security Group. Then click Create Now.
    • Name: Enter functions-deploy.
    • Enterprise Project: Enter default.
  4. Go to the details page of functions-deploy, click the Inbound Rules tab, and click Add Rule to add an inbound rule.

    Set Priority to 1, Protocol & Port to 22, and Source to the IP address group ipGroup-clouddeploy. Then click OK.

    Figure 1 Adding an inbound rule
  5. Return to the ECS console, click the ECS name, and change the security group to functions-deploy.

Installing Python Libraries

Run the following commands to install the pyyaml and pycryptodome libraries: The two libraries will respectively parse the cam.yaml configuration file of your function and encrypts and decrypts the function's environment variables.

pip3 install pyyaml
pip3 install pycryptodome

Installing KooCLI

  1. Install KooCLI.

    Remotely log in to the purchased ECS, and run the following command to install KooCLI:

    curl -sSL https://ap-southeast-3-hwcloudcli.obs.ap-southeast-3.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh
    Figure 2 Installing KooCLI
  1. Initialize KooCLI.

    Run the following command to initialize KooCLI:

    hcloud configure init

    Enter an access key ID (AK), secret access key (SK), and region name. For details about how to obtain them, see 3 and 4.

    Figure 3 Initializing KooCLI
  2. Obtain an access key (AK/SK).
    • If you have access to the console, log in, and create an access key on the My Credentials page. For details, see Creating an Access Key. An AK/SK file is downloaded. Generally, it is named credentials.csv. As shown in the following figure, the file contains a username, AK, and SK.
      Figure 4 Content of the credentials.csv file
    • If you do not have access to the console, request the administrator to create an access key for you on the IAM console in case your access key is lost or needs to be reset. For details, see Managing Access Keys for an IAM User.
  3. Obtain a region name.
    For details, see Regions and Endpoints.
    Figure 5 Obtaining region information