-
Notifications
You must be signed in to change notification settings - Fork 324
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
The NATS integration test in CI is failing because the NATS CLI version extraction is returning an empty string, resulting in a 404 error when trying to download the CLI binary.
Error
ERROR 404: Not Found
The wget command tries to download from:
https://github.com/nats-io/natscli/releases/download/v/nats--linux-amd64.zip
Notice the version is completely missing: v/ instead of v0.3.0/
Root Cause
File: .github/workflows/commit.yml
Line: 223
NATS_VERSION=$(curl -s https://api.github.com/repos/nats-io/natscli/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')This command is failing to extract the version, likely due to:
- GitHub API rate limiting - CI may hit rate limits
- Transient network issues during API call
- Fragile regex pattern that doesn't handle all edge cases
Impact
- ❌ NATS integration tests fail
- ✅ All other CI checks pass
- Not blocking development work on directory-watcher or other features
Recommended Solution
Replace the fragile grep/sed approach with jq for reliable JSON parsing:
# Before (fragile)
NATS_VERSION=$(curl -s https://api.github.com/repos/nats-io/natscli/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
# After (robust)
NATS_VERSION=$(curl -s https://api.github.com/repos/nats-io/natscli/releases/latest | jq -r '.tag_name' | sed 's/^v//')
if [ -z "$NATS_VERSION" ]; then
echo "Failed to get NATS CLI version from GitHub API"
exit 1
fiBenefits:
jqis pre-installed on GitHub Actions runners- Proper JSON parsing instead of regex
- Error handling to fail fast with clear message
- More maintainable
Alternative Quick Fix
Temporarily pin the version until the proper fix is implemented:
NATS_VERSION="0.3.0"Context
Discovered while testing PR #827 (directory-watcher feature). The failure is unrelated to that PR's code changes.
Failing Check: Run NATS Integration Tests
Duration: Fails in ~15 seconds
All Other Checks: Passing ✅
Tasks
- Update
.github/workflows/commit.ymlline 223 to usejq - Add error handling for version extraction
- Test the fix in CI
- Consider if other workflows have similar fragile patterns
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working