From 6af27cb3f957df1dad5bfeca34baa963d7318284 Mon Sep 17 00:00:00 2001 From: Amir Zarrinkafsh Date: Mon, 9 Mar 2020 17:45:15 +1100 Subject: [PATCH] [Buildkite] Fix CI docs bypass by ensuring HEAD diff for master is correct (#699) --- .buildkite/deployment.sh | 8 +++++++- .buildkite/pipeline.sh | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.buildkite/deployment.sh b/.buildkite/deployment.sh index cb0814050..e07073dce 100755 --- a/.buildkite/deployment.sh +++ b/.buildkite/deployment.sh @@ -1,9 +1,15 @@ #!/bin/bash set -u +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 + cat << EOF env: - CI_DOCS_BYPASS: $(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false) + CI_DOCS_BYPASS: ${CI_DOCS_BYPASS} steps: - label: ":docker: Image Deployments" diff --git a/.buildkite/pipeline.sh b/.buildkite/pipeline.sh index 50c01ad86..9a4e087fb 100755 --- a/.buildkite/pipeline.sh +++ b/.buildkite/pipeline.sh @@ -1,9 +1,15 @@ #!/bin/bash set -u +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 + cat << EOF env: - CI_DOCS_BYPASS: $(git diff --name-only `git merge-base --fork-point origin/master` | sed -rn '/^docs\/.*/!{q1}' && echo true || echo false) + CI_DOCS_BYPASS: ${CI_DOCS_BYPASS} steps: - label: ":hammer_and_wrench: Unit Test"