Repository navigation
Config file input - #8
Conversation
|
Here's the tools PR: bazeltools/rules_minidock_tools#278 |
| "layers": attr.label_list( | ||
| providers = [ContainerInfo], | ||
| ), | ||
| "external_config": attr.label( |
There was a problem hiding this comment.
do we not want a label list here since we can already merge?
There was a problem hiding this comment.
I honestly hadnt considered having more than one file, but we certainly can.
| expected_labels = { | ||
| "label1": "foo", | ||
| "label2": "bar", | ||
| "external-config-label-1": "extlabel1", |
There was a problem hiding this comment.
This verifies that our external configs are getting merged properly
|
@johnynek alrighty: this is ready to go, it can take the genrule files and merge them properly. |
There was a problem hiding this comment.
minor rewrite to avoid depset to_list which bazel recommends avoiding as long as possible.
| inputs = [merger_config_file] | ||
| for target in composed_external_config.config: | ||
| external_config_files = target.files.to_list() | ||
| inputs = inputs + external_config_files |
There was a problem hiding this comment.
you don't need to linearize here. add_all accepts depsets: https://bazel.build/rules/lib/builtins/Args#add_all
so instead:
transdepsets = [composed_transitive_deps]
for target in composed_external_config.config:
external_config_files = target.files
transdepsets.append(external_config_files)
merger_args.add("--external-config-path").add_all(external_config_files)
merger_input = depset([merger_config_file], transitive = transdepsets)There was a problem hiding this comment.
oh intersting, i didnt know depset had an append, updating
We'd like to do be able to capture things from the environment/at runtime and have them merged in to the metadata of our docker container. One way we can do this is what you see in the BUILD.bazel file change below: we could have our
external_config_filegrab the git commit, git branch, etc and then have that merged in (I will probably update this PR to do just that, but for now its a static file).We will then pass that to the merger app, which will merge it alongside the various config that we layer into the composition.
I was quite torn on exactly where to specify this, but container_compose felt like the right place for now.
This will be WIP until I can merge the accompanying PR in rules_minidock_tools, which I will link in a moment.