Jenkins-cli基本用法
基本的格式为
|
java -jar jenkins-cli.jar [-s JENKINS_URL] command [options][args] |
下面具体介绍各个命令的作用及基本使用方法
1. help 查看所有内嵌命令的基本功能 无参数
|
Eg. java -jar jenkins-cli.jar -s http://22.11.140.38:9080/jenkins/ help |
2. build 执行一次构建
|
参数说明: JOB : Name of the job to build 要构建的job名称 -c : Check for SCM changes before starting the build, and if there's no change, exit without doing a build -p : Specify the build parameters in the key=value format. -r VAL : Number of times to retry reading of the output log if it does not exists on first attempt. Defaults to 0. Use with -v. -s : Wait until the completion/abortion of the command -v : Prints out the console output of the build. Use with -s -w : Wait until the start of the command --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
3. cancel-quiet-down: Cancel the effect of the "quiet-down" command.
4. clear-queue: Clears the build queue
5. connect-node: Reconnect to a node
6. console: Retrieves console output of a build 显示某job某次构建的的控制台输出
|
参数说明: JOB : Name of the job BUILD : Build number or permalink to point to the build. Defaults to the last build -f : If the build is in progress, stay around and append console output as it comes, like 'tail -f' -n N : Display the last N lines --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
7. copy-job: Copies a job
|
参数说明: SRC : Name of the job to copy DST : Name of the new job to be created. --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
8. create-job: Creates a new job by reading stdin as a configuration XML file.
从一个XML文档中创建一个job
|
Eg. java -jar /home/jboss/.jenkins/jenkins-cli.jar -s http://22.11.140.61:9080/jenkins/ create-job testttt |
9. create-node: Creates a new node by reading stdin as a XML configuration.
10. delete-builds: Deletes build record(s)
|
参数说明: JOB : Name of the job to build RANGE : Range of the build records to delete. 'N-M', 'N,M', or 'N' --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password Eg. java -jar /home/jboss/.jenkins/jenkins-cli.jar -s http://22.11.140.61:9080/jenkins/ delete-builds 3-5 |
11. delete-job
|
参数说明: NAME : Job name --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
12. delete-node Deletes a node
13. disable-job Disables a job 相当于“停止构建”
|
参数说明: NAME : Job name --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
14. disconnect-node Disconnects from a node
15. enable-job Enables a job 相当于恢复可构建状态
|
参数说明: NAME : Job name --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
16. get-job Dumps the job definition XML to stdout 得到job定义的XML文档
|
参数说明: JOB : Name of the job --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
17. get-node Dumps the node definition XML to stdout
18. groovy Executes the specified Groovy script.
19. groovysh Runs an interactive groovy shell.
20. help Lists all the available commands. 无参数
21. install-plugin Installs a plugin either from a file, an URL, or from update center. 安装插件
22. install-tool Performs automatic tool installation, and print its location to stdout. Can be only called from inside a build.
23. keep-build Mark the build to keep the build forever.
24. list-changes Dumps the changelog for the specified build(s).输出某一次或几次构建的变更记录
|
参数说明: JOB : Name of the job to build RANGE : Range of the build records to delete. 'N-M', 'N,M', or 'N' -format [XML | CSV | PLAIN] : Controls how the output from this command is printed. --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
25. list-jobs Lists all jobs in a specific view or item group.列出所有的jobs名称,其后可以接视图名称,默认显示全部
|
Eg. java -jar /home/jboss/.jenkins/jenkins-cli.jar -s http://22.11.140.61:9080/jenkins/ list-jobs viewname |
26. list-plugins Outputs a list of installed plugins. 列出安装的所有插件
27. login Saves the current credential to allow future commands to run without explicit credential information.保存登录状态
|
参数说明: --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
28. logout Deletes the credential stored with the login command. 注销
29. mail Reads stdin and sends that out as an e-mail.
30. offline-node Stop using a node for performing builds temporarily, until the next "online-node" command.
31. online-node Resume using a node for performing builds, to cancel out the earlier "offline-node" command.
32. quiet-down Quiet down Jenkins, in preparation for a restart. Don?. start any builds.
33. reload-configuration Discard all the loaded data in memory and reload everything from file system. Useful when you modified config files directly on disk.重新加载配置文件无参数
34. restart Restart Jenkins 重启Jenkins
35. safe-restart Safely restart Jenkins 安全重启Jenkins,即等待已有的构建完成再重启
36. safe-shutdown Puts Jenkins into the quiet mode, wait for existing builds to be completed, and then shut down Jenkins.安全关闭Jenkins
37. session-id Outputs the session ID, which changes every time Jenkins restarts
38. set-build-description Sets the description of a build.为已有构建添加描述
|
参数说明: JOB : Name of the job to build BUILD# : Number of the build DESCRIPTION : Description to be set. '=' to read from stdin. --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
39. set-build-display-name Sets the displayName of a build重命名默认的构建编号
|
参数说明: JOB : Name of the job to build BUILD# : Number of the build DISPLAYNAME : DisplayName to be set. '-' to read from stdin. --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
40. set-build-parameter Update/set the build parameter of the current build in progress
|
参数说明: NAME : Name of the build variable VALUE : Value of the build variable --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password |
41. set-build-result Sets the result of the current build. Works only if invoked from within a build.
42. shutdown Immediately shuts down Jenkins server 立即关闭jenkins
43. update-job Updates the job definition XML from stdin. The opposite of the get-job command
44. update-node Updates the node definition XML from stdin. The opposite of the get-node command
45. version Outputs the current version. 查看当前版本
46. wait-node-offline Wait for a node to become offline
47. wait-node-online Wait for a node to become online
48. who-am-i Reports your credential and permissions 查看当前登录用户
转自-------------http://blog.sina.com.cn/s/blog_5c9288aa0102v1zc.html
Jenkins-cli基本用法的更多相关文章
- Jenkins CLI 命令详解
笔者在前文<通过 CLI 管理 Jenkins Server>中介绍了如何通过 SSH 或客户端命令行的方式管理 Jenkins Server,限于篇幅,前文主要的目的是介绍连接 Jenk ...
- Jenkins 三: Jenkins CLI
简介 该工具允许用户通过命令行来操作jenkins. 使用方法 1. 下载 jenkins_cli.jar. 下载地址: http://localhost:8080/jnlpJars/jenkins- ...
- 持续集成高级篇之Jenkins cli与Jenkins ssh
系列目录 Jenkins Cli介绍 Jenkins Cli为Jenkins提供的一个cli工具,此工具功能非常强大,可以完成诸如重启jenkins,创建/删除job,查看job控制台输出,添加/删除 ...
- Jenkins CLI 通过ssh方式链接时的证书
在Jenkins自己的配置文档下,并没有详细说明要如何生成ssh证书,不过随便网上查一查就会有很多. 这里记录一个坑: 这个ssh必须要用ssh2!!! 这个ssh必须要用ssh2!!! 这个ssh必 ...
- Jenkins Pipeline高级用法-ShareLibrary
1.Github配置 1.1 上传jenkinsfile到github https://github.com/zeyangli/ShareLibrary-jenkins.git 2.Jenkins配置 ...
- sonar,jiar,xray,jenkins[cli] [sudoers]
curl -n -X POST http://52.83.39.59:8080'/job/CLA_SSO/buildWithParameters?token=11d710a8eac8012bea28b ...
- Jenkins CLI 使用
//链接java -jar jenkins-cli.jar -s JenkinsHost who-am-i --username 用户名 --password 密码 删除Jobjava -jar je ...
- 通过 CLI 管理 Jenkins Server
Jenkins 内置的命令行接口允许管理员通过命令行工具访问并管理 Jenkins.这让我们可以通过脚本自动化的创建配置或执行任务,也就是把 Jenkins 中的配置代码化了.Jenkins 同时支持 ...
- jenkins 命令行 CLI jenkins-cli.jar
部署好jenkins后,一般都是通过jenkins提供的web界面来操作jenkins. 而有些场景则需要通过命令来操作jenkins,例如通过脚本操作jenkins. 在jenkins提供的web界 ...
- 【转】基于Jenkins实现持续集成【持续更新中】
知识预览 持续集成 Jenkins安装 Jenkins插件 Jenkins配置 Jenkins备份与恢复 发布PHP项目 SVN 发布Maven项目 按版本发布 远程管理 War文件部署设置 任务 J ...
随机推荐
- 应用PLSQL Developer(技巧)
以下是一些 PLSQL Developer的使用技巧. 转自:PLSQL developer常用技巧,作者:逍遥游xj
- Spring-data-jpa 常用的时间注解
@Entity //不写@Table默认为user @Table(name="t_user",schema="DB_name") //自定义表名 public ...
- idea 设置某项目路径下的文件在点击浏览器预览时的前缀
01,我们在开发 HTML 页面的时候,可以通过点击右上角的浏览器图标,直接打开浏览器访问,大大方便了开发 02,但是我们在开发 PHP 的时候,一般会自己安装集成环境或者编译环境,从上面的截图我们会 ...
- node.js 发送邮件
var nodemailer = require('nodemailer'); var smtpTransport = require('nodemailer-smtp-transport'); // ...
- 交叉编译zookeeper的C库
原创文章,转载请正确注明本文原始URL及作者. 今天要编译一个zookeeper的C接口,要编译一个TK1版本. 事情经过这这样的:原来用的是zookeeper-3.4.6版本,但是源码中有个函数是汇 ...
- Shell编程:小白初步
shell类型: shell的历史网络上有一大堆,这里就不介绍了.但是我们的Linux系统上是有许多种shell的我们可以查看:使用命令 vi /etc/passwd 可以查看用户对应的shell(其 ...
- Linux性能测试分析命令_iostat
iostat用于输出CPU和磁盘I/O相关的统计信息 iostat语法 用法:iostat [ 选项 ] [ <时间间隔> [ <次数> ]] 常用选项说明: -c:只显示系统 ...
- ORACLE常用操作命令
1.ORACLE实例启动.停止 SQL>startup; #启动ORACLE实例 SQL>shutdown immediate; #关闭ORACLE实例,常用.阻止新用户连接且阻止已连接 ...
- Linux crontab使用方法
crontab命令主要用于设置命令行或者脚本周期性的执行.该命令从标准输入设备读取指令,并将其存放于文件中,以供之后读取和执行.本文主要讲述crontb命令的基本语法和配置方法. 1.crontab命 ...
- windows下配置mysql环境变量 - 使用cmd访问mysql(图)
window7为例,右击“计算机” - 单击“属性” - 单击“高级系统设置” - 单击“环境变量”,剩下看图: <图1> 右下角"环境变量". <图2>选 ...