[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: steps:
- label: ":docker: Image Deployments" - label: ":docker: Image Deployments"
command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload" command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload"
concurrency: 1 concurrency: 1
concurrency_group: "deployments" concurrency_group: "deployments"
if: build.branch == "master" if: build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
- label: ":docker: Image Deployments" - label: ":docker: Image Deployments"
command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload" 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" - label: ":docker: Deploy Manifests"
command: "authelia-scripts docker push-manifest" command: "authelia-scripts docker push-manifest"
@ -17,13 +25,13 @@ steps:
concurrency_group: "deployments" concurrency_group: "deployments"
env: env:
DOCKER_CLI_EXPERIMENTAL: "enabled" DOCKER_CLI_EXPERIMENTAL: "enabled"
if: build.branch == "master" if: build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
- label: ":docker: Deploy Manifests" - label: ":docker: Deploy Manifests"
command: "authelia-scripts docker push-manifest" command: "authelia-scripts docker push-manifest"
env: env:
DOCKER_CLI_EXPERIMENTAL: "enabled" DOCKER_CLI_EXPERIMENTAL: "enabled"
if: build.branch != "master" if: build.branch != "master" && build.env("CI_DOCS_BYPASS") != "true"
- label: ":github: Deploy Artifacts" - label: ":github: Deploy Artifacts"
command: "ghartifacts.sh" command: "ghartifacts.sh"
@ -38,7 +46,7 @@ steps:
- label: ":linux: Deploy AUR" - label: ":linux: Deploy AUR"
command: ".buildkite/steps/aurpackages.sh | buildkite-agent pipeline upload" command: ".buildkite/steps/aurpackages.sh | buildkite-agent pipeline upload"
depends_on: ~ 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" - label: ":book: Deploy Documentation"
command: "syncdoc.sh" command: "syncdoc.sh"
@ -46,3 +54,4 @@ steps:
agents: agents:
upload: "fast" upload: "fast"
if: build.branch == "master" 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 #!/bin/bash
set -eu set -eu
for AUR_PACKAGE in authelia authelia-bin authelia-git; for AUR_PACKAGE in authelia authelia-bin authelia-git; do
do cat << EOF
echo " - label: \":linux: Deploy AUR Package [${AUR_PACKAGE}]\"" - label: ":linux: Deploy AUR Package [${AUR_PACKAGE}]"
echo " commands:" command: "aurhelper.sh"
echo " - \"aurhelper.sh\"" agents:
echo " agents:" upload: "fast"
echo " upload: \"fast\"" env:
echo " env:" PACKAGE: "${AUR_PACKAGE}"
echo " "PACKAGE: ${AUR_PACKAGE}"" EOF
if [[ "${AUR_PACKAGE}" != "authelia-git" ]]; then if [[ "${AUR_PACKAGE}" != "authelia-git" ]]; then
echo " depends_on:" cat << EOF
echo " - \"artifacts\"" depends_on:
echo " if: build.tag != null" - "artifacts"
if: build.tag != null
EOF
else else
echo " if: build.branch == \"master\"" cat << EOF
if: build.branch == "master"
EOF
fi fi
done done

View File

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

View File

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

View File

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