From e5c2f2abb601f2d2b32369c05f6b7bcee269f7b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Bal=C3=A1=C5=BEik?=
 <stepan.balazik@nic.cz>
Date: Thu, 13 Aug 2020 13:08:16 +0200
Subject: [PATCH] ci: check whether Deckard submodule commit is present on
 master

This is to prevent issues like https://gitlab.nic.cz/knot/knot-resolver/-/merge_requests/1036
---
 .gitlab-ci.yml             |  6 ++++++
 ci/deckard_commit_check.sh | 13 +++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100755 ci/deckard_commit_check.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 02b14dc18..1781825f2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -168,6 +168,12 @@ build:darwin:
   script:
     - ci/travis.py ${CI_COMMIT_REF_NAME}
 
+deckard_commit:
+  <<: *test_nodep
+  script:
+    - ci/deckard_commit_check.sh
+  allow_failure: true
+  
 deckard:
   <<: *test_flaky
   tags:
diff --git a/ci/deckard_commit_check.sh b/ci/deckard_commit_check.sh
new file mode 100755
index 000000000..5b4016d8e
--- /dev/null
+++ b/ci/deckard_commit_check.sh
@@ -0,0 +1,13 @@
+DECKARD_COMMIT=$(git ls-tree HEAD:tests/integration/ | grep commit | grep deckard | cut -f1 | cut -f3 '-d ')
+DECKARD_PATH="tests/integration/deckard"
+pushd $DECKARD_PATH > /dev/null
+if git merge-base --is-ancestor $DECKARD_COMMIT origin/master; then
+	echo "Deckard submodule commit is on in its master branch. All good in the hood."
+	exit 0
+else
+	echo "Deckard submodule commit $DECKARD_COMMIT is not in Deckard's master branch."
+	echo "This WILL cause CI breakages so make sure your changes in Deckard are merged"
+	echo "or point the submodule to another commit."
+	exit 1
+fi
+
-- 
GitLab