shaoqin 发表于 2018-9-4 11:30:23

Jenkins CLI get-job与Role-Based Strategy的那点事

  最近在写两个Jenkins之间的JOB同步插件。
  在测试的过程中,发现Jenkins CLI命令中的get-job、update-job、rename-job(这个是我的插件中集成进去的,官方没有提供)和Role-Based Strategy有点奸情。
  背景:Jenkins 1.5.18 + Role-based Authorization Strategy 1.1.2
  具体现象:create-job、delete-job、list-jobs等可以正常使用,但是get-job、update-job、rename-job则报错,并提示“No such job xxxx”。
http://common.cnblogs.com/images/copycode.gifC:\> java -jar jenkins-cli.jar -s http://:8080/ get-job test --username--password   No such job 'test'java -jar jenkins-cli.jar get-job args...Dumps the job definition XML to stdout 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
http://common.cnblogs.com/images/copycode.gif
  结论:
  必须保证“Anonymous”账户拥有JOB的读权限:
http://images.cnitblog.com/blog/275210/201306/13155414-fc53b3a185f84bdda40c7b14813f9763.png
  论证过程:
  分别去掉/加上“Anonymous”账户的read job权限,然后运行:
java -jar jenkins-cli.jar -s http://:8080/ get-job test --username--password

页: [1]
查看完整版本: Jenkins CLI get-job与Role-Based Strategy的那点事