【问题标题】:How to get nodes credentials using jenkinsapi如何使用 jenkinsapi 获取节点凭据
【发布时间】:2022-01-17 12:49:18
【问题描述】:

我需要获取节点的凭据信息(使用的凭据)。

目前我使用此代码打印大量信息,但没有用于节点的凭据信息:

for node in get_server_instance().nodes._data['computer']:
    for i in node:
        print (i, node[i])

有没有办法获得凭据?

谢谢

【问题讨论】:

  • 您使用什么类型的凭据? Jenkins 运行在什么类型的环境中?
  • @vault 我使用 crumb 请求进行授权
  • 这是否解决了问题? support.cloudbees.com/hc/en-us/articles/…
  • @vault nope 它只是回复结构中不存在数据
  • 我已经设置了 Jenkins,所以每个节点都是一个 docker 容器。在这种环境下,我只需执行到容器中并生成 ssh 密钥。

标签: python python-3.x jenkins pip jenkins-api


【解决方案1】:

唯一的方法是在节点目录内的服务器上运行 grep "credentials" */config.xml

【讨论】:

    猜你喜欢
    • 2020-11-13
    • 2013-04-30
    • 2018-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-17
    相关资源
    最近更新 更多