mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 03:38:09 +02:00
contrib/jenkins: improve trigger_build.sh script and add RPM parameter to jenkins
Configure jenkins project to accept a boolean build parameter "RPM" to control whether to build the RPM packages. Also, adjust the trigger_build.sh script, to support this parameter and accept command line arguments. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
dc7c8892bc
commit
9036095c8a
2 changed files with 90 additions and 13 deletions
|
|
@ -75,9 +75,11 @@ make distcheck
|
||||||
|
|
||||||
|
|
||||||
log_timestamp
|
log_timestamp
|
||||||
wget http://file.brq.redhat.com/~thaller/nmtui-0.0.1.tar.xz
|
if [[ "$RPM" == true ]]; then
|
||||||
git checkout origin/th/automation -- :/contrib/
|
wget http://file.brq.redhat.com/~thaller/nmtui-0.0.1.tar.xz
|
||||||
./contrib/rpm/build.sh
|
git checkout origin/automation -- :/contrib/
|
||||||
|
./contrib/rpm/build.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
log_timestamp
|
log_timestamp
|
||||||
|
|
|
||||||
|
|
@ -10,27 +10,102 @@ url_encode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
http_request() {
|
http_request() {
|
||||||
if [[ "$DRY_RUN" = "" ]]; then
|
if [[ "$DRY_RUN" == "no" ]]; then
|
||||||
wget -q -O /dev/null "$1"
|
wget -q -O /dev/null "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eval_bool() {
|
||||||
|
case "$1" in
|
||||||
|
no|No|NO|n|0|false|False|FALSE)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
yes|Yes|YES|y|1|true|True|TRUE)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [[ "$2" == 1 ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
_USER="${_USER-$( git config user.email 2>/dev/null || echo 'unknown' )}"
|
_USER="${_USER-$( git config user.email 2>/dev/null || echo 'unknown' )}"
|
||||||
|
|
||||||
_TOKEN=nm-build-token-f4bd8bb7eaae
|
_TOKEN=nm-build-token-f4bd8bb7eaae
|
||||||
|
|
||||||
|
ARGV=("$@")
|
||||||
|
REFS=()
|
||||||
|
for i in ${!ARGV[@]}; do
|
||||||
|
if [[ "$REMAINING" == 1 ]]; then
|
||||||
|
REFS=("${REFS[@]}" "${ARGV[i]}")
|
||||||
|
else
|
||||||
|
case "${ARGV[i]}" in
|
||||||
|
-r|--rpm)
|
||||||
|
RPM=true
|
||||||
|
;;
|
||||||
|
-R|--no-rpm)
|
||||||
|
RPM=false
|
||||||
|
;;
|
||||||
|
--n|--dry-run|--test)
|
||||||
|
DRY_RUN=yes
|
||||||
|
;;
|
||||||
|
-N|--no-test|--no-dry-run)
|
||||||
|
DRY_RUN=no
|
||||||
|
;;
|
||||||
|
-c|--check-upstream)
|
||||||
|
NO_CHECK_UPSTREAM=no
|
||||||
|
;;
|
||||||
|
-C|--no-check-upstream)
|
||||||
|
NO_CHECK_UPSTREAM=yes
|
||||||
|
;;
|
||||||
|
-h|--help|'-?')
|
||||||
|
echo "$0 [-h|-r|--rpm|-R|--no-rpm|-n|--dry-run|--no-test] [--] REFS"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
REMAINING=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
REFS=("${REFS[@]}" "${ARGV[i]}")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [[ "$DRY_RUN" != "" ]]; then
|
if eval_bool "$NO_CHECK_UPSTREAM" 0; then
|
||||||
DRY_RUN=yes
|
NO_CHECK_UPSTREAM=yes
|
||||||
|
else
|
||||||
|
NO_CHECK_UPSTREAM=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "USER : \"$_USER\""
|
if eval_bool "$DRY_RUN" 1; then
|
||||||
echo "TOKEN : \"$_TOKEN\""
|
DRY_RUN=yes
|
||||||
echo "DRY_RUN : ${DRY_RUN:-no}"
|
else
|
||||||
|
DRY_RUN=no
|
||||||
|
fi
|
||||||
|
|
||||||
for _BRANCH; do
|
if eval_bool "$RPM" 0; then
|
||||||
|
RPM=yes
|
||||||
|
_RPM=true
|
||||||
|
else
|
||||||
|
RPM=no
|
||||||
|
_RPM=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "USER : \"$_USER\""
|
||||||
|
echo "TOKEN : \"$_TOKEN\""
|
||||||
|
echo "DRY_RUN : $DRY_RUN"
|
||||||
|
echo "RPM : $RPM"
|
||||||
|
echo "NO_CHECK_UPSTREAM : $NO_CHECK_UPSTREAM"
|
||||||
|
|
||||||
|
|
||||||
|
for _BRANCH in "${REFS[@]}"; do
|
||||||
_B="$(git rev-parse -q --verify "$_BRANCH")" || die "Error parsing revision \"$_BRANCH\""
|
_B="$(git rev-parse -q --verify "$_BRANCH")" || die "Error parsing revision \"$_BRANCH\""
|
||||||
if [[ "$NO_CHECK_UPSTREAM" == "" ]]; then
|
if [[ "$NO_CHECK_UPSTREAM" == "no" ]]; then
|
||||||
if [[ "$FOUND" = "" ]]; then
|
if [[ "$FOUND" = "" ]]; then
|
||||||
echo
|
echo
|
||||||
echo "checking that the commits are pushed upstream... disable with NO_CHECK_UPSTREAM..."
|
echo "checking that the commits are pushed upstream... disable with NO_CHECK_UPSTREAM..."
|
||||||
|
|
@ -47,7 +122,7 @@ for _BRANCH; do
|
||||||
done
|
done
|
||||||
|
|
||||||
i=0
|
i=0
|
||||||
for _BRANCH; do
|
for _BRANCH in "${REFS[@]}"; do
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
i0="`printf '%03d' "$i"`"
|
i0="`printf '%03d' "$i"`"
|
||||||
_B="$(git rev-parse "$_BRANCH")"
|
_B="$(git rev-parse "$_BRANCH")"
|
||||||
|
|
@ -55,7 +130,7 @@ for _BRANCH; do
|
||||||
if [[ -n "$CAUSE" ]]; then
|
if [[ -n "$CAUSE" ]]; then
|
||||||
URL_CAUSE="&cause=`url_encode "$CAUSE"`"
|
URL_CAUSE="&cause=`url_encode "$CAUSE"`"
|
||||||
fi
|
fi
|
||||||
_URL="http://10.34.131.51:8080/job/NetworkManager/buildWithParameters?token=`url_encode "$_TOKEN"`$URL_CAUSE&BRANCH=`url_encode "$_B"`"
|
_URL="http://10.34.131.51:8080/job/NetworkManager/buildWithParameters?token=`url_encode "$_TOKEN"`$URL_CAUSE&BRANCH=`url_encode "$_B"`&RPM=$_RPM"
|
||||||
echo
|
echo
|
||||||
echo "BRANCH[$i0] : \"$_BRANCH\" ($_B)"
|
echo "BRANCH[$i0] : \"$_BRANCH\" ($_B)"
|
||||||
echo "CAUSE[$i0] : \"$CAUSE\""
|
echo "CAUSE[$i0] : \"$CAUSE\""
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue