[MERGED] osmo-gsm-tester[master]: jenkins: fix: recent change broke jenkins build

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Fri Jun 23 02:18:36 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: jenkins: fix: recent change broke jenkins build
......................................................................


jenkins: fix: recent change broke jenkins build

Recent commit 851802b927ccfcb061a2774fdc5de12141426b5c introduces a build
branch, which works fine, but only on the first run. A second run in the same
repos can't delete the branch git is currently on.

I've had enough of git being impossibly difficult in UI to simply checkout a
hash or a branch now. Completely wipe out the git repository and clone a fresh
one every time.

Unfortunately, 'git clone -b' doesn't allow passing a commit hash, so we still
need to do a clone-then-checkout dance. At least now we know it will work the
same on every run.

Change-Id: I6aca4c53a796312248a189b815dfc1198a173ed9
---
M contrib/jenkins-build-common.sh
1 file changed, 6 insertions(+), 7 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/contrib/jenkins-build-common.sh b/contrib/jenkins-build-common.sh
index 779f965..895cd63 100644
--- a/contrib/jenkins-build-common.sh
+++ b/contrib/jenkins-build-common.sh
@@ -73,18 +73,17 @@
   fi
 
   cd "$base"
-  if [ ! -d "$repo" ]; then
-    git clone "$git_url/$repo" "$repo"
-  fi
-  cd "$repo"
-  git fetch origin
+  rm -rf "$repo"
+  git clone "$git_url/$repo" "$repo"
 
-  # Figure out whether we need to prepend origin/ to find branches in upstream
+  cd "$repo"
+
+  # Figure out whether we need to prepend origin/ to find branches in upstream.
+  # Doing this allows using git hashes instead of a branch name.
   if git rev-parse "origin/$branch"; then
     branch="origin/$branch"
   fi
 
-  git branch -D build_branch || true
   git checkout -b build_branch "$branch"
   rm -rf *
   git reset --hard "$branch"

-- 
To view, visit https://gerrit.osmocom.org/3022
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6aca4c53a796312248a189b815dfc1198a173ed9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list