Skip to content

Commit

Permalink
Merge pull request #1 from equinixmetal-buildkite/init-template
Browse files Browse the repository at this point in the history
init template
  • Loading branch information
Matt Anderson authored Jun 12, 2022
2 parents 1ac3a70 + cac746a commit acd69d5
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

steps:
- label: ":shell: Shellcheck"
plugins:
shellcheck#v1.1.2:
files:
- hooks/**

- label: ":rocket: Test"
plugins:
docker-compose#v3.7.0:
run: tests

- label: ":sparkles: Lint"
plugins:
plugin-linter#v2.0.0:
id: docker-login
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# * @equinixmetal-buildkite/team
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# template-buildkite-plugin
A template repo that can help bootstrap a new buildkite plugin
# Buildkite Plugin Template

Check the [buildkite organization](https://github.com/buildkite-plugins) or [website](https://buildkite.com/plugins) to see if your plugin already exists or we can contribute to it !

Be sure to update this readme with your plugin information after using the template repository.

## Example

Provide an example of using this plugin, like so:

Add the following to your `pipeline.yml`:

```yml
steps:
- command: ls
plugins:
- a-github-user/file-counter#v1.0.0:
pattern: '*.md'
```
## Developing
Provide examples on how to modify and test, e.g.:
To run the tests:
```shell
docker-compose run --rm tests
```
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: '3.8'
services:
tests:
image: buildkite/plugin-tester
volumes:
- ".:/plugin"
6 changes: 6 additions & 0 deletions hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -o errexit # script exits when a command fails == set -e
set -o nounset # script exits when tries to use undeclared variables == set -u
set -o xtrace # trace what's executed == set -x (useful for debugging)
set -o pipefail # causes pipelines to retain / set the last non-zero status
14 changes: 14 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: your name
description: what your plugin does
author: Equinix Metal
requirements:
- if you have requirements
configuration:
properties:
propertyname:
type: string
required:
- if any properties are required
dependencies:
dependencyname: [dep]
5 changes: 5 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"config:base"
]
}
22 changes: 22 additions & 0 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "$0")/.."

if [[ "${DEBUG:-}" -gt 0 ]]
then
set -x
fi

echo "--- BATS"
docker-compose run --rm tests

echo "--- Plugin Lint"
docker-compose run --rm lint

echo "--- Shellcheck"
docker run --rm -v "${PWD}:/mnt" --workdir /mnt koalaman/shellcheck:stable hooks/** scripts/**

echo "--- Checking Markdown files (meta)..."
./hooks/command
3 changes: 3 additions & 0 deletions tests/post-checkout.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bats

PROJECT_DIR=$(cd "${BATS_TEST_DIRNAME}/.." && pwd)

0 comments on commit acd69d5

Please sign in to comment.