Updated on 2026-02-11 GMT+08:00

Configuring the Build Environment

Configure a global runtime environment for the build task. There are two types of servers available: x86 and Arm (Kunpeng). For software running on different chip architectures, you need to select the corresponding hosts. For example, if your software is designed for Arm (Kunpeng) servers, select Arm (Kunpeng).

CodeArts Build also allows you to use custom executors, such as LINUX, LINUX_DOCKER, WINDOWS, and MAC (Linux, Linux Docker, Windows, and macOS executors). For build scenarios supported by these executors, see Table 1.
Table 1 Executor types and their description

Executor Type

Description

LINUX

LINUX_DOCKER

  • When you run the build task, CodeArts Build starts a Linux Docker container in which the task is run.
  • The entire build process runs in the container. Once the task is finished, the container automatically removes the build image, which includes the code pulled during the build, the process data, and the build products.
  • You can configure the mapping between the host directory and container directory to share the host directory in the image.
  • The following build actions are unavailable: Download File from File Manager, Building with Android, and Unit Test in Building with Maven.

WINDOWS

  • You will run build tasks on the Windows executor. This allows you to execute Windows-related build tasks.
  • You can use Git Bash to run the shell script for your build.
  • Only the following build actions are available: Running Shell Commands, Uploading a Software Package to Release Repos, and Downloading a Package from Release Repos.
  • You can use Windows 7, Windows 10, Windows Server 2012, or Windows Server 2016.
  • Before customizing a Windows executor, ensure that you have installed the JDK and Git.
  • Install the compilation tool. For example, install Maven if you will use it for your build.

MAC

Constraints

When building with YAML, you have an available environment with custom executors.

Build on GUI

  1. Access the CodeArts Build homepage from the project page.
  2. On the CodeArts Build homepage, search for the target task and click its name. The build task configuration page is displayed.

    CodeArts Build presets the Configure Build Environment action. Set the parameters according to Table 2.

    Table 2 Build environment parameters

    Parameter

    Description

    Environment

    x86/Arm (Kunpeng) server

    NOTE:

    Select the appropriate type of host you intend to use for software running on different chipset architecture. For example, if your software is designed for Arm (Kunpeng) servers, select Arm (Kunpeng).

    Execution Host

    Select the compute resource used to run your build task. In CodeArts Build, virtual machines (VMs) are used. Execution hosts can be built-in or custom executors.

    • Default pools include execution hosts provided by CodeArts Build with out-of-the-box availability. The default executor specifications are 2 vCPUs and 8 GB memory.
    • Custom pools include compute resources provided by users. (For details, see Table 1.) They can be hosted in CodeArts Build after registration. CodeArts Build schedules these executors to execute build tasks.

    Select your desired pool. Custom agent pools include agents added by yourselves. For details, see Agent Pools.

    Mapping Between Host and Container Directories

    Set up the directory mapping between the custom executor and the container, and then you can mount files like dependencies from the custom executor to the container for your builds. (This parameter is mandatory when the execution host is set to Custom Pools.)

    If the Host Directory is set to /home and the Container Directory is set to /opt, then the content in the executor's local /home directory will be mounted to the /opt directory in the container.

Build with Code

Modify env settings in the YAML file by referring to the following sample code of build environment configurations.

1
2
3
4
5
6
7
version: 2.0 # The version number is required and must be set to 2.0.
env: # Optional. It defines the build environment. x86 is used by default if neither env or envs is set.
  resource:
    type: docker # Agent pool type. The value can be docker or custom. Set this value to docker to run your build on a default executor, or choose custom when using a custom executor.
    arch: X86 # The host type of the build environment can be x86 or Arm.
    class: 8U16G # Define the specification, which can be 2U8G (2 vCPUs | 8 GB), 4U8G (4 vCPUs | 8 GB), 8U16G (8 vCPUs | 16 GB), 16U32G (16 vCPUs | 32 GB), or 16U64G (16 vCPUs | 64 GB). This parameter is not required when type is set to custom.
    pool: Mydocker #Set the agent pool name. This parameter is required when type is set to custom.

Add the following code information to the YAML file for your code-based build by referring to the following sample code of BuildSpace.

You have an available environment with custom executors.

version: 2.0
buildspace: # BuildSpace is used.
  fixed: true
  path: kk  
  clean: true
  clean_exclude:
    - cache # Excluded path
    - aa # Excluded path
    - bb # Excluded path
Table 3 Parameters in the sample code of BuildSpace

Parameter

Type

Description

fixed

String

Optional. Set this parameter when you need a fixed directory for build executions.

In CodeArts Build, an empty path (for example, /devcloud/ws/sMMM/workspace/j_X/) is randomly assigned to a build task as the root directory by default. This directory is called a "BuildSpace". Even for build tasks in the same project, BuildSpaces are randomly assigned to them.

However, a fixed BuildSpace path is necessary in some scenarios. CodeArts Build allows users to configure BuildSpace to specify a fixed directory for a build.

  • true: A fixed path is used.
  • false: A random path is used.

The default value is false.

path

String

Optional. Set this parameter when you use a fixed directory for build executions.

The fixed path is in the following format: /devcloud/slavespace/usr1/+"${domainId}"+/. You can set the path parameter to add a path after the fixed path.

For example, if the path is set to kk, the fixed path is /devcloud/slavespace/usr1/+"${domainId}"+/kk.

clean

String

Optional. Set this parameter when you require the fixed path to be cleared.

  • true: The fixed path will be cleared. Files in the fixed path will be deleted each time the build task is complete.
  • false: The fixed path will not be cleared. When the total size of files reaches the maximum capacity of the workspace, you need to manually free up space by setting clean to true.
    NOTE:
    • If there is no clearance setting for the fixed path, all files within the current tenant's fixed path will be automatically deleted once the total file size reaches the upper limit of the workspace.
    • The workspace refers to the custom executor specification.

The default value is true.

clean_exclude

String

Optional. Set this parameter when you want to exclude a few paths from the cleanup of the fixed path.

Specify paths to exclude from the cleanup. Only level-1 folders in a fixed path can be specified.