El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

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
Help Center/ CodeArts Pipeline/ Best Practices/ Configuring Pass Conditions for Automated Code Checks

Configuring Pass Conditions for Automated Code Checks

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

Overview

Traditional software quality relies mainly on manual tests, leading to low efficiency.

CodeArts Pipeline uses pass conditions to control whether a pipeline can proceed to the next stage. You can apply policies to pipelines as pass conditions for efficient project management and high-quality delivery.

With CodeArts Pipeline, more than 70% issues can be intercepted through automated code checks. This improves test efficiency and software quality.

Procedure

The following describes how to configure code check thresholds and apply pass conditions to a stage for automated check.

Figure 1 Pipeline workflow

Perform the following procedure.

Table 1 Procedure

Step

Description

Create a rule and configure thresholds

Create a rule of the code check type and configure thresholds for the rule.

Create a policy and add the rule to the policy

Add the preceding code check rule to the created policy.

Configure a pipeline

Add the preceding policy to the pass conditions.

Execute the pipeline

Execute the pipeline:

  • If the code check job meets the pass conditions, the pipeline will continue to run.
  • If the code check job does not meet the pass conditions, the pipeline will stop running.

Preparations

  • You have created a project. The following uses a Scrum project named Project01 as an example.
  • You have created a code repository. The following uses a repository named Repo01 (created using the Java Maven Demo template) as an example.

    A code check task with the same name as the code repository is automatically created. Change the task name to CheckTask01 by referring to Configuring Basic Info.

  • You have created a build task with the Repo01 repository. The following uses a build task (created using the Maven template) named BuildTask01 as an example.
  • You have created a pipeline with the Repo01 repository. The following uses a pipeline named Pipeline01 (created using the blank template) as an example.

Step 1: Create a Rule and Configure Thresholds

  1. Log in to the Huawei Cloud console.
  2. Click in the upper left corner of the page and choose Developer Services > CodeArts Pipeline from the service list.
  3. Click Access Service.
  4. Click the avatar icon in the upper right corner and choose All Account Settings from the drop-down list.
  5. In the navigation pane on the left, choose Policy Management > Rules.
  6. Click Create Rule. On the displayed page, configure parameters.

    Figure 2 Creating a rule
    Table 2 Rule parameters

    Parameter

    Description

    Name

    Enter a rule name, such as Check_code.

    Type

    Select the rule type Check.

    Extension

    Select the extension Check.

    Version

    Select the version 0.0.1.

    Threshold Configuration

    The extension thresholds are automatically filled based on the selected extension version. You can use the default values.

  7. Click OK.

Step 2: Create a Policy and Add a Rule to the Policy

There are tenant-level policies and project-level policies. Tenant-level policies can be applied to pipelines of all projects under the current tenant, while project-level policies can be applied to all pipelines under the current project. The following uses a tenant-level policy as an example.

  1. In the navigation pane on the left, choose Policies.

    NOTE:

    A system policy exists by default. You can view and use the policy, but cannot edit or delete it.

  2. Click Create Policy. On the displayed page, enter a policy name and select the rule created in Step 1: Create a Rule and Configure Thresholds.

    Figure 3 Creating a policy

  3. Click OK.

Step 3: Configure a Pipeline

  1. On the top navigation bar, click Homepage.
  2. Search for the project created in Preparations and access the project.
  3. In the navigation pane on the left, choose CICD > Pipeline.
  4. Search for the pipeline created in Preparations, click in the Operation column, and select Edit. The Task Orchestration page is displayed.
  5. Click under Stage_1, add the code check job created in Preparations, and set Check Mode to Full.

    Figure 4 Adding a code check job

  6. Click under Stage_1, on the displayed window, add Pass-Conditions-of-Standard-Policies, and select the policy created in Step 2: Create a Policy and Add a Rule to the Policy.

    Figure 5 Adding pass conditions

  7. Click or to add a new stage for the pipeline, add the build job created in Preparations, and select the associated repository for the build job.

    Figure 6 Adding a build job

Step 4: Execute the Pipeline

  1. After configuring the pipeline, click Save and Execute.
  2. Check the execution result.

    • If the code check job meets the pass conditions, the pipeline will proceed to the next stage, as shown in the following figure.
      Figure 7 Executing a pipeline
    • If the code check job does not meet the pass conditions, the pipeline will stop running, as shown in the following figure. You can click the pass conditions card to check details.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback