[Buildkite] Ignore unnecessary CI steps for docs/* only based commits (#690)

* [Buildkite] Ignore build and deploy steps for [DOCS] only based commits

* [Buildkite] Convert static pipelines into dynamic pipelines

* [Buildkite] Convert dynamic pipeline steps into heredocs

* [Buildkite] Fix indentation for aurpackages.sh

* [Buildkite] Rename docs bypass env variable

* [Buildkite] Fix automatic retries in integration tests
pull/693/head^2
Amir Zarrinkafsh 2020-03-09 12:32:07 +11:00 committed by GitHub
parent 3c8babbd4f
commit b70c4a744f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 105 additions and 76 deletions

View File

@ -1,15 +1,23 @@
#!/bin/bash
set -u
cat << EOF
env:
CI_DOCS_BYPASS: $(git diff --name-only `git merge-base --fork-point master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false)
steps:
- label: ":docker: Image Deployments"
command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload"
concurrency: 1
concurrency_group: "deployments"
if: build.branch == "master"
if: build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
- label: ":docker: Image Deployments"
command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload"
if: build.branch != "master"
if: build.branch != "master" && build.env("CI_DOCS_BYPASS") != "true"
- wait
- wait:
if: build.env("CI_DOCS_BYPASS") != "true"
- label: ":docker: Deploy Manifests"
command: "authelia-scripts docker push-manifest"
@ -17,13 +25,13 @@ steps:
concurrency_group: "deployments"
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
if: build.branch == "master"
if: build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
- label: ":docker: Deploy Manifests"
command: "authelia-scripts docker push-manifest"
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
if: build.branch != "master"
if: build.branch != "master" && build.env("CI_DOCS_BYPASS") != "true"
- label: ":github: Deploy Artifacts"
command: "ghartifacts.sh"
@ -38,7 +46,7 @@ steps:
- label: ":linux: Deploy AUR"
command: ".buildkite/steps/aurpackages.sh | buildkite-agent pipeline upload"
depends_on: ~
if: build.tag != null || build.branch == "master"
if: build.tag != null || build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
- label: ":book: Deploy Documentation"
command: "syncdoc.sh"
@ -46,3 +54,4 @@ steps:
agents:
upload: "fast"
if: build.branch == "master"
EOF

View File

@ -0,0 +1,29 @@
#!/bin/bash
set -u
cat << EOF
env:
CI_DOCS_BYPASS: $(git diff --name-only `git merge-base --fork-point master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false)
steps:
- label: ":hammer_and_wrench: Unit Test"
command: "authelia-scripts --log-level debug ci"
if: build.env("CI_DOCS_BYPASS") != "true"
- wait:
if: build.env("CI_DOCS_BYPASS") != "true"
- label: ":docker: Image Builds"
command: ".buildkite/steps/buildimages.sh | buildkite-agent pipeline upload"
depends_on: ~
if: build.env("CI_DOCS_BYPASS") != "true"
- wait:
if: build.env("CI_DOCS_BYPASS") != "true"
- label: ":chrome: Integration Tests"
command: ".buildkite/steps/e2etests.sh | buildkite-agent pipeline upload"
depends_on:
- "build-docker-amd64"
if: build.env("CI_DOCS_BYPASS") != "true"
EOF

View File

@ -1,16 +0,0 @@
steps:
- label: ":hammer_and_wrench: Unit Test"
command: "authelia-scripts --log-level debug ci"
- wait
- label: ":docker: Image Builds"
command: ".buildkite/steps/buildimages.sh | buildkite-agent pipeline upload"
depends_on: ~
- wait
- label: ":chrome: Integration Tests"
command: ".buildkite/steps/e2etests.sh | buildkite-agent pipeline upload"
depends_on:
- "build-docker-amd64"

View File

@ -1,20 +1,24 @@
#!/bin/bash
set -eu
for AUR_PACKAGE in authelia authelia-bin authelia-git;
do
echo " - label: \":linux: Deploy AUR Package [${AUR_PACKAGE}]\""
echo " commands:"
echo " - \"aurhelper.sh\""
echo " agents:"
echo " upload: \"fast\""
echo " env:"
echo " "PACKAGE: ${AUR_PACKAGE}""
for AUR_PACKAGE in authelia authelia-bin authelia-git; do
cat << EOF
- label: ":linux: Deploy AUR Package [${AUR_PACKAGE}]"
command: "aurhelper.sh"
agents:
upload: "fast"
env:
PACKAGE: "${AUR_PACKAGE}"
EOF
if [[ "${AUR_PACKAGE}" != "authelia-git" ]]; then
echo " depends_on:"
echo " - \"artifacts\""
echo " if: build.tag != null"
cat << EOF
depends_on:
- "artifacts"
if: build.tag != null
EOF
else
echo " if: build.branch == \"master\""
cat << EOF
if: build.branch == "master"
EOF
fi
done

View File

@ -1,18 +1,18 @@
#!/bin/bash
set -eu
for BUILD_ARCH in amd64 arm32v7 arm64v8;
do
echo " - label: \":docker: Build Image [${BUILD_ARCH}]\""
echo " commands:"
echo " - \"authelia-scripts docker build --arch=${BUILD_ARCH}\""
echo " agents:"
echo " build: \"true\""
echo " artifact_paths:"
echo " - \"authelia-image-${BUILD_ARCH}.tar.zst\""
echo " - \"authelia-linux-${BUILD_ARCH}.tar.gz\""
echo " - \"authelia-linux-${BUILD_ARCH}.tar.gz.sha256\""
echo " env:"
echo " "ARCH: ${BUILD_ARCH}""
echo " key: \"build-docker-${BUILD_ARCH}\""
for BUILD_ARCH in amd64 arm32v7 arm64v8; do
cat << EOF
- label: ":docker: Build Image [${BUILD_ARCH}]"
command: "authelia-scripts docker build --arch=${BUILD_ARCH}"
agents:
build: "true"
artifact_paths:
- "authelia-image-${BUILD_ARCH}.tar.zst"
- "authelia-linux-${BUILD_ARCH}.tar.gz"
- "authelia-linux-${BUILD_ARCH}.tar.gz.sha256"
env:
ARCH: "${BUILD_ARCH}"
key: "build-docker-${BUILD_ARCH}"
EOF
done

View File

@ -1,13 +1,13 @@
#!/bin/bash
set -eu
for BUILD_ARCH in amd64 arm32v7 arm64v8;
do
echo " - commands:"
echo " - \"authelia-scripts docker push-image --arch=${BUILD_ARCH}\""
echo " label: \":docker: Deploy Image [${BUILD_ARCH}]\""
echo " agents:"
echo " upload: \"fast\""
echo " env:"
echo " "ARCH: ${BUILD_ARCH}""
for BUILD_ARCH in amd64 arm32v7 arm64v8; do
cat << EOF
- label: ":docker: Deploy Image [${BUILD_ARCH}]"
command: "authelia-scripts docker push-image --arch=${BUILD_ARCH}"
agents:
upload: "fast"
env:
ARCH: "${BUILD_ARCH}"
EOF
done

View File

@ -1,19 +1,22 @@
#!/bin/bash
set -eu
for SUITE_NAME in $(authelia-scripts suites list);
do
echo " - label: \":selenium: ${SUITE_NAME} Suite\""
echo " commands:"
echo " - \"authelia-scripts --log-level debug suites test ${SUITE_NAME} --headless\""
echo " retry:"
echo " "automatic: true""
if [[ "${SUITE_NAME}" != "Kubernetes" ]];
then
echo " agents:"
echo " "suite: all""
for SUITE_NAME in $(authelia-scripts suites list); do
cat << EOF
- label: ":selenium: ${SUITE_NAME} Suite"
command: "authelia-scripts --log-level debug suites test ${SUITE_NAME} --headless"
retry:
automatic: true
EOF
if [[ "${SUITE_NAME}" != "Kubernetes" ]]; then
cat << EOF
agents:
suite: "all"
EOF
else
echo " agents:"
echo " "suite: kubernetes""
cat << EOF
agents:
suite: "kubernetes"
EOF
fi
done