bazel-contrib / rules_jsonnet

Jsonnet rules for Bazel
https://bazelbuild.github.io/rules_jsonnet/
Apache License 2.0
68 stars 73 forks source link

rules_jsonnet failing on Bazel CI #51

Closed katre closed 6 years ago

katre commented 6 years ago

See the logs: https://buildkite.com/bazel/bazel-with-downstream-projects-bazel/builds/246#18005cc9-c2f3-4b2c-90a5-cc024ea05ff1

The error message is:

ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/451a80333a3ab92c117af7ae3c3ad420/external/examples/BUILD:75:1: Couldn't build file external/examples/files.json: error executing shell command: 'set -e; bazel-out/host/bin/external/jsonnet/cmd/jsonnet -J . -J bazel-out/k8-fastbuild/genfiles -J bazel-out/k8-fastbuild/bin --ext-str 'MYTEST' --ext-code 'MYJSONNET' --ext-str-file test=external/...' failed (Exit 1)
  | ERROR: environment variable MYTEST was undefined.

This fails with the Bazel nightly, and the recent 0.13.0 release.

I suspect the problem is that with sandboxing, your rule can't access the environment variables it needs.

Globegitter commented 6 years ago

Yeah, my pr broke that when I added env var support. I also added https://github.com/bazelbuild/rules_jsonnet/blob/master/tools/bazel.rc

How can I have a test that uses env variables that are being passed into the sandbox?

katre commented 6 years ago

@aehlig, do you know how this would work?

katre commented 6 years ago

@aehlig pointed out that the failing run has the flags --nomaster_bazelrc --blazerc=/dev/null, which would mean your bazel.rc wasn't being used. Runs since then have those flags removed, and are passing, so I think this was a CI issue.

Sorry for the confusion, I'm closing this now.