Jenkins命令行操作说明文档 jenkins重启命令行

假设Jenkins的URL为http://22.11.140.38:9080/jenkins/

基本的格式为

java -jar jenkins-cli.jar [-s JENKINS_URL] command[options][args]

下面具体介绍各个命令的作用及基本使用方法

1.help 查看所有内嵌命令的基本功能 无参数

Eg.

java -jar jenkins-cli.jar -shttp://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, andif

there's no change, exit without doing a build

-p: Specify the build parameters in the key=value format.

-rVAL: Number of times to retry reading of the output log ifit

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

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

passwordin 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'

-nN: Display the last N lines

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: 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.

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: 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 aconfiguration XML file.

从一个XML文档中创建一个job

Eg.

java -jar/home/jboss/.jenkins/jenkins-cli.jar -shttp://22.11.140.61:9080/jenkins/ create-job testttt

9.create-node: Creates a new node by reading stdin as a XMLconfiguration.

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'

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

passwordin arguments is insecure.

--password-file VAL : File that contains thepassword

Eg.

java -jar/home/jboss/.jenkins/jenkins-cli.jar -shttp://22.11.140.61:9080/jenkins/ delete-builds3-5

11.delete-job

参数说明:

NAME: Job name

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: 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-jobDisables a job 相当于“停止构建”

参数说明:

NAME: Job name

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

passwordin arguments is insecure.

--password-file VAL : File that contains the password

14.disconnect-nodeDisconnects from a node

15.enable-jobEnables a job 相当于恢复可构建状态

参数说明:

NAME: Job name

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

password in arguments is insecure.

--password-file VAL : File that contains the password

16.get-jobDumps the job definition XML to stdout 得到job定义的XML文档

参数说明:

JOB: Name of the job

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

password in arguments is insecure.

--password-file VAL : File that contains the password

17.get-nodeDumps the node definition XML to stdout

18.groovyExecutes the specified Groovy script.

19.groovyshRuns an interactive groovy shell.

20.helpLists all the available commands. 无参数

21.install-pluginInstalls a plugin either from a file, an URL, or from updatecenter. 安装插件

22.install-tool Performsautomatic tool installation, and print its location to stdout. Canbe only called from inside a build.

23.keep-buildMark the build to keep the build forever.

24.list-changes Dumps the changelog for thespecified 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 howthe output from this command is

printed.

--usernameVAL:User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

password in arguments is insecure.

--password-fileVAL: File that contains the password

25.list-jobsLists 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-jobsviewname

26.list-plugins Outputs a list of installedplugins. 列出安装的所有插件

27.loginSaves the current credential to allow future commands to runwithout explicit credential information.保存登录状态

参数说明:

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

password in arguments is insecure.

--password-file VAL : File that contains the password

28.logoutDeletes the credential stored with the login command.注销

29.mailReads stdin and sends that out as an e-mail.

30.offline-nodeStop using a node for performing builds temporarily, until the next"online-node" command.

31.online-node Resume using a node for performing builds, to cancelout the earlier "offline-node" command.

32.quiet-down Quiet down Jenkins, in preparationfor a restart. Don?. start any builds.

33.reload-configurationDiscard all the loaded data in memory and reload everything fromfile system. Useful when you modified config files directly ondisk.重新加载配置文件无参数

34.restartRestart Jenkins 重启Jenkins

35.safe-restart Safely restartJenkins 安全重启Jenkins,即等待已有的构建完成再重启

36.safe-shutdownPuts Jenkins into the quiet mode, wait for existing builds to becompleted, and then shut down Jenkins.安全关闭Jenkins

37.session-idOutputs the session ID, which changes every time Jenkinsrestarts

38.set-build-descriptionSets the description of a build.为已有构建添加描述

参数说明:

JOB: Name of the job to build

BUILD#: Number of the b uild

DESCRIPTION: Description to be set. '=' to read from stdin.

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

password in arguments is insecure.

--password-file VAL : File that contains the password

39.set-build-display-nameSets 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.

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

password in arguments is insecure.

--password-file VAL : File that contains the password

Jenkins命令行操作说明文档 jenkins重启命令行

40.set-build-parameter Update/set the buildparameter of the current build in progress

参数说明:

NAME: Name of the build variable

VALUE: Value of the build variable

--usernameVAL: User name to authenticate yourself to Jenkins

--passwordVAL: Password for authentication. Note that passing a

password in arguments is insecure.

--password-file VAL : File that contains the password

41.set-build-resultSets the result of the current build. Works only if invoked fromwithin a build.

42.shutdown Immediatelyshuts down Jenkins server 立即关闭jenkins

43.update-job Updates the job definition XML from stdin. Theopposite of the get-job command

44.update-nodeUpdates the node definition XML from stdin. The opposite of theget-node command

45.versionOutputs the current version. 查看当前版本

46.wait-node-offlineWait for a node to become offline

47.wait-node-onlineWait for a node to become online

48.who-am-i Reports your credential andpermissions 查看当前登录用户

Tips:为了操作方便,建议先通过login命令保存登录状态,这样就不需要每次执行操作都加上用户名密码参数了;缺点是安全性不好,记得操作结束之后logout

  

爱华网本文地址 » http://www.413yy.cn/a/25101015/244269.html

更多阅读

电脑开机就蓝屏重启解决方法 电脑一开机就蓝屏

电脑开机就蓝屏重启解决方法——简介近日微软推送8月份的更新补丁,通过系统或安全软件进行补丁更新后,可能会导致用户电脑重启后出现开机0xc0000005,0xc0000008e蓝屏,同时无法开机的现象,反复重新启动。影响系统:XP(SP3);vista_32/64(SP2);20

win7如何设置定时关机/重启 win7设置定时关机

win7如何设置定时关机/重启——简介我们在日常生活当中,可能有时在夜间下载文件,不想电脑一直开着,可以设置某个时间点自动关机,这样可以较少不必要的能源浪费。下面,小诚针对win7为大家介绍一下如何设置定时关机,希望对您有所帮助哈~win

电脑自动重启怎么办 精 电脑蓝屏自动重启

电脑无缘无故自动重启,一直是电脑菜鸟最担心的事情,如果是办公人员,那么他们所做的工作将会前功尽弃,那么究竟是什么原因导致电脑自动重启呢?电脑自动重启怎么办 精——工具/原料Windows XP电脑自动重启怎么办 精——系统失败导致自动

电脑经常蓝屏重启怎么办 精 电脑经常蓝屏重启

电脑经常蓝屏重启怎么办 精——简介电脑蓝屏,又叫蓝屏死机(Blue Screen of Death,缩写为:BSoD),指的是微软Windows操作系统在无法从一个系统错误中恢复过来时所显示的屏幕图像。电脑经常蓝屏重启怎么办?我们一起探讨这个问题,祝愿您早日

电脑蓝屏后自动重启怎么办 电脑关机蓝屏自动重启

电脑蓝屏后自动重启怎么办——简介电脑无故的自动关机或者重启,一般都有以下原因:电脑蓝屏后自动重启怎么办——事故原因电脑蓝屏后自动重启怎么办 1、电脑电压不稳: 一般家用的电脑机箱的开关电源范围都在170V-240V,当电压过低,低于

声明:《Jenkins命令行操作说明文档 jenkins重启命令行》为网友何以笙箫默分享!如侵犯到您的合法权益请联系我们删除