Support to copy existing config for PR testing
This commit is contained in:
parent
1c8defa035
commit
e466877b84
|
@ -36,18 +36,19 @@ function request_call() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":t:m:r:" opt; do
|
while getopts ":c:t:m:r:" opt; do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
t) PR_TOKEN=$OPTARG ;;
|
t) PR_TOKEN=$OPTARG ;;
|
||||||
r) run_id=$OPTARG ;;
|
r) run_id=$OPTARG ;;
|
||||||
m) ARCHITECTURE=$OPTARG ;;
|
m) ARCHITECTURE=$OPTARG ;;
|
||||||
|
c) CONFIGDIR=$OPTARG ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(( OPTIND - 1 ))
|
shift $(( OPTIND - 1 ))
|
||||||
|
|
||||||
# Check for a command line argument (PR number)
|
# Check for a command line argument (PR number)
|
||||||
if [ "$1" == "" ] || [ $# -gt 1 ] || [ -z ${PR_TOKEN} ]; then
|
if [ "$1" == "" ] || [ $# -gt 1 ] || [ -z ${PR_TOKEN} ]; then
|
||||||
echo "Usage: $0 -t <git_token> -m <architecture> -r <run_id> <PR_NUMBER>" >&2
|
echo "Usage: $0 -t <git_token> -m <architecture> -r <run_id> -c <hyperion config directory> <PR_NUMBER>" >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
pr_number="$1"
|
pr_number="$1"
|
||||||
|
@ -206,11 +207,22 @@ if [[ ! -z ${CURRENT_SERVICE} ]]; then
|
||||||
else
|
else
|
||||||
echo "---> Service ${CURRENT_SERVICE} successfully stopped, Hyperion will be started"
|
echo "---> Service ${CURRENT_SERVICE} successfully stopped, Hyperion will be started"
|
||||||
fi
|
fi
|
||||||
fi'"
|
fi'""
|
||||||
|
|
||||||
|
TARGET_CONFIGDIR="$HOME/hyperion_pr$pr_number/config"
|
||||||
|
|
||||||
|
if [[ ! -z ${CONFIGDIR} ]]; then
|
||||||
|
STARTUP_SCRIPT+="
|
||||||
|
# Copy existing configuration file
|
||||||
|
"'echo "Copy existing configuration from "'${CONFIGDIR}"
|
||||||
|
mkdir -p "$TARGET_CONFIGDIR"
|
||||||
|
cp -ri "${CONFIGDIR}/*" "$TARGET_CONFIGDIR""
|
||||||
|
fi
|
||||||
|
|
||||||
|
STARTUP_SCRIPT+="
|
||||||
# Start PR artifact
|
# Start PR artifact
|
||||||
cd $HOME/hyperion_pr$pr_number
|
cd $HOME/hyperion_pr$pr_number
|
||||||
./bin/hyperiond -d -u $HOME/hyperion_pr$pr_number"
|
./bin/hyperiond -d -u $TARGET_CONFIGDIR"
|
||||||
|
|
||||||
# Place startup script
|
# Place startup script
|
||||||
echo "$STARTUP_SCRIPT" > $HOME/hyperion_pr$pr_number/$pr_number.sh
|
echo "$STARTUP_SCRIPT" > $HOME/hyperion_pr$pr_number/$pr_number.sh
|
||||||
|
|
Loading…
Reference in New Issue