如何在管道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"
}