使用新版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,申请方法见截图
生成的token只会显示一次即刻销毁,通过下面的命令进行远程build即可
java -jar D:\svn_merge\jenkins-cli.jar -s $env_url -auth user:119ae7d02a6eeea713061aa9b00ecb00e1 build $branche_name -p $version=tags/Test-Env
#转载请注明出处!

- 上一篇: 阿里云服务器升级镜像源的方法
- 下一篇: IIS服务http强转https的方法【亲测】
评论
萌宠资讯
回复赞!我来打卡了!谢谢分享