Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ steps:
- label: ":shell: Shellcheck"
plugins:
- shellcheck#v1.3.0:
files: hooks/**
files:
- hooks/**
- commands/**
- lib/**

- label: ":sparkles:"
plugins:
Expand All @@ -25,4 +28,4 @@ steps:
- ${BUILDKITE_PULL_REQUEST_REPO:-$BUILDKITE_REPO}#${BUILDKITE_COMMIT}:
image: ubuntu:22.04
soft_fail:
- exit_status: 3
- exit_status: 3
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Also see the [Docker Compose Buildkite Plugin](https://github.com/buildkite-plug

## Example

### `run`

The following pipeline will build a binary in the dist directory using [golang Docker image](https://hub.docker.com/_/golang/) and then uploaded as an artifact.

```yml
Expand Down Expand Up @@ -113,6 +115,24 @@ steps:
mount-checkout: false
```

### `load`

If the image that you want to run is not in a registry the `load` property can be used to load an image from a tar file.

This can be useful if a previous step builds an image and uploads it as an artifact. The below example shows how a artifact can be downloaded and then passed to the `load` property to load the image which can then be referred to in the `image` property to start a container and run a command as explained above.

```yml
steps:
- command: "npm start"
plugins:
- artifacts#v1.9.0:
download: "node-7-image.tar.gz"
- docker#v5.8.0:
load: "node-7-image.tar.gz"
image: "node:7"
```


### 🚨 Warning

You need to be careful when/if [running the BuildKite agent itself in docker](https://buildkite.com/docs/agent/v3/docker) that, itself, runs pipelines that use this plugin. Make sure to read all the documentation on the matter, specially the caveats and warnings listed.
Expand Down Expand Up @@ -229,6 +249,10 @@ Whether or not to leave the container after the run, or immediately remove it wi

Default: `false`

### `load` (optional, string)

Specify a file to load a docker image from. If omitted no load will be done.

### `mount-checkout` (optional, boolean)

Whether to automatically mount the current working directory which contains your checked out codebase. Mounts onto `/workdir`, unless `workdir` is set, in which case that will be used.
Expand Down
14 changes: 14 additions & 0 deletions commands/load.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -euo pipefail

arg="${BUILDKITE_PLUGIN_DOCKER_LOAD:-}"

if [[ -z "$arg" ]]; then
echo "Error: load has to be given a path to the file that should be loaded"
exit 1
fi

# Don't convert paths on gitbash on windows, as that can mangle user paths and cmd options.
# See https://github.com/buildkite-plugins/docker-buildkite-plugin/issues/81 for more information.
( if is_windows ; then export MSYS_NO_PATHCONV=1; fi && docker load -i "${arg}" )
Loading