Merge "Update Ubuntu 1404 with 1604 mininet-ovs-25 images"
[releng/builder.git] / jjb / opendaylight-infra-push-gerrit-patch.sh
1 #!/bin/bash
2
3 # Install git-review using virtualenv to the latest version that supports
4 # --reviewers option, available through pip install. Existing minion image has a
5 # version that does not have it.
6 virtualenv "/tmp/v/git-review"
7 # shellcheck source=/tmp/v/git-review/bin/activate disable=SC1091
8 source "/tmp/v/git-review/bin/activate"
9 pip install --upgrade pip
10 pip install --upgrade git-review
11 pip freeze
12
13 # shellcheck disable=SC1083
14 CHANGE_ID=$(ssh -p 29418 "jenkins-$SILO@git.opendaylight.org" gerrit query \
15                limit:1 owner:self is:open project:{project} \
16                message:'{gerrit-commit-message}' \
17                topic:{gerrit-topic} | \
18                grep 'Change-Id:' | \
19                awk '{{ print $2 }}')
20
21 if [ -z "$CHANGE_ID" ]; then
22     git commit -sm "{gerrit-commit-message}"
23 else
24     git commit -sm "{gerrit-commit-message}" -m "Change-Id: $CHANGE_ID"
25 fi
26
27 git status
28 git remote add gerrit "ssh://jenkins-$SILO@git.opendaylight.org:29418/releng/builder.git"
29
30 # Don't fail the build if this command fails because it's possible that there
31 # is no changes since last update.
32 # shellcheck disable=SC1083
33 git review --yes -t {gerrit-topic} --reviewers jluhrsen@redhat.com || true