aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-03-01 08:45:47 +0100
committerOliver Smith <osmith@sysmocom.de>2021-03-01 08:50:57 +0100
commit292e35c1d9db679446e46de5a283a88382de5518 (patch)
tree92134e3b1a030e83e0f42eea163d4cd0d6475ab8 /scripts
parentc87782175879ddeab7b84333901a0c88173142e5 (diff)
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
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-test/kernel-build.sh19
1 files changed, 19 insertions, 0 deletions
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 @@ KERNEL_DIR=/cache/linux
# 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 @@ prepare_git_repo() {
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"