Skip to content

Conversation

dbanetto
Copy link
Contributor

@dbanetto dbanetto commented Sep 30, 2025

Issue

When a jsonnet_library defined a data dependency and the jsonnet_library was included in a {tla,ext}_code_libraries (See updated //:extvar_code_library_test) the data was not being included which results in error like:

==================== Test output for //:extvar_code_library_test:
FAIL (exit code): extvar_code_library_test
Expected: 0
Actual: 1
Output: RUNTIME ERROR: couldn't open import "file.txt": no match locally or in the Jsonnet library path
s
        extvar_code_library.jsonnet:2:14-34     thunk <data> from <$>
        extvar_code_library.jsonnet:7:9-13      object <anonymous>
        Field "data"
        During manifestation

Digging into the sandbox, the data file (files.txt in the example //:extvar_code_library_test) looks like:

> ls /private/var/tmp/_bazel/e78a12433a29cf2af3c4357fe05a3925/execroot/_main/bazel-out/darwin_arm64
-fastbuild/bin/extvar_code_library_test.runfiles/_main/
code_library.libsonnet           extvar_code_library.jsonnet      workflow.libsonnet
extvar_code_library_test         extvar_files_library_golden.json

Resolution

Adding the missing addition of the data_runfiles to the transitive_data in jsonnet_to_json{,_test}.

Updated the example to make use of this as well.

)

transitive_data = depset(
transitive = [dep.data_runfiles.files for dep in ctx.attr.deps] +
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Is there a reason that the jsonnet_ext_code_files & jsonnet_ext_str_files are not included here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant