无法使用gcloud build命令进行构建 Gcloud“失败”

问题描述

我正在遵循有关如何在Google Cloud Run上设置基本的Hello World Type应用程序的教程:

https://cloud.google.com/run/docs/quickstarts/build-and-deploy#java

我执行步骤:

gcloud builds submit --tag gcr.io/PROJECT-ID/helloworld

就我而言:

gcloud builds submit --tag gcr.io/whataboutanewproject/helloworld

我得到一个例外

ERROR: (gcloud.builds.submit) build 522dae9a-ddc3-4add-aeb4-f0a542c33649 completed with status "FAILURE"

我的整个堆栈跟踪如下:

C:\dev\temp\cloudrun\helloworld>gcloud builds submit --tag gcr.io/whataboutanewproject/helloworld
Creating temporary tarball archive of 13 file(s) totalling 76.4 KiB before compression.
Uploading tarball of [.] to [gs://whataboutanewproject_cloudbuild/source/1600095894.659957-225401928ec54d23ad36d56f150a2040.tgz]
Created [https://cloudbuild.googleapis.com/v1/projects/whataboutanewproject/builds/a71fcef2-d9da-4c6f-a5e8-2b6086c962b2].
Logs are available at [https://console.cloud.google.com/cloud-build/builds/a71fcef2-d9da-4c6f-a5e8-2b6086c962b2?project=825197540625].
------------------------------------------------------------------------------------------------------------ REMOTE BUILD OUTPUT ------------------------------------------------------------------------------------------------------------
starting build "a71fcef2-d9da-4c6f-a5e8-2b6086c962b2"

FETCHSOURCE
Fetching storage object: gs://whataboutanewproject_cloudbuild/source/1600095894.659957-225401928ec54d23ad36d56f150a2040.tgz#1600095896709973
Copying gs://whataboutanewproject_cloudbuild/source/1600095894.659957-225401928ec54d23ad36d56f150a2040.tgz#1600095896709973...
/ [1 files][ 53.1 KiB/ 53.1 KiB]
Operation completed over 1 objects/53.1 KiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon  109.6kB
Step 1/8 : FROM maven:3.6-jdk-11 as builder
3.6-jdk-11: Pulling from library/maven
57df1a1f1ad8: Pulling fs layer
71e126169501: Pulling fs layer
1af28a55c3f3: Pulling fs layer
03f1c9932170: Pulling fs layer
881ad7aafb13: Pulling fs layer
9c0ffd4062f3: Pulling fs layer
bd62e479351a: Pulling fs layer
5d4cc47cef87: Pulling fs layer
0c8911cc7703: Pulling fs layer
c19e861fcc5b: Pulling fs layer
03f1c9932170: Waiting
881ad7aafb13: Waiting
9c0ffd4062f3: Waiting
bd62e479351a: Waiting
5d4cc47cef87: Waiting
0c8911cc7703: Waiting
c19e861fcc5b: Waiting
1af28a55c3f3: Verifying Checksum
1af28a55c3f3: Download complete
71e126169501: Verifying Checksum
71e126169501: Download complete
57df1a1f1ad8: Verifying Checksum
57df1a1f1ad8: Download complete
9c0ffd4062f3: Verifying Checksum
9c0ffd4062f3: Download complete
881ad7aafb13: Verifying Checksum
881ad7aafb13: Download complete
03f1c9932170: Verifying Checksum
03f1c9932170: Download complete
5d4cc47cef87: Verifying Checksum
5d4cc47cef87: Download complete
0c8911cc7703: Verifying Checksum
0c8911cc7703: Download complete
c19e861fcc5b: Verifying Checksum
c19e861fcc5b: Download complete
57df1a1f1ad8: Pull complete
71e126169501: Pull complete
1af28a55c3f3: Pull complete
bd62e479351a: Verifying Checksum
bd62e479351a: Download complete
03f1c9932170: Pull complete
881ad7aafb13: Pull complete
9c0ffd4062f3: Pull complete
bd62e479351a: Pull complete
5d4cc47cef87: Pull complete
0c8911cc7703: Pull complete
c19e861fcc5b: Pull complete
Digest: sha256:c3bf5c312b5ad860cfd0b0f7a9b548367fbf2a52a3a786d5ed23742abe2a70db
Status: Downloaded newer image for maven:3.6-jdk-11
 ---> 89d9818b132c
Step 2/8 : WORKDIR /app
 ---> Running in b5b37ac614df
Removing intermediate container b5b37ac614df
 ---> dd90b62db365
Step 3/8 : COPY pom.xml .
COPY failed: stat /var/lib/docker/tmp/docker-builder268680314/pom.xml: no such file or directory
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ERROR: (gcloud.builds.submit) build a71fcef2-d9da-4c6f-a5e8-2b6086c962b2 completed with status "FAILURE"

C:\dev\temp\cloudrun\helloworld>

为什么会这样?

解决方法

如John Hanley所说,您的构建缺少pom.xml文件。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...