Merge "Add Gate job for netvirt-hwvtep"
[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 install --upgrade pipdeptree
12 pipdeptree
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