我在项目xxxx的GCE VM(Debian)上安装了Jenkins。
我需要在Google云存储库中部署带有源代码的云功能来进行yyyy项目。
我从Jenkins VM的外壳成功完成了此操作。 为了从管道中部署功能,我做到了:
在yyyy项目中创建一个服务帐户。
将密钥(json文件)上传到VM。
激活帐户gcloud auth activate-service-account yyyy-sa@yyyy.iam.gservice account.com-密钥文件jenkins-test.json
定义管道:
管道{
agent any
stages {
stage('Build') {
steps {
sh 'gcloud config set account yyyy@yyyy.iam.gserviceaccount.com'
sh '''
gcloud functions deploy helloWorld --region=us-central1 --runtime nodejs8 --trigger-http --project yyyy \
--source https://source.developers.google.com/projects/xxxx/repos/test1/moveable-aliases/master/paths/HelloWorld/
'''
}
}
}
}
反正我收到:
gcloud functions deploy helloWorld --region=us-central1 --runtime nodejs8 --trigger-http
--project yyyy --source https://source.developers.google.com/projects/xxxx/repos/test1/moveable-
aliases/master/paths/HelloWorld/
ERROR: (gcloud.functions.deploy) Your current active account [yyyy@yyyy.iam.gserviceaccount.com] **does not have any valid credentials**