Custom Buttons
Supports configuring custom buttons on the page, to trigger the execution of CI pipelines (only supports triggering web_trigger events). Supports entering environment variables on the page
Currently, only supports configuring custom buttons on the branch details page.
# Custom Button Configuration
Add a .cnb/web_trigger.yml
file in the root directory of the repository to configure custom buttons.
# .cnb/web_trigger.yml
branch:
# The following buttons will be displayed on the branch details page with branch names starting with release
- reg: "^release"
buttons:
- name: Button Name 1
# If there is any, it will be used as the pipeline title; otherwise, the pipeline will use the default title.
description: Button Description
event: web_trigger_one # Triggered CI event name
# Environment variables
env:
a: 1
b: 2
# Manually input environment variables, which can override the above env variable configuration
inputs:
# Currently supports the following three formats: input box (input), multiline text input box (textarea), dropdown selection box (select)
var1:
# Input box
description: Input Variable 1
required: true # Whether it is required
type: input
default: Default Value 1
var2:
# Input box
description: Input Variable 2
required: true
type: textarea
default: Default Value 2
var3:
# Dropdown selection box
description: Input Variable 3
required: false
type: select
default: Default Value 3
options:
- name: Option 1
value: value1
- name: Option 2
value: value2
# The following buttons will be displayed on the branch details page with branch names starting with dev
- reg: "^dev"
buttons:
- name: Button Name 2
description: Button Description
event: web_trigger_two
- name: Button Name 3
description: Button Description
event: web_trigger_three
# The following custom buttons will be displayed on all branch details pages
- buttons:
- name: Button Name 4
description: Button Description
event: web_trigger_four
Currently, only supports configuring custom buttons on the branch details page.
The key value in yaml is branch
, and the value is an array format. The array element definition is as follows:
reg
:Optional
,String
, regular expression, used to match the branch name (only branches that match will display the custom buttons configured bybuttons
). If not filled, it matches all branches.buttons
:Required
,Array<Button>
, custom button definition.Button
type definition is as follows:name
:Required
,String
, custom button namedescription
:Optional
,String
, button description. If there is any, it will be used as the pipeline title; otherwise, the pipeline will use the default title.event
:Required
,String
, event nameenv
:Optional
,Object< String, String>
, environment variables passed to the web_trigger event pipelineinputs
:Optional
,Object<String, Input>
, manually input environment variables. The key value of the object is the variable name, and theInput
type definition is as follows:description
:Optional
,String
, description informationrequired
:Optional
,Boolean
, whether it is requiredtype
:Optional
,String
, input box type, optionalinput
、textarea
、select
, default is inputdefault
:Optional
,String
, default valueoptions
:Optional
,Array<Option>
, dropdown box options when type: select.Option
type definition is as follows:name
:Required
,String
, option namevalue
:Required
,String
, option value, used as the environment variable value
# Custom web_trigger Pipeline
The custom buttons in .cnb/web_trigger.yml
only support triggering web_trigger events.
The web_trigger event pipeline is configured in .cnb.yml
.
# .cnb.yml
# Match branch names starting with release
release*:
# Custom button triggered events
web_trigger_one:
- stages:
- name: Output Environment Variables
script:
- echo $a
- echo $b
- echo $var1
- echo $var2
- echo $var3
# Match branch names starting with dev
dev*:
web_trigger_two:
- stages:
- name: Execute Task
script: echo "job"
web_trigger_three:
- stages:
- name: Execute Task
script: echo "job"
# Match all branch names
"**":
web_trigger_four:
- stages:
- name: Execute Task
script: echo "job"
# Permission Description
Only users with repository write permission can click custom buttons to execute web_trigger pipelines.