Skip to content

Commit 16c0297

Browse files
committed
Add wait for ado-helper in case it isn't installed immediately
1 parent 47b524b commit 16c0297

2 files changed

Lines changed: 29 additions & 4 deletions

File tree

src/artifacts-helper/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
}
6767
},
6868
"containerEnv": {
69-
"PATH": "${shimDirectory}:${PATH}"
69+
"PATH": "/usr/local/share/codespace-shims:${PATH}"
7070
},
7171
"installsAfter": [
7272
"ghcr.io/devcontainers/features/common-utils",
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
#!/bin/bash
2-
if [ -f "${HOME}/ado-auth-helper" ]; then
3-
ARTIFACTS_ACCESSTOKEN=$(${HOME}/ado-auth-helper get-access-token)
4-
fi
2+
3+
echo "::step::Waiting for AzDO Authentication Helper..."
4+
5+
# Wait up to 3 minutes for the ado-auth-helper to be installed
6+
MAX_WAIT=180
7+
ELAPSED=0
8+
9+
while [ $ELAPSED -lt $MAX_WAIT ]; do
10+
if [ -f "${HOME}/ado-auth-helper" ]; then
11+
echo "::step::Running ado-auth-helper get-access-token..."
12+
ARTIFACTS_ACCESSTOKEN=$(${HOME}/ado-auth-helper get-access-token)
13+
echo "::step::✓ Access token retrieved successfully"
14+
return 0
15+
fi
16+
sleep 2
17+
ELAPSED=$((ELAPSED + 2))
18+
19+
# Progress indicator every 20 seconds
20+
if [ $((ELAPSED % 20)) -eq 0 ]; then
21+
echo " Still waiting... (${ELAPSED}s elapsed)"
22+
fi
23+
done
24+
25+
# Timeout reached
26+
echo "::error::AzDO Authentication Helper not found after ${MAX_WAIT} seconds"
27+
echo "Expected location: ${HOME}/ado-auth-helper"
28+
echo "Restore cannot proceed without authentication"
29+
return 1

0 commit comments

Comments
 (0)