首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jenkins用户的Jenkins CLI设置-方法

Jenkins用户的Jenkins CLI设置-方法
EN

Stack Overflow用户
提问于 2017-12-12 18:49:09
回答 1查看 2.5K关注 0票数 2

我在redhat服务器上运行了Jenkins 1.647。我正在尝试从命令行使用Jenkins jobs在Execute Shell based on parameters中创建作业。我尝试了下面的方法,但所有命令都不起作用。我的jenkins身份验证是基于ldap的。

通过Jenkins执行这些命令,执行Shell。命令-1

代码语言:javascript
复制
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

代码语言:javascript
复制
java -jar jenkins-cli.jar -s http://buildserver:8080/jenkins/ --username my-name --password-file /tmp/password-file

/tmp/password-file
xxxxx

有没有办法使用Jenkins用户API令牌来使上述命令工作。请提个建议。

EN

回答 1

Stack Overflow用户

发布于 2019-08-15 22:45:25

使用

代码语言:javascript
复制
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

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47770745

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档