[英]Unable to use gcloud in a jenkins docker-agent
我正在尝试使用 docker 代理 (google/cloud-sdk:alpine) 运行 jenkins 管道,以将我的代码部署到 App Engine。 不幸的是,尽管我是 docker 的根,但我似乎没有权限这样做。
这个问题往往与这篇文章中的问题相同: Jenkins Pipeline gcloud problems in docker但是这个问题没有正确的答案。
当我手动启动这些命令时,一切正常。
我的詹金斯文件是:
pipeline {
agent {
docker {
image 'registry.hub.docker.com/google/cloud-sdk:alpine'
args '-v $HOME:/home -w /home'
}
}
stages {
stage('Deploy') {
steps {
withCredentials([file(credentialsId: 'bnc-hub', variable: 'SECRET_JSON')]) {
sh '''
set +x
gcloud auth activate-service-account --key-file $SECRET_JSON
gcloud config set project bnc-hub
gcloud app deploy app.yaml
'''
}
}
}
}
}
詹金斯的回报是:
[workspace] Running shell script
+ set +x
WARNING: Could not setup log file in /.config/gcloud/logs, (Error: Could not create directory [/.config/gcloud/logs/2018.12.28]: Permission denied.
Please verify that you have permissions to write to the parent directory.)
script returned exit code 1
默认首页=/
添加
HOME=$WORKSPACE before gcloud auth activate-service-account --key-file=${GCP_SA}
为我工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.