mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
93abf699b8
If origin/master diverges beyond the initial fork-point on branches or external forks, the `git merge-base` command exits unsuccessfully. This will cause commits to incorrectly be recognised as a docs bypass. This change will catch the unsuccessful exit and treat it as a normal CI/CD run. Examples: - https://buildkite.com/authelia/authelia/builds/932 - https://buildkite.com/authelia/authelia/builds/933 - https://buildkite.com/authelia/authelia/builds/941
73 lines
2.1 KiB
Bash
Executable File
73 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -u
|
|
|
|
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)
|
|
else
|
|
CI_DOCS_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false)
|
|
fi
|
|
else
|
|
CI_DOCS_BYPASS="false"
|
|
fi
|
|
else
|
|
CI_DOCS_BYPASS="false"
|
|
fi
|
|
|
|
cat << EOF
|
|
env:
|
|
CI_DOCS_BYPASS: ${CI_DOCS_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"
|
|
|
|
- label: ":docker: Image Deployments"
|
|
command: ".buildkite/steps/deployimages.sh | buildkite-agent pipeline upload"
|
|
if: build.branch != "master" && build.env("CI_DOCS_BYPASS") != "true"
|
|
|
|
- wait:
|
|
if: build.env("CI_DOCS_BYPASS") != "true"
|
|
|
|
- label: ":docker: Deploy Manifests"
|
|
command: "authelia-scripts docker push-manifest"
|
|
concurrency: 1
|
|
concurrency_group: "deployments"
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
|
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" && build.env("CI_DOCS_BYPASS") != "true"
|
|
|
|
- label: ":github: Deploy Artifacts"
|
|
command: "ghartifacts.sh"
|
|
depends_on: ~
|
|
retry:
|
|
automatic: true
|
|
agents:
|
|
upload: "fast"
|
|
key: "artifacts"
|
|
if: build.tag != null
|
|
|
|
- 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"
|
|
|
|
- label: ":book: Deploy Documentation"
|
|
command: "syncdoc.sh"
|
|
depends_on: ~
|
|
agents:
|
|
upload: "fast"
|
|
if: build.branch == "master"
|
|
EOF |