summaryrefslogtreecommitdiffhomepage
path: root/tool
AgeCommit message (Collapse)AuthorFilesLines
2025-09-15tool/gocross: ensure child process error codes are propagated on non-UnixAaron Klotz2-2/+16
The Unix implementation of doExec propagates error codes by virtue of the fact that it does an execve; the replacement binary will return the exit code. On non-Unix, we need to simulate these semantics by checking for an ExitError and, when present, passing that value on to os.Exit. We also add error handling to the doExec call for the benefit of handling any errors where doExec fails before being able to execute the desired binary. Updates https://github.com/tailscale/corp/issues/29940 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-08-18tool/gocross: fix environment variable clearing in gocross-wrapper.ps1Aaron Klotz1-5/+11
The -Environment argument to Start-Process is essentially being treated as a delta; removing a particular variable from the argument's hash table does not indicate to delete. Instead we must set the value of each unwanted variable to $null. Updates https://github.com/tailscale/corp/issues/29940 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-08-18tool/gocross: don't set executable bits on PowerShell scriptAaron Klotz1-1/+1
Updates https://github.com/tailscale/corp/issues/29940 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-08-18tool, tool/gocross: update gocross to support building natively on Windows ↵Aaron Klotz8-7/+309
and add a PowerShell Core wrapper script gocross-wrapper.ps1 is a PowerShell core script that is essentially a straight port of gocross-wrapper.sh. It requires PowerShell 7.4, which is the latest LTS release of PSCore. Why use PowerShell Core instead of Windows PowerShell? Essentially because the former is much better to script with and is the edition that is currently maintained. Because we're using PowerShell Core, but many people will be running scripts from a machine that only has Windows PowerShell, go.cmd has been updated to prompt the user for PowerShell core installation if necessary. gocross-wrapper.sh has also been updated to utilize the PSCore script when running under cygwin or msys. gocross itself required a couple of updates: We update gocross to output the PowerShell Core wrapper alongside the bash wrapper, which will propagate the revised scripts to other repos as necessary. We also fix a couple of things in gocross that didn't work on Windows: we change the toolchain resolution code to use os.UserHomeDir instead of directly referencing the HOME environment variable, and we fix a bug in the way arguments were being passed into exec.Command on non-Unix systems. Updates https://github.com/tailscale/corp/issues/29940 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-06-26tool/gocross: remove GOROOT to ensure correct toolchain useJames Tucker1-0/+6
go(1) repsects GOROOT if set, but tool/go / gocross-wrapper.sh are explicitly intending to use our toolchain. We don't need to set GOROOT, just unset it, and then go(1) handles the rest. Updates tailscale/corp#26717 Signed-off-by: James Tucker <james@tailscale.com>
2025-06-22tool: rename go.ps1 to go-win.ps1 for cmd.exe+Powershell compatBrad Fitzpatrick2-1/+1
This tweaks the just-added ./tool/go.{cmd,ps1} port of ./tool/go for Windows. Otherwise in Windows Terminal in Powershell, running just ".\tool\go" picks up go.ps1 before go.cmd, which means execution gets denied without the cmd script's -ExecutionPolicy Bypass part letting it work. This makes it work in both cmd.exe and in Powershell. Updates tailscale/corp#28679 Change-Id: Iaf628a9fd6cb95670633b2dbdb635dfb8afaa006 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-20tool: add go toolchain wrapper for WindowsBrad Fitzpatrick2-0/+66
go.cmd lets you run just "./tool/go" on Windows the same as Linux/Darwin. The batch script (go.md) then just invokes PowerShell which is more powerful than batch. I wanted this while debugging Windows CI performance by reproducing slow tests on my local Windows laptop. Updates tailscale/corp#28679 Change-Id: I6e520968da3cef3032091c1c4f4237f663cefcab Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-17tool/gocross: put the synthetic GOROOTs outside of the tsgo directoryBrad Fitzpatrick2-1/+2
We aim to make the tsgo directories be read-only mounts on builders. But gocross was previously writing within the ~/.cache/tsgo/$HASH/ directories to make the synthetic GOROOT directories. This moves them to ~/.cache/tsgoroot/$HASH/ instead. Updates tailscale/corp#28679 Updates tailscale/corp#26717 Change-Id: I0d17730bbdce3d6374e79d49486826575d4690af Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-17.github/workflows: remove redundant work between staticcheck jobsBrad Fitzpatrick1-0/+206
Make the OS-specific staticcheck jobs only test stuff that's specialized for that OS. Do that using a new ./tool/listpkgs program that's a fancy 'go list' with more filtering flags. Updates tailscale/corp#28679 Change-Id: I790be2e3a0b42b105bd39f68c4b20e217a26de60 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-06-16tool/gocross: make gocross opt-in instead of opt-outBrad Fitzpatrick2-4/+34
gocross is not needed like it used to be, now that Go does version stamping itself. We keep it for the xcode and Windows builds for now. This simplifies things in the build, especially with upcoming build system updates. Updates tailscale/corp#28679 Updates tailscale/corp#26717 Change-Id: Ib4bebe6f50f3b9c3d6cd27323fca603e3dfb43cc Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-29tool/gocross: break circular dependency on tailcfg (#15829)Andrew Lytvynov2-7/+37
Instead of using the version package (which depends on tailcfg.CurrentCapabilityVersion) to get the git commit hash, do it directly using debug.BuildInfo. This way, when changing struct fields in tailcfg, we can successfully `go generate` it without compiler errors. Updates #9634 Updates https://github.com/tailscale/corp/issues/26717 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-04-15node.rev: bump to latest 22.x LTS release (#15652)Mario Minardi1-1/+1
Bump to latest 22.x LTS release for node as the 18.x line is going EOL this month. Updates https://github.com/tailscale/corp/issues/27737 Signed-off-by: Mario Minardi <mario@tailscale.com>
2024-10-28tool/gocross: remove trimpath from test buildsJames Tucker2-2/+5
trimpath can be inconvenient for IDEs and LSPs that do not always correctly handle module relative paths, and can also contribute to caching bugs taking effect. We rarely have a real need for trimpath of test produced binaries, so avoiding it should be a net win. Updates #2988 Signed-off-by: James Tucker <james@tailscale.com>
2024-10-17tool/gocross: add support for tvOS Simulator (#13847)Andrea Gottardo1-1/+5
Updates ENG-5321 Allow gocross to build a static library for the Apple TV Simulator. Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
2024-10-07tool/gocross: fix argument order to findBrad Fitzpatrick1-1/+1
To avoid warning: find: warning: you have specified the global option -maxdepth after the argument -type, but global options are not positional, i.e., -maxdepth affects tests specified before it as well as those specified after it. Please specify global options before other arguments. Fixes tailscale/corp#23689 Change-Id: I91ee260b295c552c0a029883d5e406733e081478 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-09-24tool/gocross: make gocross-wrapper.sh keep multiple Go toolchains aroundBrad Fitzpatrick2-35/+52
So it doesn't delete and re-pull when switching between branches. Updates tailscale/corp#17686 Change-Id: Iffb989781db42fcd673c5f03dbd0ce95972ede0f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-18{tool,client}: bump node version (#12840)Mario Minardi1-1/+1
Bump node version to latest lts on the 18.x line which is 18.20.4 at the time of writing. Updates https://github.com/tailscale/corp/issues/21741 Signed-off-by: Mario Minardi <mario@tailscale.com>
2024-07-10all: add test for package comments, fix, add comments as neededBrad Fitzpatrick1-1/+0
Updates #cleanup Change-Id: Ic4304e909d2131a95a38b26911f49e7b1729aaef Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-07-01tool/gocross: fix regression detecting when gocross needs rebuildBrad Fitzpatrick2-1/+28
Fix regression from #8108 (Mar 2023). Since that change, gocross has always been rebuilt on each run of ./tool/go (gocross-wrapper.sh), adding ~100ms. (Well, not totally rebuilt; cmd/go's caching still ends up working fine.) The problem was $gocross_path was just "gocross", which isn't in my path (and "." isn't in my $PATH, as it shouldn't be), so this line was always evaluating to the empty string: gotver="$($gocross_path gocross-version 2>/dev/null || echo '')" The ./gocross is fine because of the earlier `cd "$repo_root"` Updates tailscale/corp#21262 Updates tailscale/corp#21263 Change-Id: I80d25446097a3bb3423490c164352f0b569add5f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-05-22tool/gocross: add debug data to CGO buildsJames Tucker2-21/+21
We don't build a lot of tools with CGO, but we do build some, and it's extremely valuable for production services in particular to have symbols included - for perf and so on. I tested various other builds that could be affected negatively, in particular macOS/iOS, but those use split-dwarf already as part of their build path, and Android which does not currently use gocross. One binary which is normally 120mb only grew to 123mb, so the trade-off is definitely worthwhile in context. Updates tailscale/corp#20296 Signed-off-by: James Tucker <james@tailscale.com>
2024-05-16tool/gocross: treat empty GOOS/GOARCH as native GOOS/GOARCHJames Tucker2-2/+61
Tracking down the side effect can otherwise be a pain, for example on Darwin an empty GOOS resulted in CGO being implicitly disabled. The user intended for `export GOOS=` to act like unset, and while this is a misunderstanding, the main toolchain would treat it this way. Fixes tailscale/corp#20059 Signed-off-by: James Tucker <james@tailscale.com>
2024-03-19tool/gocross: add android autoflags (#11465)James Tucker2-0/+61
Updates tailscale/corp#18202 Signed-off-by: James Tucker <james@tailscale.com>
2024-02-16tool/gocross: pass flags for visionOS and visionOS Simulator (#11127)Andrea Gottardo1-0/+6
Adds logic in gocross to detect environment variables and pass the right flags so that the backend can be built with the visionOS SDK. Signed-off-by: Andrea Gottardo <andrea@tailscale.com> Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
2024-01-19tool/gocross: force use of our custom toolchainDavid Anderson2-0/+45
The new 'toolchain' directive in go.mod can sometimes force the use of an upstream toolchain against our wishes. Concurrently, some of our dependencies have added the 'toolchain' directive, which transitively adds it to our own go.mod. Force all uses of gocross to ignore that directive and stick to our customized toolchain. Updates #cleanup Signed-off-by: David Anderson <danderson@tailscale.com>
2023-12-20all: cleanup unused code, part 1 (#10661)Andrew Lytvynov1-25/+0
Run `staticcheck` with `U1000` to find unused code. This cleans up about a half of it. I'll do the other half separately to keep PRs manageable. Updates #cleanup Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-12-19tool/gocross: make all Windows DLLs build with static libgccNick Khyl1-0/+1
In this commit, we have updated the build process for our Windows DLLs to link statically with libgcc, ensuring our Windows DLLs are self-contained. Updates #10617 Signed-off-by: Nick Khyl <nickk@tailscale.com>
2023-11-21ci: report test coverage to coveralls.ioPercy Wegmann1-1/+1
This records test coverage for the amd64 no race tests and uploads the results to coveralls.io. Updates #cleanup Signed-off-by: Ox Cart <ox.to.a.cart@gmail.com>
2023-10-30tool: download helm CLI (#9981)Irbe Krumina2-0/+70
Updates tailscale/tailscale#9222 Signed-off-by: Irbe Krumina <irbe@tailscale.com>
2023-10-10tool/gocross: handle VERSION file not foundMaisem Ali1-1/+4
Fixes #9734 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-10-05tool/gocross: don't absorb --tags flags passed to subcommandDavid Anderson2-5/+56
Fixes tailscale/corp#15117 Signed-off-by: David Anderson <danderson@tailscale.com>
2023-10-03Revert "tool/gocross: disable Linux static linking if GOCROSS_STATIC=0"Brad Fitzpatrick1-4/+0
This reverts commit 2c0f0ee759cc571db06b4615c900fc2e905498b1. Fixed by efac2cb8d672670b7 Updates tailscale/corp#15058 Updates tailscale/corp#13113
2023-10-03tool/gocross: merge user's build tags and implicitly added build tags togetherBrad Fitzpatrick2-1/+102
Fixes tailscale/corp#15058 Change-Id: I7e539b3324153077597f30385a2cb540846e8bdc Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-28tool/gocross: disable Linux static linking if GOCROSS_STATIC=0Brad Fitzpatrick1-0/+4
So we can experiment with disabling static linking for tests in CI to make GitHub Actions output less spammy. Updates tailscale/corp#13113 Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2023-09-21release/dist, tool/gocross: add fake "windowsdll" GOOS to gocrossAaron Klotz1-1/+18
We're going to need to build a DLL containing custom actions for the installer. This patch adds the foundations of that capability to dist and gocross. Updates https://github.com/tailscale/corp/issues/13998 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2023-08-22release/dist: run yarn build before building CLIWill Norris1-1/+1
This builds the assets for the new web client as part of our release process. The path to the web client source is specified by the -web-client-root flag. This allows corp builds to first vendor the tailscale.com module, and then build the web client assets in the vendor directory. The default value for the -web-client-root flag is empty, so no assets are built by default. This is an update of the previously reverted 0fb95ec Updates tailscale/corp#13775 Signed-off-by: Will Norris <will@tailscale.com>
2023-08-21Revert "release/dist: run yarn build before building CLI"Will Norris1-1/+1
This caused breakages on the build server: synology/dsm7/x86_64: chdir /home/ubuntu/builds/2023-08-21T21-47-38Z-unstable-main-tagged-devices/0/client/web: no such file or directory synology/dsm7/i686: chdir /home/ubuntu/builds/2023-08-21T21-47-38Z-unstable-main-tagged-devices/0/client/web: no such file or directory synology/dsm7/armv8: chdir /home/ubuntu/builds/2023-08-21T21-47-38Z-unstable-main-tagged-devices/0/client/web: no such file or directory ... Reverting while I investigate. This reverts commit 0fb95ec07daa81d2a30a44af7d969249cec5bdc8. Signed-off-by: Will Norris <will@tailscale.com>
2023-08-21release/dist: run yarn build before building CLIWill Norris1-1/+1
This builds the assets for the new web client as part of our release process. These assets will soon be embedded into the cmd/tailscale binary, but are not actually done so yet. Updates tailscale/corp#13775 Signed-off-by: Will Norris <will@tailscale.com>
2023-08-21tool: force HTTP/1.1 in curl to prevent hang behind load balancerVal1-1/+6
When running in our github CI environment, curl sometimes hangs while closing the download from the nodejs.org server and fails with INTERNAL_ERROR. This is likely caused by CI running behind some kind of load balancer or proxy that handles HTTP/2 incorrectly in some minor way, so force curl to use HTTP 1.1. Updates #8988 Signed-off-by: Val <valerie@tailscale.com>
2023-08-10tool/{node,yarn}: update node and yarn toolsSonia Appasamy3-68/+92
Syncing these up with what we've got in corp. Updates tailscale/corp#13775 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
2023-06-23tool/gocross: make gocross behave with pre-release Go toolchainsDavid Anderson1-14/+19
Also switch the wrapper script to use bash not posix shell. We now depend on bash elsewhere for saner behavior in esoteric areas, so might as well use it everywhere for consistency. Fixes #8425 Signed-off-by: David Anderson <danderson@tailscale.com>
2023-06-15tool/gocross: properly set simulator deployment target (#8355)Nick O'Neill1-1/+5
Fixes tailscale/corp#11876 Signed-off-by: Nick O'Neill <nick@tailscale.com>
2023-06-06tool/gocross: handle TVOS_DEPLOYMENT_TARGET (#8292)Andrea Gottardo1-0/+2
This is needed in order to build our network extension on tvOS. First step for #8282 Signed-off-by: Andrea Gottardo <andrea@tailscale.com> Co-authored-by: Andrea Gottardo <andrea@tailscale.com>
2023-05-29release/dist/synology: build synology packages with cmd/distDavid Anderson1-1/+3
Updates #8217 Signed-off-by: David Anderson <danderson@tailscale.com>
2023-05-09tool/gocross: fix incorrect relpath usage in bootstrap scriptDavid Anderson1-3/+3
The subshell in which gocross gets built cd's to the corp checkout dir near the top, so all future references to corp repository files should be simple relative paths, and not reference $repo_root. When $repo_root is an absolute path, it doesn't matter and everything works out, but on some OSes and shells and invocations, $repo_root is a completely relative path that is invalidated by the "cd". Fixes tailscale/corp#11183 Signed-off-by: David Anderson <danderson@tailscale.com>
2023-04-17various: add golangci-lint, fix issues (#7905)Andrew Dunham1-1/+1
This adds an initial and intentionally minimal configuration for golang-ci, fixes the issues reported, and adds a GitHub Action to check new pull requests against this linter configuration. Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I8f38fbc315836a19a094d0d3e986758b9313f163
2023-04-11tool/gocross: add ts_macext build tag for Xcode buildsMihai Parparita2-2/+6
It's used to control various opt-in functionality for the macOS and iOS apps, and was lost in the migration to gocross. Updates tailscale/tailscale#7769 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2023-03-28tool/gocross: use grep -E over egrep to avoid warningJames Tucker1-1/+1
Recent egrep builds produce a warning: ``` egrep: warning: egrep is obsolescent; using grep -E ``` Updates #cleanup Signed-off-by: James Tucker <james@tailscale.com>
2023-03-20tool/gocross: correctly embed the git commit into gocrossDavid Anderson1-2/+2
Previously, the build ended up embedding an empty string, which made the shell wrapper rebuild gocross on every invocation. This is still reasonably fast, but fixing the bypass shaves 80% off gocross's overhead when no rebuild is needed. Signed-off-by: David Anderson <danderson@tailscale.com>
2023-03-20tool/gocross: support running from outside the repo dirDavid Anderson2-4/+21
A bunch of us invoke tool/go from outside the repo that hosts gocross, as a way of accessing our version-controlled toolchain. This removes assumptions from gocross that it's being invoked within the repository that contains its source code and toolchain configuration. Fixes tailscale/corp#9627 Signed-off-by: David Anderson <danderson@tailscale.com>
2023-03-20tool/gocross: fail if the toolchain revision isn't findableDavid Anderson1-3/+0
This used to make sense, but after a refactor somewhere along the line this results in trying to download from a malformed URL and generally confusing failures. Signed-off-by: David Anderson <danderson@tailscale.com>