- 浏览: 20600 次
- 性别:
- 来自: 北京
文章分类
最新评论
假设Jenkins的URL为http://22.11.140.38:9080/jenkins/
基本的格式为
java
基本的格式为
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 查看当前登录用户
Tips:为了操作方便,建议先通过login命令保存登录状态,这样就不需要每次执行操作都加上用户名密码参数了;缺点是安全性不好,记得操作结束之后logout
相关推荐
用于解密和转储Jenkins凭证的命令行工具。 这是怎么回事 Jenkins将加密的凭据存储在credentials.xml文件或文件夹下的config.xml 。 要解密它们,您需要master.key和hudson.util.Secret文件。 所有文件都位于Jenkins...
登录jenkins页面,进入【系统管理】-【jenkins命令行接口】,点击截图中内容即可下载jar包文件。 编写jks-autodeploy.py文件,内容如下: #!/usr/bin/python3 #coding:utf8 import os import time curtime=time....
通过命令行与进行交互。 用Go语言编写。 重写 。 复制作业,创建管道并触发管道输入。 建立: 设置以下环境变量: JENKINS_ROOT_URL-Jenkins服务器的URL(IE: ) JENKINS_USER_NAME-具有API访问权限的Jenkins...
用命令:brew install jenkins会报网络错误,无法成功下载 那就用pkg文件安装吧【这是官方提供的最新的2021安装包了】 jenkins-2.229.pkg,2020-03-30 06:15发布,63M大小
使用 Jenkins和容器解决之前测试环境需要测试人员按照文档全手工命令行部署,流程复杂易出错,上线部署流程不透明且不易控制的问题; 使用Jenkins和容器解决实际工作中的环境差异,统一版本; 使用Kubernetes和...
#显示测试报告控件 #Windows安装包:在系统管理-脚本命令行输入如下,运行两次出现结果行“result:result:script-src‘unsafe-inline’...#使用tomcat需改catalina文件,具体百度“jenkins IE打开网页无法使用控件”
该项目的目的是能够在Docker化的Jenkins中使用命令行值运行Selenium自动化pytest。 Docker化的Jenkins将研究这个项目。 它将工作空间拉到Jenkins容器中,然后执行在该代码仓库中找到的Dockerfile。 然后,存储库将...
该脚本将创建一个 release-notes.txt 文件,其中包含自 Jenkins 上次升级后的提交(默认)或拉取请求(您可以选择升级级别) 提交日志取自 GitHub API,因此您甚至可以使用浅克隆来创建发行说明。 最后,您不仅...
詹金斯凭证解密器用于解密和转储Jenkins凭证的命令行工具。这是怎么回事Jenkins将加密的凭据存储在credentials.xml文件中。 要解密它们,您需要master.key和hudson.util.Secret文件。 这三个文件都位于Jenkins主目录...
NPM GROOVY LINT(+格式和自动修复)Groovy和Jenkinsfile Linter,格式化程序和自动修复程序基于 ,此开箱即用的... 在这里问:) 用法 npm-groovy-lint OPTIONS 范围类型描述-p - 小路细绳包含要处理的文件的目录例如
在configs目录下创建配置,请参考包含的sample.json文件。 有2个主要脚本: http://example.com/hook.php :由 Bitbucket hook 触发以启动 Jenkins Build http://example.com/pull-request.php :由 Jenkins 构建...
Transifex命令行工具入门无论您是否有命令行经验,都适合希望学习... 以通过我们的文档站点获取有关Transifex命令行工具的完整文档。安装您可以运行pip install transifex-client或easy_install transifex-client
您可以构建一个jar文件并从命令行运行它: git clone https://github.com/aws-samples/amazon-eks-jenkins-terraformcd amazon-eks-jenkins-terraform./mvnw packagejava -jar target/*.jar然后,您可以在此处访问...
您可以通过编辑文件来添加和删除插件 Docker用于管理Docker CI生命周期 用于Kubernetes API的kubectl命令行客户端 helm管理您的掌舵图表CI / CD生命周期 重要说明:此示例用于演示和测试。 不应在生产环境中使用它...
通过PyInstaller交付“ add2vals”工具会将其转换为Linux的独立可执行文件,您可以通过Jenkins下载该文件,并在不使用PythonLinux机器上的命令行上执行。 jenkins目录包含您将在本教程中创建的Jenkinsfile (即...
我们将启动连接到Github的Jenkins管道,并从Dockerfile构建Docker映像,将映像发布到Docker Hub,然后使用Lacework命令行界面映像启动对该映像的容器漏洞扫描。 我们将使用Docker在本地配置Jenkins,并连接到...
jenkins-jdeveloper-ojdeploy ... 作业配置简单,只需阅读ojdeploy命令行文档即可。使用命令行安装git clone cd jenkins-jdeveloper-ojdeploy mvn清洁包装提取target \ ojdeploy.hpi生成的文件并将其安装到jenkins中。
OpenShift Jenkins管道(DSL)插件 想要验证部署或服务? 我们仍然可以做到! ImageStream SCM? 改用管道构建策略和图像更改触发器。... 该插件利用了OpenShift命令行工具(oc),该脚本必须在执行脚
对于入门信息运行java -jar working.jar 内部配置文件可以在以下位置查看core... git configworkflow.configFile [配置文件的路径] 然后,该配置文件将用于该存储库中的每个操作。 配置文件值将覆盖internalConfig.js
这些特定的配置参数是: 加载脚本:作为-A命令行参数传递后加载脚本:作为AFTERLOGONSCRIPT环境变量传递在运行ObjectStudio之前,某些文件已复制到临时文件,因为ObjectStudio可能会更改以下文件: OStudio Ini文件...