container_daemon(
name = "db",
image = "mysql:5.7",
args = [
"--default-authentication-plugin=mysql_native_password",
],
env = {
"MYSQL_ROOT_PASSWORD": "hunter2",
},
)
wrapped_java_test(
...
container_deps = [ ":db" ]
)
I wasn't able to find any rules that do similar things and I didn't see a way to handle long running processes in this manner. The only thing I can think of is writing the container id to an output file and having something external to bazel garbage-collect containers after test runs.
Does anyone have pointers to similar rules or advice on how to implement this?
Thank you!
Rob
[1] https://www.youtube.com/watch?v=muvU1DYrY0w&list=PLxNYxgaZ8RseY0KmkXQSt0StE71E7yizG&index=13&t=0s
have you checked out rules_docker (https://github.com/bazelbuild/rules_docker) + rules_k8s (https://github.com/bazelbuild/rules_k8s). While these rules do a bit more than what you are asking for, it could work for your use case to bring up the container used in test with kubernetes.
wrt to doing this with a starlark rule that calls docker directly, I'd personally recommend against bringing up a long running container with a build target/build dep, as this would be a non hermetic operation, and would likely not play nice with the bazel cache.
--
You received this message because you are subscribed to a topic in the Google Groups "bazel-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bazel-discuss/m6lgDczg7Qg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/59ad06ce-0db5-4bae-b173-5b40350f6388%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.