Skip to content

Commit e6a8ab2

Browse files
committed
stop echoing tailscale status to console
Updates #201 Signed-off-by: Percy Wegmann <percy@tailscale.com>
1 parent 2976a88 commit e6a8ab2

4 files changed

Lines changed: 106 additions & 79 deletions

File tree

.github/workflows/test.yml

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,62 +23,62 @@ jobs:
2323
version: latest
2424
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
2525

26-
# Try unstable too
27-
- os: ubuntu-latest
28-
runner-os: Linux
29-
arch: amd64
30-
version: unstable
31-
32-
# Try a pinned version
33-
- os: ubuntu-latest
34-
runner-os: Linux
35-
arch: amd64
36-
# leave version blank to fall back to default
37-
38-
# Linux tests (ARM64)
39-
- os: ubuntu-24.04-arm
40-
runner-os: Linux
41-
arch: arm64
42-
version: latest
43-
44-
# Windows tests (AMD64)
45-
- os: windows-latest
46-
runner-os: Windows
47-
arch: amd64
48-
version: latest
49-
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
50-
51-
- os: windows-latest
52-
runner-os: Windows
53-
arch: amd64
54-
version: unstable
55-
56-
# Windows tests (ARM64)
57-
- os: windows-11-arm
58-
runner-os: Windows
59-
arch: arm64
60-
version: latest
61-
62-
# macOS 13 (AMD64)
63-
- os: macos-13
64-
runner-os: macOS
65-
arch: amd64
66-
version: latest
67-
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
68-
69-
# macOS 14 (ARM)
70-
- os: macos-14
71-
runner-os: macOS
72-
arch: arm64
73-
version: latest
74-
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
75-
76-
# macOS latest (ARM)
77-
- os: macos-latest
78-
runner-os: macOS
79-
arch: arm64
80-
version: latest
81-
ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
26+
# # Try unstable too
27+
# - os: ubuntu-latest
28+
# runner-os: Linux
29+
# arch: amd64
30+
# version: unstable
31+
32+
# # Try a pinned version
33+
# - os: ubuntu-latest
34+
# runner-os: Linux
35+
# arch: amd64
36+
# # leave version blank to fall back to default
37+
38+
# # Linux tests (ARM64)
39+
# - os: ubuntu-24.04-arm
40+
# runner-os: Linux
41+
# arch: arm64
42+
# version: latest
43+
44+
# # Windows tests (AMD64)
45+
# - os: windows-latest
46+
# runner-os: Windows
47+
# arch: amd64
48+
# version: latest
49+
# ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
50+
51+
# - os: windows-latest
52+
# runner-os: Windows
53+
# arch: amd64
54+
# version: unstable
55+
56+
# # Windows tests (ARM64)
57+
# - os: windows-11-arm
58+
# runner-os: Windows
59+
# arch: arm64
60+
# version: latest
61+
62+
# # macOS 13 (AMD64)
63+
# - os: macos-13
64+
# runner-os: macOS
65+
# arch: amd64
66+
# version: latest
67+
# ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
68+
69+
# # macOS 14 (ARM)
70+
# - os: macos-14
71+
# runner-os: macOS
72+
# arch: arm64
73+
# version: latest
74+
# ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
75+
76+
# # macOS latest (ARM)
77+
# - os: macos-latest
78+
# runner-os: macOS
79+
# arch: arm64
80+
# version: latest
81+
# ping: 100.99.0.2,lax-pve.pineapplefish.ts.net,lax-pve
8282

8383
runs-on: ${{ matrix.os }}
8484

package-lock.json

Lines changed: 25 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
"license": "BSD-3-Clause",
1515
"dependencies": {
1616
"@actions/cache": "^4.0.0",
17-
"@actions/core": "^1.10.1",
17+
"@actions/core": "^1.10.1",
1818
"@actions/exec": "^1.1.1",
1919
"@actions/github": "^6.0.1",
20-
"@actions/tool-cache": "^2.0.1"
20+
"@actions/tool-cache": "^2.0.1",
21+
"null-writable": "^2.0.1"
2122
},
2223
"devDependencies": {
2324
"@types/node": "^20.17.6",
@@ -30,4 +31,4 @@
3031
"glob": "^10.3.10",
3132
"inflight": "npm:@isaacs/inflight@^1.0.6"
3233
}
33-
}
34+
}

src/main.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,22 @@ type tailscaleStatus = {
5858

5959
// Cross-platform Tailscale local API status check
6060
async function getTailscaleStatus(): Promise<tailscaleStatus> {
61-
const { stdout } = await exec.getExecOutput(cmdTailscale, [
62-
"status",
63-
"--json",
64-
]);
61+
const { exitCode, stdout, stderr } = await exec.getExecOutput(
62+
cmdTailscale,
63+
["status", "--json"],
64+
{
65+
silent: true,
66+
ignoreReturnCode: true,
67+
}
68+
);
69+
if (exitCode !== 0) {
70+
process.stderr.write(stderr);
71+
throw new Error(`tailscale status failed with exit code ${exitCode}`);
72+
}
73+
if (core.isDebug()) {
74+
process.stdout.write(stdout);
75+
}
76+
core.debug(stdout);
6577
return JSON.parse(stdout);
6678
}
6779

@@ -574,6 +586,7 @@ async function waitForDaemonReady(): Promise<void> {
574586

575587
core.info("Waiting for tailscaled daemon to become ready...");
576588

589+
var lastErr: any;
577590
while (waited < maxWaitMs) {
578591
try {
579592
const status = await getTailscaleStatus();
@@ -586,13 +599,16 @@ async function waitForDaemonReady(): Promise<void> {
586599
}
587600
} catch (err) {
588601
// Daemon not ready yet, keep polling
602+
lastErr = err;
589603
core.debug(`Waiting for daemon... (${waited}ms elapsed)`);
590604
}
591605
await sleep(pollIntervalMs);
592606
waited += pollIntervalMs;
593607
}
594608

595-
throw new Error("tailscaled daemon did not become ready within timeout");
609+
throw new Error(
610+
`tailscaled daemon did not become ready within timeout, last error: ${lastErr}`
611+
);
596612
}
597613

598614
async function connectToTailscale(

0 commit comments

Comments
 (0)