Restore common.sh

pull/10774/head
Ilya Zuyev 2021-03-22 10:48:13 -07:00
parent d6572d87a2
commit adf7428c28
1 changed files with 19 additions and 34 deletions

View File

@ -333,6 +333,10 @@ min=$(($elapsed/60))
sec=$(tail -c 3 <<< $((${elapsed}00/60)))
elapsed=$min.$sec
SHORT_COMMIT=${COMMIT:0:7}
JOB_GCS_BUCKET="minikube-builds/logs/${MINIKUBE_LOCATION}/${SHORT_COMMIT}/${JOB_NAME}"
echo ">> Copying ${TEST_OUT} to gs://${JOB_GCS_BUCKET}out.txt"
gsutil -qm cp "${TEST_OUT}" "gs://${JOB_GCS_BUCKET}out.txt"
echo ">> Attmpting to convert test logs to json"
@ -356,13 +360,11 @@ echo ">> Installing jq"
fi
echo ">> Installing gopogh"
curl -LO "https://github.com/medyagh/gopogh/releases/download/v0.6.0/gopogh-${OS_ARCH}"
sudo install "gopogh-${OS_ARCH}" /usr/local/bin/gopogh
#temp
echo $PATH
ls /usr/local/bin
if [ "$(uname)" != "Darwin" ]; then
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.6.0/gopogh-linux-amd64 && sudo install gopogh-linux-amd64 /usr/local/bin/gopogh
else
curl -LO https://github.com/medyagh/gopogh/releases/download/v0.6.0/gopogh-darwin-amd64 && sudo install gopogh-darwin-amd64 /usr/local/bin/gopogh
fi
echo ">> Running gopogh"
if test -f "${HTML_OUT}"; then
@ -381,32 +383,19 @@ if [ "$status" = "failure" ]; then
fi
echo $description
REPORTS_PATH=test_reports
mkdir -p "$REPORTS_PATH"
cp "${TEST_OUT}" "$REPORTS_PATH/test.out"
cp "${JSON_OUT}" "$REPORTS_PATH/json.out"
cp "${HTML_OUT}" "$REPORTS_PATH/html.out"
cp "${SUMMARY_OUT}" "$REPORTS_PATH/summary.out"
# upload results to GCS
JOB_GCS_BUCKET="minikube-builds/logs/${MINIKUBE_LOCATION}/${COMMIT:0:7}/${JOB_NAME}"
echo ">> Copying ${TEST_OUT} to gs://${JOB_GCS_BUCKET}out.txt"
gsutil -qm cp "${TEST_OUT}" "gs://${JOB_GCS_BUCKET}out.txt" || true
echo ">> uploading ${JSON_OUT}"
gsutil -qm cp "${JSON_OUT}" "gs://${JOB_GCS_BUCKET}.json" || true
echo ">> uploading ${HTML_OUT}"
gsutil -qm cp "${HTML_OUT}" "gs://${JOB_GCS_BUCKET}.html" || true
echo ">> uploading ${SUMMARY_OUT}"
gsutil -qm cp "${SUMMARY_OUT}" "gs://${JOB_GCS_BUCKET}_summary.json" || true
#
public_log_url="https://storage.googleapis.com/${JOB_GCS_BUCKET}.txt"
if grep -q html "$HTML_OUT"; then
public_log_url="https://storage.googleapis.com/${JOB_GCS_BUCKET}.html"
fi
echo ">> Cleaning up after ourselves ..."
timeout 3m ${SUDO_PREFIX}${MINIKUBE_BIN} tunnel --cleanup || true
@ -415,9 +404,9 @@ cleanup_stale_routes || true
${SUDO_PREFIX} rm -Rf "${MINIKUBE_HOME}" || true
${SUDO_PREFIX} rm -f "${KUBECONFIG}" || true
#${SUDO_PREFIX} rm -f "${TEST_OUT}" || true
#${SUDO_PREFIX} rm -f "${JSON_OUT}" || true
#${SUDO_PREFIX} rm -f "${HTML_OUT}" || true
${SUDO_PREFIX} rm -f "${TEST_OUT}" || true
${SUDO_PREFIX} rm -f "${JSON_OUT}" || true
${SUDO_PREFIX} rm -f "${HTML_OUT}" || true
rmdir "${TEST_HOME}" || true
echo ">> ${TEST_HOME} completed at $(date)"
@ -425,11 +414,6 @@ if [[ "${MINIKUBE_LOCATION}" == "master" ]]; then
exit $result
fi
public_log_url="https://storage.googleapis.com/${JOB_GCS_BUCKET}.txt"
if grep -q html "$HTML_OUT"; then
public_log_url="https://storage.googleapis.com/${JOB_GCS_BUCKET}.html"
fi
# retry_github_status provides reliable github status updates
function retry_github_status() {
local commit=$1
@ -465,5 +449,6 @@ function retry_github_status() {
done
}
retry_github_status "${COMMIT}" "${JOB_NAME}" "${status}" "${access_token}" "${public_log_url}" "${description}"
exit $result