简体   繁体   English

在不修改构建日志的情况下并行化 google cloudbuild 步骤

[英]Parallelizing google cloudbuild steps without mangling the build logs

Following guidance here: https://cloud.google.com/cloud-build/docs/configuring-builds/configure-build-step-order遵循此处的指导: https : //cloud.google.com/cloud-build/docs/configuring-builds/configure-build-step-order

We have split up our build into a multilayer docker image where layers are我们已经将我们的构建拆分成一个多层 docker 镜像,其中层是

  1. Install OS and third party deps安装操作系统和第三方 deps
  2. Install our sources and build (in debug or release depending on docker ARG)安装我们的源代码并构建(在调试或发布中,取决于 docker ARG)
  3. Run ci / code coverage运行ci/代码覆盖

We have tagged the steps in cloudbuild.yaml with docker id's and are using waitfor to try to make it so that the debug and release versions can run in parallel .我们已经用 docker id 标记了 cloudbuild.yaml 中的步骤,并且正在使用waitfor尝试使其能够并行运行debugrelease版本。

However, when we do this, the build log is mixed up -- the build logs for release and debug are are jumbled together making it much harder to read.然而,当我们这样做时,构建日志是混乱的——发布和调试的构建日志混杂在一起,使其更难以阅读。 eg例如

Step #2 - "build-debug": �[0m�[91m  Downloaded colored v1.7.0
Step #5 - "build-release": �[0m�[91merror: couldn't read /tmp/mobilenode/src/attest/src/ias/../data/AttestationReportSigningCACert.pem: No such file or directory (os error 2)
Step #5 - "build-release":   --> /tmp/mobilenode/src/attest/src/ias/verify.rs:35:7
Step #5 - "build-release":    |
Step #5 - "build-release": 35 |     &[include_str!("../data/AttestationReportSigningCACert.pem")];
Step #5 - "build-release":    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Step #5 - "build-release": 
Step #2 - "build-debug": �[0m�[91m  Downloaded toml v0.4.10
[0m�[91m  Downloaded safemem v0.3.0
Step #2 - "build-debug": �[0m�[91m  Downloaded crunchy v0.1.6
Step #2 - "build-debug": �[0m�[91m  Downloaded grpcio-sys v0.4.4
Step #5 - "build-release": �[0m�[91merror: aborting due to previous error
Step #5 - "build-release": 
Step #5 - "build-release": �[0m�[91merror: Could not compile `attest`.
Step #5 - "build-release": warning: build failed, waiting for other jobs to finish...
Step #5 - "build-release": �[0m�[91merror: build failed
Step #5 - "build-release": �[0m�[91mmake: *** [src/enclave/target/release/libenclave.so] Error 101
Step #5 - "build-release": �[0mMakefile:90: recipe for target 'src/enclave/target/release/libenclave.so' failed
Step #2 - "build-debug": �[0m�[91m  Downloaded term v0.5.1
Step #2 - "build-debug": �[0m�[91m  Downloaded tiny_http v0.6.2
Step #2 - "build-debug": �[0m�[91m  Downloaded regex v0.1.80

Is there a way to configure cloudbuild so that there is a separate log file for each build step?有没有办法配置 cloudbuild 以便每个构建步骤都有一个单独的日志文件? Is the best answer to use a different cloudbuild.yaml for the parallel steps, and skip all this wait_for stuff?对并行步骤使用不同的 cloudbuild.yaml 并跳过所有这些wait_for内容是最佳答案吗?

I was having this same issue, but then I discovered that viewing a build via the History under Cloud Build in the Console will let you view each step individually, or view the entire job, like you're currently seeing (click Build Summary , the top entry in the sidebar).我遇到了同样的问题,但后来我发现通过控制台中Cloud Build下的History查看构建将使您可以单独查看每个步骤,或查看整个作业,就像您当前看到的一样(单击Build Summary ,侧边栏中的顶部条目)。 Click on the name of the step in sidebar, each step should be comprised of a number followed by a colon and then the name of the step.单击边栏中的步骤名称,每个步骤应由数字后跟冒号和步骤名称组成。 The number appears to be based upon the order in which the job appears in your cloudbuild.yaml该数字似乎基于作业出现在您的cloudbuild.yaml中的cloudbuild.yaml

What you're seeing is a result of the parallelization of your build, as each step that is marked as being able to run concurrently is at a different step in its execution.您所看到的是构建并行化的结果,因为标记为能够并发运行的每个步骤都处于执行中的不同步骤。

示例构建 You can read more about viewing the Build History using the console here .您可以在 此处阅读有关使用控制台查看构建历史的更多信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么 Google Cloud Build 在 cloudbuild.yaml 文件中没有任何配置的情况下在步骤之间传递数据 - Why Google Cloud Build is passing data between steps without any configuration in cloudbuild.yaml file 如何在 google cloudbuild 中跨连续构建步骤(包括在 docker 步骤中)访问内容 - how to access content across successive build steps (including in docker steps) in google cloudbuild 如何在 google cloudbuild 步骤中保留变量? - How to persist variables in google cloudbuild steps? 如何使用 Google Ko 构建和推送 Go 映像?你能告诉我 cloudbuild.yaml 创建映像并使用 Google 推送 go 映像的步骤吗? - How to build and push Go image using Google Ko?Could you tell me the steps for cloudbuild.yaml to create the image and push go image using Google ko? 在Google Build cloudbuild.yaml中运行pytest以确定是否通过构建 - Run pytest in Google Build cloudbuild.yaml to determine if build passes or not 使用 CloudBuild 在 Google App Engine 中部署 ANGULAR build --prod 错误 - ANGULAR build --prod error deploying in Google App Engine using CloudBuild Google Cloud构建意外的char:位于cloudbuild.yaml中 - Google cloud build unexpected char : in cloudbuild.yaml 通过cloudbuild.yaml进行的Google Cloud Build随机超时 - Google Cloud Build via cloudbuild.yaml times out randomly Google Build cloudbuild.yaml部署python函数的最佳做法 - Google Build cloudbuild.yaml deploying python functions best practices Google Cloud Build不缓存自定义构建步骤? - Google Cloud Build not caching custom build steps?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM