From 592ab1eb863c188a303771ca1ae5211424c64ba6 Mon Sep 17 00:00:00 2001 From: Michael Youngstrom <youngstrom.m@husky.neu.edu> Date: Fri, 4 Jan 2019 17:26:22 -0500 Subject: [PATCH] Fix quality and python private jobs --- scripts/jenkins-common.sh | 3 ++- scripts/xss-commit-linter.sh | 12 ++++++++++-- tox.ini | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/jenkins-common.sh b/scripts/jenkins-common.sh index 0ec5ec12d80..f5ca9b5a810 100644 --- a/scripts/jenkins-common.sh +++ b/scripts/jenkins-common.sh @@ -18,7 +18,8 @@ mongo --quiet --eval 'db.getMongo().getDBNames().forEach(function(i){db.getSibli # branch to a target branch; depending on how the GitHub plugin refspec # is configured, this may not already be fetched. if [ ! -z ${TARGET_BRANCH+x} ]; then - git fetch origin $TARGET_BRANCH:refs/remotes/origin/$TARGET_BRANCH + TARGET_BRANCH_WITHOUT_ORIGIN=$(echo "${TARGET_BRANCH}" | sed 's:^origin/::') + git fetch origin $TARGET_BRANCH_WITHOUT_ORIGIN:refs/remotes/origin/$TARGET_BRANCH_WITHOUT_ORIGIN fi # Reset the jenkins worker's virtualenv back to the diff --git a/scripts/xss-commit-linter.sh b/scripts/xss-commit-linter.sh index c5d58f854e8..75c6019f9f2 100755 --- a/scripts/xss-commit-linter.sh +++ b/scripts/xss-commit-linter.sh @@ -60,8 +60,16 @@ done current_branch_hash=`git rev-parse HEAD` if [ -z "${MAIN_COMMIT+x}" ]; then - # if commit is not set, get hash of current branch - MAIN_COMMIT="origin/master" + if [ -z ${TARGET_BRANCH+x} ]; then + # if commit is not set and no target branch, get hash of current branch + MAIN_COMMIT="origin/master" + else + if [[ $TARGET_BRANCH == origin/* ]]; then + MAIN_COMMIT=$TARGET_BRANCH + else + MAIN_COMMIT=origin/$TARGET_BRANCH + fi + fi fi merge_base_command="git merge-base $current_branch_hash $MAIN_COMMIT" diff --git a/tox.ini b/tox.ini index 4e592b2917c..8e812a9c079 100644 --- a/tox.ini +++ b/tox.ini @@ -45,6 +45,7 @@ passenv = SELENIUM_PORT SHARD SKIP_NPM_INSTALL + TARGET_BRANCH TEST_SUITE XDIST_CONTAINER_SECURITY_GROUP XDIST_CONTAINER_SUBNET -- GitLab