diff --git a/hack/e2e.sh b/hack/e2e.sh index 953ff29f02..97a8ba8898 100755 --- a/hack/e2e.sh +++ b/hack/e2e.sh @@ -2,9 +2,26 @@ set -euo pipefail +OPENSHIFT_CI=${OPENSHIFT_CI:-""} +E2E_RELEASE_BRANCH=${E2E_RELEASE_BRANCH:-""} +GIT_BRANCH_ARGS="" + +if [ "$OPENSHIFT_CI" == "true" ]; then # detect ci environment there + E2E_RELEASE_BRANCH=${PULL_BASE_REF} # use target branch as E2E_RELEASE_BRANCH for handling backports correctly +fi; + +if [ "$E2E_RELEASE_BRANCH" != "" ]; then + echo "cloning branch $E2E_RELEASE_BRANCH" + GIT_BRANCH_ARGS="--branch ${E2E_RELEASE_BRANCH} --single-branch" +fi; + unset GOFLAGS tmp="$(mktemp -d)" -git clone "https://github.com/openshift/cluster-api-actuator-pkg.git" "$tmp" +pushd "$tmp" + git clone ${GIT_BRANCH_ARGS} --depth 1 "https://github.com/openshift/cluster-api-actuator-pkg.git" . + echo "git branch: $(git status -b -s)" + echo "latest git commit: $(git --no-pager log --oneline -1)" +popd -exec make -C "$tmp" test-e2e \ No newline at end of file +exec make -C "$tmp" test-e2e