[英]Google Cloud Build show no logs
I have a Google Cloud Trigger that triggers cloud build on Github push.我有一个 Google Cloud Trigger,可以在 Github 推送时触发云构建。
The problem is that the Cloud Build shows no logs.问题是 Cloud Build 没有显示任何日志。 I followed this doc but can not find any logs on neither the Cloud Build log nor the Logs Explorer (see the image below)
我遵循了这个文档,但在 Cloud Build 日志和 Logs Explorer 上都找不到任何日志(见下图)
This is my cloudbuild.yaml
这是我的
cloudbuild.yaml
steps:
# install dependencies
- name: node:16
entrypoint: yarn
args: []
# create .env file
- name: 'ubuntu'
args: ['bash', './makeEnv.sh']
env:
- 'GCP_SHOPIFY_STOREFRONT_ACCESS_TOKEN=$_GCP_SHOPIFY_STOREFRONT_ACCESS_TOKEN'
- 'GCP_SHOPIFY_DOMAIN=$_GCP_SHOPIFY_DOMAIN'
# build code
- name: node:16
entrypoint: yarn
args: ["build"]
# deploy to gcp
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'bash'
args: ['-c', 'gcloud config set app/cloud_build_timeout 1600 && gcloud app deploy --promote']
timeout: "1600s"
options:
logging: CLOUD_LOGGING_ONLY
The build failed but it actually create a subsequence App Engine build that successfully deploy a version to App Engine.构建失败,但它实际上创建了一个成功将版本部署到 App Engine 的子序列 App Engine 构建。 But that version is not auto-promoted (see the image below)
但是那个版本不是自动升级的(见下图)
I do not have all the details, so trying to help with all the above information mentioned.我没有所有的细节,所以试图帮助解决上面提到的所有信息。
As I can see you are using CLOUD_LOGGING_ONLY
and not been able to see the log in the log explorer and considering you have all the permissions to access the logs.正如我所看到的,您正在使用
CLOUD_LOGGING_ONLY
并且无法在日志资源管理器中看到日志,并且考虑到您拥有访问日志的所有权限。
I would suggest you to look into the service account that you are using for cloud build must at least have the role: role/logging.logWriter or permission: logging.logEntries.create
permission if it is not the default cloud build SA project-number@cloudbuild.gserviceaccount.com
.我建议您查看用于云构建的服务帐户必须至少具有角色: role/logging.logWriter
logging.logEntries.create
权限:如果不是默认的云构建 SA project-number@cloudbuild.gserviceaccount.com
,则为 logging.logEntries.create 权限project-number@cloudbuild.gserviceaccount.com
。
Hope this helps:)希望这可以帮助:)
In my case, looking at the Google Cloud Build Service Account (project-number@cloudbuild.gserviceaccount.com) in the Google Cloud IAM console , it was missing the role Cloud Build Service Account
.就我而言,查看Google Cloud IAM 控制台中的 Google Cloud Build Service Account (project-number@cloudbuild.gserviceaccount.com),它缺少角色
Cloud Build Service Account
。 I was also missing logs.我也缺少日志。
This fixed symptom of a cloud function deploy with the message:云 function 部署的此修复症状带有以下消息:
(gcloud.functions.deploy) OperationError: code=3, message=Build failed: {
"metrics":{},
"error":{
"buildpackId":"",
"buildpackVersion":"",
"errorType":"OK",
"canonicalCode":"OK",
"errorId":"",
"errorMessage":""
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.