diff --git a/.buildkite/deployment.yml b/.buildkite/deployment.sh old mode 100644 new mode 100755 similarity index 64% rename from .buildkite/deployment.yml rename to .buildkite/deployment.sh index 1f15b6fe..5c86d00d --- a/.buildkite/deployment.yml +++ b/.buildkite/deployment.sh @@ -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 \ No newline at end of file diff --git a/.buildkite/pipeline.sh b/.buildkite/pipeline.sh new file mode 100755 index 00000000..8ec5b705 --- /dev/null +++ b/.buildkite/pipeline.sh @@ -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 \ No newline at end of file diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml deleted file mode 100644 index 96e83009..00000000 --- a/.buildkite/pipeline.yml +++ /dev/null @@ -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" \ No newline at end of file diff --git a/.buildkite/steps/aurpackages.sh b/.buildkite/steps/aurpackages.sh index d9c8663e..cd2dbf34 100755 --- a/.buildkite/steps/aurpackages.sh +++ b/.buildkite/steps/aurpackages.sh @@ -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}"" - if [[ "${AUR_PACKAGE}" != "authelia-git" ]]; then - echo " depends_on:" - echo " - \"artifacts\"" - echo " if: build.tag != null" - else - echo " if: build.branch == \"master\"" - fi +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 +cat << EOF + depends_on: + - "artifacts" + if: build.tag != null +EOF +else +cat << EOF + if: build.branch == "master" +EOF +fi done \ No newline at end of file diff --git a/.buildkite/steps/buildimages.sh b/.buildkite/steps/buildimages.sh index 91b4e21a..334c56a9 100755 --- a/.buildkite/steps/buildimages.sh +++ b/.buildkite/steps/buildimages.sh @@ -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 \ No newline at end of file diff --git a/.buildkite/steps/deployimages.sh b/.buildkite/steps/deployimages.sh index 857c2c3e..cf517872 100755 --- a/.buildkite/steps/deployimages.sh +++ b/.buildkite/steps/deployimages.sh @@ -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 \ No newline at end of file diff --git a/.buildkite/steps/e2etests.sh b/.buildkite/steps/e2etests.sh index 14c5f695..25c26362 100755 --- a/.buildkite/steps/e2etests.sh +++ b/.buildkite/steps/e2etests.sh @@ -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"" - else - echo " agents:" - echo " "suite: kubernetes"" - fi +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 +cat << EOF + agents: + suite: "kubernetes" +EOF +fi done \ No newline at end of file