Add comment-to-gerrit macro
[releng/global-jjb.git] / shell / comment-to-gerrit.sh
diff --git a/shell/comment-to-gerrit.sh b/shell/comment-to-gerrit.sh
new file mode 100644 (file)
index 0000000..b4d3d66
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash -l
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+set -xe -o pipefail
+
+if [[ -e gerrit_comment.txt ]] ; then
+  echo
+  echo "posting review comment to gerrit..."
+  echo
+  cat gerrit_comment.txt
+  echo
+  ssh -p 29418 "$GERRIT_HOST" \
+      "gerrit review -p $GERRIT_PROJECT \
+       -m '$(cat gerrit_comment.txt)' \
+       $GERRIT_PATCHSET_REVISION \
+       --notify NONE"
+fi