Configuring the Code Download
In this action, you set the download mode for pulling code from the repository during the build process.
Build on GUI
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. Set the parameters according to Table 1.
Parameter |
Description |
---|---|
Specify Repository Tag or Commit ID |
Specify whether to specify a tag or a commit ID when running a build task.
|
Clone Depth |
Optional. The clone depth is the number of recent commits that will be cloned. A larger value indicates more commits will be fetched. The clone depth must be a positive integer. The recommended maximum value is 25. For example, setting the clone depth to 5 instructs the system to fetch only the five most recent commits, but no earlier records. |
Auto Update |
A submodule is a Git tool used to manage shared repositories for higher team efficiency. Submodules allow you to keep a shared repository as a subdirectory of your repository. You can isolate and reuse repositories, and pull latest changes from or push commits to shared repositories. For details, see Submodules.
|
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. |
Build with Code (Downloading Code from a Single Repo)
Modify the code in the PRE_BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:
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 only url: xxxxxxxxx # This refers to the SSH address of the repository that the code is pulled from. branch: ${codeBranch} # Mandatory at any time and can be parameterized. commit: ${commitId} lfs: true submodule: true depth: 100 tag: ${tag} path: test |
Parameter |
Type |
Description |
---|---|---|
scm |
String |
Enter a 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 will be used. The default value is codehub. |
url |
String |
Enter the SSH address of the code repository from which the code will be pulled. |
branch |
String |
Specify the branch from which to pull the code. You can use ${codeBranch} to reference this parameter. |
commit |
String |
Optional. If needed, you can enter a commit ID to indicate the specific version of the source code to be pulled for your build. You can also use ${commitId} to reference this parameter. |
tag |
String |
Optional. If needed, you can enter a tag to indicate the specific version of the source code to be pulled for your build. You can also use ${tag} to reference this parameter. If you provide both the commit ID and tag, the build using the commit ID will be run first. |
depth |
Int |
Optional. 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. The default value is 1. |
submodule |
Bool |
Optional. Specify whether to pull the submodules.
The default value is false. |
lfs |
Bool |
Optional. Specify whether to enable Git LFS.
By default, CodeArts Build does not pull large files such as audios, videos, and images. You can enable Git LFS to pull all files. The default value is false. |
path |
String |
Optional. Sub-path for cloning: The code is downloaded to the sub-path. |
Build with Code (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 integrates the Repo download tool. You only need to perform simple configurations to download multiple code repositories. Currently, this feature only applies to CodeArts Repo repositories.
Modify the code in the PRE_BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:
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}" |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Optional. Enter the action name. The default value is manifest_checkout. |
manifest_url |
String |
Enter the address of a Manifest repository that includes an XML file. |
manifest_branch |
String |
Optional. Enter the Manifest branch or revision. The default value is HEAD. |
manifest_file |
String |
Optional. Manifest file path. The default value is default.xml. |
path |
String |
Optional. Download path of all sub-repositories of the custom Manifest file, which is the relative path of the working path. The path cannot start with a slash (/) and cannot contain any period (.). The default value is the working path. |
repo_url |
String |
Optional. Enter the address of the CodeArts Repo repository. The default value is https://gerrit.googlesource.com/git-repo. |
repo_branch |
String |
Optional. Enter the branch of the CodeArts Repo repository. The default value is stable. |
username |
String |
Optional. Enter the username used for downloading the repository. This parameter is mandatory for private repositories. |
password |
String |
Optional. Enter the HTTPS password used for downloading the repository. This parameter is mandatory for private repositories. |
- 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.
- You must have been granted the download permission for the CodeArts Repo repository specified by repo_url (the repository can either be open-source or private, but configured with account and password).
- If the optional parameters mentioned above are left empty, default values will be used.
- When using private repositories, you are advised to configure the username and password using private build parameters. For details, see Configuring 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