You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Download devfile stack extra files during component initialization
Add functionality to download additional stack files (Dockerfile, Kubernetes
manifests, etc.) when creating components from devfile registry sources.
This brings odoInit to feature parity with the real odo CLI.
Key Changes:
- Add DevfileRegistry.downloadStackExtraFiles() API for downloading stack
files referenced in devfile components (dockerfile.uri, kubernetes.uri)
- Download files directly from GitHub devfile registry repository via HTTPS
(no ORAS/OCI dependencies needed)
- Implement two-level caching: in-memory (ExecutionContext) + filesystem
(~/.local/state/vs-openshift-tools/devfile-registry-cache/)
- Cache location configurable via VSCODE_OPENSHIFT_CACHE_ROOT environment
variable for users with permission issues or custom cache locations
- Robust cache validation with fallback to temp directory and user warnings
- Integrate into odoInit to download files after devfile resolution
- Add 5 comprehensive integration tests covering all scenarios
Implementation Details:
- Files are downloaded from:
https://raw.githubusercontent.com/devfile/registry/main/stacks/{name}/{version}/{uri}
- Cache location:
* Default: <cache-root>/vs-openshift-tools/devfile-registry-cache/
where cache-root is ~/.local/state (XDG spec)
* Override: Set VSCODE_OPENSHIFT_CACHE_ROOT=/custom/path to use
/custom/path/vs-openshift-tools/devfile-registry-cache/
* Same env var can be used by other cache consumers (tools.ts, etc.)
- Cache validation checks: directory exists, is writable, not a file
- Fallback: If primary cache fails, falls back to os.tmpdir()
- User warning: Console warning shown once if caching is unavailable
- Downloads are optional and don't fail init if files are unavailable
- Language-agnostic solution works for all stacks (Go, Python, Java, etc.)
Testing:
- Integration tests verify: basic download, caching, multiple files,
error handling, and devfiles without extra files
- Tests respect VSCODE_OPENSHIFT_CACHE_ROOT environment variable
- All cross-platform path operations use Node.js standard APIs
(path.join, os.homedir, os.tmpdir)
Fixes the issue where components created with odoInit were missing
deployment-related files that real odo init creates.
Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
console.warn('[vscode-openshift-tools] Devfile registry cache is unavailable. Files will be downloaded without caching. Set VSCODE_OPENSHIFT_CACHE_ROOT to a writable directory to enable caching.');
0 commit comments