I am very new to jenkins, but I have searched for an answer for this a couple of days now. I run jenkins on localhost:8080. I have written a program in Java which uses gradle to deploy to Google App Engine cloud. Now I wanted to use Jenkins to build my program in GIT. Building the program with gradle is fine. When I run
./gradlew appengineDeploy
in Execute Shell I get following:
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':appengineDeploy'.
The Google Cloud SDK could not be found in the customary locations and no path was provided.
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 9.571 secs
Build step 'Execute shell' marked build as failure Finished: FAILURE
When I run the code locally, without Jenkins, The Google Cloud SDk is found under:
/Users/marioyoussef/Desktop/google-cloud-sdk
And it works perfect, but I have no idea how to load it to jenkins when executing ./gradlew appengineDeploy.
Adding the following to the module's
build.gradle
might help:See https://cloud.google.com/appengine/docs/flexible/java/gradle-reference#global_properties:
The cloud tries to find the Google Cloud sdk in a set of predefined directories. If it does not find it, it throws an error. What helped me was this:
Adding a shortcut to the home directory solved my problem.
There are two ways to tackle the issue.
Add a symlink/shortcut for Google Cloud SDK The cloud plugin in IDE searches for SDK in some custom locations such as
$HOME/google-cloud-sdk
. So you can add a symlink in this directory and point it to actual installed location. In your case a shortcut in/Users/marioyoussef
namedgoogle-cloud-sdk
and point it to/Users/marioyoussef/Desktop/google-cloud-sdk
Add a cloudSdkHome property in build.gradle, but this can be troublesome if you share it with others as the might have it on a different location. For that, you can just mention it in README for others to change it. Just add this line in app's build.gradle
appengine.tools.cloudSdkHome="/Users/marioyoussef/Desktop/google-cloud-sdk"
Source: GitHub Issues