add option to skip git push by setting GITPUSH=NO when running merger_from_main.sh
# This script has no command line arguments.
# However, it requires that the environment variable variable
# GIT_ADMIN is set to: <githubuserid>:<password>
+# unless GITPUSH is set to NO
#
# --- Start standard header to set AOMP environment variables ----
realpath=`realpath $0`
@@ -12,10 +13,14 @@ thisdir=`dirname $realpath`
. $thisdir/trunk_common_vars
# --- end standard header ----
+GITPUSH=${GITPUSH:-YES}
+if [ "$GITPUSH" == "YES" ] ; then
if [ -z $GIT_ADMIN ] ; then
echo "ERROR: You must set environment variable GIT_ADMIN to <userid>:<password>"
+ echo " or set GITPUSH=NO"
exit 1
fi
+fi
REPO_MIRROR="https://github.com/ROCm-Developer-Tools/llvm-project"
REPO="REPO_MIRROR"
_dev_branch="amd-trunk-dev"
@@ -28,7 +33,6 @@ if [ ! -f $logfile ] ; then
exit 1
fi
-
echo " " >> $logfile
echo "=============== START $0 ========================" | tee -a $logfile
date | tee -a $logfile
@@ -113,6 +117,7 @@ echo "git merge main " | tee -a $logfile
git merge main -m "Merge attempt by $0 into branch $_dev_branch " 2>&1 | tee -a $logfile
_merge_rc=$?
if [ $_merge_rc == 0 ] ; then
+ if [ "$GITPUSH" == "YES" ] ; then
echo "=============== Successful MERGE ====================" | tee -a $logfile
echo "git push ${!REPO} $_dev_branch" | tee -a $logfile
PUSH_LOG="$(git push ${!REPO/https:\/\//https:\/\/$GIT_ADMIN@} $_dev_branch 2>&1)"
@@ -126,6 +131,9 @@ if [ $_merge_rc == 0 ] ; then
echo " GIT_ADMIN=$GIT_ADMIN" # do not write a password to any log file
_fail=1
fi
+ else
+ echo "WARNING: SKIPPING git push because GITPUSH=$GITPUSH" | tee -a $logfile
+ fi
else
echo " " >> $logfile
echo "ERROR: MERGE FAILED with rc $_merge_rc " | tee -a $logfile
