1
0

Updated to latest scripts/trigger.sh from xe-solutions

Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
James Ketrenos 2020-01-29 14:21:04 -08:00
parent 4d5e882ed6
commit e6f88283d2

View File

@ -8,6 +8,27 @@
# the environment or from the SOLUTION file) # the environment or from the SOLUTION file)
# #
YES=
PROJECT=$(basename $(pwd))
while getopts ydp: opt; do
case "${opt}" in
p)
PROJECT=${OPTARG}
;;
y)
YES=1
;;
[?])
>&2 echo -e "\nInvalid parameter: ${opt}\n"
usage >&2
exit 1
;;
esac
done
shift $(( OPTIND-1 ))
TRIGGER_VARS=( TRIGGER_VARS=(
OS_DISTRO OS_DISTRO
OS_RELEASE OS_RELEASE
@ -28,9 +49,10 @@ done
# Bring in the variables from SOLUTION file, supporting # Bring in the variables from SOLUTION file, supporting
# nested substitution # nested substitution
. SOLUTION [[ -e SOLUTION ]] && . SOLUTION
VARS=($(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION)) VARS=()
[[ -e SOLUTION ]] && VARS=($(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION))
for var in ${VARS[@]}; do for var in ${VARS[@]}; do
export ${var} export ${var}
done done
@ -41,7 +63,7 @@ BUILD=${BUILD:-7517585}
BRANCH=${BRANCH:-releases_19.4} BRANCH=${BRANCH:-releases_19.4}
REF=${REF:-master} REF=${REF:-master}
PROJECT="vtt/sws/osgc/solutions/$(basename $(pwd))" PROJECT="vtt/sws/osgc/solutions/${PROJECT}"
URI_PROJECT=$(echo ${PROJECT} | sed -E 's,/,%2F,g') URI_PROJECT=$(echo ${PROJECT} | sed -E 's,/,%2F,g')
eval $(grep ^SYS_OSGC_TOKEN SECRETS) eval $(grep ^SYS_OSGC_TOKEN SECRETS)
@ -53,7 +75,7 @@ eval $(grep ^SYS_OSGC_TOKEN SECRETS)
GITLAB="https://gitlab.devtools.intel.com" GITLAB="https://gitlab.devtools.intel.com"
echo "Looking for CI trigger" echo "Looking for CI trigger on ${PROJECT}"
RESULTS=$(curl --noproxy '*' -s -X GET \ RESULTS=$(curl --noproxy '*' -s -X GET \
--header "PRIVATE-TOKEN: ${SYS_OSGC_TOKEN}" \ --header "PRIVATE-TOKEN: ${SYS_OSGC_TOKEN}" \
@ -94,7 +116,7 @@ TOKEN=$(echo ${RESULTS} | sed -E 's#([[{},])#\1\n#g' | {
[[ "${TOKEN}" == "" ]] && { [[ "${TOKEN}" == "" ]] && {
echo "'sys_osgc CI trigger' does not exist on ${PROJECT}." echo "'sys_osgc CI trigger' does not exist on ${PROJECT}."
while read -n1 -r -p "Create new trigger [y|N]?"; do (( YES )) || while read -n1 -r -p "Create new trigger [y|N]? "; do
case $REPLY in case $REPLY in
y|Y) y|Y)
echo "" echo ""
@ -110,7 +132,6 @@ TOKEN=$(echo ${RESULTS} | sed -E 's#([[{},])#\1\n#g' | {
esac esac
done done
RESULTS=$(curl --noproxy '*' -s -X POST \ RESULTS=$(curl --noproxy '*' -s -X POST \
--header "PRIVATE-TOKEN: ${SYS_OSGC_TOKEN}" \ --header "PRIVATE-TOKEN: ${SYS_OSGC_TOKEN}" \
-F 'description="sys_osgc CI trigger"' \ -F 'description="sys_osgc CI trigger"' \
@ -179,11 +200,10 @@ done
EOF EOF
while read -n1 -r -p "Is this correct [y|N]? "; do (( YES )) || while read -n1 -r -p "Is this correct [y|N]? "; do
case $REPLY in case $REPLY in
y|Y) y|Y)
echo "" echo ""
post
break break
;; ;;
n|N|"") n|N|"")
@ -195,3 +215,5 @@ while read -n1 -r -p "Is this correct [y|N]? "; do
;; ;;
esac esac
done done
post