Closed a-canela closed 2 years ago
This looks good @a-canela!
It just needs a test, I couldn't seem to push a test commit onto your branch, so here's a passing test for this option :
diff --git a/tests/command.bats b/tests/command.bats
index 2f4d42e..63ffa30 100644
--- a/tests/command.bats
+++ b/tests/command.bats
@@ -225,6 +225,21 @@ setup() {
unstub docker
}
+@test "Runs BUILDKITE_COMMAND with pid namespace" {
+ export BUILDKITE_PLUGIN_DOCKER_PID=host
+ export BUILDKITE_COMMAND="echo hello world"
+
+ stub docker \
+ "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --pid host --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker"
+
+ run $PWD/hooks/command
+
+ assert_success
+ assert_output --partial "ran command in docker"
+
+ unstub docker
+}
+
@test "Runs BUILDKITE_COMMAND with propagate environment" {
export BUILDKITE_PLUGIN_DOCKER_PROPAGATE_ENVIRONMENT=true
export BUILDKITE_PLUGIN_DOCKER_ENVIRONMENT_0=MY_TAG=value
If you could add it this in, I can merge and release this. Thanks again!
@jayco test added! Sorry for the delay and thanks for your time :)
Hey @a-canela! Sorry for the very late reply! 😅 I'm reviewing your other PR #172 which contain also this functionality and it's more complete. I'll close this one. Thanks!
The PID namespace Docker option was added to this Buildkite plugin. More details about this Docker option can be found here:
https://docs.docker.com/engine/reference/run/#pid-settings---pid