我想在Jenkins管道中使用gcloud
,因此我首先需要使用Google服务账户进行身份验证。我正在使用https://wiki.jenkins.io/display/JENKINS/Google+OAuth+Plugin插件来保存我的私钥凭据。但我无法将凭据加载到管道中:
withCredentials([[$class: 'MultiBinding', credentialsId: 'my-creds', variable: 'GCSKEY']]) {
sh "gcloud auth activate-service-account --key-file=${GCSKEY}"
}
我也尝试了从文件中读取,但没有成功。
withCredentials([file(credentialsId:'my-creds', variable: 'GCSKEY')]) {
日志显示:
org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: Credentials 'my-creds' is of type 'Google Service Account from private key' ....