mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
bb0b4db228
During e.g. cross-compiling, it is sometimes useful to be able to have another binary than the default one as the compiler. This patch for the build scripts lets "go" be the default value for the variable GO, and the latter is then used as the go compiler. Change-Id: I0adf7a661b26593d9b0ea902a61b631b80e76ae7 Signed-off-by: Joakim Roubert <joakimr@axis.com>
51 lines
1.1 KiB
Bash
Executable File
51 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
[ -d "$1" ] || {
|
|
echo "First argument should be a directory" >&2
|
|
exit 1
|
|
}
|
|
|
|
umask 077
|
|
|
|
GO=${GO-go}
|
|
|
|
TMPDIR=$(mktemp -d)
|
|
cleanup() {
|
|
exit_code=$?
|
|
trap - EXIT INT
|
|
rm -rf ${TMPDIR}
|
|
exit ${exit_code}
|
|
}
|
|
trap cleanup EXIT INT
|
|
|
|
GCLOUD_JSON=${TMPDIR}/.gcloud.json
|
|
[ -z "${GCLOUD_AUTH}" ] || echo "${GCLOUD_AUTH}" >${GCLOUD_JSON}
|
|
[ -s "${GCLOUD_JSON}" ] || {
|
|
echo "gcloud auth not defined" >&2
|
|
exit 1
|
|
}
|
|
|
|
BOTO_CONF=${TMPDIR}/.boto
|
|
[ -s "${BOTO_CONF}" ] || cat >${BOTO_CONF} <<END
|
|
[Credentials]
|
|
gs_service_key_file = ${GCLOUD_JSON}
|
|
[Boto]
|
|
https_validate_certificates = True
|
|
[GSUtil]
|
|
content_language = en
|
|
default_api_version = 2
|
|
default_project_id = rancher-dev
|
|
END
|
|
|
|
[ -d "${TMPDIR}/gsutil" ] || curl -sfL https://storage.googleapis.com/pub/gsutil.tar.gz | tar xz -C ${TMPDIR}
|
|
|
|
HOME=${TMPDIR}
|
|
PATH=$PATH:${HOME}/gsutil
|
|
|
|
LOG_TGZ=k3s-log-$(date +%s)-$("${GO}" env GOARCH)-$(git rev-parse --short HEAD)-$(basename $1).tgz
|
|
|
|
tar -cz -f ${TMPDIR}/${LOG_TGZ} -C $(dirname $1) $(basename $1)
|
|
gsutil cp ${TMPDIR}/${LOG_TGZ} gs://k3s-ci-logs || exit 1
|
|
echo "Logs uploaded" >&2
|
|
echo "https://storage.googleapis.com/k3s-ci-logs/${LOG_TGZ}"
|