Jenkins在GCE上-将Google Cloud Function部署到其他GCP项目

时间:2020-03-27 05:28:17

标签: jenkins google-cloud-platform google-cloud-functions

我在项目xxxx的GCE VM(Debian)上安装了Jenkins。

我需要在Google云存储库中部署带有源代码的云功能来进行yyyy项目。

我从Jenkins VM的外壳成功完成了此操作。 为了从管道中部署功能,我做到了:

  1. 在yyyy项目中创建一个服务帐户。

  2. 将密钥(json文件)上传到VM。

  3. 激活帐户gcloud auth activate-service-account yyyy-sa@yyyy.iam.gservice account.com-密钥文件jenkins-test.json

  4. 定义管道:

    管道{

        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**

0 个答案:

没有答案