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"
66type wget > /dev/null 2> /dev/null
77hasWget=$?
88type curl > /dev/null 2> /dev/null
@@ -12,8 +12,9 @@ hasPython3=$?
1212type python > /dev/null 2> /dev/null
1313hasPython2=$?
1414
15+ REPOSITORY=" hyperion-project/hyperion.ng"
1516DISTRIBUTION=" debian"
16- CODENAME= " bullseye "
17+ CODEBASE= " "
1718ARCHITECTURE=" "
1819
1920BASE_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)
9396if [ " $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
9699else
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
139142else
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
142150fi
143151
152+ api_url=" ${api_url} /${REPOSITORY} "
153+
154+
144155# Determine if PR number exists
145156pulls=$( request_call " $api_url /pulls?state=open" )
146157
0 commit comments