From 28f163542cc089078b35a8dc1168c878223aadc5 Mon Sep 17 00:00:00 2001 From: Irbe Krumina Date: Wed, 14 Jan 2026 15:15:02 +0000 Subject: [PATCH] .github/actions/go-cache: build cigocacher using remote path, fall back to ./tool/go (#18409) If local tailscale/tailscale checkout is not available, pulll cigocacher remotely. Fall back to ./tool/go if no other Go installation is present. Updates tailscale/corp#32493 Signed-off-by: Irbe Krumina --- .github/actions/go-cache/action.sh | 19 +++++++++++++++++-- .github/actions/go-cache/action.yml | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/actions/go-cache/action.sh b/.github/actions/go-cache/action.sh index bd584f6f1..f49d5bb77 100755 --- a/.github/actions/go-cache/action.sh +++ b/.github/actions/go-cache/action.sh @@ -23,8 +23,23 @@ if [ -z "${URL:-}" ]; then exit 0 fi -BIN_PATH="${RUNNER_TEMP:-/tmp}/cigocacher$(go env GOEXE)" -go build -o "${BIN_PATH}" ./cmd/cigocacher +GOPATH=$(command -v go || true) +if [ -z "${GOPATH}" ]; then + if [ ! -f "tool/go" ]; then + echo "Go not available, unable to proceed" + exit 1 + fi + GOPATH="./tool/go" +fi + +BIN_PATH="${RUNNER_TEMP:-/tmp}/cigocacher$(${GOPATH} env GOEXE)" +if [ -d "cmd/cigocacher" ]; then + echo "cmd/cigocacher found locally, building from local source" + "${GOPATH}" build -o "${BIN_PATH}" ./cmd/cigocacher +else + echo "cmd/cigocacher not found locally, fetching from tailscale.com/cmd/cigocacher" + "${GOPATH}" build -o "${BIN_PATH}" tailscale.com/cmd/cigocacher +fi CIGOCACHER_TOKEN="$("${BIN_PATH}" --auth --cigocached-url "${URL}" --cigocached-host "${HOST}" )" if [ -z "${CIGOCACHER_TOKEN:-}" ]; then diff --git a/.github/actions/go-cache/action.yml b/.github/actions/go-cache/action.yml index 38bb15b37..7f5a66de1 100644 --- a/.github/actions/go-cache/action.yml +++ b/.github/actions/go-cache/action.yml @@ -31,4 +31,5 @@ runs: HOST: ${{ inputs.cigocached-host }} CACHE_DIR: ${{ inputs.cache-dir }} working-directory: ${{ inputs.checkout-path }} - run: .github/actions/go-cache/action.sh + # https://github.com/orgs/community/discussions/25910 + run: $GITHUB_ACTION_PATH/action.sh