[Buildkite] Adjust CI bypasses (#804)

pull/806/head^2
Amir Zarrinkafsh 2020-04-01 09:44:57 +11:00 committed by GitHub
parent 6652d53b8b
commit 6128081e1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 31 deletions

View File

@ -0,0 +1,8 @@
<h4>Bypass Build</h4>
<dl class="flex flex-wrap mxn1">
<div class="m1">
<dd>
CI/CD steps have been skipped as this build will not affect code.
</dd>
</div>
</dl>

View File

@ -1,8 +0,0 @@
<h4>Documentation Build</h4>
<dl class="flex flex-wrap mxn1">
<div class="m1">
<dd>
CI/CD steps have been skipped as this build only affects documentation.
</dd>
</div>
</dl>

View File

@ -6,34 +6,34 @@ DIVERGED=$(git merge-base --fork-point origin/master > /dev/null; echo $?)
if [[ $DIVERGED -eq 0 ]]; then
if [[ $BUILDKITE_TAG == "" ]]; then
if [[ $BUILDKITE_BRANCH == "master" ]]; then
CI_DOCS_BYPASS=$(git diff --name-only HEAD~1 | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false)
CI_BYPASS=$(git diff --name-only HEAD~1 | sed -rn '/^(BREAKING.md|CONTRIBUTING.md|README.md|docs\/.*)/!{q1}' && echo true || echo false)
else
CI_DOCS_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false)
CI_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^(BREAKING.md|CONTRIBUTING.md|README.md|docs\/.*)/!{q1}' && echo true || echo false)
fi
else
CI_DOCS_BYPASS="false"
CI_BYPASS="false"
fi
else
CI_DOCS_BYPASS="false"
CI_BYPASS="false"
fi
cat << EOF
env:
CI_DOCS_BYPASS: ${CI_DOCS_BYPASS}
CI_BYPASS: ${CI_BYPASS}
steps:
- label: ":docker: Image Deployments"
command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload"
concurrency: 1
concurrency_group: "deployments"
if: build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
if: build.branch == "master" && build.env("CI_BYPASS") != "true"
- label: ":docker: Image Deployments"
command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload"
if: build.branch != "master" && build.env("CI_DOCS_BYPASS") != "true"
if: build.branch != "master" && build.env("CI_BYPASS") != "true"
- wait:
if: build.env("CI_DOCS_BYPASS") != "true"
if: build.env("CI_BYPASS") != "true"
- label: ":docker: Deploy Manifests"
command: "authelia-scripts docker push-manifest"
@ -41,13 +41,13 @@ steps:
concurrency_group: "deployments"
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
if: build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
if: build.branch == "master" && build.env("CI_BYPASS") != "true"
- label: ":docker: Deploy Manifests"
command: "authelia-scripts docker push-manifest"
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
if: build.branch != "master" && build.env("CI_DOCS_BYPASS") != "true"
if: build.branch != "master" && build.env("CI_BYPASS") != "true"
- label: ":github: Deploy Artifacts"
command: "ghartifacts.sh"
@ -62,7 +62,7 @@ steps:
- label: ":linux: Deploy AUR"
command: ".buildkite/steps/aurpackages.sh | buildkite-agent pipeline upload"
depends_on: ~
if: build.tag != null || build.branch == "master" && build.env("CI_DOCS_BYPASS") != "true"
if: build.tag != null || build.branch == "master" && build.env("CI_BYPASS") != "true"
- label: ":book: Deploy Documentation"
command: "syncdoc.sh"

View File

@ -6,44 +6,44 @@ DIVERGED=$(git merge-base --fork-point origin/master > /dev/null; echo $?)
if [[ $DIVERGED -eq 0 ]]; then
if [[ $BUILDKITE_TAG == "" ]]; then
if [[ $BUILDKITE_BRANCH == "master" ]]; then
CI_DOCS_BYPASS=$(git diff --name-only HEAD~1 | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false)
CI_BYPASS=$(git diff --name-only HEAD~1 | sed -rn '/^(BREAKING.md|CONTRIBUTING.md|README.md|docs\/.*)/!{q1}' && echo true || echo false)
else
CI_DOCS_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false)
CI_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^(BREAKING.md|CONTRIBUTING.md|README.md|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"
if [[ $CI_BYPASS == "true" ]]; then
cat .buildkite/annotations/bypass | buildkite-agent annotate --style "info" --context "ctx-info"
fi
else
CI_DOCS_BYPASS="false"
CI_BYPASS="false"
fi
else
CI_DOCS_BYPASS="false"
CI_BYPASS="false"
fi
cat << EOF
env:
CI_DOCS_BYPASS: ${CI_DOCS_BYPASS}
CI_BYPASS: ${CI_BYPASS}
steps:
- label: ":hammer_and_wrench: Unit Test"
command: "authelia-scripts --log-level debug ci"
if: build.branch !~ /^(master)|(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_DOCS_BYPASS") != "true"
if: build.branch !~ /^(master)|(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true"
- wait:
if: build.env("CI_DOCS_BYPASS") != "true"
if: build.env("CI_BYPASS") != "true"
- label: ":docker: Image Builds"
command: ".buildkite/steps/buildimages.sh | buildkite-agent pipeline upload"
depends_on: ~
if: build.env("CI_DOCS_BYPASS") != "true"
if: build.env("CI_BYPASS") != "true"
- wait:
if: build.branch !~ /^(master)|(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_DOCS_BYPASS") != "true"
if: build.branch !~ /^(master)|(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true"
- label: ":chrome: Integration Tests"
command: ".buildkite/steps/e2etests.sh | buildkite-agent pipeline upload"
depends_on:
- "build-docker-amd64"
if: build.branch !~ /^(master)|(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_DOCS_BYPASS") != "true"
if: build.branch !~ /^(master)|(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true"
EOF