2

Can't figure out how to use Cloud Build + Gradle + Java 17 to build a Java Jar file. I can't find any example cloudbuild.yaml that uses Gradle 7.6, which is required for my Gradle build. I'm not trying to build an image, just a jar file. The project is stored in GCP Cloud Source and includes the Gradle Wrapper.

Here's the cloudbuild.yaml

steps:
- name: gradle:7.6-jdk17
  args: ['build']

Here's the cloudbuild error

Status: Downloaded newer image for gradle:7.6-jdk17 docker.io/library/gradle:7.6-jdk17 ERROR ERROR: build step 0 "gradle:7.6-jdk17" failed: starting step container failed: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "build": executable file not found in $PATH: unknown

tried searching for example cloudbuild.yaml files for Java 17 + Gradle 7.6 - no luck

tried using Google's examples, but they all use java 8

1 Answers1

1
steps:
- name: gradle:7.6-jdk17
  args: ['build']

In the above code you are using the gradle image directly instead of gcr.io/cloudbuilders/gradle which internally have the entrypoint as gradle So there it will works

steps:
- name: gcr.io/cloudbuilders/gradle
  args: ['build']

But In your case you have to mention the entrypoint as gradle like below

steps:
- name: gradle:7.6-jdk17
  entrypoint: gradle
  args: ['build']

Or

steps:
- name: gradle:7.6-jdk17
  args: ['gradle','build']
  • 1
    thanks for the response Soundarrajan - @Raushan Kuma gave me the fix/solution (see his comment above) –  Mar 11 '23 at 18:15