jenkins - GCE 上的 Jenkins - 将 Google Cloud Function 部署到不同的 GCP 项目
问题描述
我在项目 xxxx 的 GCE VM (Debian) 上安装了 Jenkins。
我需要在谷歌云存储库中部署一个带有源的云功能来项目 yyyy。
我从 Jenkins VM 的外壳成功地做到了。为了从管道部署功能,我确实遵循了:
在 yyyy 项目中创建服务帐户。
将密钥(json 文件)上传到 VM。
激活账户 gcloud auth activate-service-account yyyy-sa@yyyy.iam.gservice account.com --key-file 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**
解决方案
推荐阅读
- spring-security - 会话认证策略的 Spring Security 集成测试
- python - 以相同的方式在python中随机拆分两个列表
- java - Apache Ant:从同一个 build.xml 运行 2 个 java 程序
- slider - JSSOR 错误 - 移动 Safari 方向更改时的全宽缩放
- javascript - 在 Cordova 应用程序中获取动态创建的 html 行的文本
- qt - 区分动态分配的属性和静态分配的属性
- html - 如何更改div位置
- android - 从实时数据库中的已知子关键节点检索未知父节点
- typescript - 将 Typescript 路径指向项目文件夹之外的文件夹,以便可以在项目之间共享
- c++ - 为什么 QT Creator Preview 与我实际得到的不同?