Plugin configuration specification
1 Description
Each plugin has a description file named task.json Input fields, output fields, and startup commands are described by the developer in task.json
describing the input fields, the purpose of which is to allow the user to configure custom parameter values when programming the pipeline.
description of the output field, which is intended to allow the user to understand the plugin output for use in downstream steps when programming the pipeline
description of the start command, which is intended to let bkci know how to start the plugin execution
The description file (task.json) is stored in the root of the plugin codebase
The content of the description file (task.json) is formatted as json
2 task.json data structure details
The overall structure is as follows
Detailed explanation of each configuration item
atomCode
A unique identifier for the plugin, consisting of a letter of the alphabet, consistent with the identifier specified during plugin initialization
The value format is a string
execution
Configuration related to the execution command entry
The value format is an object.
The value object includes the following attributes.
Attribute Name | Attribute Description | Format | Remarks |
---|---|---|---|
packagePath | The relative path of the plugin execution package in the release package | string | required, including the execution package name, the execution package will be found according to this configuration when the release package is downloaded and unpacked |
language | development language | string | required, such as python, java, etc., and the language specified when the plugin is initialized |
demands | dependencies | array | optional |
target | execution portal | string | required, usually a command line executable |
inputGroups
Input field grouping, optional, after setting, can display input fields by group, support expand by group put away
The value format is array.
Multiple groups can be set, each group uses an object to describe, including the following attributes.
Property Name | Property Description | Format | Remarks |
---|---|---|---|
name | groupName | string | required, configured in the groupName of the input field, identifies the group to which the field belongs |
label | groupName | String | Required, the name of the group that the user sees directly |
input
Input field definition
Value formatted as an object
One or more input fields can be configured
Each input field is identified as a key and the value as an object
System supports the following UI components
Component type | Component name | Remarks | Description of the value obtained by the plugin backend during execution |
---|---|---|---|
vuex-input | single-line textbox | string | |
vuex-textarea | multi-line textbox | string | |
atom-ace-editor | code edit box | string | |
selector | drop-down box | selectable, not input | string |
select-input | The input value can be a value that is not in the drop-down list (including variables), and the id that is seen in the box when selected | string | |
devops-select | select-input | The input value can only be a variable, after checking the box you will see the name | string |
atom-checkbox-list | checkbox list | strings, e.g. ["id1", "id2" ] | |
atom-checkbox | checkbox (boolean) | string | |
enum-input | single-select | string | |
cron-timer | time picker | string | |
time-picker | date picker | string | |
user-input | Person Name Selector | string | |
tips | hints | support dynamic preview of user input parameters, support hyperlinks | string |
parameter | Indefinite parameter list | Parameter list support from interface | string |
dynamic-parameter | variable-parameter | support for getting from the interface, support for multiple columns per row, support for dynamic addition and deletion | string |
If the above components do not meet your needs, please contact bkci customer service.
Each input field configuration supports the following public attributes
Property Name | Property Description | Configuration Format | Remarks |
---|---|---|---|
label | Chinese name | string | used for display, null allowed (in combination with other fields in the scenario) |
type | component type | string | required, the platform provides common input components, according to different components have different display |
default | default value | default value format varies by component | Not required |
placeholder | placeholder | string | Not required |
groupName | groupName | string | Not required, the name of the inputGroups defined in the |
desc | fieldDescription | string | Not required, field description, support for \r\n line feeds |
required | required | boolean | Not required |
disabled | editable | boolean | Not required |
isSensitive | isSensitive | boolean | Not required, sensitive information in the log will not be displayed in plain text |
rely | Show/hide current fields based on conditions | object | Not required |
rule | Value validity limit | 0 | Not required The following attributes are supported: alpha: English characters only, Boolean, true/false numeric: Only numeric, Boolean, true/false is allowed alpha_dash: The value can contain English, digits, underscores (_), hyphens (-), Boolean, true, or false alpha_num: Can contain English and numeric, Boolean, true/false max: indicates the maximum length of a string, int min: The minimum length of a string, int regex: a string of regular expressions |
rule configuration example:
Has personalized properties for different types of components
1. Single line text box: type=vuex-input
Component properties.
inputType: used when the input string is desired to be displayed as*******, the value is password
Example.
Configuration
2. Checkbox (boolean): type = atom-checkbox
Component properties.
text: At this point the label can be set to empty, the corresponding value is true/false
Example.
Configuration
3、Dropdown box/enterable dropdown box:type = selector/select-input/devops-select
Component Properties:
optionsConf:drop-down box property configuration
bkci-Service links, you can use the browser developer assistant to grab, commonly used links are as follows:
ticket: /ticket/api/user/credentials/{projectId}/hasPermissionList?permission=USE&page=1&pageSize=100&credentialTypes=USERNAME_PASSWORD
credentialTypes CredentialType
code-base:/repository/api/user/repositories/{projectId}/hasPermissionList?permission=USE&repositoryType=CODE_GIT&page=1&pageSize=5000
repositoryType ScmType
node:/environment/api/user/envnode/{projectId}/listUsableServerNodes?page=1&pageSize=100
options:Drop-down list item definition
4、Single choice: type = enum-input
Component Properties:
list
5. Date picker: type=time-picker
Component properties.
startDate: timestamp, milliseconds, start date
endDate: timestamp, milliseconds, end date
showTime: boolean, whether to show the time
6. hint-message: tips
Component properties.
tipStr: tip message content template
Support {} reference to other variables of the current plugin
Support inserting hyperlinks
Example.
Example configuration.
7. Indefinite parameter list: parameter
Component properties.
paramType: data dynamically obtained from the link or from the definition of the list, optional values are: url, list
url: paramType=url when configuring the link
urlQuery: value for the object, url parameter settings such as: {"param1": "", "param2": ""} param1, param2 can be other parameters of the current plug-in, the implementation will automatically replace the value
parameters: a list of parameters, you can define one or more parameters Each parameter contains the following properties
Property Name Property Description Format Remarks id
the unique identifier of the row
string
the unique identifier of the row
key
the value of key
string
the key of the row's parameter
keyType
the type of key
string
optional values for input, select
keyListType
type of key data source
string
valid when keyType=select, optional values are url, list
keyUrl
string
valid when keyListType=url
keyList
list
keyListType=list, example: [ { id: 'id', name: 'name' } \ ], id is the specific value of the key
keyDisable
whether to edit
boolean
true, false
keyMultiple
whether multi-selectable
boolean
true, false
value
the value of the value
string
the value of the line parameter
valueType
the type of value
string
optional values for input, select
valueListType
type of value data source
string
valid when valueType=select, optional values are url, list
valueUrl
string
valid if valueListType=url
valueList
list
valueListType=list, example: [ { id: 'id', name: 'name' } \ ], id is the specific value of value
valueDisable
whether to edit
boolean
true, false
valueMultiple
whether multi-selectable
boolean
true, false
8、Checkbox list: type=atom-checkbox-list
组件属性:
list
9. Code edit box: atom-ace-editor
Component properties.
bashConf
lang
10. Person name selector: user-input
Component properties.
inputType: the type of data that can be entered, the optional values are email , rtx , all
11, dynamic-parameter component: dynamic-parameter
Component properties
Example of data passed to the plugin backend during execution.
[{"id":"parameterId","values":[{"id":123,"value":"3d029fbe08c011e99792fa163e50f2b5,${abc}"},{"id":1233,"value":"ab"},{"id":1235,"value":"id"}]}]
12、Simplified version of dynamic-parameter component: dynamic-parameter-simple
Component Properties
Property Name | Property Description | Required | Format | Remarks |
---|---|---|---|---|
rowAttributes[N].id | The unique ID of the attribute, | Required | Yes | String |
type | optional: ["input", "select"] | yes | String | When using "select", the rowAttributes[N].options item is required |
rowAttributes[N].options | Dropdown box options on the page | Yes | Array Of Instance Option | when rowAttributes[N].type is "select". |
rowAttributes[N].options[M].name | The value to display on the page | When rowAttributes[N].type is "select", then yes | String | |
id | the actual selected value | when rowAttributes[N].types is "select", then yes | String |
demo
Features supported by ####
Show/hide the current field based on conditions
Example configuration.
output
Output field definition
Value formatted as an object
One or more output fields can be configured
Each output field has an English identifier of key and a value of object
Each output field definition contains the following attributes.
Property Name | Property Description | Format | Remarks |
---|---|---|---|
type | The type of the output field | string | Required. The following three types are supported: string: String artifact: Output file, which will be automatically archived to the repository report: Custom report html, which will be automatically stored and rendered in the output report screen |
description | description | string | not required, description |
isSensitive | isSensitive | isBoolean | non-required, whether is sensitive information |
3. Input component configuration example
vuex-input
Person Name Selector
atom-checkbox
selector/select-input/devops-select
The list of options is configured in task.json
The list of options is obtained from the interface
Configuration specification: specified by optionsConf's url, paramId, paramName, dataPath
The url supports two types.
bkci built-in services
Third-party API for accessing the BK Gateway
url return specification: return json format data
status: whether the operation is successful, 0 success, non-0 failure
data: option list data. Support specifying the path, such as data.detail.list
optionId and optionName fields in data are not mandatory, they correspond to the paramId and paramName in the configuration.
message: error message when status is not 0
demo
atom-checkbox-list Checkbox list
time-picker date picker
tips tips message
parameter indefinite parameter list
enum-input single-select radio
4. Field show/hide configuration based on conditions
Specified by the rely attribute in the input field definition. rely has two attributes.
operation: the relationship between multiple conditions, with, or, or not
expression: conditional expression
The operation field supports three values.
AND
OR
NOT
Exact match is supported, when the expression attribute is
key: the English name of the field
value: field value
Supports regularity, where the expression attribute is
key: English name of the field
regex: regular expression
Example.
Show the current field when the value of inputField_1 is true and the value of inputField_2 ends with .apk, otherwise hide the current field
Last updated