2020-06-18 07:49:13 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-03-09 01:32:07 +00:00
|
|
|
set -u
|
|
|
|
|
2020-03-21 13:42:29 +00:00
|
|
|
DIVERGED=$(git merge-base --fork-point origin/master > /dev/null; echo $?)
|
|
|
|
|
2021-06-26 01:45:21 +00:00
|
|
|
if [[ "${DIVERGED}" == 0 ]]; then
|
|
|
|
if [[ "${BUILDKITE_TAG}" == "" ]]; then
|
|
|
|
if [[ "${BUILDKITE_BRANCH}" == "master" ]]; then
|
2022-06-04 09:38:13 +00:00
|
|
|
BUILD_DUO=$(git diff --name-only HEAD~1 | grep -q ^internal/suites/example/compose/duo-api/.* && echo true || echo false)
|
|
|
|
BUILD_HAPROXY=$(git diff --name-only HEAD~1 | grep -q ^internal/suites/example/compose/haproxy/Dockerfile && echo true || echo false)
|
2022-05-24 12:28:45 +00:00
|
|
|
CI_BYPASS=$(git diff --name-only HEAD~1 | sed -rn '/^(CODE_OF_CONDUCT\.md|CONTRIBUTING\.md|README\.md|SECURITY\.md|crowdin\.yml|\.all-contributorsrc|\.editorconfig|\.github\/.*|docs\/.*|examples\/.*)/!{q1}' && echo true || echo false)
|
2020-03-21 13:42:29 +00:00
|
|
|
else
|
2022-06-04 09:38:13 +00:00
|
|
|
BUILD_DUO=$(git diff --name-only `git merge-base --fork-point origin/master` | grep -q ^internal/suites/example/compose/duo-api/.* && echo true || echo false)
|
|
|
|
BUILD_HAPROXY=$(git diff --name-only `git merge-base --fork-point origin/master` | grep -q ^internal/suites/example/compose/haproxy/Dockerfile && echo true || echo false)
|
2022-05-24 12:28:45 +00:00
|
|
|
CI_BYPASS=$(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^(CODE_OF_CONDUCT\.md|CONTRIBUTING\.md|README\.md|SECURITY\.md|crowdin\.yml|\.all-contributorsrc|\.editorconfig|\.github\/.*|docs\/.*|examples\/.*)/!{q1}' && echo true || echo false)
|
2020-03-21 13:42:29 +00:00
|
|
|
fi
|
|
|
|
|
2022-06-04 09:38:13 +00:00
|
|
|
if [[ "${CI_BYPASS}" == "true" ]]; then
|
2020-03-31 22:44:57 +00:00
|
|
|
cat .buildkite/annotations/bypass | buildkite-agent annotate --style "info" --context "ctx-info"
|
2020-03-21 13:42:29 +00:00
|
|
|
fi
|
2020-03-15 10:07:23 +00:00
|
|
|
else
|
2022-06-04 09:38:13 +00:00
|
|
|
BUILD_DUO="false"
|
|
|
|
BUILD_HAPROXY="false"
|
2020-03-31 22:44:57 +00:00
|
|
|
CI_BYPASS="false"
|
2020-03-15 10:07:23 +00:00
|
|
|
fi
|
2020-03-15 11:01:52 +00:00
|
|
|
else
|
2022-06-04 09:38:13 +00:00
|
|
|
BUILD_DUO="false"
|
|
|
|
BUILD_HAPROXY="false"
|
2020-03-31 22:44:57 +00:00
|
|
|
CI_BYPASS="false"
|
2020-03-10 23:25:47 +00:00
|
|
|
fi
|
|
|
|
|
2020-03-09 01:32:07 +00:00
|
|
|
cat << EOF
|
|
|
|
env:
|
2022-06-04 09:38:13 +00:00
|
|
|
BUILD_DUO: ${BUILD_DUO}
|
|
|
|
BUILD_HAPROXY: ${BUILD_HAPROXY}
|
2020-03-31 22:44:57 +00:00
|
|
|
CI_BYPASS: ${CI_BYPASS}
|
2020-03-09 01:32:07 +00:00
|
|
|
|
|
|
|
steps:
|
2020-04-22 13:10:22 +00:00
|
|
|
- label: ":service_dog: Linting"
|
2020-12-03 07:06:42 +00:00
|
|
|
command: "reviewdog -reporter=github-check -filter-mode=nofilter -fail-on-error"
|
2021-08-07 00:06:42 +00:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.message !~ /\[(skip test|test skip)\]/
|
2020-04-22 13:10:22 +00:00
|
|
|
|
2020-03-09 01:32:07 +00:00
|
|
|
- label: ":hammer_and_wrench: Unit Test"
|
2021-06-25 11:53:20 +00:00
|
|
|
command: "authelia-scripts --log-level debug ci --buildkite"
|
2021-02-22 03:24:01 +00:00
|
|
|
agents:
|
|
|
|
build: "unit-test"
|
2020-04-28 14:07:20 +00:00
|
|
|
artifact_paths:
|
2021-09-16 12:39:18 +00:00
|
|
|
- "authelia-*.tar.gz"
|
|
|
|
- "authelia-*.tar.gz.sha256"
|
2021-01-03 04:28:46 +00:00
|
|
|
key: "unit-test"
|
2020-05-02 01:41:53 +00:00
|
|
|
if: build.env("CI_BYPASS") != "true"
|
2020-03-09 01:32:07 +00:00
|
|
|
|
|
|
|
- wait:
|
2020-03-31 22:44:57 +00:00
|
|
|
if: build.env("CI_BYPASS") != "true"
|
2022-06-04 09:38:13 +00:00
|
|
|
EOF
|
|
|
|
if [[ "${BUILD_DUO}" == "true" ]]; then
|
|
|
|
cat << EOF
|
|
|
|
- label: ":rocket: Trigger Pipeline [integration-duo]"
|
|
|
|
trigger: "integration-duo"
|
|
|
|
build:
|
|
|
|
message: "${BUILDKITE_MESSAGE}"
|
|
|
|
commit: "${BUILDKITE_COMMIT}"
|
|
|
|
branch: "${BUILDKITE_BRANCH}"
|
|
|
|
env:
|
|
|
|
BUILDKITE_PULL_REQUEST: "${BUILDKITE_PULL_REQUEST}"
|
|
|
|
BUILDKITE_PULL_REQUEST_BASE_BRANCH: "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
|
|
|
|
BUILDKITE_PULL_REQUEST_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
|
|
|
|
depends_on: ~
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
if [[ "${BUILD_HAPROXY}" == "true" ]]; then
|
|
|
|
cat << EOF
|
|
|
|
- label: ":rocket: Trigger Pipeline [integration-haproxy]"
|
|
|
|
trigger: "integration-haproxy"
|
|
|
|
build:
|
|
|
|
message: "${BUILDKITE_MESSAGE}"
|
|
|
|
commit: "${BUILDKITE_COMMIT}"
|
|
|
|
branch: "${BUILDKITE_BRANCH}"
|
|
|
|
env:
|
|
|
|
BUILDKITE_PULL_REQUEST: "${BUILDKITE_PULL_REQUEST}"
|
|
|
|
BUILDKITE_PULL_REQUEST_BASE_BRANCH: "${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
|
|
|
|
BUILDKITE_PULL_REQUEST_REPO: "${BUILDKITE_PULL_REQUEST_REPO}"
|
|
|
|
depends_on: ~
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
cat << EOF
|
2021-09-16 12:39:18 +00:00
|
|
|
- label: ":docker: Build Image [coverage]"
|
|
|
|
command: "authelia-scripts docker build --container=coverage"
|
2022-04-27 01:49:47 +00:00
|
|
|
retry:
|
|
|
|
manual:
|
|
|
|
permit_on_passed: true
|
2021-09-16 12:39:18 +00:00
|
|
|
agents:
|
|
|
|
build: "linux-coverage"
|
|
|
|
artifact_paths:
|
|
|
|
- "authelia-image-coverage.tar.zst"
|
2020-03-09 01:32:07 +00:00
|
|
|
depends_on: ~
|
2021-09-16 12:39:18 +00:00
|
|
|
key: "build-docker-linux-coverage"
|
|
|
|
if: build.env("CI_BYPASS") != "true" && build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.message !~ /\[(skip test|test skip)\]/
|
2020-03-09 01:32:07 +00:00
|
|
|
|
2021-06-26 01:45:21 +00:00
|
|
|
- label: ":debian: Package Builds"
|
|
|
|
command: ".buildkite/steps/debpackages.sh | buildkite-agent pipeline upload"
|
|
|
|
depends_on: ~
|
2021-06-27 03:58:58 +00:00
|
|
|
if: build.branch !~ /^(dependabot|renovate)\/.*/ && build.env("CI_BYPASS") != "true"
|
2021-06-26 01:45:21 +00:00
|
|
|
|
2020-03-09 01:32:07 +00:00
|
|
|
- wait:
|
2021-08-07 00:06:42 +00:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true" && build.message !~ /\[(skip test|test skip)\]/
|
2020-03-09 01:32:07 +00:00
|
|
|
|
|
|
|
- label: ":chrome: Integration Tests"
|
|
|
|
command: ".buildkite/steps/e2etests.sh | buildkite-agent pipeline upload"
|
|
|
|
depends_on:
|
2020-06-05 00:43:19 +00:00
|
|
|
- "build-docker-linux-coverage"
|
2021-08-07 00:06:42 +00:00
|
|
|
if: build.branch !~ /^(v[0-9]+\.[0-9]+\.[0-9]+)$\$/ && build.env("CI_BYPASS") != "true" && build.message !~ /\[(skip test|test skip)\]/
|
2022-06-04 09:38:13 +00:00
|
|
|
EOF
|