我在redhat服务器上运行了Jenkins 1.647。我正在尝试从命令行使用Jenkins jobs在Execute Shell based on parameters中创建作业。我尝试了下面的方法,但所有命令都不起作用。我的jenkins身份验证是基于ldap的。
通过Jenkins执行这些命令,执行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命令-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令牌来使上述命令工作。请提个建议。
发布于 2019-08-15 22:45:25
使用
java -jar jenkins-cli.jar -s https://buildserver:8080/jenkins/ -auth USER:TOKEN get-job job-template需要在JENKINS_URL:PORT/user/YOUR_USER/configure下创建接口token
https://stackoverflow.com/questions/47770745
复制相似问题