post_gerrit_comment.sh: Enable posting comments to Gerrit by default
At the same time, don't post comments when run on staging (unless it's
a sandbox project used for testing this script).
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Iab53913dd4af7206cc08db5bf35ba9906db52d56
diff --git a/eclair/post_gerrit_comment.sh b/eclair/post_gerrit_comment.sh
index cb3d0a3..ec83e9e 100755
--- a/eclair/post_gerrit_comment.sh
+++ b/eclair/post_gerrit_comment.sh
@@ -1,13 +1,21 @@
#!/bin/bash
#
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2022, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
set -ex
-should_post_comment=0
+# Set to 0 to temporarily disable posting comments to Gerrit.
+should_post_comment=1
+# Don't post comments if run on the staging server.
+if echo "$JENKINS_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