Browse code

Allow overriding repository and branch in validate scripts

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>

Sebastiaan van Stijn authored on 2019/01/31 06:16:16
Showing 2 changed files
... ...
@@ -11,6 +11,11 @@ DOCKERFILE := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $$
11 11
 DOCKER_GITCOMMIT := $(shell git rev-parse --short HEAD || echo unsupported)
12 12
 export DOCKER_GITCOMMIT
13 13
 
14
+# allow overriding the repository and branch that validation scripts are running
15
+# against these are used in hack/validate/.validate to check what changed in the PR.
16
+export VALIDATE_REPO
17
+export VALIDATE_BRANCH
18
+
14 19
 # env vars passed through directly to Docker's build scripts
15 20
 # to allow things like `make KEEPBUNDLE=1 binary` easily
16 21
 # `project/PACKAGERS.md` have some limited documentation of some of these
... ...
@@ -47,6 +52,8 @@ DOCKER_ENVS := \
47 47
 	-e TESTDIRS \
48 48
 	-e TESTFLAGS \
49 49
 	-e TIMEOUT \
50
+	-e VALIDATE_REPO \
51
+	-e VALIDATE_BRANCH \
50 52
 	-e HTTP_PROXY \
51 53
 	-e HTTPS_PROXY \
52 54
 	-e NO_PROXY \
... ...
@@ -6,8 +6,8 @@ if [ -z "$VALIDATE_UPSTREAM" ]; then
6 6
 	# this is kind of an expensive check, so let's not do this twice if we
7 7
 	# are running more than one validate bundlescript
8 8
 
9
-	VALIDATE_REPO='https://github.com/docker/docker.git'
10
-	VALIDATE_BRANCH='master'
9
+	VALIDATE_REPO="${VALIDATE_REPO:-https://github.com/docker/docker.git}"
10
+	VALIDATE_BRANCH="${VALIDATE_BRANCH:-master}"
11 11
 
12 12
 	VALIDATE_HEAD="$(git rev-parse --verify HEAD)"
13 13