Skip to content

Commit a37fd51

Browse files
committed
Fix Windows agentd detection - use correct path C:\\ProgramData\\Agentd\\agentd-service.exe
1 parent 2d87636 commit a37fd51

21 files changed

+21812
-13
lines changed

.direnv/flake-profile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flake-profile-2-link

.direnv/flake-profile-2-link

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/nix/store/vsdzic8q5wvzc6fby3y4xxg2rd6f8yjf-api-devshell-env

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.log
2+
dist/
3+
/cli
4+
/bin
5+
/depot
6+
7+
node_modules
8+
9+
/CHANGELOG.md
10+
go.work
11+
go.work.sum

.envrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export NIXPKGS_ALLOW_UNFREE=1;
2+
use_impure_flake() {
3+
watch_file flake.nix
4+
watch_file flake.lock
5+
mkdir -p "$(direnv_layout_dir)"
6+
# 1password-cli is closed source
7+
eval "$(nix --extra-experimental-features "nix-command flakes" print-dev-env --profile "$(direnv_layout_dir)/flake-profile" --impure "$@")"
8+
nix --extra-experimental-features "nix-command flakes" profile wipe-history --profile "$(direnv_layout_dir)/flake-profile"
9+
}
10+
11+
use impure_flake;

.github/workflows/test-depot-detection.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ jobs:
5252
echo "=== DEPOT WINDOWS RUNNER TEST ==="
5353
echo "Hostname: $(hostname)"
5454
55-
# Build CLI
55+
# Build CLI and test program
5656
go build -o depot-test.exe ./cmd/depot
57+
go build -o test-detection.exe ./cmd/test-detection
5758
5859
# Run with debug
5960
export DEPOT_DEBUG_DETECTION=1
61+
echo -e "\n--- Running detection test ---"
62+
./test-detection.exe || true
63+
6064
echo -e "\n--- Running depot version ---"
6165
./depot-test.exe version || true
6266
@@ -65,9 +69,7 @@ jobs:
6569
run: |
6670
Write-Host "`n--- Manual agentd check ---"
6771
$paths = @(
68-
"C:\Program Files\Depot\agentd.exe",
69-
"C:\ProgramData\Depot\agentd.exe",
70-
"C:\usr\local\bin\agentd.exe"
72+
"C:\ProgramData\Agentd\agentd-service.exe"
7173
)
7274
foreach ($path in $paths) {
7375
if (Test-Path $path) {
@@ -158,9 +160,7 @@ jobs:
158160
run: |
159161
Write-Host "`n--- Manual agentd check ---"
160162
$paths = @(
161-
"C:\Program Files\Depot\agentd.exe",
162-
"C:\ProgramData\Depot\agentd.exe",
163-
"C:\usr\local\bin\agentd.exe"
163+
"C:\ProgramData\Agentd\agentd-service.exe"
164164
)
165165
foreach ($path in $paths) {
166166
if (Test-Path $path) {

Oops.rej

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@@ -319,7 +319,7 @@
2+
PrintBuildURL(build.BuildURL, options.progress)
3+
}()
4+
5+
- options.builderOptions = []builder.Option{builder.WithDepotOptions(buildPlatform, build)}
6+
+ options.builderOptions = []builder.Option{builder.WithDepotOptions(buildPlatform, build, false)}
7+
8+
buildProject := build.BuildProject()
9+
if buildProject != "" {
10+
\ No newline at end of line

TESTING_DEPOT_DETECTION.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Testing Depot GHA Detection
2+
3+
This document outlines how to test the Depot GitHub Actions runner detection feature.
4+
5+
## What We're Testing
6+
7+
The CLI now detects when it's running on a Depot GitHub Actions runner and automatically requests private IP addresses for builder connections. This improves performance by using internal networking instead of public internet.
8+
9+
## Detection Method
10+
11+
The detection checks for the `agentd` binary in OS-specific locations:
12+
13+
- **Linux**: `/usr/local/bin/agentd`
14+
- **macOS**: `/usr/local/bin/agentd`
15+
- **Windows**:
16+
- `C:\Program Files\Depot\agentd.exe`
17+
- `C:\ProgramData\Depot\agentd.exe`
18+
- `C:\usr\local\bin\agentd.exe`
19+
20+
## Test Programs
21+
22+
### 1. Standalone Detection Test
23+
24+
```bash
25+
# Build the test program
26+
go build -o test-detection ./cmd/test-detection
27+
28+
# Run with debug output
29+
DEPOT_DEBUG_DETECTION=1 ./test-detection
30+
```
31+
32+
### 2. Full CLI Test
33+
34+
```bash
35+
# Build the CLI
36+
go build -o depot-test ./cmd/depot
37+
38+
# Run any depot command with debug output
39+
DEPOT_DEBUG_DETECTION=1 ./depot-test build .
40+
```
41+
42+
## Expected Output
43+
44+
### On Depot Runners
45+
```
46+
[DEPOT DEBUG] Starting Depot GHA runner detection on linux/amd64
47+
[DEPOT DEBUG] Checking for agentd at: /usr/local/bin/agentd
48+
[DEPOT DEBUG] Found agentd at /usr/local/bin/agentd - Depot runner DETECTED
49+
[DEPOT DEBUG] Requesting PRIVATE IP for builder connection
50+
```
51+
52+
### On Regular GitHub/Local Machines
53+
```
54+
[DEPOT DEBUG] Starting Depot GHA runner detection on linux/amd64
55+
[DEPOT DEBUG] Checking for agentd at: /usr/local/bin/agentd
56+
[DEPOT DEBUG] agentd not found at /usr/local/bin/agentd: stat /usr/local/bin/agentd: no such file or directory
57+
[DEPOT DEBUG] No agentd found - NOT a Depot runner
58+
[DEPOT DEBUG] Using default (PUBLIC) IP for builder connection
59+
```
60+
61+
## GitHub Actions Workflow
62+
63+
A test workflow is available at `.github/workflows/test-depot-detection.yml` that:
64+
1. Tests on Depot runners (ubuntu, windows, macos)
65+
2. Tests on regular GitHub runners for comparison
66+
3. Shows debug output for verification
67+
68+
## Manual Testing Commands
69+
70+
### Windows (PowerShell)
71+
```powershell
72+
$env:DEPOT_DEBUG_DETECTION="1"
73+
.\depot-test.exe version
74+
75+
# Check for agentd manually
76+
Test-Path "C:\Program Files\Depot\agentd.exe"
77+
Test-Path "C:\ProgramData\Depot\agentd.exe"
78+
Test-Path "C:\usr\local\bin\agentd.exe"
79+
```
80+
81+
### Linux/macOS
82+
```bash
83+
export DEPOT_DEBUG_DETECTION=1
84+
./depot-test version
85+
86+
# Check for agentd manually
87+
ls -la /usr/local/bin/agentd
88+
```
89+
90+
## Verification Steps
91+
92+
1. **Build the CLI** with the changes
93+
2. **Run on Depot runners** - Should detect and request private IPs
94+
3. **Run on GitHub runners** - Should NOT detect, use public IPs
95+
4. **Run locally** - Should NOT detect, use public IPs
96+
5. **Check debug output** matches expected patterns
97+
98+
## Notes
99+
100+
- The debug output is only shown when `DEPOT_DEBUG_DETECTION=1` is set
101+
- The detection happens during builder connection, not at CLI startup
102+
- Private IP requests only affect builder connections, not API calls

build-test-binaries.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Building test binaries for all platforms..."
5+
6+
# Clean previous builds
7+
rm -rf test-binaries
8+
mkdir -p test-binaries
9+
10+
# Build for each platform
11+
echo "Building Linux amd64..."
12+
GOOS=linux GOARCH=amd64 go build -o test-binaries/depot-test-linux-amd64 ./cmd/depot
13+
14+
echo "Building Linux arm64..."
15+
GOOS=linux GOARCH=arm64 go build -o test-binaries/depot-test-linux-arm64 ./cmd/depot
16+
17+
echo "Building Windows amd64..."
18+
GOOS=windows GOARCH=amd64 go build -o test-binaries/depot-test-windows-amd64.exe ./cmd/depot
19+
20+
echo "Building macOS amd64..."
21+
GOOS=darwin GOARCH=amd64 go build -o test-binaries/depot-test-darwin-amd64 ./cmd/depot
22+
23+
echo "Building macOS arm64..."
24+
GOOS=darwin GOARCH=arm64 go build -o test-binaries/depot-test-darwin-arm64 ./cmd/depot
25+
26+
# Also build the standalone detection test
27+
echo "Building detection test binaries..."
28+
GOOS=linux GOARCH=amd64 go build -o test-binaries/test-detection-linux-amd64 ./cmd/test-detection
29+
GOOS=windows GOARCH=amd64 go build -o test-binaries/test-detection-windows-amd64.exe ./cmd/test-detection
30+
GOOS=darwin GOARCH=amd64 go build -o test-binaries/test-detection-darwin-amd64 ./cmd/test-detection
31+
GOOS=darwin GOARCH=arm64 go build -o test-binaries/test-detection-darwin-arm64 ./cmd/test-detection
32+
33+
echo "Done! Binaries are in test-binaries/"
34+
ls -la test-binaries/

cmd/test-detection/main.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ func main() {
3939
switch runtime.GOOS {
4040
case "windows":
4141
paths = []string{
42-
"C:\\Program Files\\Depot\\agentd.exe",
43-
"C:\\ProgramData\\Depot\\agentd.exe",
44-
"C:\\usr\\local\\bin\\agentd.exe",
42+
"C:\\ProgramData\\Agentd\\agentd-service.exe",
4543
}
4644
case "darwin":
4745
paths = []string{

0 commit comments

Comments
 (0)