Skip to content

Commit af70ca6

Browse files
authored
Merge pull request #59 from buildkite-plugins/toote_skip_invalid
New `skip-invalid` option
2 parents 34a82a5 + 2b6f3b9 commit af70ca6

4 files changed

Lines changed: 35 additions & 5 deletions

File tree

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For a full list of features see the [Buildkite Plugin Linter cli tool documentat
1010
steps:
1111
- label: ":sparkles: Lint"
1212
plugins:
13-
- plugin-linter#v3.2.0:
13+
- plugin-linter#v3.3.0:
1414
id: my-org/my-plugin
1515
```
1616
@@ -20,17 +20,25 @@ If you want to run it locally on a command line, see the [Buildkite Plugin Linte
2020
2121
## Configuration
2222
23-
### `id`
23+
### Required
24+
25+
#### `id`
2426

2527
The id of the plugin (e.g. `my-org/my-plugin`)
2628

27-
### `image-version`
29+
### Optional
30+
31+
#### `image-version`
2832

2933
The docker tag of the `buildkite/plugin-linter` image to use. Default is `2.0.3`
3034

31-
### `readme` (optional)
35+
#### `readme`
36+
37+
The filename of the plugin’s readme to lint examples on. Default is `README.md`
38+
39+
#### `skip-invalid` (boolean)
3240

33-
The filename of the plugin’s readme. Default is `README.md`
41+
Whether invalid examples (for example with invalid options) should not cause the linting to fail. Defaults to false.
3442

3543
## Developing
3644

hooks/command

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,8 @@ if [[ -n "${BUILDKITE_PLUGIN_PLUGIN_LINTER_README:-}" ]] ; then
2626
args+=("--env" "PLUGIN_README=$BUILDKITE_PLUGIN_PLUGIN_LINTER_README")
2727
fi
2828

29+
if [[ -n "${BUILDKITE_PLUGIN_PLUGIN_LINTER_SKIP_INVALID:-}" ]] ; then
30+
args+=("--env" "PLUGIN_SKIP_INVALID=$BUILDKITE_PLUGIN_PLUGIN_LINTER_SKIP_INVALID")
31+
fi
32+
2933
docker run "${args[@]}" buildkite/plugin-linter:"${TAG}"

plugin.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ configuration:
1111
type: string
1212
readme:
1313
type: string
14+
skip-invalid:
15+
type: boolean
1416
required:
1517
- id
1618
additionalProperties: false

tests/command.bats

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@ setup() {
4848
unstub docker
4949
}
5050

51+
52+
@test "Supports the skip-invalid option" {
53+
export BUILDKITE_PLUGIN_PLUGIN_LINTER_SKIP_INVALID=true
54+
55+
stub docker \
56+
"pull buildkite/plugin-linter:latest : echo pulled image" \
57+
"run -it --rm --volume /plugin:/plugin:ro --env PLUGIN_ID=my-plugin --env PLUGIN_SKIP_INVALID=true buildkite/plugin-linter:latest : echo linted"
58+
59+
run "$PWD"/hooks/command
60+
61+
assert_success
62+
assert_output --partial "pulled image"
63+
assert_output --partial "linted"
64+
unstub docker
65+
}
66+
5167
@test "Support not specifying a tag" {
5268
unset BUILDKITE_PLUGIN_PLUGIN_LINTER_IMAGE_VERSION
5369

0 commit comments

Comments
 (0)