search for
Use the following command to search for Jenkins tasks:
jcli job search input
To find a specific type of Jenkins task, you can do so by filtering the value of the corresponding field. Below, an example of finding a parameterized task is given:
jcli job search --filter Parameterized=true
Wherein --filter
support any of the fields, it is judged whether the specified character string.
Construct
To trigger a task, you can use the following command:
jcli job build "jobName" -b
When you need to trigger a task build and wait for the corresponding task's build number, you can use the following command
(depending on the plugin pipeline-restful-api-plugin ):
jcli job build job/test -b --wait
Interactive input
Jenkins pipeline to execute input
the instruction, there will be prompt interactive input. Here is an example:
pipeline {
agent {
label 'master'
}
stages {
stage('sample') {
steps {
input 'test'
}
}
}
}
After the above pipeline operation, to perform input
the position and will block waiting for input, then the command can jcli job input test 1
be executed or interrupted so that continued.
edit
Currently, only pipelines saved in the form of scripts on Jenkins have editing function support. The command is very simple:jcli job edit test
If you want to quickly give a sample pipeline, when the pipeline script is empty, you can execute the command:jcli job edit test --sample
If you want to edit the pipeline and save and exit, you can directly trigger it by using the corresponding parameters:jcli job edit test --build
Disable
Disable task:jcli job disable job/test/
Enable task:jcli job enable job/test/
View log
You can refer to the execution log of a task with the following command:
jcli job log "jobName" -w
View history
jcli job history job/test/
Archive file
View archive file list jcli job artifact job/test/
Download archive file job artifact download /job/tsf/job/ddd/
Show specified column
When outputting in tabular form and hoping to output the specified fields as columns, we can achieve this in the following way:
jcli job search --columns Name,URL,Parameterized
Please note that the above parameter --columns
value is a comma (,) for the division.
If you do not want to output the header, you can add parameters:--no-headers
jcli job search --columns Name,URL,Parameterized --no-headers
Task type
List the task types currently supported by Jenkins jcli job type