Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle wrapper is not detected reliably #9494

Closed
sergeykad opened this issue Aug 11, 2024 · 1 comment
Closed

Gradle wrapper is not detected reliably #9494

sergeykad opened this issue Aug 11, 2024 · 1 comment

Comments

@sergeykad
Copy link

Expected behavior

Skaffold will always use Gradle wrapper if present for Gradle + Jib build

Actual behavior

Gradle wrapper detected only in some scenarios.

File structure:
+-------------------+
| Project Root |
+-------------------+
| |
| +-- skaffold.yaml
| +-- gradlew
| |
| +-- service1
| | +-- skaffold.yaml
| |
| +-- service2
| | +-- skaffold.yaml
+-------------------+

Unsupported scenarios:

  1. Skaffold executed in a module directory.
cd service1
skaffold run
exec: "gradle": executable file not found in $PATH
  1. Skaffold executed in the root folder, but configuration refers a submodule.
apiVersion: skaffold/v4beta11
kind: Config

requires:
  - path: ./service1

Executing skaffold run in the project's root folder results in the same exec: "gradle": executable file not found in $PATH error.

This issue makes it very awkward to use Skaffold with a multimodule Grale project.

Information

Skaffold version: 2.12.0
Operating system: Ubuntu 22.04.4
Installed via: curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \ sudo install skaffold /usr/local/bin/

Logs

Skaffold executed from project's root without submodules

DEBU[0002] Running command: [java -version]              subtask=-1 task=Build
DEBU[0002] Using wrapper for gradlew: gradle             subtask=-1 task=Build
DEBU[0002] Running command: [/home/user/my-project/gradlew _skaffoldFailIfJibOutOfDate -Djib.requiredVersion=1.4.0 :file-system-manager:_jibSkaffoldFilesV2 -q --console=plain]  subtask=-1 task=Build

Skaffold executed from a module/subfolder

DEBU[0000] Running command: [java -version]              subtask=-1 task=Build
DEBU[0000] Running command: [gradle _skaffoldFailIfJibOutOfDate -Djib.requiredVersion=1.4.0 :service1:_jibSkaffoldFilesV2 -q --console=plain]  subtask=-1 task=Build
 - service1: Error checking cache.
DEBU[0000] Running command: [tput colors]                subtask=-1 task=DevLoop
DEBU[0000] Command output: [256
]                        subtask=-1 task=DevLoop
getting hash for artifact "service1": getting dependencies for "service1": could not fetch dependencies for workspace .: initial Jib dependency refresh failed: failed to get Jib dependencies: starting command gradle _skaffoldFailIfJibOutOfDate -Djib.requiredVersion=1.4.0 :service1:_jibSkaffoldFilesV2 -q --console=plain: exec: "gradle": executable file not found in $PATH
@sergeykad
Copy link
Author

I found the relevant documentation here.

"Set the artifact’s context field to the root project location."

It still would be nice if the context could be detected automatically by going up in the folder tree until "gradle.settings" or Gradle wrapper script is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant