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

osmith gerrit-no-reply at
Mon Mar 1 12:26:03 UTC 2021

osmith has submitted this change. ( )

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

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/
1 file changed, 19 insertions(+), 0 deletions(-)

  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/ b/scripts/kernel-test/
index d261051..5f246ae 100755
--- a/scripts/kernel-test/
+++ b/scripts/kernel-test/
@@ -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_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
 	git fetch "$KERNEL_REMOTE_NAME"

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I18b29011e3e8e2577bdf1a9c64c4370309cc8399
Gerrit-Change-Number: 23151
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at>
Gerrit-Reviewer: fixeria <vyanitskiy at>
Gerrit-Reviewer: osmith <osmith at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list