Hi,
I am trying to deploy a simple spring boot app to gcp using the pipeline. I found the CI tool to be great and went ahead with the doing a POC for the client. I am really looking forward for the project to work but for some reason it keeps getting knocked back and I am trying to find an answer for the past 5 days. Here is my pipeline details. Right now I am using the default pipeline
image: maven:3.5.2-jdk-8
pipelines:
default:
- step:
script:
# Downloading the Google Cloud SDK
- curl -o /tmp/google-cloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-155.0.0-linux-x86_64.tar.gz
- tar -xvf /tmp/google-cloud-sdk.tar.gz -C /tmp/
- /tmp/google-cloud-sdk/install.sh -q
- source /tmp/google-cloud-sdk/path.bash.inc
# Authenticating with the service account key file
- echo $GCLOUD_API_KEYFILE | base64 --decode --ignore-garbage > ./gcloud-api-key.json
#set the account before activating
#below two lines are being omitted since the auth is set with the key configured in the env varible
#- gcloud config set account learning-gcp-199805
#- gcloud auth activate-service-account learning-gcp-199805 --key-file gcloud-api-key.json
# Linking to the Google Cloud project
- gcloud config set project $GCLOUD_PROJECT
- gcloud components install app-engine-java
- gcloud auth activate-service-account --key-file gcloud-api-key.json
- echo $GCLOUD_API_KEYFILE > /tmp/client-secret.json
- echo $GCLOUD_APP_YAML | base64 --decode --ignore-garbage > ./app.yaml
#- ls
#- cd SpringBootProjectWithSecurity #use this only if the ls retunrs the details that are not in the root of the project but a level above too far
#e,lse just continue
- mvn clean install package
#- mvn appengine:update
- mvn appengine:update -Dappengine.additionalParams="--service_account_json_key_file=/tmp/client-secret.json"
#now both the mvn scripts returns error
#
I have added the gcp plugin in my pom.xml
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.9</version>
</plugin>
But I cannot deploy it to gcp/ This is the error that I am getting now. Seems that it is not able to find the packaged jar to deploy.
[INFO] Updating Google App Engine Application
[INFO] Running --oauth2 update /opt/atlassian/pipelines/agent/build/target/SpringBootProjectWithSecurity-0.0.1-SNAPSHOT
Unable to find the webapp directory /opt/atlassian/pipelines/agent/build/target/SpringBootProjectWithSecurity-0.0.1-SNAPSHOT
usage: AppCfg [options] <action> [<app-dir>] [<argument>]
Action must be one of:
help: Print help for a specific action.
download_app: Download a previously uploaded app version.
request_logs: Write request logs in Apache common log format.
rollback: Rollback an in-progress update.
start_module_version: Start the specified module version.
stop_module_version: Stop the specified module version.
update: Create or update an app version.
update_indexes: Update application indexes.
update_cron: Update application cron jobs.
update_queues: Update application task queue definitions.
update_dispatch: Update the application dispatch configuration.
Could someone please help me with this?
So I tried to package the app as jar . Here is the complete project. I have commneted out the postgreSQL part so no concerning data source will be created
https://vijay_psg587@bitbucket.org/vijay_psg587/springbootprojectwithsecurity.git
There is this error that I get at the very end
I cannot find what the error is
Could someone from the community help me out
[INFO] GCLOUD: 58f025dfe415: Layer already exists
[INFO] GCLOUD: c669caf5b2fe: Pushed
[INFO] GCLOUD: latest: digest: sha256:53f498e0b3ab3fd1a629283df74fb6f14c2ce5043360e4df9755194de2d6b307 size: 2206
[INFO] GCLOUD: DONE
[INFO] GCLOUD: --------------------------------------------------------------------------------
[INFO] GCLOUD:
[INFO] GCLOUD: Updating service [default] (this may take several minutes)...
[INFO] GCLOUD: ........................................................................................................................failed.
[INFO] GCLOUD: ERROR: (gcloud.app.deploy) Error Response: [9]
[INFO] GCLOUD: Application startup error:
[INFO] GCLOUD: Start command: java -showversion -agentpath:/opt/cdbg/cdbg_java_agent.so=--log_dir=/var/log/app_engine,--alsologtostderr=true -Xms491M -Xmx491M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+PrintCommandLineFlags -jar app.jar
[INFO] GCLOUD: -XX:InitialHeapSize=514850816 -XX:MaxHeapSize=514850816 -XX:+ParallelRefProcEnabled -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC
[INFO] GCLOUD: I0417 06:34:59.401672 25 jvmti_globals.cc:352] Build time: Dec 6 2017 15:08:30
[INFO] GCLOUD: I0417 06:34:59.461772 25 jvmti_agent.cc:162] Java debuglet initialization started
[INFO] GCLOUD: I0417 06:34:59.462419 25 jvmti_agent.cc:196] Java debuglet initialization completed
[INFO] GCLOUD: I0417 06:34:59.510303 25 jvmti_agent.cc:207] Java VM started
[INFO] GCLOUD: I0417 06:34:59.515746 25 jvmti_agent.cc:217] JvmtiAgent::JvmtiOnVMInit initialization time: 5443 microseconds
[INFO] GCLOUD: I0417 06:34:59.515969 36 jvmti_agent_thread.cc:99] Agent thread started: CloudDebugger_main_worker_thread
[INFO] GCLOUD: I0417 06:34:59.516378 36 jvm_internals.cc:376] Loading internals from /opt/cdbg/cdbg_java_agent_internals.jar
[INFO] GCLOUD: openjdk version "1.8.0_131"
[INFO] GCLOUD: OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
[INFO] GCLOUD: OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
[INFO] GCLOUD:
[INFO] GCLOUD: no main manifest attribute, in app.jar
[INFO] GCLOUD: I0417 06:34:59.661659 36 jni_logger.cc:31] Initializing ClassPathLookup, default classpath: true, extra classpath: [], config: null
I was able to deploy successfully when packaged as war file but when I pack it as jar file I am ending up with the below issue
Could you guys please help
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:45 min
[INFO] Finished at: 2018-04-19T08:37:46Z
[INFO] Final Memory: 47M/620M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy (default-cli) on project SpringBootProjectWithSecurity: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy failed: Non zero exit: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy (default-cli) on project SpringBootProjectWithSecurity: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy failed: Non zero exit: 1
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much!
I just successfully deployed to a google cloud bucket from gitlab but I wouldn't have been able to figure out the `gcloud auth activate-service-account --key-file gcloud-api-key.json` part without looking over your shoulder.
In gitlab you run docker images and I cheated a little and started out with the google/cloud-sdk:latest docker image so I didn't have to install cloud-sdk. But that I had to base64 my json, I wouldn't have figured - great recipe - sorry you had so many difficulties.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you :) . Great to know that it helped you out
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.