Merge "Remove 6wind/quagga build temporarily"
[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 "$WORKSPACE/.virtualenvs/git-review"
7 # shellcheck source=./.virtualenvs/tox/bin/activate disable=SC1091
8 source "$WORKSPACE/.virtualenvs/git-review/bin/activate"
9 PYTHON="$WORKSPACE/.virtualenvs/git-review/bin/python"
10 $PYTHON -m pip install --upgrade pip
11 $PYTHON -m pip install --upgrade git-review
12 $PYTHON -m pip freeze
13
14 # shellcheck disable=SC1083
15 CHANGE_ID=$(ssh -p 29418 "jenkins-$SILO@git.opendaylight.org" gerrit query \
16                limit:1 owner:self is:open project:{project} \
17                message:'{gerrit-commit-message}' \
18                topic:{gerrit-topic} | \
19                grep 'Change-Id:' | \
20                awk '{{ print $2 }}')
21
22 if [ -z "$CHANGE_ID" ]; then
23     git commit -sm "{gerrit-commit-message}"
24 else
25     git commit -sm "{gerrit-commit-message}" -m "Change-Id: $CHANGE_ID"
26 fi
27
28 git status
29 git remote add gerrit "ssh://jenkins-$SILO@git.opendaylight.org:29418/releng/builder.git"
30
31 # Don't fail the build if this command fails because it's possible that there
32 # is no changes since last update.
33 # shellcheck disable=SC1083
34 git review --yes -t {gerrit-topic} --reviewers jluhrsen@redhat.com || true