Repository navigation
Fix Artifactory store and improve store documentation - #2038
Conversation
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2038 +/- ##
==========================================
+ Coverage 75.50% 75.55% +0.05%
==========================================
Files 793 793
Lines 73713 73718 +5
==========================================
+ Hits 55657 55699 +42
+ Misses 14562 14524 -38
- Partials 3494 3495 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Replace unsafe string formatting with struct-based JSON marshaling to address CodeQL security alert about potentially unsafe quoting. Uses struct field ordering to ensure "results" comes before "range" in the JSON output, which is required by the JFrog SDK's ContentReader. Co-Authored-By: Claude Opus 4.5 <[email protected]>
📝 WalkthroughWalkthroughSet download params to flatten results and normalize temporary download directories in Artifactory store Get/GetKey; add an Artifactory mock server and integration tests; update documentation and examples to use new store type names and Artifactory guidance. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Focus on the user-facing problem (Artifactory retrieval failing with nested paths) rather than internal implementation details. Co-Authored-By: Claude Opus 4.5 <[email protected]>
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
On Windows, filepath.Join uses backslashes which breaks Artifactory API paths. Use path.Join which always uses forward slashes for URL paths. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Allow users to test Atmos features from PRs without installing Go or manually downloading artifacts from GitHub Actions UI. Extend --use-version to support PR numbers using the pr:NNNN format (e.g., --use-version pr:2038). Key features: - Smart GitHub token detection (ATMOS_GITHUB_TOKEN, GITHUB_TOKEN, or gh CLI) - Automatic platform detection for Linux/macOS/Windows - Download and extract artifacts from successful PR CI runs - Caching of downloaded binaries for reuse - Clear error messages for missing tokens, failed CI, unsupported platforms New packages: - pkg/github/: GitHub API integration for PR artifact retrieval - toolchain/pr_artifact.go: PR artifact download and installation logic Modified: - pkg/version/reexec.go: Added PR version detection in version switching - toolchain/install.go: Added PR version detection in tool installation Implements #2038. Co-Authored-By: Claude Haiku 4.5 <[email protected]>
|
These changes were released in v1.205.1-rc.0. |
Allow users to test Atmos features from PRs without installing Go or manually downloading artifacts from GitHub Actions UI. Extend --use-version to support PR numbers using the pr:NNNN format (e.g., --use-version pr:2038). Key features: - Smart GitHub token detection (ATMOS_GITHUB_TOKEN, GITHUB_TOKEN, or gh CLI) - Automatic platform detection for Linux/macOS/Windows - Download and extract artifacts from successful PR CI runs - Caching of downloaded binaries for reuse - Clear error messages for missing tokens, failed CI, unsupported platforms New packages: - pkg/github/: GitHub API integration for PR artifact retrieval - toolchain/pr_artifact.go: PR artifact download and installation logic Modified: - pkg/version/reexec.go: Added PR version detection in version switching - toolchain/install.go: Added PR version detection in tool installation Implements #2038. Co-Authored-By: Claude Haiku 4.5 <[email protected]>
* feat: add support for PR artifacts in --use-version flag Allow users to test Atmos features from PRs without installing Go or manually downloading artifacts from GitHub Actions UI. Extend --use-version to support PR numbers using the pr:NNNN format (e.g., --use-version pr:2038). Key features: - Smart GitHub token detection (ATMOS_GITHUB_TOKEN, GITHUB_TOKEN, or gh CLI) - Automatic platform detection for Linux/macOS/Windows - Download and extract artifacts from successful PR CI runs - Caching of downloaded binaries for reuse - Clear error messages for missing tokens, failed CI, unsupported platforms New packages: - pkg/github/: GitHub API integration for PR artifact retrieval - toolchain/pr_artifact.go: PR artifact download and installation logic Modified: - pkg/version/reexec.go: Added PR version detection in version switching - toolchain/install.go: Added PR version detection in tool installation Implements #2038. Co-Authored-By: Claude Haiku 4.5 <[email protected]> * chore: improve PR artifact installation UX - Add SHA and timestamp to "Found workflow run" message - Use spinner pattern for download+install (replaces separate messages) - Format timestamp in user-friendly format (e.g., "Jan 29, 2025 at 3:04 PM") - Show short SHA (7 chars) with markdown backticks for styling - Extract downloadAndInstallArtifact helper for cleaner code New output format: ✓ Found workflow run #21489525938 (sha: `ceb7526`) from Jan 29, 2026 at 12:11 PM ✓ Installed to ~/.local/share/atmos/toolchain/bin/cloudposse/atmos/pr-2040/atmos Co-Authored-By: Claude Opus 4.5 <[email protected]> * refactor: remove SHA version support and add semver validation - Remove SHA version support (sha:XXXXXXX and auto-detected SHAs) - Add semver validation - reject invalid inputs like 'abc', 'abc123' - Delete toolchain/sha_artifact.go - Update ParseVersionSpec to return error for invalid formats - Add isValidSemver() function for version validation - Remove GetSHAArtifactInfo from pkg/github/artifacts.go - Update blog post and PR description to not mention SHA Invalid version formats now show helpful error: ✗ Error: invalid version format 'abc' 💡 Version must be a PR number, pr:NNNN, or semver (e.g., 1.2.3) Co-Authored-By: Claude Opus 4.5 <[email protected]> * security: fix Zip Slip vulnerability in artifact extraction (CodeQL) Add proper path sanitization to prevent Zip Slip attacks when extracting downloaded PR artifacts. The `sanitizeZipPath()` function now: - Rejects absolute paths (Unix and Windows style) - Rejects paths containing backslash (Windows-style traversal on Unix) - Rejects paths containing ".." traversal components - Verifies the final path stays within the destination directory Added comprehensive tests for all attack patterns. Fixes CodeQL alert: "Arbitrary file access during archive extraction" Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: prevent panic on short HeadSHA and update roadmap PR link - Add length check before slicing HeadSHA to prevent potential panic (CodeRabbit suggestion) - Add PR number (2040) to roadmap milestone entry Co-Authored-By: Claude Opus 4.5 <[email protected]> * docs: update roadmap to show PR number auto-detection The `pr:` prefix is optional - just use the PR number directly. Co-Authored-By: Claude Opus 4.5 <[email protected]> * feat: add SHA-based artifact installation support Add support for installing Atmos from a specific commit SHA's build artifact, similar to PR-based installation. Changes: - Add SHAArtifactInfo type and GetSHAArtifactInfo function to github pkg - Add error checking helper functions (IsNotFoundError, etc.) - Add toolchain/sha_artifact.go for SHA-based installation - Update version_spec to support SHA version parsing - Fix Windows test failures: use platform-specific binary name in tests The SHA installation allows users to install a specific commit's build: atmos --use-version sha:ceb7526 Co-Authored-By: Claude Opus 4.5 <[email protected]> * docs: update blog post and roadmap for PR artifact installation Update documentation to reflect the SHA-based installation support and fix any remaining content in the PR artifact installation blog post. Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: add PR number validation and download timeout for artifact installation - Add 5-minute timeout for artifact downloads to prevent hanging - Validate PR numbers must be positive integers (reject 0, negative, non-numeric) - Add tests for invalid PR format edge cases Co-Authored-By: Claude Opus 4.5 <[email protected]> * fix: address PR review comments and lint issues - Add sha: prefix validation in ParseVersionSpec using isValidSHA() - Extract parsePRPrefix/parseSHAPrefix helpers to reduce cyclomatic complexity - Add inline filepath.Rel() Zip Slip guard to satisfy CodeQL scanner - Wrap 5 error sites in reexec.go with errUtils.Build() and sentinels - Add 5 invalid sha: test cases and errors.Is assertions in tests - Fix missing comment periods for godot linter compliance - Refactor cli_utils.go: table-driven terraform two-word commands, extract helpers to fix nestif/err113/revive lint issues Co-Authored-By: Claude Opus 4.6 <[email protected]> * test: add comprehensive tests for artifact installation and error handling - Add tests for IsNotFoundError, artifact URL construction, and platform support - Add tests for PR artifact installation flow, zip extraction, and Zip Slip protection - Add SHA artifact test suite with installation, cache status, and error paths - Improve error assertions to use errors.Is with sentinel errors Co-Authored-By: Claude Opus 4.6 <[email protected]> * test: add mock-based unit tests for GitHub artifact functions Introduce PullRequestService and ActionsService interfaces following the established ratelimit.go pattern, enabling deterministic unit tests without network calls. Export ArtifactFetcher struct with NewArtifactFetcher constructor for test injection. Refactor private helpers to accept interfaces and generate mocks via mockgen. Adds 21 new unit tests covering getPRHeadSHA, findSuccessfulWorkflowRun, findArtifactByName, GetArtifactDownloadURL, GetPRArtifactInfo, and GetSHAArtifactInfo with success, error propagation, and sentinel error cases. Also fixes a minor grammar issue in a trailing comment. Co-Authored-By: Claude Opus 4.6 <[email protected]> * fix: add nil-safety guards and godot linter fixes for GitHub artifacts Guard against nil responses from ListRepositoryWorkflowRuns and ListWorkflowRunArtifacts to prevent panics. Add trailing periods to section-divider comments to satisfy the godot linter. Co-Authored-By: Claude Opus 4.6 <[email protected]> * feat: add tests, fix CodeRabbit feedback, and update docs for PR/SHA artifact installation Add comprehensive mock-based unit tests for PR and SHA artifact installation paths across pkg/version, pkg/toolchain, and pkg/github packages. Fix end-of-flags delimiter (--) handling in root command for --use-version and --chdir flags. Address CodeRabbit review feedback including interface-based DI for GitHub API clients, improved error messages, and token detection chain fixes. Update PRD and blog post to reflect fully-implemented status with current architecture details. Co-Authored-By: Claude Opus 4.6 <[email protected]> --------- Co-authored-by: Claude Haiku 4.5 <[email protected]> Co-authored-by: Andriy Knysh <[email protected]> Co-authored-by: aknysh <[email protected]>
what
Flat=trueparameter to JFrog SDK downloads and proper directory path handlingwhy
Customer reported retrieval issues with Artifactory store. Investigation revealed two problems:
The Artifactory
GetKeymethod lacked the same configuration that theGetmethod had, causing downloads to fail. Documentation had outdated examples with unsupported stores (Vault, AWS Secrets Manager) and wrong field names (backend/configinstead oftype/options).Customer-reported issue
Customer logs showed the exact problem this PR fixes:
Root cause: Without
Flat=true, the JFrog SDK preserves the directory structure when downloading:/tmp/atmos-artifactory.../dev/myapp/private_ip(nested path)/tmp/atmos-artifactory.../private_ip(flat path)The fix: Adding
downloadParams.Flat = truetells the SDK to download files directly to the temp directory with just the base filename, matching what the code expects.The
Getmethod already had this configuration (which is why!storewith stack/component/key worked), butGetKeywas missing it.references
aws-ssm-parameter-store,azure-key-vault,google-secret-manager,redis,artifactorySummary by CodeRabbit
Bug Fixes
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.