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