Skip to content

Commit

Permalink
Merge latest master (kids, remember to make sure all your branches ar…
Browse files Browse the repository at this point in the history
…e up-to-date before merging)
  • Loading branch information
toote committed Sep 16, 2022
2 parents 854ce3a + 23ccdfe commit 0a32517
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ Enables debug mode, which outputs the full Docker commands that will be run on t

Default: `false`

### `entrypoint` (optional, string or boolean)
### `entrypoint` (optional, string)

Override the image’s default entrypoint, and defaults the `shell` option to `false`. See the [docker run --entrypoint documentation](https://docs.docker.com/engine/reference/run/#entrypoint-default-command-to-execute-at-runtime) for more details. Set it to `""` (empty string) to disable the default entrypoint for the image (you may also need to use this plugin's `command` option instead of the top-level `command` option - see [Issue 138](https://github.com/buildkite-plugins/docker-buildkite-plugin/issues/138) for more information).
Override the image’s default entrypoint, and defaults the `shell` option to `false`. See the [docker run --entrypoint documentation](https://docs.docker.com/engine/reference/run/#entrypoint-default-command-to-execute-at-runtime) for more details. Set it to `""` (empty string) to disable the default entrypoint for the image, but note that you may need to use this plugin's `command` option instead of the top-level `command` option or set a `shell` instead (depending on the command you want/need to run - see [Issue 138](https://github.com/buildkite-plugins/docker-buildkite-plugin/issues/138) for more information).

Example: `/my/custom/entrypoint.sh`, `""`

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '2'
services:
tests:
image: buildkite/plugin-tester
image: buildkite/plugin-tester:v3.0.0
volumes:
- ".:/plugin:ro"
4 changes: 2 additions & 2 deletions hooks/command
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ if [[ -n "${BUILDKITE_PLUGIN_DOCKER_MEMORY_SWAPPINESS:-}" ]]; then
fi

# Handle entrypoint if set (or empty), and default shell to disabled
if [[ "${BUILDKITE_PLUGIN_DOCKER_ENTRYPOINT-false}" != "false" ]] ; then
args+=("--entrypoint" "${BUILDKITE_PLUGIN_DOCKER_ENTRYPOINT:-}")
if [[ -v BUILDKITE_PLUGIN_DOCKER_ENTRYPOINT ]] ; then
args+=("--entrypoint" "${BUILDKITE_PLUGIN_DOCKER_ENTRYPOINT}")
shell_disabled=1
fi

Expand Down
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ configuration:
debug:
type: boolean
entrypoint:
type: [string, boolean]
type: string
environment:
type: array
image:
Expand Down
8 changes: 4 additions & 4 deletions tests/command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,12 @@ EOF
unstub docker
}

@test "Runs BUILDKITE_COMMAND with entrypoint disabled by null" {
@test "Runs BUILDKITE_COMMAND with entrypoint disabled by empty string" {
export BUILDKITE_PLUGIN_DOCKER_ENTRYPOINT=''
export BUILDKITE_COMMAND="echo hello world"

stub docker \
"run -t -i --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 $'''' --label com.buildkite.job-id=1-2-3-4 image:tag 'echo hello world' : echo ran command in docker"

run $PWD/hooks/command

Expand All @@ -499,12 +499,12 @@ EOF
unstub docker
}

@test "Runs BUILDKITE_COMMAND with entrypoint disabled by false" {
@test "Runs BUILDKITE_COMMAND with entrypoint set as false" {
export BUILDKITE_PLUGIN_DOCKER_ENTRYPOINT=false
export BUILDKITE_COMMAND="echo hello world"

stub docker \
"run -t -i --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 false --label com.buildkite.job-id=1-2-3-4 image:tag 'echo hello world' : echo ran command in docker"

run $PWD/hooks/command

Expand Down

0 comments on commit 0a32517

Please sign in to comment.