このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

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
On this page

on

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

Use on to specify events that automatically trigger a pipeline. These events include changing branches, files, and tags, and executing scheduled tasks.

on.<event_name>.types

Use on.<event_name>.types to specify the type of a merge request (MR) event that can trigger a pipeline.

Table 1 Merge request types

MR Type

Description

opened

An MR is created.

synchronize

The source branch is updated.

closed

An MR is merged.

reopened

An MR is reopened.

If you do not define a type, the pipeline will be triggered when an MR is opened, synchronized, or reopened. The following example shows the syntax for triggering a pipeline when an MR is closed.

1
2
3
4
on:
  pull_request:
    types:
      - closed

on.<pull_request>.<branches|branches-ignore>

Use the pull_request event to define a pipeline to run for MRs that target specific branches.

  • branches: Use branches to include specific branches, or both include and exclude specific branches.
  • branches-ignore: Use branches-ignore to exclude specific branches.
NOTE:

Do not use branches and branches-ignore for a pull_request event at the same time.

branches and branches-ignore support the use of glob patterns to match branch names.

Table 2 Matching characters

Character

Description

Example

*

Matches zero or more characters, except the slash (/).

dev*: matches dev and develop, but cannot match dev/test.

?

Matches one character.

dev?: matches dev1 and dev2, but cannot match dev12.

**

Matches zero or more characters.

dev**: matches dev, develop, and dev/test.

[]

Matches one character listed in or within the specified range in the brackets. Ranges only include a-z, A-Z, and 0-9.

  • v[a-z].[0-9]*: matches va.1, vb.111, and so on.
  • v[01]: matches v0 and v1.

{}

Matches strings listed in the parentheses.

{branch1,branch2}: matches branch1 and branch2.

!

It is at the start of a string, indicating that the subsequent characters are not matched.

!develop: matches all characters except develop.

Example

  • Including branches
    on:
      pull_request:
        branches:
          - master
          - 'release**'

    This example indicates that the pipeline would run when there is a pull_request event that targets the following branches:

    • a branch named master, or;
    • a branch whose name starts with release, for example, release, release-1.0.0, and release/1.0.0
  • Excluding branches
    on:
      pull_request:
        branches-ignore:
          - test
          - 'dev**'

    This example indicates that the pipeline would run when there is a pull_request event, unless the event targets the following branches:

    • a branch named test, or;
    • a branch whose name starts with dev, for example, dev, develop-1.0.0, and develop/1.0.0
  • Both including and excluding branches
    Use branches and an exclamation mark (!) to both include and exclude specific branches.
    on:
      pull_request:
        branches:
          - 'release**'
          - '!release/v1**'

    This example indicates that the pipeline would run when there is a pull_request event, and the event's targeting branches meet all of the following conditions:

    • a branch whose name starts with release, for example, release, release-1.0.0, and release/1.0.0.
    • a branch whose name does not start with release/v1/**, for example, release/v1, release/v1.0, and release/v1/1.0.

on.<push>.<branches|branches-ignore|tags|tags-ignore>

Use the push event to define a pipeline to run on specific branches or tags.

  • branches: Use branches to include specific branches, or both include and exclude specific branches.
  • branches-ignore: Use branches-ignore to exclude specific branches.
  • tags: Use tags to include specific tags, or both include and exclude specific tags.
  • tags-ignore: Use tags-ignore to exclude specific tags.
NOTE:
  • Do not use branches and branches-ignore for a push event at the same time.
  • Do not use tags and tags-ignore for a push event at the same time.

Example

  • Including branches/tags
    on:
      push:
        branches:
          - master
          - 'release**'
        tags:
          - v1
          - 'v2.*'

    This example indicates that the pipeline would run when there is a push event that targets the following branches and tags:

    • a branch named master, or;
    • a branch whose name starts with release, for example, release, release-1.0.0, and release/1.0.0
    • a tag named v1
    • a tag whose name starts with v2., for example, v2.1 and v2.1.1
  • Excluding branches/tags
    on:
      push:
        branches-ignore:
          - test
          - 'dev**'
        tags-ignore:
          - v1
          - 'v2.*'

    This example indicates that the pipeline would run when there is a push event, unless the event targets the following branches and tags:

    • a branch named test, or;
    • a branch whose name starts with dev, for example, dev, develop-1.0.0, and develop/1.0.0.
    • a tag named v1
    • a tag whose name starts with v2., for example, v2.1 and v2.1.1
  • Both including and excluding branches/tags
    Use branches, tags, and an exclamation mark (!) to both include and exclude specific branches and tags.
    on:
      push:
        branches:
          - 'release**'
          - '!release/v1**'
        tags:
          - 'v1**'
          - '!v1.1'

    This example indicates that the pipeline would run when there is a push event, and the event's targeting branches and tags meet all of the following conditions:

    • a branch whose name starts with release, for example, release, release-1.0.0, and release/1.0.0
    • a branch whose name does not start with release/v1/**, for example, release/v1, release/v1.0, and release/v1/1.0
    • a tag whose name starts with v1, for example, v1 and v1.2
    • a tag whose name is not v1.1

on.<push|pull_request>.<paths|paths-ignore>

Use the push and pull_request events to define a pipeline to run when specified files change.

  • paths: Use paths to include specific files or both include and exclude specific files.
  • paths-ignore: Use paths-ignore to exclude specific files.
NOTE:

Do not use paths and paths-ignore for push and pull_request events at the same time.

Example

  • Including files
    on:
      push:
        paths:
          - '**.java'

    This example indicates that the pipeline would run when you push a .java file.

  • Excluding files
    on:
      push:
        paths-ignore:
          - 'docs/**'

    This example indicates that the pipeline would run when there is a push event, unless all pushed files are in the docs directory.

  • Both including and excluding files

    Use paths and an exclamation mark (!) to both include and exclude specific files.

    on:
      push:
        paths:
          - 'src/**'
          - '!src/docs/**'

    This example indicates that the pipeline would run when the changed files are in the src directory or its subdirectories, but not in the src/docs directory.

on.schedule

Use on.schedule to schedule a pipeline to run at a specified UTC time by defining a cron expression. The pipeline will run based on the lasted scheduled task information. To update the scheduled task, edit YAML and save it. The default branch of the pipeline source is used.

on:
  schedule:
    - cron:  '0 0 12 * * ?'
    - cron:  '0 0 20 * * ?'

The above example indicates that the pipeline would run at 12:00 and 20:00 (UTC time) every day.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback