Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 46 additions & 3 deletions examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,23 @@ jsonnet_to_json_test(
jsonnet_library(
name = "code_library_lib",
srcs = ["code_library.libsonnet"],
deps = [":workflow"]
deps = [":workflow"],
)

jsonnet_to_json_test(
name = "extvar_code_library_test",
size = "small",
src = "extvar_code_library.jsonnet",
ext_code_libraries = { ":code_library_lib": "codefile" },
ext_code_libraries = {":code_library_lib": "codefile"},
golden = "extvar_files_library_golden.json",
)

jsonnet_to_json_test(
name = "tla_code_library_test",
size = "small",
src = "tla_code_library.jsonnet",
tla_code_libraries = { ":code_library_lib": "tla_code" },
golden = "tla_code_library_golden.json",
tla_code_libraries = {":code_library_lib": "tla_code"},
)

jsonnet_to_json_test(
Expand Down Expand Up @@ -336,3 +336,46 @@ jsonnet_to_json(
"multiple_outs_nested_asymmetric/file.json",
],
)

jsonnet_library(
name = "extvar-lib",
srcs = [
"extvar.libsonnet",
],
ext_code_envs = ["MYJSONNET"],
ext_code_libraries = {
":code_library_lib": "ext_lib",
},
ext_str_envs = ["MYTEST"],
ext_str_files = {
":test_str_files": "str_files",
},
ext_strs = {
"non_stamp": "non_stamp",
"mydefine": "$(mydefine)",
"k8s": "{STABLE_K8S_CLUSTER}",
},
)

jsonnet_to_json_test(
name = "extvar-lib-test",
src = "extvar-library.jsonnet",
golden = "extvar-library.json",
deps = [
":extvar-lib",
],
)

jsonnet_to_json(
name = "extvar-lib-json",
src = "extvar-library.jsonnet",
outs = ["ext-lib.json"],
ext_code_envs = ["MYJSONNET"],
ext_str_envs = ["MYTEST"],
ext_strs = {
"non_stamp": "non_stamp",
},
deps = [
":extvar-lib",
],
)
13 changes: 13 additions & 0 deletions examples/extvar-library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"code_env": {
"code": "some code"
},
"library": {
"workflow": { }
},
"k8s": "{STABLE_K8S_CLUSTER}",
"mydefine": "",
"non_stamp": "non_stamp",
"str_env": "test",
"str_files": "this is great\n"
}
1 change: 1 addition & 0 deletions examples/extvar-library.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'extvar.libsonnet'
9 changes: 9 additions & 0 deletions examples/extvar.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
non_stamp: std.extVar('non_stamp'),
mydefine: std.extVar('mydefine'),
k8s: std.extVar('k8s'),
str_files: std.extVar('str_files'),
code_env: std.extVar('MYJSONNET'),
str_env: std.extVar('MYTEST'),
library: std.extVar('ext_lib'),
}
Loading