Skip to content

Download devfile stack extra files during component initialization#5942

Open
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:download-devfile-stack-extra-files
Open

Download devfile stack extra files during component initialization#5942
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:download-devfile-stack-extra-files

Conversation

@vrubezhny

Copy link
Copy Markdown
Contributor

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/)
  • Integrate into odoInit to download files after devfile resolution
  • Add 5 comprehensive integration tests covering all scenarios

Implementation Details:

Testing:

  • Integration tests verify: basic download, caching, multiple files, error handling, and devfiles without extra files
  • 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.

Assisted-By: Claude Sonnet 4.5 noreply@anthropic.com

@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.39535% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.29%. Comparing base (da60441) to head (eed7b87).
⚠️ Report is 1862 commits behind head on main.

Files with missing lines Patch % Lines
src/devfile-registry/devfileRegistryWrapper.ts 88.73% 8 Missing ⚠️
src/devfile/init.ts 46.66% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5942       +/-   ##
===========================================
+ Coverage   32.37%   49.29%   +16.92%     
===========================================
  Files          85      110       +25     
  Lines        6505    10011     +3506     
  Branches     1349     2241      +892     
===========================================
+ Hits         2106     4935     +2829     
- Misses       4399     5073      +674     
- Partials        0        3        +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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/)
- 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 follows XDG Base Directory spec on Linux/macOS and is
  cross-platform compatible with Windows
- 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
- 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>
@vrubezhny vrubezhny force-pushed the download-devfile-stack-extra-files branch from 32c1ced to eed7b87 Compare July 7, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant