Merge "Add job to delete stale nodes older than 24H on RS"
[releng/builder.git] / jjb / opendaylight-infra-push-gerrit-patch.sh
1 #!/bin/bash
2
3 # upgrade git-review to a version that will have the --reviewers option. existing minion
4 # image has a version that does not have it.
5 sudo pip install git-review --upgrade
6
7 # shellcheck disable=SC1083
8 CHANGE_ID=$(ssh -p 29418 "jenkins-$SILO@git.opendaylight.org" gerrit query \
9                limit:1 owner:self is:open project:{project} \
10                message:'{gerrit-commit-message}' \
11                topic:{gerrit-topic} | \
12                grep 'Change-Id:' | \
13                awk '{{ print $2 }}')
14
15 if [ -z "$CHANGE_ID" ]; then
16     git commit -sm "{gerrit-commit-message}"
17 else
18     git commit -sm "{gerrit-commit-message}" -m "Change-Id: $CHANGE_ID"
19 fi
20
21 git status
22 git remote add gerrit "ssh://jenkins-$SILO@git.opendaylight.org:29418/releng/builder.git"
23
24 # Don't fail the build if this command fails because it's possible that there
25 # is no changes since last update.
26 # shellcheck disable=SC1083
27 git review --yes -t {gerrit-topic} --reviewers jluhrsen@redhat.com || true