Skip to content

Commit 39cdabc

Browse files
authored
Merge pull request buildkite-plugins#202 from buildkite-plugins/add-skip-checkout-option
Add skip checkout option
2 parents b96db48 + f0ebdf1 commit 39cdabc

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ Set the shell to use for the command. Set it to `false` to pass the command dire
357357

358358
Example: `[ "powershell", "-Command" ]`
359359

360+
### `skip-checkout` (optional, run only)
361+
362+
Whether to skip the repository checkout phase. This is useful for steps that use a pre-built image. This will fail if there is no pre-built image.
363+
360364
### `workdir` (optional, run only)
361365

362366
Specify the container working directory via `docker-compose run --workdir`.

hooks/pre-checkout

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -ueo pipefail
3+
4+
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
5+
6+
# shellcheck source=lib/shared.bash
7+
. "$DIR/../lib/shared.bash"
8+
# shellcheck source=lib/metadata.bash
9+
. "$DIR/../lib/metadata.bash"
10+
11+
# skip checkout if skip-checkout is set
12+
if [[ "$(plugin_read_config SKIP_CHECKOUT "false")" == "true" ]] ; then
13+
export BUILDKITE_REPO=""
14+
export BUILDKITE_PLUGIN_DOCKER_COMPOSE_REQUIRE_PREBUILD="true"
15+
fi

plugin.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ configuration:
4545
minimum: 1
4646
command:
4747
type: array
48+
skip-checkout:
49+
type: boolean
4850
leave-volumes:
4951
type: boolean
5052
no-cache:

0 commit comments

Comments
 (0)