From 8672a1b33eef61ff206d2e5cea2d0fc88a2a3837 Mon Sep 17 00:00:00 2001 From: Laurynas Lubys Date: Mon, 6 Jun 2022 08:58:46 +0000 Subject: [PATCH 1/7] Allow switching '--interactive' off --- README.md | 8 ++++++-- hooks/command | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e4d0d26..7c2e046 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ steps: artifact_paths: "dist/**" ``` -You can pass in additional environment variables and customize what is mounted into the container. +You can pass in additional environment variables and customize what is mounted into the container. Note: If you are utilizing Buildkite's [Elastic CI Stack S3 Secrets plugin](https://github.com/buildkite/elastic-ci-stack-s3-secrets-hooks), you must specify the environment variable key names as they appear in your S3 bucket's `environment` hook in order to access the secret from within your container. @@ -287,6 +287,10 @@ If set to false, doesn't allocate a TTY. This is useful in some situations where Default: `true` for Linux and macOS, and `false` for Windows. +### `interactive` (optional, boolean) + +If set to false, doesn't connect `stdin` to the process. Some scripts fall back to asking for user input in case of errors, if the process has `stdin` connected and this results in the process waiting for input indefinitely. + ### `user` (optional, string) Allows a user to be set, and override the USER entry in the Dockerfile. See https://docs.docker.com/engine/reference/run/#user for more details. @@ -343,7 +347,7 @@ Example: `0.5` ### `memory` (optional, string) -Set the memory limit to apply when running the container. More information can +Set the memory limit to apply when running the container. More information can be found in https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory. Example: `2g` diff --git a/hooks/command b/hooks/command index b3a177a..deef94d 100755 --- a/hooks/command +++ b/hooks/command @@ -67,6 +67,7 @@ is_macos() { } tty_default='on' +interactive_default='on' init_default='on' mount_agent_default='on' mount_ssh_agent='' @@ -90,8 +91,11 @@ args=() # Support switching tty off if [[ "${BUILDKITE_PLUGIN_DOCKER_TTY:-$tty_default}" =~ ^(true|on|1)$ ]] ; then - args+=("-it") -else + args+=("-t") +fi + +# Support switching interactive off +if [[ "${BUILDKITE_PLUGIN_DOCKER_INTERACTIVE:-$interactive_default}" =~ ^(true|on|1)$ ]] ; then args+=("-i") fi From 20c62717c67f24b7c80fec2caa6aa8c7936d6a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20Bellone?= Date: Wed, 14 Sep 2022 19:53:33 -0300 Subject: [PATCH 2/7] Corrected all failing tests --- tests/command.bats | 94 +++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/tests/command.bats b/tests/command.bats index 26266d1..01dacc0 100644 --- a/tests/command.bats +++ b/tests/command.bats @@ -19,7 +19,7 @@ setup() { unset BUILDKITE_PLUGIN_DOCKER_MOUNT_BUILDKITE_AGENT stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'command1 \"a string\"' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'command1 \"a string\"' : echo ran command in docker" run $PWD/hooks/command @@ -36,7 +36,7 @@ setup() { unset BUILDKITE_PLUGIN_DOCKER_CLEANUP stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'command1 \"a string\"' : echo ran command in docker" \ + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'command1 \"a string\"' : echo ran command in docker" \ "ps -a -q --filter label=com.buildkite.job-id=1-2-3-4 : echo 939fb4ab31b2" \ "stop 939fb4ab31b2 : echo stopped container" @@ -54,7 +54,7 @@ setup() { stub docker \ "pull image:tag : echo pulled latest image" \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'pwd' : echo ran command in docker" run $PWD/hooks/command @@ -70,7 +70,7 @@ setup() { export BUILDKITE_COMMAND="pwd" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'pwd' : echo ran command in docker" run $PWD/hooks/command @@ -86,7 +86,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --volume $PWD:/app --volume /var/run/docker.sock:/var/run/docker.sock --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/app --volume /var/run/docker.sock:/var/run/docker.sock --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -102,7 +102,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --volume $PWD:/app --device /dev/bus/usb/001/001 --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/app --device /dev/bus/usb/001/001 --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -119,7 +119,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --volume $PWD:/app --workdir /app --publish 80:8080 --publish 90:9090 --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/app --workdir /app --publish 80:8080 --publish 90:9090 --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -136,7 +136,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --volume $PWD:/app --sysctl net.ipv4.ip_forward=1 --sysctl net.unix.max_dgram_qlen=200 --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/app --sysctl net.ipv4.ip_forward=1 --sysctl net.unix.max_dgram_qlen=200 --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -151,7 +151,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --volume /plugin:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --volume /plugin:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -166,7 +166,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --init --volume /plugin:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --init --volume /plugin:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -181,7 +181,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -197,7 +197,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --volume $PWD:/app --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/app --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -214,7 +214,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world; pwd" stub docker \ - "run -it --rm --init --volume $PWD:/app --volume /var/run/docker.sock:/var/run/docker.sock --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/app --volume /var/run/docker.sock:/var/run/docker.sock --workdir /app --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world; pwd' : echo ran command in docker" run $PWD/hooks/command @@ -230,7 +230,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --env MY_TAG=value --env ANOTHER_TAG=llamas --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --env MY_TAG=value --env ANOTHER_TAG=llamas --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 @@ -245,7 +245,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --storage-opt size=50G --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --storage-opt size=50G --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 @@ -260,7 +260,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --shm-size 100mb --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --shm-size 100mb --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 @@ -275,7 +275,7 @@ setup() { 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 -t -i --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 @@ -290,7 +290,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --cpus=0.5 --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --cpus=0.5 --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 @@ -305,7 +305,7 @@ setup() { export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --gpus 0 --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --gpus 0 --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 @@ -327,7 +327,7 @@ A_VARIABLE="with\nnewline" EOF stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --env MY_TAG=value --env FOO --env A_VARIABLE --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --env MY_TAG=value --env FOO --env A_VARIABLE --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 @@ -342,7 +342,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir -u foo --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir -u foo --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 @@ -357,7 +357,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --userns foo --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --userns foo --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 @@ -373,7 +373,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --group-add foo --group-add bar --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --group-add foo --group-add bar --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 @@ -392,7 +392,7 @@ EOF "-g : echo 456" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir -u 123:456 --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir -u 123:456 --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 @@ -410,7 +410,7 @@ EOF stub docker \ "network ls --quiet --filter 'name=foo' : echo " \ "network create foo : echo creating network foo" \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --network foo --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --network foo --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 @@ -426,7 +426,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --runtime custom_runtime --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --runtime custom_runtime --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 @@ -441,7 +441,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --ipc 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 -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --ipc 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 @@ -456,7 +456,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint /some/custom/entry/point --label com.buildkite.job-id=1-2-3-4 image:tag 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint /some/custom/entry/point --label com.buildkite.job-id=1-2-3-4 image:tag 'echo hello world' : echo ran command in docker" run $PWD/hooks/command @@ -474,7 +474,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint /some/custom/entry/point --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint /some/custom/entry/point --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b 'echo hello world' : echo ran command in docker" run $PWD/hooks/command @@ -489,7 +489,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint '\'\'' image:tag 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint '\'\'' image:tag 'echo hello world' : echo ran command in docker" run $PWD/hooks/command @@ -504,7 +504,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint '\'\'' image:tag 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint '\'\'' image:tag 'echo hello world' : echo ran command in docker" run $PWD/hooks/command @@ -521,7 +521,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b 'echo hello world' : echo ran command in docker" run $PWD/hooks/command @@ -546,7 +546,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag 'echo hello world' : echo ran command in docker" run $PWD/hooks/command @@ -562,7 +562,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --add-host buildkite.fake:127.0.0.1 --add-host www.buildkite.local:0.0.0.0 --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --add-host buildkite.fake:127.0.0.1 --add-host www.buildkite.local:0.0.0.0 --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 @@ -588,7 +588,7 @@ EOF export BUILDKITE_COMMAND= stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag echo 'hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag echo 'hello world' : echo ran command in docker" run $PWD/hooks/command @@ -607,7 +607,7 @@ EOF export BUILDKITE_COMMAND= stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b echo 'hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b echo 'hello world' : echo ran command in docker" run $PWD/hooks/command @@ -627,7 +627,7 @@ EOF export BUILDKITE_COMMAND= stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint llamas.sh --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b echo 'hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --entrypoint llamas.sh --label com.buildkite.job-id=1-2-3-4 image:tag custom-bash -a -b echo 'hello world' : echo ran command in docker" run $PWD/hooks/command @@ -642,7 +642,7 @@ EOF export SUPER_SECRET=supersecret stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --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 @@ -659,7 +659,7 @@ EOF unset BUILDKITE_PLUGIN_DOCKER_MOUNT_BUILDKITE_AGENT stub docker \ - "run -it --rm --init --volume $PWD:/workdir --volume /tmp/mirrors/git-github-com-buildkite-agent-abc123:/tmp/mirrors/git-github-com-buildkite-agent-abc123:ro --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo hello world" + "run -t -i --rm --init --volume $PWD:/workdir --volume /tmp/mirrors/git-github-com-buildkite-agent-abc123:/tmp/mirrors/git-github-com-buildkite-agent-abc123:ro --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo hello world" run $PWD/hooks/command @@ -677,7 +677,7 @@ EOF unset BUILDKITE_PLUGIN_DOCKER_MOUNT_BUILDKITE_AGENT stub docker \ - "run -it --rm --init --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo hello world" + "run -t -i --rm --init --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo hello world" run $PWD/hooks/command @@ -696,7 +696,7 @@ EOF unset BUILDKITE_PLUGIN_DOCKER_MOUNT_BUILDKITE_AGENT stub docker \ - "run -it --rm --init --volume $PWD:/workdir --volume /one:/a --volume /two:/b:ro --volume /tmp/mirrors/git-github-com-buildkite-agent-abc123:/tmp/mirrors/git-github-com-buildkite-agent-abc123:ro --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo hello world" + "run -t -i --rm --init --volume $PWD:/workdir --volume /one:/a --volume /two:/b:ro --volume /tmp/mirrors/git-github-com-buildkite-agent-abc123:/tmp/mirrors/git-github-com-buildkite-agent-abc123:ro --workdir /workdir --env BUILDKITE_JOB_ID --env BUILDKITE_BUILD_ID --env BUILDKITE_AGENT_ACCESS_TOKEN --volume /buildkite-agent:/usr/bin/buildkite-agent --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo hello world" run $PWD/hooks/command @@ -717,7 +717,7 @@ EOF export AWS_DEFAULT_REGION="ap-southeast-2" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_SESSION_TOKEN --env AWS_REGION --env AWS_DEFAULT_REGION --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_SESSION_TOKEN --env AWS_REGION --env AWS_DEFAULT_REGION --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 @@ -736,7 +736,7 @@ EOF export AWS_SESSION_TOKEN="AQoEXAMPLEH4aoAH0gNCAPy...truncated...zrkuWJOgQs8IZZaIv2BXIa2R4Olgk" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_SESSION_TOKEN --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_SESSION_TOKEN --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 @@ -753,7 +753,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --memory=2g --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --memory=2g --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 @@ -768,7 +768,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --memory-swap=2g --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --memory-swap=2g --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 @@ -783,7 +783,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --memory-swappiness=0 --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --memory-swappiness=0 --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 @@ -799,7 +799,7 @@ EOF export BUILDKITE_COMMAND="echo hello world" stub docker \ - "run -it --rm --init --volume $PWD:/workdir --workdir /workdir --memory=2g --memory-swap=2g --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --memory=2g --memory-swap=2g --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 From c792bb2310b5816903f22f9f31aac669fd75737f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20Bellone?= Date: Wed, 14 Sep 2022 19:53:53 -0300 Subject: [PATCH 3/7] Added test for new interactive option --- tests/command.bats | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/command.bats b/tests/command.bats index 01dacc0..b4aab0e 100644 --- a/tests/command.bats +++ b/tests/command.bats @@ -808,3 +808,34 @@ EOF unstub docker } + +@test "Runs BUILDKITE_COMMAND without interactive options" { + export BUILDKITE_PLUGIN_DOCKER_INTERACTIVE=0 + export BUILDKITE_COMMAND="echo hello world" + + stub docker \ + "run -t --rm --init --volume $PWD:/workdir --workdir /workdir --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 wit interactive options" { + export BUILDKITE_PLUGIN_DOCKER_INTERACTIVE=1 + export BUILDKITE_COMMAND="echo hello world" + + stub docker \ + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --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 +} \ No newline at end of file From f4125ca74f8f4ca7728991aee024a72e19694e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20Bellone?= Date: Wed, 14 Sep 2022 19:56:48 -0300 Subject: [PATCH 4/7] Added tests for TTY option (and corrected minor typo) --- tests/command.bats | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/tests/command.bats b/tests/command.bats index b4aab0e..fdf5b71 100644 --- a/tests/command.bats +++ b/tests/command.bats @@ -809,7 +809,7 @@ EOF unstub docker } -@test "Runs BUILDKITE_COMMAND without interactive options" { +@test "Runs BUILDKITE_COMMAND without interactive option" { export BUILDKITE_PLUGIN_DOCKER_INTERACTIVE=0 export BUILDKITE_COMMAND="echo hello world" @@ -824,8 +824,7 @@ EOF unstub docker } - -@test "Runs BUILDKITE_COMMAND wit interactive options" { +@test "Runs BUILDKITE_COMMAND with interactive option" { export BUILDKITE_PLUGIN_DOCKER_INTERACTIVE=1 export BUILDKITE_COMMAND="echo hello world" @@ -837,5 +836,35 @@ EOF assert_success assert_output --partial "ran command in docker" + unstub docker +} + +@test "Runs BUILDKITE_COMMAND without tty option" { + export BUILDKITE_PLUGIN_DOCKER_TTY=0 + export BUILDKITE_COMMAND="echo hello world" + + stub docker \ + "run -i --rm --init --volume $PWD:/workdir --workdir /workdir --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 tty option" { + export BUILDKITE_PLUGIN_DOCKER_TTY=1 + export BUILDKITE_COMMAND="echo hello world" + + stub docker \ + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --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 } \ No newline at end of file From 8be906b1e4a9cd6b8d88757c4b14b56257542bf4 Mon Sep 17 00:00:00 2001 From: Pol Date: Thu, 15 Sep 2022 22:23:04 -0300 Subject: [PATCH 5/7] Update docker version on Readme --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7c2e046..96652b7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ steps: - command: "go build -o dist/my-app ." artifact_paths: "./dist/my-app" plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "golang:1.11" ``` @@ -23,7 +23,7 @@ Windows images are also supported: steps: - command: "dotnet publish -c Release -o published" plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "microsoft/dotnet:latest" always-pull: true ``` @@ -33,7 +33,7 @@ If you want to control how your command is passed to the docker container, you c ```yml steps: - plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "mesosphere/aws-cli" always-pull: true command: ["s3", "sync", "s3://my-bucket/dist/", "/app/dist"] @@ -50,7 +50,7 @@ steps: - "yarn install" - "yarn run test" plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "node:7" always-pull: true environment: @@ -70,7 +70,7 @@ steps: env: MY_SPECIAL_BUT_PUBLIC_VALUE: kittens plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "node:7" always-pull: true propagate-environment: true @@ -86,7 +86,7 @@ steps: env: MY_SPECIAL_BUT_PUBLIC_VALUE: kittens plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "node:7" always-pull: true propagate-aws-auth-tokens: true @@ -100,7 +100,7 @@ steps: - "docker build . -t image:tag" - "docker push image:tag" plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "docker:latest" always-pull: true volumes: @@ -113,7 +113,7 @@ You can disable the default behaviour of mounting in the checkout to `workdir`: steps: - command: "npm start" plugins: - - docker#v3.13.0: + - docker#v4.0.0: image: "node:7" always-pull: true mount-checkout: false From 4a4d50994dc67ccdf191c1608baa2268f6c1db0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20Bellone?= Date: Fri, 16 Sep 2022 15:23:15 -0300 Subject: [PATCH 6/7] Fix my incorrect conflict resolution attempt --- tests/command.bats | 69 ++++++++-------------------------------------- 1 file changed, 12 insertions(+), 57 deletions(-) diff --git a/tests/command.bats b/tests/command.bats index 857eb3b..377d013 100644 --- a/tests/command.bats +++ b/tests/command.bats @@ -809,7 +809,6 @@ EOF unstub docker } - @test "Runs BUILDKITE_COMMAND with one added capability" { export BUILDKITE_COMMAND="echo hello world" export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_0='cap-0' @@ -825,7 +824,6 @@ EOF unstub docker } - @test "Runs BUILDKITE_COMMAND with multiple added capabilities" { export BUILDKITE_COMMAND="echo hello world" export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_0='cap-0' @@ -858,7 +856,6 @@ EOF unstub docker } - @test "Runs BUILDKITE_COMMAND with multiple dropped capabilities" { export BUILDKITE_COMMAND="echo hello world" export BUILDKITE_PLUGIN_DOCKER_DROP_CAPS_0='cap-0' @@ -876,7 +873,6 @@ EOF unstub docker } - @test "Runs BUILDKITE_COMMAND with one security opt" { export BUILDKITE_COMMAND="echo hello world" export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_0='sec-0=1' @@ -892,7 +888,6 @@ EOF unstub docker } - @test "Runs BUILDKITE_COMMAND with multiple security opts" { export BUILDKITE_COMMAND="echo hello world" export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_0='sec-0=1' @@ -910,30 +905,12 @@ EOF unstub docker } -@test "Runs BUILDKITE_COMMAND with one added capability" { - export BUILDKITE_COMMAND="echo hello world" - export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_0='cap-0' - - stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-add cap-0 --workdir /workdir --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 multiple added capabilities" { +@test "Runs BUILDKITE_COMMAND without interactive option" { + export BUILDKITE_PLUGIN_DOCKER_INTERACTIVE=0 export BUILDKITE_COMMAND="echo hello world" - export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_0='cap-0' - export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_1='cap-1' - export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_2='cap-2' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-add cap-0 --cap-add cap-1 --cap-add cap-2 --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t --rm --init --volume $PWD:/workdir --workdir /workdir --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 @@ -943,30 +920,12 @@ EOF unstub docker } -@test "Runs BUILDKITE_COMMAND with one dropped capability" { +@test "Runs BUILDKITE_COMMAND with interactive option" { + export BUILDKITE_PLUGIN_DOCKER_INTERACTIVE=1 export BUILDKITE_COMMAND="echo hello world" - export BUILDKITE_PLUGIN_DOCKER_DROP_CAPS_0='cap-0' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-drop cap-0 --workdir /workdir --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 multiple dropped capabilities" { - export BUILDKITE_COMMAND="echo hello world" - export BUILDKITE_PLUGIN_DOCKER_DROP_CAPS_0='cap-0' - export BUILDKITE_PLUGIN_DOCKER_DROP_CAPS_1='cap-1' - export BUILDKITE_PLUGIN_DOCKER_DROP_CAPS_2='cap-2' - - stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-drop cap-0 --cap-drop cap-1 --cap-drop cap-2 --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --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 @@ -976,13 +935,12 @@ EOF unstub docker } - -@test "Runs BUILDKITE_COMMAND with one security opt" { +@test "Runs BUILDKITE_COMMAND without tty option" { + export BUILDKITE_PLUGIN_DOCKER_TTY=0 export BUILDKITE_COMMAND="echo hello world" - export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_0='sec-0=1' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --security-opt 'sec-0=1' --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -i --rm --init --volume $PWD:/workdir --workdir /workdir --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 @@ -992,15 +950,12 @@ EOF unstub docker } - -@test "Runs BUILDKITE_COMMAND with multiple security opts" { +@test "Runs BUILDKITE_COMMAND with tty option" { + export BUILDKITE_PLUGIN_DOCKER_TTY=1 export BUILDKITE_COMMAND="echo hello world" - export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_0='sec-0=1' - export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_1='sec-1:0' - export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_2='sec-2=1:0' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --security-opt 'sec-0=1' --security-opt 'sec-1:0' --security-opt 'sec-2=1:0' --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --workdir /workdir --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 From 854ce3a848b7a2206a343c61d194e2ef90c4437b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20A=2E=20Bellone?= Date: Fri, 16 Sep 2022 15:26:06 -0300 Subject: [PATCH 7/7] Fix tests due to changes in how options are presented --- tests/command.bats | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/command.bats b/tests/command.bats index 377d013..930b34d 100644 --- a/tests/command.bats +++ b/tests/command.bats @@ -814,7 +814,7 @@ EOF export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_0='cap-0' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-add cap-0 --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --cap-add cap-0 --workdir /workdir --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 @@ -831,7 +831,7 @@ EOF export BUILDKITE_PLUGIN_DOCKER_ADD_CAPS_2='cap-2' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-add cap-0 --cap-add cap-1 --cap-add cap-2 --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --cap-add cap-0 --cap-add cap-1 --cap-add cap-2 --workdir /workdir --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 @@ -846,7 +846,7 @@ EOF export BUILDKITE_PLUGIN_DOCKER_DROP_CAPS_0='cap-0' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-drop cap-0 --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --cap-drop cap-0 --workdir /workdir --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 @@ -863,7 +863,7 @@ EOF export BUILDKITE_PLUGIN_DOCKER_DROP_CAPS_2='cap-2' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --cap-drop cap-0 --cap-drop cap-1 --cap-drop cap-2 --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --cap-drop cap-0 --cap-drop cap-1 --cap-drop cap-2 --workdir /workdir --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 @@ -878,7 +878,7 @@ EOF export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_0='sec-0=1' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --security-opt 'sec-0=1' --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --security-opt 'sec-0=1' --workdir /workdir --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 @@ -895,7 +895,7 @@ EOF export BUILDKITE_PLUGIN_DOCKER_SECURITY_OPTS_2='sec-2=1:0' stub docker \ - "run -it --rm --init --volume $PWD:/workdir --security-opt 'sec-0=1' --security-opt 'sec-1:0' --security-opt 'sec-2=1:0' --workdir /workdir --label com.buildkite.job-id=1-2-3-4 image:tag /bin/sh -e -c 'echo hello world' : echo ran command in docker" + "run -t -i --rm --init --volume $PWD:/workdir --security-opt 'sec-0=1' --security-opt 'sec-1:0' --security-opt 'sec-2=1:0' --workdir /workdir --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