From 8b80be4061492d1669c90bf7fc9c759d60e703fc Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Wed, 11 Mar 2020 10:25:47 +1100 Subject: [PATCH] [Buildkite] Utilise annotations for build notifications (#700) * [Buildkite] Utilise annotations for artifact and doc bypass notifications * [Buildkite] Add context to annotations * [Buildkite] Adjust docs annotation to display for PRs --- .buildkite/annotations/artifacts | 24 ++++++++++++++++++++++++ .buildkite/annotations/documentation | 8 ++++++++ .buildkite/hooks/post-command | 6 +++++- .buildkite/pipeline.sh | 4 ++++ 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .buildkite/annotations/artifacts create mode 100644 .buildkite/annotations/documentation diff --git a/.buildkite/annotations/artifacts b/.buildkite/annotations/artifacts new file mode 100644 index 00000000..dca78ba2 --- /dev/null +++ b/.buildkite/annotations/artifacts @@ -0,0 +1,24 @@ +

Artifacts

+
+ + + +
\ No newline at end of file diff --git a/.buildkite/annotations/documentation b/.buildkite/annotations/documentation new file mode 100644 index 00000000..e6cb1da4 --- /dev/null +++ b/.buildkite/annotations/documentation @@ -0,0 +1,8 @@ +

Documentation Build

+
+
+
+ CI/CD steps have been skipped as this build only affects documentation. +
+
+
\ No newline at end of file diff --git a/.buildkite/hooks/post-command b/.buildkite/hooks/post-command index 9c9bdd6e..d485aaef 100755 --- a/.buildkite/hooks/post-command +++ b/.buildkite/hooks/post-command @@ -10,6 +10,10 @@ if [[ $BUILDKITE_LABEL =~ ":selenium:" ]] || [[ $BUILDKITE_LABEL =~ ":docker: Bu fi fi +if [[ $BUILDKITE_LABEL == ":docker: Image Deployments" ]]; then + cat .buildkite/annotations/artifacts | buildkite-agent annotate --style "success" --context "ctx-success" +fi + if [[ $BUILDKITE_LABEL =~ ":docker: Deploy" ]]; then docker logout fi @@ -32,4 +36,4 @@ if [[ $BUILDKITE_LABEL == ":docker: Deploy Manifests" ]] && [[ $BUILDKITE_BRANCH echo "Removing tag ${PR_TAG}" curl -fsL --retry 3 -o /dev/null -X "DELETE" -H "Authorization: JWT ${authtoken}" https://hub.docker.com/v2/repositories/authelia/authelia/tags/${PR_TAG}/ done -fi +fi \ No newline at end of file diff --git a/.buildkite/pipeline.sh b/.buildkite/pipeline.sh index 9a4e087f..f57848db 100755 --- a/.buildkite/pipeline.sh +++ b/.buildkite/pipeline.sh @@ -7,6 +7,10 @@ else CI_DOCS_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false) fi +if [[ $CI_DOCS_BYPASS == "true" ]]; then + cat .buildkite/annotations/documentation | buildkite-agent annotate --style "info" --context "ctx-info" +fi + cat << EOF env: CI_DOCS_BYPASS: ${CI_DOCS_BYPASS}