首页 最新文章网站服务器运维正文

使用新版jenkin-cli命令username无效问题

java -jar D:\SVN_merge\jenkins-cli.jar -s $env_url  build $branche_name -p $version=tags/Test-Env --username zhagnsan---password zhangsang
ERROR: "--username" is Not a valid option
java -jar jenkins-cli.jar build JOB [-c] [-f] [-p] [-r N] [-s] [-v] [-w]
Starts a build, and optionally waits for a completion.
Aside from general scripting use, this command can be
used to invoke another job from within a build of one job.
With the -s option, this command changes the exit code based on
the outcome of the build (exit code 0 indicates a success)
and interRUPting the command will interrupt the job.
With the -f option, this command changes the exit code based on
the outcome of the build (exit code 0 indicates a success)
however, unlike -s, interrupting the command will not interrupt
the job (exit code 125 indicates the command was interrupted).
With the -c option, a build will only run if there has been
an SCM change.
 JOB : Name of the job to build
 -c  : Check for SCM changes before starting the build, and if there's no
       change, exit without doing a build (default: false)
 -f  : Follow the build progress. Like -s only interrupts are not passed
       through to the build. (default: false)
 -p  : Specify the build paRAMeters in the key=value format. (default:
       {member_version=tags/Test_235-Env})
 -s  : Wait until the completion/abortion of the command. Interrupts are passed
       through to the build. (default: false)
 -v  : Prints out the console output of the build. Use with -s (default: false)
 -w  : Wait until the start of the command (default: false)

处于安全考虑,新版(2.26)jenkin命令不允许再使用明密,可以使用参数auth

首先需要通过jenkins的用户管理申请token,申请方法见截图

image.png

生成的token只会显示一次即刻销毁,通过下面的命令进行远程build即可

java -jar D:\svn_merge\jenkins-cli.jar -s $env_url -auth user:119ae7d02a6eeea713061aa9b00ecb00e1 build $branche_name -p $version=tags/Test-Env

左手Excel右手VBA此处内容已经被作者隐藏,请输入验证码查看内容
验证码:
请关注本站微信公众号,回复“验证码”,获取验证码。在微信里搜索“左手Excel右手VBA”或者“URItker”或者微信扫描右侧二维码都可以关注本站微信公众号。

#转载请注明出处!

评论

精彩评论
觉得有用就打赏吧
关注本站公众号,享受更多服务!
联系方式
QQ:########
地址:中国·辽宁
Email:2727987445#qq.com
Copyright ©2015-2021.Powered by 云水客 | 网站地图 | 辽ICP备14000512号-5