From 021e6035834bda7eec9f2b466903d782f7c36df9 Mon Sep 17 00:00:00 2001 From: econwar Date: Thu, 10 Jan 2019 09:39:30 +0000 Subject: [PATCH] Fix to allow tracking of new files Add if to check if remote upstream has already been added Delete delivery branch afterwards Change-Id: Id07bf1a4f54ca95525055b7a403df06715fc7917 Signed-off-by: Conor Ward --- jjb/global/push-upstream-jobs.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/jjb/global/push-upstream-jobs.sh b/jjb/global/push-upstream-jobs.sh index 3eedac2c..8bc35dd3 100755 --- a/jjb/global/push-upstream-jobs.sh +++ b/jjb/global/push-upstream-jobs.sh @@ -46,22 +46,32 @@ git config user.email $(git show -s --pretty=%ae) git config user.name $username echo "Checking out branch on master with new changes" -git reset HEAD~1 +git reset HEAD~1 --soft git checkout -b delivery_branch origin/master -echo '[remote "upstream"]' >> $WORKSPACE/.git/config -echo " url = ssh://$username@gerrit.onap.org:29418/$project.git" >> $WORKSPACE/.git/config -echo " fetch = +refs/heads/*:refs/remotes/upstream/*" >> $WORKSPACE/.git/config +git config --get remote.upstream.url +retVal=$? + +if [[ $retVal -eq 0 ]] +then + git remote rm upstream + git remote add upstream "ssh://$username@gerrit.onap.org:29418/$project.git" +else + git remote add upstream "ssh://$username@gerrit.onap.org:29418/$project.git" +fi echo "Committing changes and pushing upstream" git commit -as -m "$message" git push upstream HEAD:refs/for/master -retVal=$? -if [[ $retVal -eq 0 ]] +retVal1=$? +if [[ $retVal1 -eq 0 ]] then echo "Push upstream to ONAP succeeded" else echo "Push upstream to ONAP failed" exit 2 fi + +git checkout $BRANCH +git branch -D delivery_branch -- 2.25.1