Skip to content

Commit c0355a0

Browse files
authored
Allow to select codebase and repository
1 parent 274dc2e commit c0355a0

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

bin/scripts/install_pr.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Script for downloading a specific open Pull Request Artifact from Hyperion.NG
33

44
# Fixed variables
5-
api_url="https://api.github.com/repos/hyperion-project/hyperion.ng"
5+
api_url="https://api.github.com/repos"
66
type wget >/dev/null 2>/dev/null
77
hasWget=$?
88
type curl >/dev/null 2>/dev/null
@@ -12,8 +12,9 @@ hasPython3=$?
1212
type python >/dev/null 2>/dev/null
1313
hasPython2=$?
1414

15+
REPOSITORY="hyperion-project/hyperion.ng"
1516
DISTRIBUTION="debian"
16-
CODENAME="bullseye"
17+
CODEBASE=""
1718
ARCHITECTURE=""
1819

1920
BASE_PATH='.'
@@ -79,10 +80,12 @@ request_call() {
7980
echo "$body"
8081
}
8182

82-
while getopts ":a:c:r:t:" opt; do
83+
while getopts ":a:b:c:g:r:t:" opt; do
8384
case "$opt" in
8485
a) ARCHITECTURE=$OPTARG ;;
86+
b) CODEBASE=$OPTARG ;;
8587
c) CONFIGDIR=$OPTARG ;;
88+
g) REPOSITORY=$OPTARG ;;
8689
r) run_id=$OPTARG ;;
8790
t) PR_TOKEN=$OPTARG ;;
8891
esac
@@ -91,7 +94,7 @@ shift $((OPTIND - 1))
9194

9295
# Check for a command line argument (PR number)
9396
if [ "$1" == "" ] || [ $# -gt 1 ] || [ -z ${PR_TOKEN} ]; then
94-
echo "Usage: $0 -t <git_token> -a <architecture> -r <run_id> -c <hyperion config directory> <PR_NUMBER>" >&2
97+
echo "Usage: $0 -t <git_token> -a <architecture> -b <codebase> -r <run_id> -c <hyperion config directory> -g <github project/repository> <PR_NUMBER>" >&2
9598
exit 1
9699
else
97100
pr_number="$1"
@@ -137,10 +140,18 @@ if [ $? -ne 0 ]; then
137140
echo "---> Critical Error: Target architecture $ARCHITECTURE is unknown -> abort"
138141
exit 1
139142
else
140-
PACKAGE="${ARCHITECTURE}"
141-
echo "---> Download package for identified runtime architecture: $ARCHITECTURE"
143+
if [[ -z ${CODEBASE} ]]; then
144+
PACKAGE="${ARCHITECTURE}"
145+
echo "---> Download package for identified runtime architecture: $ARCHITECTURE"
146+
else
147+
PACKAGE="${CODEBASE}_${ARCHITECTURE}"
148+
echo "---> Download package for identified runtime architecture: $ARCHITECTURE and selected codebase: $CODEBASE"
149+
fi
142150
fi
143151

152+
api_url="${api_url}/${REPOSITORY}"
153+
154+
144155
# Determine if PR number exists
145156
pulls=$(request_call "$api_url/pulls?state=open")
146157

0 commit comments

Comments
 (0)