diff options
| author | Irbe Krumina <irbe@tailscale.com> | 2026-01-14 15:15:02 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-14 15:15:02 +0000 |
| commit | 28f163542cc089078b35a8dc1168c878223aadc5 (patch) | |
| tree | 113be4930aad0498ad3dfe0f5b83de7610025f01 | |
| parent | 6a6aa805d61a014aa602501e42320368970eb17d (diff) | |
| download | tailscale-28f163542cc089078b35a8dc1168c878223aadc5.tar.xz tailscale-28f163542cc089078b35a8dc1168c878223aadc5.zip | |
.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 <irbekrm@gmail.com>
| -rwxr-xr-x | .github/actions/go-cache/action.sh | 19 | ||||
| -rw-r--r-- | .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 |
