Repository navigation
feat: Support XDG base directory for bundle cache - #3296
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Relative XDG paths incorrectly fail instead of being ignored, and the displayed static default contradicts runtime selection.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds XDG-aware default bundle-cache resolution while preserving legacy cache compatibility.
Changes:
- Adds cache-directory resolution and
~expansion. - Rejects empty
--cache-dirvalues and expands test coverage. - Updates CLI help and generated documentation.
| File | Description |
|---|---|
pkg/bundle/cache_dir.go |
Implements cache-path selection. |
pkg/bundle/cache_dir_test.go |
Tests cache-path precedence. |
pkg/bundle/flags.go |
Adds validated cache flag handling. |
pkg/bundle/remote.go |
Applies resolved cache paths. |
pkg/bundle/remote_test.go |
Tests caching integration. |
pkg/cmd/bundle/list.go |
Updates cache help text. |
pkg/cmd/bundle/list_test.go |
Tests explicit and empty flags. |
docs/cmd/tkn_bundle_list.md |
Updates generated command documentation. |
docs/man/man1/tkn-bundle-list.1 |
Updates generated manpage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Supported the XDG Base Directory Specification for the bundle cache. The cache directory defaulted to the legacy `~/.tekton/bundles` path only when the `~/.tekton` directory already existed. Otherwise, it used `$XDG_CACHE_HOME/tkn/bundles` or `~/.cache/tkn/bundles`. Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
0fc6303 to
98405cb
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |


Changes
Adds support for the XDG Base Directory Specification when resolving the default bundle cache directory.
When
--cache-diris not set,tknpicks the default in this order:~/.tekton/bundles, if~/.tektonalready exists (kept for backward compatibility)$XDG_CACHE_HOME/tkn/bundles, ifXDG_CACHE_HOMEis set to an absolute path~/.cache/tkn/bundlesotherwiseIt also replaces the
mitchellh/go-homedirdependency with a small internal~expansion helper (pkg/bundle/cache_dir.go), and--cache-dirnow rejects an empty value instead of silently caching in the current directory.See this article why repescting XDG is important (event on OSX/WSL): https://maex.me/2019/12/the-power-of-the-xdg-base-directory-specification/
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
make checkmake generatedSee the contribution guide
for more details.
Release Notes
NOTE: I have used AI for implementing this feature but reviewed it myself,
gpt-6-luna