Creating a Build Task with Code
CodeArts Build allows you to define your build as code using YAML. Your configurations, such as build environments, parameters, commands, and actions, reside in a YAML file named build.yml. After creating this file, add it along with the source code to a code repository. The file will be used as a script by the system to run a build.
Constraints
You can only use the code hosted in CodeArts Repo for code-based builds.
Preparations
- Obtain permissions for CodeArts Repo. For details, see Granting Permissions for Using CodeArts Repo.
- Create a CodeArts project by referring to CodeArts User Guide > "Preparations" > "Creating a Project".
If you already have a project available, skip this step.
Creating a YAML File for Your Code-based Build
- Access the CodeArts Build homepage from the project list.
- In the navigation pane, choose Creating a Custom Repository. . Create a code repository by referring to
- Click the repository name. On the displayed page, choose Create > Create Directory and name the directory .cloudbuild.
- In the .cloudbuild directory, choose to create a file named build.yml. Figure 1 shows the directory that stores files of the code repository.
If the YAML file is not stored in the .cloudbuild directory, you can use parameter CB_BUILD_YAML_PATH to specify the path of the YAML file in the code repository. For details about parameter settings, see Adding Custom Parameters.
- Click
and write the build.yml file by referring to the sample code in Crafting Your build.xml for a Single Task or Crafting Your build.xml for Multiple Tasks.
Configuring Basic Information
- In the navigation pane, choose .
- Click Create Task. On the displayed page, configure the basic information of the build task by referring to Table 1.
Table 1 Basic information Parameter
Description
Name
Assign a custom name to the build task.
- Letters, digits, underscores (_), and hyphens (-) allowed.
- 1 to 115 characters.
Project
Select the project to which the build task belongs.
- This parameter is autofilled when you access CodeArts Build through the project list, so you can leave it as default.
- When accessing the service through the service homepage, select the project created in preparations.
Code Source
If you select Repo, code is pulled from CodeArts Repo for your build.
Repository
Select the repository from where the code to be compiled is pulled.
Default Branch
Select a default branch.
Description
Optional. Enter additional information to describe the build task. Max. 512 characters.
- Click Next. The page for selecting a build template is displayed.
Selecting a Build Template
Configuring Build Actions
In the upper left corner of the Build Actions page, click the Code tab. The system automatically reads the YAML file from the code repository and the branch configured in basic information.
You can modify the YAML file by referring to the sample code in sections "Performing Basic Configurations" and "Configuring Build Actions" of Configuring a Build Task. Any changes made to the YAML file will overwrite the original YAML file you create for your code-based build once the build task is completed.
Complete all the configurations and click Save to create a build task. The new task will be displayed on the build task list.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot