{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/app-gradle-plugin/issues/188","repository_url":"https://api.github.com/repos/GoogleCloudPlatform/app-gradle-plugin","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/app-gradle-plugin/issues/188/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/app-gradle-plugin/issues/188/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/app-gradle-plugin/issues/188/events","html_url":"https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues/188","id":272793250,"number":188,"title":"Unable to deploy flex application with enable_app_engine_apis: true as WAR","user":{"login":"justindriggers","id":6137627,"avatar_url":"https://avatars3.githubusercontent.com/u/6137627?v=4","gravatar_id":"","url":"https://api.github.com/users/justindriggers","html_url":"https://github.com/justindriggers","followers_url":"https://api.github.com/users/justindriggers/followers","following_url":"https://api.github.com/users/justindriggers/following{/other_user}","gists_url":"https://api.github.com/users/justindriggers/gists{/gist_id}","starred_url":"https://api.github.com/users/justindriggers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justindriggers/subscriptions","organizations_url":"https://api.github.com/users/justindriggers/orgs","repos_url":"https://api.github.com/users/justindriggers/repos","events_url":"https://api.github.com/users/justindriggers/events{/privacy}","received_events_url":"https://api.github.com/users/justindriggers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"loosebazooka","id":1304826,"avatar_url":"https://avatars2.githubusercontent.com/u/1304826?v=4","gravatar_id":"","url":"https://api.github.com/users/loosebazooka","html_url":"https://github.com/loosebazooka","followers_url":"https://api.github.com/users/loosebazooka/followers","following_url":"https://api.github.com/users/loosebazooka/following{/other_user}","gists_url":"https://api.github.com/users/loosebazooka/gists{/gist_id}","starred_url":"https://api.github.com/users/loosebazooka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loosebazooka/subscriptions","organizations_url":"https://api.github.com/users/loosebazooka/orgs","repos_url":"https://api.github.com/users/loosebazooka/repos","events_url":"https://api.github.com/users/loosebazooka/events{/privacy}","received_events_url":"https://api.github.com/users/loosebazooka/received_events","type":"User","site_admin":false},"assignees":[{"login":"loosebazooka","id":1304826,"avatar_url":"https://avatars2.githubusercontent.com/u/1304826?v=4","gravatar_id":"","url":"https://api.github.com/users/loosebazooka","html_url":"https://github.com/loosebazooka","followers_url":"https://api.github.com/users/loosebazooka/followers","following_url":"https://api.github.com/users/loosebazooka/following{/other_user}","gists_url":"https://api.github.com/users/loosebazooka/gists{/gist_id}","starred_url":"https://api.github.com/users/loosebazooka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loosebazooka/subscriptions","organizations_url":"https://api.github.com/users/loosebazooka/orgs","repos_url":"https://api.github.com/users/loosebazooka/repos","events_url":"https://api.github.com/users/loosebazooka/events{/privacy}","received_events_url":"https://api.github.com/users/loosebazooka/received_events","type":"User","site_admin":false}],"milestone":null,"comments":11,"created_at":"2017-11-10T01:45:48Z","updated_at":"2017-11-14T23:09:20Z","closed_at":null,"author_association":"NONE","body":"Migrating from the Managed VM `java-compat` runtime, following the instructions here: https://cloud.google.com/appengine/docs/flexible/java/upgrading#continuing_to_use_compat_runtimes\r\n\r\n`src/appengine/app.yaml`:\r\n```\r\nservice: my-application\r\nruntime: java\r\nenv: flex\r\n\r\nhandlers:\r\n- url: /.*\r\n  script: this field is required, but ignored\r\nruntime_config:  # Optional\r\n  jdk: openjdk8\r\n  server: jetty9\r\nmanual_scaling:\r\n  instances: 1\r\nresources:\r\n  cpu: 1\r\n  memory_gb: 3.35\r\nbeta_settings:\r\n  enable_app_engine_apis: true\r\nhealth_check:\r\n  enable_health_check: true\r\n  check_interval_sec: 50\r\n  timeout_sec: 30\r\n  unhealthy_threshold: 10\r\n  healthy_threshold: 5\r\n  restart_threshold: 60\r\n```\r\n\r\nAfter running `appengineDeploy`, the following error is reported:\r\n```\r\nStarting Step #0\r\nStep #0: INFO  - Identified Java artifact for deployment Artifact{type=WAR, path=/workspace/my-application.war}\r\nStep #0: Exception in thread \"main\" com.google.cloud.runtimes.builder.buildsteps.base.BuildStepException: App Engine APIs have been enabled. In order to use App Engine APIs, an exploded WAR artifact is required, but a WAR artifact was found. See https://cloud.google.com/appengine/docs/flexible/java/upgrading for more detail.\r\nStep #0: \tat com.google.cloud.runtimes.builder.buildsteps.RuntimeImageBuildStep.getBaseRuntimeImage(RuntimeImageBuildStep.java:76)\r\nStep #0: \tat com.google.cloud.runtimes.builder.buildsteps.RuntimeImageBuildStep.run(RuntimeImageBuildStep.java:51)\r\nStep #0: \tat com.google.cloud.runtimes.builder.BuildPipelineConfigurator.generateDockerResources(BuildPipelineConfigurator.java:96)\r\nStep #0: \tat com.google.cloud.runtimes.builder.Application.main(Application.java:105)\r\nFinished Step #0\r\n```\r\nSince the plugin detects that the application is a \"flex\" application, there is no `explodeWar` task, so I whipped one up:\r\n\r\n```\r\nappengine {\r\n    stage {\r\n        artifact = \"$buildDir/exploded-app/\"\r\n    }\r\n}\r\n\r\ntask explodeWar(type: Sync) {\r\n    into appengine.stage.artifact\r\n    with war\r\n}\r\n\r\nassemble.dependsOn explodeWar\r\n```\r\nHowever, that only results in an error complaining about the artifact not being a file:\r\n```\r\nFAILURE: Build failed with an exception.\r\n\r\n* What went wrong:\r\nA problem was found with the configuration of task 'appengineStage'.\r\n> File '${project_path}/my-application/build/exploded-app' specified for property 'stagingConfig.artifact' is not a file.\r\n```\r\nI believe that has to do with the `@InputFile` annotation on `StageFlexibleExtension#getArtifact()` (`@Input` supports files and directories).\r\n\r\nTo work around this, we are currently exploding the WAR _between_ the `appengineStage` and `appengineDeploy` tasks:\r\n\r\n```\r\nappengine {\r\n    stage {\r\n        stagingDirectory = \"$buildDir/staged-app/\"\r\n    }\r\n}\r\n\r\ntask cleanupWar(type: Delete) {\r\n    delete fileTree(appengine.stage.stagingDirectory) {\r\n        include '**/*.war'\r\n    }\r\n}\r\n\r\ntask explodeWar(type: Copy) {\r\n    into appengine.stage.stagingDirectory\r\n    with war\r\n    finalizedBy cleanupWar\r\n}\r\n\r\nappengineStage {\r\n    finalizedBy explodeWar\r\n}\r\n```\r\nThis way, the WAR is built and copied into the staged-app directory, and then exploded directly inside of the staged-app directory (while cleaning up the WAR so that it doesn't get built into the Dockerfile). Using this setup, the `appengineDeploy` task correctly deploys the exploded WAR with the enabled APIs using the flex runtime.\r\n\r\nIdeally, I think the appengineStage task should simply detect the presence of `enable_app_engine_apis: true` in the `app.yaml`, and explode the WAR on its own."},"comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/app-gradle-plugin/issues/comments/344430863","html_url":"https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues/188#issuecomment-344430863","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/app-gradle-plugin/issues/188","id":344430863,"user":{"login":"loosebazooka","id":1304826,"avatar_url":"https://avatars2.githubusercontent.com/u/1304826?v=4","gravatar_id":"","url":"https://api.github.com/users/loosebazooka","html_url":"https://github.com/loosebazooka","followers_url":"https://api.github.com/users/loosebazooka/followers","following_url":"https://api.github.com/users/loosebazooka/following{/other_user}","gists_url":"https://api.github.com/users/loosebazooka/gists{/gist_id}","starred_url":"https://api.github.com/users/loosebazooka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loosebazooka/subscriptions","organizations_url":"https://api.github.com/users/loosebazooka/orgs","repos_url":"https://api.github.com/users/loosebazooka/repos","events_url":"https://api.github.com/users/loosebazooka/events{/privacy}","received_events_url":"https://api.github.com/users/loosebazooka/received_events","type":"User","site_admin":false},"created_at":"2017-11-14T23:09:20Z","updated_at":"2017-11-14T23:09:20Z","author_association":"CONTRIBUTOR","body":"`flex-compat` follows the appengine standard workflow (appengine-web.xml, exploded-war, etc) which is why you are seeing AppEngineStandardPlugin applied. `<env>flex</env>` just tells the deployment that the target environment is flex-compat.\r\n\r\nIf you were to deploy a pure-flex style app, then AppEngineFlexiblePlugin would be applied."}}
{"actor":{"display_login":"loosebazooka"}}