【发布时间】:2018-05-26 00:40:07
【问题描述】:
我在 redhat 服务器上运行 Jenkins 1.647。我正在尝试根据参数使用 Execute Shell 中的 Jenkins Jobs 从命令行创建作业。 我尝试如下,但没有一个命令有效。我的jenkins认证是基于ldap的。
通过 Jenkins Execute Shell 执行这些命令。 命令-1
java -jar jenkins-cli.jar -s https://buildserver:8080/jenkins/ get-job job-template -i /var/lib/jenkins/.ssh/id_rsa
[WARN] Failed to authenticate with your SSH keys. Proceeding as anonymous
No such job 'job-template'
java -jar jenkins-cli.jar get-job JOB [--username VAL] [--password VAL] [--password-file VAL]
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
Build step 'Execute shell' marked build as failure
command-2
java -jar jenkins-cli.jar -s http://buildserver:8080/jenkins/ --username my-name --password-file /tmp/password-file
/tmp/password-file
xxxxx
有没有办法使用 Jenkins 用户 API 令牌使上述命令工作。请提出建议。
【问题讨论】:
标签: shell jenkins jenkins-cli