หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Configuring the Code Download

Updated on 2025-01-03 GMT+08:00

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.

Table 1 Parameters for configuring the code download

Parameter

Description

Specify Repository Tag or Commit ID

Specify whether to specify a tag or a commit ID when running a build task.

  • Do Not specify: All code is pulled for your build.
  • Tag: Only the code with the specified tag is pulled for your build. When you run the build task, a dialog box will appear prompting you to enter a tag.

    A tag marks a point in a code repository. If you select Repo as the code source, you can create a tag by referring to Managing Tags. When using a third-party code repository as the source, you need to create a tag within that repository.

  • Commit ID: Only the code with the specified commit ID is pulled for your build. When you run the build task, a dialog box will appear prompting you to enter a commit ID.

    A commit ID is the number generated when the code is committed. For example, the commit ID in a CodeArts Repo repository is shown in Figure 1.

    Figure 1 Commit ID

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 Configuring a Submodule.

  • Enabled: If the code repository contains submodules, the system automatically pulls the code from the submodule repository during a build.
  • Disabled: The system does not automatically pull the code of the submodule repository.

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
Table 2 Parameters in the sample code for downloading a single repository

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.

  • true: Pull.
  • false: Do not pull.

The default value is false.

lfs

Bool

Optional. Specify whether to enable Git LFS.

  • true: Enable.
  • false: Disable.

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}"
Table 3 Parameters in the sample code for downloading multiple repositories via Manifest

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.

NOTE:
  1. The repositories defined in manifest_file must be of the same code source.
  2. 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.
  3. 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).
  4. If the optional parameters mentioned above are left empty, default values will be used.
  5. When using private repositories, you are advised to configure the username and password using private build parameters. For details, see Configuring Parameters.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback