fix(ci): write Brev credentials file so CLI authenticates on runner#1639
fix(ci): write Brev credentials file so CLI authenticates on runner#1639
Conversation
The `brev login --token` call was removed in 374a847 (#1470), replaced with a `brev ls` pre-check that assumes the CLI is already authenticated. But on ephemeral GH Actions runners there is no ~/.brev/credentials.json, so `brev ls` fails and the entire E2E suite silently skips (0 tests run, reports success). Write the credentials file during the "Install Brev CLI" step so the `hasAuthenticatedBrev` check in brev-e2e.test.js passes. Fixes #1638 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe workflow now injects Changes
Sequence Diagram(s)mermaid GH->>Step: start step (env BREV_API_TOKEN) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/e2e-brev.yaml:
- Around line 155-160: The workflow currently writes ~/.brev/credentials.json
from $BREV_API_TOKEN without checking it's present and doesn't verify
authentication, so CI can silently skip tests; update the steps that create the
credentials (the mkdir + printf block) to first fail-fast if $BREV_API_TOKEN is
empty or invalid, write the credentials file with restricted permissions (e.g.,
chmod 600) and immediately run a quick verification command (brev ls) and exit
non-zero on failure so the pipeline fails fast instead of allowing the test
harness's hasAuthenticatedBrev to swallow auth errors.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c8ab42b2-e63d-42ad-b9d8-06d54c156b75
📒 Files selected for processing (1)
.github/workflows/e2e-brev.yaml
Address CodeRabbit review: guard against empty BREV_API_TOKEN, restrict credentials file to 600, and verify auth with `brev ls` immediately so the pipeline fails fast instead of silently skipping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cv
left a comment
There was a problem hiding this comment.
LGTM — security review WARNING (non-blocking).
Minor suggestion: The printf '{"refresh_token":"%s"}' could malform JSON if the token ever contains quotes/backslashes. Since Node.js is already set up on the runner, consider:
node -e "process.stdout.write(JSON.stringify({refresh_token: process.env.BREV_API_TOKEN}))" > ~/.brev/credentials.jsonOtherwise clean:
- File permissions correct (umask 077 + chmod 600)
- Secret never echoed to logs (masked by GHA, written to file only)
- Fail-fast guard on empty token
brev ls >/dev/nullverification step- CI-only, no production impact
- All checks green
No blocking concerns.
Summary
~/.brev/credentials.jsonduring the "Install Brev CLI" workflow stepBREV_API_TOKENfrom the environment — it requires a credentials filebrev login --tokencall was removed in 374a847 (refactor(installer): unify host preflight and thin deploy compatibility #1470), breaking all E2E runs sinceRoot Cause
PR #1470 replaced
brev("login", "--token", process.env.BREV_API_TOKEN)with abrev("ls")pre-check (hasAuthenticatedBrev), but nothing writes the credentials file on the ephemeral GH Actions runner. Result:brev lsfails silently,hasAuthenticatedBrevreturns false,describe.runIf()skips the entire suite, and CI reports success with 0 tests run.Evidence
Test plan
e2e-brevworkflow withTEST_SUITE=full— confirm tests actually run (not skip)Fixes #1638
🤖 Generated with Claude Code
Summary by CodeRabbit