GoogleCloudPlatform / microservices-demo

Sample cloud-first application with 10 microservices showcasing Kubernetes, Istio, and gRPC.
https://cymbal-shops.retail.cymbal.dev
Apache License 2.0
17.12k stars 7.38k forks source link

Unable to build adservice #1434

Closed HarikiRito closed 1 year ago

HarikiRito commented 1 year ago

Describe the bug

build [adservice] failed: exit status 1. Docker build ran into internal error. Please retry.

To Reproduce

Logs

Generating tags...

2 [internal] load .dockerignore

2 sha256:3a3376a110bfc911c611e7778255bed1a6fcc5f12331b0f88bd3f8a17922905e

2 transferring context: 2B done

2 DONE 0.0s

4 [internal] load metadata for docker.io/library/eclipse-temurin:19@sha256:17e3d3b61ca4a7606490f596feb77f69980939fecacf91a1f13ea7b17147058f

4 sha256:fa4367848242f6486a2e5650a6e73e7b59134bc9cb3dc1bc2d5c9165b8260a0c

4 DONE 0.0s

3 [internal] load metadata for docker.io/library/eclipse-temurin:19.0.1_10-jre-alpine@sha256:1aa167ab4f1498130e04bed5d6a83fed23c1fd8e3df8589723bc876770dd6a3a

3 sha256:095a08a5e87c0f08ca7fe08671a1bd8b85fa3840a51991c36774312eb5e5a0c7

3 DONE 0.0s

9 [builder 1/9] FROM docker.io/library/eclipse-temurin:19@sha256:17e3d3b61ca4a7606490f596feb77f69980939fecacf91a1f13ea7b17147058f

9 sha256:e6598a80b4806e6f96c6639d605cf4c6eca4174e9d77b4bae443fffb1f2dcc2c

9 DONE 0.0s

11 [internal] load build context

11 sha256:14ea7f78c196e3fc2a5c4cafe5ae47a5c9c8babae792578ef62a0fb5a60e3aaf

11 transferring context: 840B done

11 DONE 0.0s

13 [builder 4/9] COPY gradle gradle

13 sha256:fdaeb43ef35a139a2ecd1cead76d33dfdf08ec928d056377bb6d0e4fa7ba5adc

13 CACHED

10 [builder 2/9] WORKDIR /app

10 sha256:c8376895fb2b0a3b0283686ae8db694693504e2b0084b35d3dad35064057b43b

10 CACHED

12 [builder 3/9] COPY [build.gradle, gradlew, ./]

12 sha256:83c710fc667545608bfc816075122245e3b257bcc1277345bb9b3282cfe1fefe

12 CACHED

14 [builder 5/9] RUN chmod +x gradlew

14 sha256:1a500f6f159b665ab926871cb66d0e20677a0a5f0b055537bcd781f6c6395e61

14 CACHED

5 [without-grpc-health-probe-bin 1/5] FROM docker.io/library/eclipse-temurin:19.0.1_10-jre-alpine@sha256:1aa167ab4f1498130e04bed5d6a83fed23c1fd8e3df8589723bc876770dd6a

3a

5 sha256:3ec4fd675030cb4080679827d76012c9836cfa8e143f949ed6cf49b3d748d907

5 resolve docker.io/library/eclipse-temurin:19.0.1_10-jre-alpine@sha256:1aa167ab4f1498130e04bed5d6a83fed23c1fd8e3df8589723bc876770dd6a3a done

5 sha256:bfba53c59e931f5d57c41ba291b90b1ab7e3034d4df5a30ba2ff56f63583beef 0B / 161B 0.2s

5 sha256:1aa167ab4f1498130e04bed5d6a83fed23c1fd8e3df8589723bc876770dd6a3a 1.16kB / 1.16kB done

5 sha256:0fdafb034be2a2cb5ed98aa1b8116b05184efb869e1d7026bb395dc7f7be8f50 4.22kB / 4.22kB done

5 sha256:d8e5acd5897d762b9a83758d4ceae374df7b8b0367a48cc14b8a00e33998b3bf 0B / 12.02MB 0.2s

5 sha256:b231e5a3c8c25582f722e10270be76c230ecdb668b26782fe0b4cd29037021c6 0B / 49.14MB 0.2s

5 CANCELED

15 [builder 6/9] RUN ./gradlew downloadRepos

15 sha256:3997494df4830672a9af711404a7be3af2e05bafbda5e4154acd7d8958e0c28e

15 0.366 /bin/sh: 1: ./gradlew: not found

15 ERROR: executor failed running [/bin/sh -c ./gradlew downloadRepos]: exit code: 127


[builder 6/9] RUN ./gradlew downloadRepos:

executor failed running [/bin/sh -c ./gradlew downloadRepos]: exit code: 127 Building [productcatalogservice]... Target platforms: [linux/amd64] Build [productcatalogservice] was canceled Building [emailservice]... Target platforms: [linux/amd64] Build [emailservice] was canceled Building [recommendationservice]... Target platforms: [linux/amd64] Build [recommendationservice] was canceled build [adservice] failed: exit status 1. Docker build ran into internal error. Please retry. If this keeps happening, please open an issue..

Screenshots

Environment

Additional context

Exposure

aawiatr commented 1 year ago

[EDIT] There is a workaround. The same as described here: https://github.com/GoogleCloudPlatform/microservices-demo/issues/196 by geoff-maddock. This helps: git clone https://github.com/GoogleCloudPlatform/microservices-demo.git --config core.autocrlf=input

Is there a workaround?

NimJay commented 1 year ago

@aawiatr, thanks so much for digging up that workaround!

git clone https://github.com/GoogleCloudPlatform/microservices-demo.git --config core.autocrlf=input

But I'm not sure that it's the same issue @HarikiRito reported in this GitHub issue. This is @HarikiRito's error message:

#15 [builder 6/9] RUN ./gradlew downloadRepos
#15 sha256:3997494df4830672a9af711404a7be3af2e05bafbda5e4154acd7d8958e0c28e
#15 0.366 /bin/sh: 1: ./gradlew: not found
#15 ERROR: executor failed running [/bin/sh -c ./gradlew downloadRepos]: exit code: 127

Also, @HarikiRito is on Windows. Judging by your (@aawiatr's) use of --config core.autocrlf=input, I'm guessing you're not on Windows. Question for @aawiatr:

  1. What is your operating system?
  2. What was the error message you got? Was it different from @HarikiRito?

Aside: Regarding https://github.com/GoogleCloudPlatform/microservices-demo/issues/196, we should introduce a .gitattributes file to this repo.

NimJay commented 1 year ago

Ah, I might be mistaken! (It might be the same issue.)

According to stackoverflow.com/a/70849938:

/bin/sh: 1: ./gradlew: not found is usually caused by carriage return (\r) line endings in the bash script. Removing the carriage return will most like resolve the issue.

@HarikiRito, since you're on Windows, could you try:

git clone https://github.com/GoogleCloudPlatform/microservices-demo.git --config core.autocrlf=true

and re-try building adservice?


If it works, I will add a .gitattributes file into this repo with the contents:

# This file configures the git settings for this repository.

# Converts CR + LF to LF when committing, for all "text" files.
* text=auto
HarikiRito commented 1 year ago

@NimJay The workaround working. I'm just cloning the repo again using that method to my Ubuntu (WSL2) instance and it's working fine.