summaryrefslogtreecommitdiff
path: root/jenkins/trigger-source-rebuild
blob: d7e22efccf9dbfc30633ace4f882a13ac0c90384 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

# Retrieve last git hash built, and rebuild the source package with it.
# Useful when new distributions have been added and Jenkins doesn't have the
# source packages for them yet.

# for pkg in $(cat packages); do ./trigger-source-rebuild "$pkg"; done

set -eu

while getopts "d:r:" opt ; do
  case $opt in
    d) distribution="$OPTARG" ;;
    r) revision="$OPTARG" ;;
    *) exit 5 ;;
  esac
done
# shift away args
shift $(($OPTIND - 1))

PACKAGE="$1"
XML=$(curl -fs https://jengus.postgresql.org/view/Sources/job/$PACKAGE-source/lastSuccessfulBuild/api/xml?xpath=//lastBuiltRevision/SHA1)
SHA1=$(echo "$XML" | grep -Eo '[0-9a-f]{40}')
test "$SHA1"

set -x
./trigger-job ${distribution:+-d $distribution} -r "${revision:-1}" "$PACKAGE-source" "branch=$SHA1"