Change-Id: I887a067968e3d3aa1837f7e63870ab3691767bed
This commit is contained in:
Tom Proctor
2025-12-15 14:39:37 +00:00
parent 5f64412b63
commit 5937ce072f
3 changed files with 807 additions and 808 deletions

View File

@@ -25,9 +25,13 @@ fi
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
BASE_CMD="${REPO_ROOT}/tool/cigocacher --cache-dir ${CACHE_DIR} --cigocached-url ${URL} --cigocached-host ${HOST}"
TOOL_PATH="${REPO_ROOT}/tool/cigocacher"
if [[ "${OSTYPE}" == "msys"* || "${OSTYPE}" == "cygwin"* || "${OSTYPE}" == "win32"* ]]; then
NATIVE_TOOL_PATH="$(cygpath -w "${TOOL_PATH}")"
fi
BASE_ARGS="--cache-dir ${CACHE_DIR} --cigocached-url ${URL} --cigocached-host ${HOST}"
CIGOCACHER_TOKEN="$("${BASE_CMD}" --auth)"
CIGOCACHER_TOKEN="$(${TOOL_PATH} ${BASE_ARGS} --auth | tr -d '\r\n')"
if [ -z "${CIGOCACHER_TOKEN:-}" ]; then
echo "Failed to fetch cigocacher token, skipping cigocacher setup"
exit 0
@@ -36,5 +40,5 @@ fi
echo "Fetched cigocacher token successfully"
echo "::add-mask::${CIGOCACHER_TOKEN}"
echo "GOCACHEPROG=${BASE_CMD} --token ${CIGOCACHER_TOKEN}" >> "${GITHUB_ENV}"
echo "GOCACHEPROG=${NATIVE_TOOL_PATH:-${TOOL_PATH}} ${BASE_ARGS} --token ${CIGOCACHER_TOKEN}" >> "${GITHUB_ENV}"
echo "success=true" >> "${GITHUB_OUTPUT}"

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,9 @@
#!/usr/bin/env bash
#
# Run cmd/cigocacher based on the revision pinned in tool/cigocacher.rev
# Note, unlike our other tools, this one never sets -x because it may
# print sensitive auth tokens. These should be masked by GitHub, but better
# to be safe.
set -euo pipefail
@@ -42,17 +45,9 @@ goarch() {
esac
}
if [[ "${CI:-}" == "true" ]]; then
set -x
fi
cachedir="${HOME}/.cache/tailscale-cigocacher"
(
if [[ "${CI:-}" == "true" ]]; then
set -x
fi
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
repo_root="${SCRIPT_DIR}/../"
cd "$repo_root"
@@ -62,14 +57,14 @@ cachedir="${HOME}/.cache/tailscale-cigocacher"
want_rev="$(cat ./tool/cigocacher.rev)"
got_rev=""
if [[ -x "${cachedir}/cigocacher" ]]; then
got_rev=$("${cachedir}/cigocacher" --version)
got_rev=$("${cachedir}/cigocacher" --version | tr -d '\r\n')
fi
if [[ "$want_rev" != "$got_rev" ]]; then
echo "Downloading cigocacher rev ${want_rev} (got ${got_rev})" >&2
rm -rf "$cachedir" "$tarball"
mkdir -p "$cachedir"
curl -w "%{size_download} bytes | %{time_total}s | %{speed_download} bytes/sec\n" -fsSL -o "$tarball" \
"https://github.com/tailscale/tailscale/releases/download/cmd%2Fcigocacher%2F${want_rev}/cigocacher-$(goos)-$(goarch).tar.gz"
curl -fsSL -o "$tarball" "https://github.com/tailscale/tailscale/releases/download/cmd%2Fcigocacher%2F${want_rev}/cigocacher-$(goos)-$(goarch).tar.gz"
(cd "$cachedir" && tar -xf "$tarball")
rm -f "$tarball"
fi