Configuring Code Download
In this action, you define how code is downloaded.
Graphical Build
You can specify a source version with a code repository tag or commit ID. Besides, you can enable auto update of submodules and Git Large File Storage (LFS) for your build.
The Configure Code Download action is preset on the GUI.
The parameters are described in the following table.
| Parameter | Description |
|---|---|
| Specify Repository Tag or Commit ID | Three options are available: Do not specify (do not specify a tag or a commit ID), Tag (specify a tag), and Commit ID (specify a commit ID). |
| Auto Update | Submodule is a concept of Git and is used to solve the problem that a code repository contains and uses the code repository of other projects. For details, see .
|
| Enable Git LFS | Determine whether to enable Git LFS to pull all files, including large files, such as audios, videos, and images, during a build. By default, these files are not pulled. |
Specifying a tag
A tag is associated with a code repository. If you select Repo as the code source, you can create a tag by referring to .
- When creating a build task, select Tag to use the code of a previous version.
- During task execution, a dialog box is displayed. Enter the tag and click Confirm to run the task.
Specifying a commit ID
A commit ID is the number generated when the code is committed.
In a build task, you can specify the commit ID to use the code of a previous version for building.
- Select Commit ID, enter the clone depth, and save the task.
The clone depth is the number of revisions of the repository that will be cloned. A larger value indicates a longer time for checking out the code. The clone depth must be a positive integer. The recommended maximum depth is 25.
For example, if Clone Depth is set to 5, you can set Commit ID to any of the previous five commits.
- Enter the commit ID and click Confirm to start the task.
Code-based Build (Downloading Code from a Single Repo)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | version: 2.0 # The value must be 2.0. steps: PRE_BUILD: - checkout: name: checkout inputs: scm: codehub # Code source: CodeArts Repo and open source url: xxxxxxxxx # SSH address for the URL to pull code branch: ${codeBranch} # Mandatory at any time and can be parameterized. commit: ${commitId} lfs: true submodule: true depth: 100 tag: ${tag} path: test |
The parameters are described in the following table.
| Parameter | Type | Description | Mandatory | Default Value |
|---|---|---|---|---|
| scm | String | Code source. Currently, only CodeArts Repo is supported. If this parameter is not configured in the YAML file, the code repository information configured in the build task is used. | No | codehub |
| url | String | SSH address for pulling code. | Yes | None |
| branch | String | Pulled code branch, which can be parameterized. | Yes | None |
| commit | String | Commit ID obtained during builds can be parameterized. | No | None |
| tag | String | Tag pulled during tag builds: It can be parameterized. If a commit ID and a tag exist at the same time, the build based on a commit ID is executed first. | No | None |
| depth | int | Shallow clone depth. When a commit ID is specified for builds, depth must be greater than or equal to the depth of the commit ID. | No | 1 |
| submodule | bool | Whether to pull the submodule. The options are true (pull) and false (not pull). | No | false |
| lfs | bool | Whether to enable Git LFS: If this parameter is set to true, Git LFS pull is executed. | No | false |
| path | String | Sub-path for cloning: The code is downloaded to the subpath. | No | None |
Code-based Build (Downloading Code from Multiple Repos via Manifest)
In scenarios such as Android and HarmonyOS, hundreds or even thousands of code repositories need to be integrated at the same time during one build. The efficiency of integrating and downloading multiple code repositories is critical.
CodeArts Build has integrated the Repo download tool. You only need to perform simple configurations to download multiple code repositories. Currently, CodeArts Repo and Gerrit are supported.
The following configurations are for your reference.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | version: 2.0 # The value must be 2.0. steps: PRE_BUILD: - manifest_checkout: name: "manifest" inputs: manifest_url: "https://example.example.example.example.example.com/xx/manifest.git" manifest_branch: "master" manifest_file: "default.xml" path: "dir/dir02" repo_url: "https://example.example.example.example.example.com/xx/git-repo.git" repo_branch: "master" username: "someone" password: "${PASSWD}" |
The parameters are described in the following table.
| Parameter | Type | Description | Mandatory | Default Value |
|---|---|---|---|---|
| name | String | Step name. | No. | manifest_checkout |
| manifest_url | String | Address of a Manifest repository that includes an XML file. | Yes | None |
| manifest_branch | String | A Manifest branch or revision. | No. | HEAD |
| manifest_file | String | Manifest file path. | No. | default.xml |
| path | String | Download path of all sub-repositories of the customized manifest file, which is the relative path of the working path. The path cannot start with a slash (/) and cannot contain any period (.). | No. | The default value is the working path. |
| repo_url | String | Repo repository address. | No. | |
| repo_branch | String | Repo repository branch. | No. | stable |
| username | String | Username for downloading the repository. | No. This parameter is mandatory when a non-public repository is downloaded. | None |
| password | String | HTTPS password used for downloading the repository. | No. This parameter is mandatory when a non-public repository is downloaded. | None |
- The repositories defined in manifest_file must be of the same code source.
- manifest_url and manifest_file must use the same code source. For private repositories, the account indicated by the username and password you use must have been granted the download permission.
- The repo repository corresponding to repo_url must have the download permission (the repository is open-source, or the repository is private but configured with an account and password).
- If the values of the preceding optional parameters are empty, the default values are used.
- When a non-public repository is used, configure the username and password using the private build parameters. For details, see (Optional) Configuring Build Task Parameters.
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