简体   繁体   English

Google Cloud Build 不显示任何日志

[英]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.

相关问题 如何让 Google Cloud Logging 以正确的警报级别显示我的 flask + gunicorn 应用程序的日志? - How can I get Google Cloud Logging to show my flask + gunicorn app's logs with the correct alert level? 谷歌云构建、云运行、云 SQL Prisma 迁移 - Google Cloud Build, Cloud Run, Cloud SQL Prisma Migration 将 Kaniko 缓存与用于 Google Cloud 的 Google Cloud Build Kubernetes 部署一起使用 - Using Kaniko cache with Google Cloud Build for Google Cloud Kubernetes Deployments 在谷歌云构建中的两个容器之间进行通信 - Communicate between two containers in Google cloud build Google Cloud Platform:秘密作为构建环境变量 - Google Cloud Platform: secret as build env variable Google Cloud 日志:如何将错误日志详细信息发送到另一个通道,例如 slack、email 或 webhook API? - Google Cloud logs: How to send error logs details to another channel like slack, email, or webhook API? 将 Google Cloud Build 连接到私有端点 - Connecting Google Cloud Build to Private Endpoints 谷歌云构建和部署到 Kubernetes 环境变量 - Google Cloud Build and Deploy to Kubernetes environment variables 是否可以在 Google Cloud Build 中动态生成标签? - Is it possible to generate tags dynamically in Google Cloud Build? 开始使用 Google Cloud Kubernetes 集群后,Cloud Build 无法部署 Cloud Run - Cloud Build fails to deploy Cloud Run after started using Google Cloud Kubernetes Cluster
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM