Add eclair scripts
copy these scripts from ci/tf-ci-scripts
Signed-off-by: Arthur She <arthur.she@linaro.org>
Change-Id: I555cb85bcb207d247d84e06fcd47d22e55b4ac10
diff --git a/eclair/post_gerrit_comment.sh b/eclair/post_gerrit_comment.sh
new file mode 100755
index 0000000..9d2042f
--- /dev/null
+++ b/eclair/post_gerrit_comment.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Copyright (c) 2019-2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+set -ex
+
+# Set to 0 to temporarily disable posting comments to Gerrit.
+should_post_comment=1
+
+# Directory where this script resides.
+SCRIPT_DIR="$(cd "$(dirname "$0")" ; echo "${PWD}")"
+
+# Don't post comments if run on the staging server.
+if echo "$JENKINS_PUBLIC_URL" | grep -q "ci\.staging"; then
+ should_post_comment=0
+fi
+
+# Always enable posting comments to sandbox (test) projects, even if they're
+# disabled above.
+if echo "${GERRIT_PROJECT}" | grep -q sandbox; then
+ should_post_comment=1
+fi
+
+# If run without a patch (e.g. for debugging, don't try to post comment.
+if [ -z "$GERRIT_CHANGE_NUMBER" ]; then
+ should_post_comment=0
+fi
+
+if [ $should_post_comment -eq 1 ]; then
+ mkdir -p ~/.ssh/
+ ssh-keyscan -H -p 29418 $GERRIT_HOST >> ~/.ssh/known_hosts
+
+ quoted="$(python3 $SCRIPT_DIR/prepare_gerrit_comment.py misra_delta.txt)"
+
+ ssh -o "PubkeyAcceptedKeyTypes +ssh-rsa" -p 29418 -i "$CI_BOT_KEY" "$CI_BOT_USERNAME@$GERRIT_HOST" gerrit \
+ review "$GERRIT_CHANGE_NUMBER,$GERRIT_PATCHSET_NUMBER" \
+ --message "$quoted"
+fi