簡體   English   中英

第一次嘗試從 GCP 運行 Cloud Build 時遇到錯誤

[英]Attempting to run Cloud Build from GCP for the first time and encountered error

作為初學者,我創建了一個源代碼存儲庫並編寫了一些基本的 terraform 代碼,然后由 Cloud Build 執行。

我從控制台創建了 Cloud Build,並將其配置為在推送到 dev 分支時觸發。

創建后,我嘗試通過單擊控制台上的運行來手動觸發作業。 在此處輸入圖像描述

此時我從控制台收到一個錯誤:

Failed to trigger build: unable to get call option credentials for cloud build robot: generic::permission_denied: error generating service identity: tenantmanager::123456: Consumer 1234567899 should enable service:cloudbuild.googleapis.com before generating a service account. com.google.api.tenant.error.TenantManagerException: Consumer 1234567899 should enable service:cloudbuild.googleapis.com before generating a service account.

仍在嘗試弄清楚如何解決這個問題 go。 感謝任何指針。

謝謝

通常,您應該在 CLI 工具中使用以下命令啟用雲構建 API:

gcloud services enable cloudbuild.googleapis.com

您可能需要考慮使用以下命令將雲構建帳戶添加為服務帳戶(用相關值替換變量)

gcloud projects add-iam-policy-binding $PROJECT_ID --member="serviceAccount:${PROJECT_NUM}@cloudbuild.gserviceaccount.com" --role='roles/iam.serviceAccountUser'

有許多實踐可以遵循(取決於您想要實現的目標),強烈建議您通過 GCP 文檔 go,該文檔非常詳細、信息豐富且有用。

https://cloud.google.com/iam/docs/service-accountshttps://cloud.google.com/build/docs

在 GCP 中,當我們創建一個雲項目時,默認情況下會啟用以下 API:

* BigQuery API
* BigQuery Storage API
* Cloud Datastore API
* Cloud Debugger API
* Cloud Logging API
* Cloud Monitoring API
* Cloud SQL
* Cloud Storage
* Cloud Storage API
* Cloud Trace API
* Google Cloud APIs
* Google Cloud Storage JSON API
* Service Management API
* Service Usage API

為了使用不在上述列表中的任何服務,我們必須訪問 API 和服務。 對於此示例,請訪問 Cloud Build API 並單擊啟用 API。

請參閱此鏈接中的文檔。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM