Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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
Situation Awareness
Managed Threat Detection
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 Project-Level Commit Rules

Updated on 2024-12-12 GMT+08:00

Overview of Commit Rules

CodeArts Repo supports verification and restriction rules for high-quality code commits.

The following describes how to configure project-level commit rules and use common regular expressions.

Configuring Project-Level Commit Rules

On the CodeArts Repo homepage, go to the project homepage, choose Settings > Policy Settings > Commit Rules, and click Create Commit Rule. For details, see Table 1.

Table 1 Parameters for project-level commit rules

Parameter

Description

Rule Name

Mandatory. Custom rule name.

Branch

Enter a complete rule name or create a regular expression. This parameter is mandatory. The input needs to be verified, including the branch name and regular expression.

Commit Rule

Optional.

  • Commit Message Match: This parameter is empty by default. If left blank, all messages can be committed. Every commit message that matches the regex can be committed. You can also set that the committed information must contain the work item number to implement E2E code tracing with max. 500 characters.
  • Commit Message Negative Match: This parameter is empty by default. If left blank, all messages can be committed. Every commit message that matches the regex provided in it, will be rejected with max. 500 characters.
  • Commit Author: This parameter is left empty by default, indicating that the commit author is not verified, and any parameter can be committed. This field supports a maximum of 200 characters.

    The commit author can run the git config -l command to view the value of user.name and run the git config --global user.name command to set the value of user.name.

    Example:

    Rules for setting the commit author: ([a-z][A-Z]{3})([0-9]{1,9})
  • Commit Author's Email: This parameter is left empty by default, indicating that the commit author email is not verified, and any parameter can be committed. This field supports a maximum of 200 characters.

    The commit author can run the git config -l command to view the value of user.email and run the git config --global user.email command to set the email address.

    Example:

    Commit author's email: @my-company.com$

Basic Attributes

Optional.

  • File Name That Cannot Be Changed: This parameter is left empty by default, indicating that a file with any name can be committed. You are advised to use standard regular expressions to match the file name. By default, the file path is verified based on the file name rule. This field supports a maximum of 2,000 characters.

    Example:

    File name that cannot be changed: (\.jar|\.exe)$
  • Each File Size (MB): The default value is 50, indicating that the push is rejected if the size of the added or updated file exceeds 50 MB.
NOTE:

When a repository is created, the max. size of a single file in the default commit rule is 50 MB for recommendation. The max. file size is 200 MB.

Binary Rules

Optional.

This is not selected by default. Do not allow new binary files (privileged users excepted) is selected by default. After Allow changes to binary files is selected, binary files in the modify state will not be intercepted and can be directly uploaded. Binary files can be deleted without binary check.

  • Do not allow new binary files (privileged users excepted)
  • Allow changes to binary files (privileged users excepted)
  • Repo File Whitelist (files that can be directly imported to the database. This field supports a maximum of 2,000 characters.)
  • Privileged Users (Max. 50 privileged users.)
    NOTE:

    If the privileged user is not a repository member, the system displays a message indicating that the privileged user fails to be verified when you click Save. In this case, remove the privileged user to save the information.

Effective Date

Optional.

Before being committed, all commits created after the effective date must match the hook settings. If this parameter is left empty, all commits are checked regardless of the commit date.

Common Regular Expression Examples

Common regular expression examples are listed below.

Table 2 Examples

Rule

Example

Single a, b, or c

[abc]

Characters other than a, b, or c

[^abc]

Lowercase letters ranging from a to z

[a-z]

Characters other than the range of a to z

[^a-z]

Uppercase and lowercase letters in the range of a to z or A to Z

[a-zA-Z]

Any single character

.

Either a or b

a|b

Any blank character

\s

Non-blank character

\S

Arabic numeral character

\d

Non-Arabic numeral characters

\D

Letters, digits, or underscores (_)

\w

Characters other than letters, digits, or underscores (_)

\W

Match the content in parentheses (not capture)

(?:...)

Match and capture the content in parentheses

(...)

No or one a

a?

No or more a's

a*

One or more a's

a+

Three a's

a{3}

More than three a's

a{3,}

3 to 6 a's

a{3,6}

Beginning of text

^

End of text

$

Word boundary

\b

Non-word boundary

\B

Line breaker

\n

Carriage return character

\r

Tab key

\t

Null string

\0

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback