YETUS-867. Circle CI's master failing pull
Signed-off-by: Roman Shaposhnik <rvs@apache.org>
diff --git a/precommit/src/main/shell/robots.d/circleci.sh b/precommit/src/main/shell/robots.d/circleci.sh
index 9b9c2eb..3e74d34 100755
--- a/precommit/src/main/shell/robots.d/circleci.sh
+++ b/precommit/src/main/shell/robots.d/circleci.sh
@@ -39,7 +39,9 @@
USER_PARAMS+=("--empty-patch")
PATCH_BRANCH="${CIRCLE_BRANCH}"
pushd "${BASEDIR}" >/dev/null || exit 1
- "${GIT}" branch --set-upstream-to=origin/"${CIRCLE_BRANCH}" "${CIRCLE_BRANCH}"
+ echo "Attempting to reset Circle CI's understanding of ${CIRCLE_BRANCH}"
+ "${GIT}" branch --set-upstream-to=origin/"${CIRCLE_BRANCH}" "${CIRCLE_BRANCH}" || true
+ "${GIT}" branch -f "${CIRCLE_BRANCH}" origin/"${CIRCLE_BRANCH}" || true
popd >/dev/null || exit 1
else
PATCH_OR_ISSUE="${CIRCLE_PULL_REQUEST}"
@@ -99,6 +101,15 @@
add_footer_table "Console output" "${BUILD_URL}"
}
+function circleci_pre_git_checkout
+{
+ pushd "${BASEDIR}" >/dev/null || exit 1
+ echo "Attempting to reset Circle CI's understanding of ${PATCH_BRANCH_DEFAULT}"
+ "${GIT}" branch --set-upstream-to=origin/"${PATCH_BRANCH_DEFAULT}" "${PATCH_BRANCH_DEFAULT}" || true
+ "${GIT}" branch -f "${PATCH_BRANCH_DEFAULT}" origin/"${PATCH_BRANCH_DEFAULT}" || true
+ popd >/dev/null || exit 1
+}
+
#function circleci_unittest_footer
#{
# declare statusjdk=$1
diff --git a/precommit/src/main/shell/test-patch.sh b/precommit/src/main/shell/test-patch.sh
index 05c6889..259d362 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -1107,6 +1107,12 @@
git_requires_creds
+ if [[ ${ROBOT} == true ]]; then
+ if declare -f "${ROBOTTYPE}"_pre_git_checkout >/dev/null; then
+ "${ROBOTTYPE}"_pre_git_checkout
+ fi
+ fi
+
cd "${BASEDIR}" || cleanup_and_exit 1
if [[ ! -e .git ]]; then
yetus_error "ERROR: ${BASEDIR} is not a git repo."