Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Unable to deploy with --use_google_application_default_credentials option from Debian Jessie GCE instance. #75

Closed
tswast opened this issue May 13, 2016 · 5 comments

Comments

@tswast
Copy link

tswast commented May 13, 2016

On a fresh GCE instance with the Debian Jessie image, I ran the following commands:

$ sudo apt-get update
$ sudo apt-get install default-jdk
$ java -version
java version "1.7.0_101"
OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-1~deb8u1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

$ sudo apt-get install unzip
$ wget http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
$ unzip apache-maven-3.3.9-bin.zip
$ export PATH="${HOME}/apache-maven-3.3.9/bin/:${PATH}"
$ mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /home/swast/apache-maven-3.3.9
Java version: 1.7.0_101, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"

$ sudo apt-get install git
$ git clone https://github.com/GoogleCloudPlatform/appengine-try-java.git

$ cd appengine-try-java
$ mvn clean appengine:update -Dappengine.additionalParams='--use_google_application_default_credentials' -Dappengine.appId=swast-scra
tch -Dappengine.version=deploytest
...
[INFO] Updating Google App Engine Application
[INFO] Running -A swast-scratch -V deploytest --oauth2 --use_google_application_default_credentials update /home/swast/appengine-try-java/target/appengine-try-java-1.0
May 13, 2016 10:45:26 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.

It gives no error message, but it does not deploy either.

This is blocking our ability to do end-to-end tests of App Engine quickstart Java code samples from our Jenkins installation.

I have also tested with the latest SDK snapshot version with no luck.

@ludoch
Copy link
Contributor

ludoch commented May 13, 2016

Not a bug... You did not configure correctly the default credential via gcloud auth login or
Maybe the json file is in a different location than the default expected location which is:
~/.config/gcloud/application_default_credentials.json
?

@ludoch ludoch closed this as completed May 13, 2016
@tswast
Copy link
Author

tswast commented May 13, 2016

Thanks. Note: gcloud auth login gives a warning on a GCE instance. It gets credentials from the Metadata server, which is a bit different than other platforms.

I was able to work around this by copying a service account key to the instance and using the --service_account_json_key_file=PATH argument to appcfg.

mvn clean appengine:update -Dappengine.additionalParams="--service_account_json_key_file=${HOME}/my-key.json" -Dap
pengine.appId=my-project -Dappengine.version=sometests

@ludoch
Copy link
Contributor

ludoch commented May 13, 2016

I still think googledefaultcredential should work on GCE OOB and find the
correct info from the metadata server...
Surprised it did not work!

On Fri, May 13, 2016 at 4:46 PM, Tim Swast notifications@github.com wrote:

Thanks. Note: gcloud auth login gives a warning on a GCE instance. It
gets credentials from the Metadata server, which is a bit different than
other platforms.

I was able to work around this by copying a service account key to the
instance and using the --service_account_json_key_file=PATH argument to
appcfg.

mvn clean appengine:update -Dappengine.additionalParams="--service_account_json_key_file=${HOME}/my-key.json" -Dap
pengine.appId=my-project -Dappengine.version=sometests


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#75 (comment)

@broady
Copy link

broady commented Jun 1, 2016

At the very least, it's a bug that there is no error message, right?

@tswast
Copy link
Author

tswast commented Jun 27, 2016

I filed a bug internally for this issue. I tested today on Cloud Shell, and --use_google_application_default_credentials has the same issue there (no deploy, but no error message). No configuration should be necessary on Cloud Shell.

swast@tensile-octagon-135519:~/src/tensile-octagon-135519/java_gae_quickstart$ mvn clean appengine:update -Dappengine.additionalParams='--use_google_application_default_c
redentials' -Dappengine.appId=tensile-octagon-135519 -Dappengine.version=1
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building appengine-try-java 1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ appengine-try-java ---
[INFO] Deleting /home/swast/src/tensile-octagon-135519/java_gae_quickstart/target
[INFO] 
[INFO] >>> appengine-maven-plugin:1.9.38:update (default-cli) > package @ appengine-try-java >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ appengine-try-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/swast/src/tensile-octagon-135519/java_gae_quickstart/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ appengine-try-java ---
[INFO] Compiling 1 source file to /home/swast/src/tensile-octagon-135519/java_gae_quickstart/target/appengine-try-java/WEB-INF/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ appengine-try-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/swast/src/tensile-octagon-135519/java_gae_quickstart/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ appengine-try-java ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ appengine-try-java ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:2.3:war (default-war) @ appengine-try-java ---
[INFO] Packaging webapp
[INFO] Assembling webapp [appengine-try-java] in [/home/swast/src/tensile-octagon-135519/java_gae_quickstart/target/appengine-try-java-1.0]
[INFO] Processing war project
[INFO] Copying webapp webResources [/home/swast/src/tensile-octagon-135519/java_gae_quickstart/src/main/webapp/WEB-INF] to [/home/swast/src/tensile-octagon-135519/java_ga
e_quickstart/target/appengine-try-java-1.0]
[INFO] Copying webapp resources [/home/swast/src/tensile-octagon-135519/java_gae_quickstart/src/main/webapp]
[INFO] Building jar: /home/swast/src/tensile-octagon-135519/java_gae_quickstart/target/appengine-try-java-1.0/WEB-INF/lib/appengine-try-java-1.0.jar
[INFO] Webapp assembled in [174 msecs]
[INFO] Building war: /home/swast/src/tensile-octagon-135519/java_gae_quickstart/target/appengine-try-java-1.0.war
[INFO] 
[INFO] <<< appengine-maven-plugin:1.9.38:update (default-cli) < package @ appengine-try-java <<<
[INFO] 
[INFO] --- appengine-maven-plugin:1.9.38:update (default-cli) @ appengine-try-java ---
[INFO] 
[INFO] Google App Engine Java SDK - Updating Application
[INFO] 
[INFO] Retrieving Google App Engine Java SDK from Maven
[INFO] Updating Google App Engine Application
[INFO] Running -A tensile-octagon-135519 -V 1 --oauth2 --use_google_application_default_credentials update /home/swast/src/tensile-octagon-135519/java_gae_quickstart/target/appengine-try-java-1.0
swast@tensile-octagon-135519:~/src/tensile-octagon-135519/java_gae_quickstart$ 

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

No branches or pull requests

3 participants