Search code examples
google-app-enginegcloudbuild.xmlgoogle-cloud-sdkappcfg

Java8 migrate appcfg to gcloud


Having issues since the recent appcfg deprecation. My project is java8 built with ant in a jenkins pipeline to GCP.

[exec] 95% Application deployment failed. Message: Deployments using appcfg are no longer supported. See https://cloud.google.com/appengine/docs/deprecations

In GCP I have 3 projects, dev, test and live. I build with the parameter to match the project via jenkins. E.g. building with test passes a parameter of deploy-test.

Snippets from ant build.xml:

<target name="deploy-test" depends="build, setup-for-appengine, setup-for-test, deploy"></target>

<target name="deploy-live" depends="build, setup-for-appengine, setup-for-live, deploy"</target>

<target name="setup-for-test" description="Configuration for test">
  (Some config stuff e.g. replacing app id and version in the appengine-web.xml)
</target>

<target name="deploy" description="Upload to App Engine.">
  <exec executable="${FILE PATH TO appcfg.sh}" failonerror="true">
    <arg line="update '${.ENV FILE PATH}/war'" />
  </exec>
</target>

I've updated from App Engine SDK to Cloud SDK and migrated to gcloud CLI. My executable in build.xml is now:

<target name="deploy" description="Upload to App Engine.">
  <exec executable="${FILE PATH TO gcloud executable}" failonerror="true">
    <arg line="app deploy '${.ENV FILE PATH}/war'" />
  </exec>
</target>

This deployment will run successfully via jenkins but this results in a 500 error and targets dev instead of test. The only things changed are file paths from App Engine SDK to Cloud SDK and migrated to gcloud command.

     [exec] descriptor:      [filepath/appengine-web.xml]
     [exec] source:          [filepath/war]
     [exec] target project:  [dev]
     [exec] target service:  [default]
     [exec] target version:  [version no.]
     [exec] target url:      [https://dev.appspot.com]

Any direction will be much appreciated. Thanks in advance


Solution

  • Resolved by adding --project and --version as and are no longer respected in the appengine-web.xml. -q is added to pass any prompts such as updates.

    <target name="deploy" description="Upload to App Engine.">
       <exec executable="${FILE PATH TO gcloud executable}" failonerror="true">
         <arg line="app deploy '${.ENV FILE PATH}/war/WEB-INF/appengine-web.xml' --project=${application_id} --version=${application_version} -q" />
       </exec>
     </target>
    

    I also had some issues with GCP and changing permissions of gservice account scope of projects which is now resolved.