Skip to content

Commit

Permalink
Merge pull request #83 from magec/feature/allow_privileged
Browse files Browse the repository at this point in the history
Allow running privileged containers
  • Loading branch information
lox authored Nov 23, 2018
2 parents 9e766ab + 1c28bcc commit d86e4a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ Whether or not to automatically propagate all pipeline environment variables int

Note that only pipeline variables will automatically be propagated (what you see in the Buildkite UI). Variables set in proceeding hook scripts will not be propagated to the container.

### `privileged` (optional, boolean)

Whether or not to run the container in [privileged mode](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities)

### `mount-buildkite-agent` (optional, boolean)

Whether to automatically mount the `buildkite-agent` binary from the host agent machine into the container. Set to `false` if you want to disable, or if you already have your own binary in the image.
Expand Down
5 changes: 5 additions & 0 deletions hooks/command
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ while IFS='=' read -r name _ ; do
fi
done < <(env | sort)

# Privileged container
if [[ "${BUILDKITE_PLUGIN_DOCKER_PRIVILEGED:-false}" =~ ^(true|on|1)$ ]] ; then
args+=( "--privileged" )
fi

# Propagate all environment variables into the container if requested
if [[ "${BUILDKITE_PLUGIN_DOCKER_PROPAGATE_ENVIRONMENT:-false}" =~ ^(true|on|1)$ ]] ; then
if [[ -n "${BUILDKITE_ENV_FILE:-}" ]] ; then
Expand Down
2 changes: 2 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ configuration:
type: string
propagate-environment:
type: boolean
privileged:
type: boolean
required:
- image
additionalProperties: false

0 comments on commit d86e4a8

Please sign in to comment.