Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying the --no-deps flag #117

Merged
merged 1 commit into from Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -279,6 +279,12 @@ If set to false, doesn't allocate a TTY. This is useful in some situations where

The default is `true`.

### `dependencies` (optional, run only)

If set to false, doesn't start linked services.

The default is `true`.

### `verbose` (optional)

Sets `docker-compose` to run with `--verbose`
Expand Down
5 changes: 5 additions & 0 deletions hooks/commands/run.sh
Expand Up @@ -91,6 +91,11 @@ if [[ "$(plugin_read_config TTY "true")" == "false" ]] ; then
run_params+=(-T)
fi

# Optionally disable dependencies
if [[ "$(plugin_read_config DEPENDENCIES "true")" == "false" ]] ; then
run_params+=(--no-deps)
fi

run_params+=("$run_service")

if [[ ! -f "$override_file" ]]; then
Expand Down
25 changes: 25 additions & 0 deletions tests/run.bats
Expand Up @@ -236,6 +236,31 @@ export BUILDKITE_JOB_ID=1111
unstub buildkite-agent
}

@test "Run without dependencies" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
export BUILDKITE_PIPELINE_SLUG=test
export BUILDKITE_BUILD_NUMBER=1
export BUILDKITE_COMMAND=pwd
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_CHECK_LINKED_CONTAINERS=false
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_CLEANUP=false
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_DEPENDENCIES=false

stub docker-compose \
"-f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml pull myservice : echo pulled myservice" \
"-f docker-compose.yml -p buildkite1111 -f docker-compose.buildkite-1-override.yml run --name buildkite1111_myservice_build_1 --no-deps myservice pwd : echo ran myservice without dependencies"

stub buildkite-agent \
"meta-data get docker-compose-plugin-built-image-tag-myservice : echo myimage"

run $PWD/hooks/command

assert_success
assert_output --partial "ran myservice without dependencies"
unstub docker-compose
unstub buildkite-agent
}

@test "Run with multiple config files" {
export BUILDKITE_JOB_ID=1111
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_RUN=myservice
Expand Down