bazelbuild/rules_appengine

Deploy fails

steren opened this issue · 12 comments

I am following the Bazel backend tutorial

When I run $WORKSPACE/bazel-bin/backend/backend.deploy <project-id>

I get:

steren-macbookpro:tutorial steren$ $WORKSPACE/bazel-bin/backend/backend.deploy test-gae-bazel
Cannot stat file /private/var/folders/3v/vr09tqmx6t3bkzc046mzdb84007nxl/T/war.9u3YywA3/./WEB-INF: No such file or directory
Cannot stat file /private/var/folders/3v/vr09tqmx6t3bkzc046mzdb84007nxl/T/war.9u3YywA3/./WEB-INF/lib: No such file or directory
/Users/steren/work/test-bazel-gae/examples/tutorial//bazel-bin/backend/backend.deploy: line 38: /Users/steren/work/test-bazel-gae/examples/tutorial//bazel-bin/backend/backend.runfiles/__main__/../com_google_appengine_java/appengine-java-sdk-1.9.38//bin/appcfg.sh: No such file or directory

@kchodorow said in this PR:

it looks like it's using AppEngine 1.9.38, not 1.9.48 (which is what rule_appengine 0.0.5 specifies). > Is it possible you're using an older version of rules_appengine (maybe overriding the version in your WORKSPACE file)?

My answer is: I am just following the tutorial and have no real idea of what I am doing. I did not specify myself an sdk version.
However, I note the presence of an appengine.BUILD next to my WORKSPACE file in the sample code I download for the tutorial: https://github.com/bazelbuild/examples/blob/source-only/tutorial/appengine.BUILD
Is this normal ? Could this be the problem?

@katre updated the tutorial yesterday, could you try changing your WORKSPACE file to:

http_archive(
    name = "io_bazel_rules_appengine",
    sha256 = "f4fb98f31248fca5822a9aec37dc362105e57bc28e17c5611a8b99f1d94b37a4",
    strip_prefix = "rules_appengine-0.0.6",
    url = "https://github.com/bazelbuild/rules_appengine/archive/0.0.6.tar.gz",
)
load("@io_bazel_rules_appengine//appengine:appengine.bzl", "appengine_repositories")
appengine_repositories()

and rebuilding (bazel build //backend)? (I.e., https://github.com/bazelbuild/examples/blob/master/tutorial/WORKSPACE.)

I did try with these latest changes, and get the error I reporter above.

What version of bazel are you running (bazel version)?

However, I note the presence of an appengine.BUILD next to my WORKSPACE file in the sample code I download for the tutorial: https://github.com/bazelbuild/examples/blob/source-only/tutorial/appengine.BUILD
Is this normal ? Could this be the problem?

That's old, but it should be fine (it's unused).

steren-macbookpro:tutorial steren$ bazel version
Build label: 0.4.3-homebrew
Build target: bazel-out/local-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 22 15:20:15 2016 (1482420015)
Build timestamp: 1482420015
Build timestamp as int: 1482420015

You do not reproduce the issue?

If appengine.BUILD is unused, shall I send a PR to remove the file?

katre commented

@katre the tutorial clones the source-only branch, you should make the change there too.

You do not reproduce the issue?

Unfortunately no.

Could you try bazel clean --expunge and rebuild?

I now have a different problem, backend.deploy seems to not exist.

steren-macbookpro:tutorial steren$ bazel clean --expunge
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
steren-macbookpro:tutorial steren$ bazel build //backend:backend
..........
INFO: Found 1 target...
Target //backend:backend up-to-date:
  bazel-bin/backend/backend.war
  bazel-bin/backend/backend_deploy.sh
  bazel-bin/backend/backend
INFO: Elapsed time: 50.926s, Critical Path: 2.56s
steren-macbookpro:tutorial steren$ $WORKSPACE/bazel-bin/backend/backend.deploy test-gae-bazel
bash: /Users/steren/work/test-bazel-gae/examples/tutorial//bazel-bin/backend/backend.deploy: No such file or directory
steren-macbookpro:tutorial steren$ echo $WORKSPACE
/Users/steren/work/test-bazel-gae/examples/tutorial/

It's an implicit target, you have to specify it specially to build it:

bazel build //backend:backend.deploy

OK, so we will need to update the tutorial to say so.

Then I get a Java 8 error: Unable to update app: Class file is Java 8 but max supported is Java 7: com/google/bazel/example/app/MyAppServlet.class in ...

To fix this, I had to use:
$ bazel build --java_toolchain=@io_bazel_rules_appengine//appengine:jdk7 //backend:backend.deploy

Shall I send a PR to the tutorial instructions fixing those 2 points?

I confirm I could successfully deploy to GAE. Let's close this issue. We have bazelbuild/bazel#2330 for the tutorial part.

Shall I send a PR to the tutorial instructions fixing those 2 points?

That would be great, thank you!

Glad it (finally) worked.