如何在管道 Jenkinsfile 中获取 github API 端点和 scan-credentials id 以运行 Github API 请求。
我正在使用 github 组织文件夹插件。
如何在管道 Jenkinsfile 中获取 github API 端点和 scan-credentials id 以运行 Github API 请求。
我正在使用 github 组织文件夹插件。
您使用“withCredentials”来公开秘密。(显然,将秘密呼应出来是一种保守秘密的不好方法——但你可以将这个秘密传递给其他没有打印出来的东西......)
withCredentials([[$class : 'StringBinding',
credentialsId : 'my_secret_token',
variable: 'GHE_TOKEN',
]]) {
echo "I can access my secret token of ${env.GHE_TOKEN} now"
}
您需要为凭证选择一个助记符 ID,然后在Jenkinsfile
. 此时,您可以使用 Credentials Binding 插件来检索实际密钥。