mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
2a08f33166
When running CI in other repositories (e.g. Docker's downstream docker/engine repository), or other branches, the validation scripts were calculating the list of changes based on the wrong information. This lead to weird failures in CI in a branch where these values were not updated ':-) (CI on a pull request failed because it detected that new tests were added to the deprecated `integration-cli` test-suite, but the pull request did not actually make changes in that area). This patch allows overriding the target repository (and branch) to compare to (without having to edit the scripts). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
30 lines
857 B
Bash
30 lines
857 B
Bash
#!/usr/bin/env bash
|
|
|
|
set -e -o pipefail
|
|
|
|
if [ -z "$VALIDATE_UPSTREAM" ]; then
|
|
# this is kind of an expensive check, so let's not do this twice if we
|
|
# are running more than one validate bundlescript
|
|
|
|
VALIDATE_REPO="${VALIDATE_REPO:-https://github.com/docker/docker.git}"
|
|
VALIDATE_BRANCH="${VALIDATE_BRANCH:-master}"
|
|
|
|
VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
|
|
|
|
git fetch -q "$VALIDATE_REPO" "refs/heads/$VALIDATE_BRANCH"
|
|
VALIDATE_UPSTREAM="$(git rev-parse --verify FETCH_HEAD)"
|
|
|
|
VALIDATE_COMMIT_LOG="$VALIDATE_UPSTREAM..$VALIDATE_HEAD"
|
|
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
|
|
|
|
validate_diff() {
|
|
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
|
git diff "$VALIDATE_COMMIT_DIFF" "$@"
|
|
fi
|
|
}
|
|
validate_log() {
|
|
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
|
git log "$VALIDATE_COMMIT_LOG" "$@"
|
|
fi
|
|
}
|
|
fi
|