-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 904c073
Showing
7 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
steps: | ||
- label: ":hammer: Test" | ||
plugins: | ||
docker-compose#v1.3.1: | ||
run: tests | ||
- label: ":sparkles: Lint" | ||
plugins: | ||
plugin-linter#v2.0.0: | ||
id: tendnz/git-tag | ||
- label: ":shell: Shellcheck" | ||
plugins: | ||
shellcheck#v1.0.1: | ||
files: hooks/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 The Dyrt | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Git Tag Buildkite Plugin | ||
|
||
A [Buildkite plugin](https://buildkite.com/docs/agent/v3/plugins) to tag the current head with a version and push it to the repo. | ||
|
||
Based heavily on [Git Commit](https://github.com/thedyrt/git-commit-buildkite-plugin). | ||
|
||
## Example | ||
|
||
With no options, tags the `$BUILDKITE_BRANCH` and pushes the tags, with a commit message like `Build #4`: | ||
|
||
```yml | ||
steps: | ||
- command: make | ||
plugins: | ||
- tendnz/git-tag#v1.0.0: | ||
version: "v1.0.0-prod" | ||
``` | ||
With all options customized: | ||
```yml | ||
steps: | ||
- command: make | ||
plugins: | ||
- tendnz/git-tag#v1.0.0: | ||
version: "v1.0.0-prod" | ||
message: "Release to $ENV [$BUILDKITE_BUILD_NUMBER]" | ||
user: | ||
name: Bob Monkey | ||
email: [email protected] | ||
``` | ||
## Configuration | ||
- **version** (required)) | ||
A tag to use in `git tag $VERSION` | ||
|
||
- **message** (optional, defaults to `Build #${BUILDKITE_BUILD_NUMBER}`) | ||
|
||
The commit message | ||
|
||
- **user.email** (optional) | ||
|
||
If given, will configure the git user email for the repo. | ||
|
||
- **user.name** (optional) | ||
|
||
If given, will configure the git user name for the repo. | ||
|
||
|
||
## Tests / Linting | ||
|
||
To run the tests of this plugin, run | ||
|
||
```sh | ||
docker-compose run --rm tests | ||
``` | ||
|
||
To run the [Buildkite Plugin Linter](https://github.com/buildkite-plugins/buildkite-plugin-linter), run | ||
|
||
```sh | ||
docker-compose run --rm lint | ||
``` | ||
|
||
## License | ||
|
||
MIT (see [LICENSE](LICENSE)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: '2' | ||
services: | ||
tests: | ||
image: buildkite/plugin-tester | ||
volumes: | ||
- ".:/plugin:ro" | ||
lint: | ||
image: buildkite/plugin-linter | ||
command: ['--id', 'tendnz/git-tag'] | ||
volumes: | ||
- ".:/plugin:ro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
if [[ ${BUILDKITE_COMMAND_EXIT_STATUS:-0} != "0" ]] | ||
then | ||
echo "--- Skipping git-tag because the command failed" | ||
exit 0 | ||
fi | ||
|
||
branch=${BUILDKITE_PLUGIN_GIT_TAG_BRANCH:-${BUILDKITE_BRANCH}} | ||
message=${BUILDKITE_PLUGIN_GIT_TAG_MESSAGE:-"Build #${BUILDKITE_BUILD_NUMBER}"} | ||
|
||
if [[ -n ${BUILDKITE_PLUGIN_GIT_TAG_USER_NAME+x} ]] | ||
then | ||
git config user.name "$BUILDKITE_PLUGIN_GIT_TAG_USER_NAME" | ||
fi | ||
|
||
if [[ -n ${BUILDKITE_PLUGIN_GIT_TAG_USER_EMAIL+x} ]] | ||
then | ||
git config user.email "$BUILDKITE_PLUGIN_GIT_TAG_USER_EMAIL" | ||
fi | ||
|
||
echo "--- Tagging with ${BUILDKITE_PLUGIN_GIT_TAG_VERSION}" | ||
git tag "${BUILDKITE_PLUGIN_GIT_TAG_VERSION}" -m "${BUILDKITE_PLUGIN_GIT_TAG_MESSAGE}" | ||
git push --tags | ||
echo "--- Tags pushed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Git Tag | ||
description: A Buildkite plugin to tag the current git repository with a specific value | ||
author: https://github.com/nicwise | ||
requirements: [] | ||
configuration: | ||
properties: | ||
version: | ||
type: string | ||
message: | ||
type: string | ||
user: | ||
type: object | ||
properties: | ||
email: | ||
type: string | ||
name: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bats | ||
|
||
load '/usr/local/lib/bats/load.bash' | ||
|
||
post_command_hook="$PWD/hooks/post-command" | ||
|
||
|
||
echo "needs ot have some tests" |