diff --git a/gitlab/before_deploy.sh b/gitlab/before_deploy.sh index 25fc0bab0f3ef5f875ee4619e5849231a6a70856..ca6c3d69c19ef2841f7decf6bf4edbaa3804098b 100755 --- a/gitlab/before_deploy.sh +++ b/gitlab/before_deploy.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # Wed 21 Sep 2016 13:08:05 CEST +# Refreshes build scripts if necessary +$(dirname ${0})/install.sh $(dirname ${0}) + source $(dirname ${0})/functions.sh run_cmd $(dirname ${0})/before_test.sh diff --git a/gitlab/before_test.sh b/gitlab/before_test.sh index e348f8dc50610aa7a9ae6c00646f773c6d07ed38..f24b8edce796dc2c5042d57da77faf1781922fe0 100755 --- a/gitlab/before_test.sh +++ b/gitlab/before_test.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # Wed 21 Sep 2016 13:08:05 CEST +# Refreshes build scripts if necessary +$(dirname ${0})/install.sh $(dirname ${0}) + source $(dirname ${0})/functions.sh run_cmd $(dirname ${0})/before_build.sh diff --git a/gitlab/functions.sh b/gitlab/functions.sh index 8b6d09a7361acc6ca1673c2d8a36bfa2212cf72b..e4e0ad896c84ef11643a102a068f81a7a58c2bef 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -55,8 +55,6 @@ run_cmd() { if [ ${status} != 0 ]; then log_error "Command Failed \"${@}\"" exit ${status} - else - log_info "Finished comand \"${@}\"" fi } @@ -97,7 +95,7 @@ doc_upload() { check_pass DOCUSER check_pass DOCPASS log_info "${1} -> ${DOCSERVER}/${2}, via curl..." - curl --silent --user "${DOCUSER}:${DOCPASS}" --upload-file ${1} ${DOCSERVER}/${2} + curl --location --silent --user "${DOCUSER}:${DOCPASS}" --upload-file ${1} ${DOCSERVER}/${2} local status=$? if [ ${status} != 0 ]; then log_error "Curl command finished with an error condition (status=${status})" diff --git a/gitlab/install.sh b/gitlab/install.sh index 157d57e0976e7c2dda97b5fa780cedcd1b4bd65f..fa0b05fa83ed6355f75c20e604a7fdff0170e41e 100755 --- a/gitlab/install.sh +++ b/gitlab/install.sh @@ -29,14 +29,26 @@ run_cmd() { if [ ${status} != 0 ]; then log_error "Command Failed \"${@}\"" exit ${status} - else - log_info "Finished comand \"${@}\"" fi } get_script() { - run_cmd curl --silent --output ${1}/${2} "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/${2}" + local curlopt="--location --output ${1}/${2}" + if [ -e ${1}/${2} ]; then #check for updates + local checkopt="${curlopt} --time-cond ${1}/${2} --silent" + checkopt="${checkopt} --write-out %{http_code}" + if [ "$(curl ${checkopt})" == "200" ]; then + log_info "CI script ${1}/${2} needs updating..." + rm -f ${1}/${2} + else + log_info "CI script ${1}/${2} is up-to-date" + return 0 + fi + fi + # check file needs updating + local url="https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/${2}" + run_cmd curl ${curlopt} ${url} } @@ -48,6 +60,7 @@ get_exec() { run_cmd mkdir -pv ${1} get_script ${1} functions.sh +get_script ${1} install.sh for stage in "build" "test" "wheels" "deploy"; do get_exec ${1} before_${stage}.sh get_exec ${1} ${stage}.sh