Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mbedtls-kick-ci: support the framework repository #161

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions tools/bin/mbedtls-kick-ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@

set -eu

DEFAULT_SCOPE=all

usage () {
cat <<EOF
Usage: $0 PR_NUMBER [all|internal|internal-pr-head|internal-pr-merge|openci|...]
Start the CI on a pull request.
Use just the digits of the pull request number for a pull request in mbedtls.
Use the prefix "f" (e.g. "${0##*/} f123") for a pull request
in mbedtls-framework.
Default job set: $DEFAULT_SCOPE
EOF
}

script=$(basename -- "$0")
usage="$script: usage: $script PR_NUMBER [all|internal|internal-pr-head|internal-pr-merge|openci|...]"

host_internal_ci=jenkins-mbedtls.oss.arm.com
host_open_ci=mbedtls.trustedfirmware.org
Expand Down Expand Up @@ -54,18 +66,26 @@ kick_one () {
did_something=1
}

if [ "$1" = "--help" ]; then
usage
exit
fi

if [ $# -eq 1 ]; then
set -- "$1" all
set -- "$1" "$DEFAULT_SCOPE"
fi

if [ $# != 2 ]; then
echo $usage 1>&2
usage >&2
exit 2
fi

PR="$1"
SCOPE="$2"

case "$PR" in
f*) PR="${PR#f}"; SCOPE="framework-$SCOPE";;
esac
case "$PR" in
*[!0-9]*) echo >&2 "$0: $PR: pull request must be a number"; exit 2;;
*) : ;; # Must be a number
Expand All @@ -77,27 +97,36 @@ case "$SCOPE" in
all|internal|internal-pr-head )
kick_one internal-pr-head $JENKINS_INTERNAL_USER_ID $JENKINS_INTERNAL_API_TOKEN "https://$host_internal_ci/job/mbed-tls-pr-head/view/change-requests/job/PR-$PR-head/build/api/json?delay=0sec"
;;
framework-all|framework-internal|framework-internal-pr-head )
kick_one framework-internal-pr-head $JENKINS_INTERNAL_USER_ID $JENKINS_INTERNAL_API_TOKEN "https://$host_internal_ci/job/mbed-tls-framework-multibranch/view/change-requests/job/PR-$PR-head/build/api/json?delay=0sec"
;;
esac

case $SCOPE in
all|internal|internal-pr-merge)
kick_one internal-pr-merge $JENKINS_INTERNAL_USER_ID $JENKINS_INTERNAL_API_TOKEN "https://$host_internal_ci/job/mbed-tls-pr-merge/view/change-requests/job/PR-$PR-merge/build/api/json?delay=0sec"
;;
# No merge job in mbedtls-framework
esac

case $SCOPE in
all|openci|openci-pr-head)
kick_one openci-pr-head $JENKINS_OPENCI_USER_ID $JENKINS_OPENCI_API_TOKEN "https://$host_open_ci/job/mbed-tls-pr-head/view/change-requests/job/PR-$PR-head/build/api/json?delay=0sec"
;;
framework-all|framework-openci|framework-openci-pr-head )
kick_one openci-pr-head $JENKINS_OPENCI_USER_ID $JENKINS_OPENCI_API_TOKEN "https://$host_open_ci/job/mbed-tls-framework-multibranch/view/change-requests/job/PR-$PR-head/build/api/json?delay=0sec"
;;
esac

case $SCOPE in
all|openci|openci-pr-merge)
kick_one openci-pr-merge $JENKINS_OPENCI_USER_ID $JENKINS_OPENCI_API_TOKEN "https://$host_open_ci/job/mbed-tls-pr-merge/view/change-requests/job/PR-$PR-merge/build/api/json?delay=0sec"
;;
# No merge job in mbedtls-framework
esac

if [ "$did_something" != 1 ]; then
echo $usage 1>&2
echo 1>&2 "$0: Found nothing to do."
usage 1>&2
exit 2
fi