Change in docker-playground[master]: kernel-test: verify REMOTE_NAME and URL

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/.

osmith gerrit-no-reply at lists.osmocom.org
Mon Mar 1 12:26:03 UTC 2021


osmith has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/23151 )

Change subject: kernel-test: verify REMOTE_NAME and URL
......................................................................

kernel-test: verify REMOTE_NAME and URL

If the checked out git repository already has a remote with the name
KERNEL_REMOTE_NAME, make sure that the KERNEL_URL matches the remote
URL.

Motivation for this change is osmo-ci
I5d4202a67a24d9c15a5b211fa29ce9d5b5a9d9c1, which will expose the
parameters in the jenkins job.

Related: OS#3208
Change-Id: I18b29011e3e8e2577bdf1a9c64c4370309cc8399
---
M scripts/kernel-test/kernel-build.sh
1 file changed, 19 insertions(+), 0 deletions(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  fixeria: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved; Verified



diff --git a/scripts/kernel-test/kernel-build.sh b/scripts/kernel-test/kernel-build.sh
index d261051..5f246ae 100755
--- a/scripts/kernel-test/kernel-build.sh
+++ b/scripts/kernel-test/kernel-build.sh
@@ -9,6 +9,8 @@
 
 # Add the kernel repository as git remote, fetch it, checkout the given branch
 prepare_git_repo() {
+	local url
+
 	if ! [ -d "$KERNEL_DIR" ]; then
 		mkdir -p "$KERNEL_DIR"
 		git -C "$KERNEL_DIR" init
@@ -18,6 +20,23 @@
 
 	if ! git remote | grep -q "^$KERNEL_REMOTE_NAME$"; then
 		git remote add "$KERNEL_REMOTE_NAME" "$KERNEL_URL"
+	else
+		url="$(git remote get-url "$KERNEL_REMOTE_NAME")"
+		if [ "$url" != "$KERNEL_URL" ]; then
+			set +x
+			echo "ERROR: the checked out repository already has" \
+				"a remote with the same name, pointing to a" \
+				"different URL!"
+			echo
+			echo "KERNEL_REMOTE_NAME:       $KERNEL_REMOTE_NAME"
+			echo "KERNEL_URL (parameter):   $KERNEL_URL"
+			echo "KERNEL_URL (checked out): $url"
+			echo
+			echo "Please restart the job, and either change the" \
+				"KERNEL_URL parameter to the same value, or" \
+				"use a different KERNEL_REMOTE_NAME."
+			exit 1
+		fi
 	fi
 
 	git fetch "$KERNEL_REMOTE_NAME"

-- 
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/23151
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I18b29011e3e8e2577bdf1a9c64c4370309cc8399
Gerrit-Change-Number: 23151
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210301/bc13b693/attachment.htm>


More information about the gerrit-log mailing list