Skip to content

Replace odo deploy/undeploy commands with native TypeScript implement…#5944

Draft
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:replace-odo-deploy
Draft

Replace odo deploy/undeploy commands with native TypeScript implement…#5944
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:replace-odo-deploy

Conversation

@vrubezhny

Copy link
Copy Markdown
Contributor

…ation

This change removes the dependency on the external odo binary for deploy and undeploy operations by implementing them natively in TypeScript.

New files:

  • src/devfile/applyCommand.ts - Executes apply commands from devfiles, loads Kubernetes manifests from inlined YAML or URIs, and applies them to the cluster using oc apply
  • src/devfile/deploy.ts - Main deployment orchestration that resolves devfiles, finds deploy commands, executes them, and tracks deployed resources in .odo/deploystate.json
  • src/devfile/undeploy.ts - Resource cleanup using deploystate.json tracking or label-based fallback for orphaned resources

Modified files:

  • src/odo/componentTypeDescription.ts - Added DeployedResource and DeployState types, extended Kubernetes interface with inlined/uri
  • src/devfile/variableResolver.ts - Added resolveApply() and resolveKubernetesContent() methods
  • src/devfile/devfileCommandRunner.ts - Added apply command handling
  • src/openshift/component.ts - Replaced deploy/undeploy implementations, added DEP_STARTING and DEP_STOPPING states
  • src/odo/command.ts - Removed deploy() and undeploy() methods
  • src/util/childProcessUtil.ts - Renamed OdoChannel to OpenshiftChannel
  • src/odo/odoWrapper.ts - Updated to use OpenshiftChannel

Added unit tests for variable resolution, deploy/undeploy command logic, and YAML resource parsing.

Key features:

  • Idempotent operations (oc apply) - safe to retry on failure
  • State tracking via .odo/deploystate.json for undeploy
  • Label-based cleanup fallback for orphaned resources
  • Proper state management (DEP -> DEP_STARTING -> DEP_RUNNING)
  • Variable resolution in URIs and manifest content
  • HTTP URI support for remote manifests

Follows the same pattern as PR #5843 (odo run replacement)

Issue: https://redhat.atlassian.net/browse/CRW-10962
Issue: #4482

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

@vrubezhny vrubezhny marked this pull request as draft July 7, 2026 23:56
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.67717% with 171 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.10%. Comparing base (da60441) to head (8a0ba34).
⚠️ Report is 1865 commits behind head on main.

Files with missing lines Patch % Lines
src/devfile/undeploy.ts 26.98% 46 Missing ⚠️
src/devfile/applyCommand.ts 28.57% 45 Missing ⚠️
src/devfile/deploy.ts 36.06% 39 Missing ⚠️
src/openshift/component.ts 19.51% 33 Missing ⚠️
src/odo/odoWrapper.ts 40.00% 6 Missing ⚠️
src/devfile/devfileCommandRunner.ts 50.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5944       +/-   ##
===========================================
+ Coverage   32.37%   49.10%   +16.73%     
===========================================
  Files          85      113       +28     
  Lines        6505    10269     +3764     
  Branches     1349     2296      +947     
===========================================
+ Hits         2106     5043     +2937     
- Misses       4399     5223      +824     
- 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.

…ation

This change removes the dependency on the external odo binary for
deploy and undeploy operations by implementing them natively in
TypeScript.

New files:
- src/devfile/applyCommand.ts - Executes apply commands from devfiles,
  loads Kubernetes manifests from inlined YAML or URIs, and applies
  them to the cluster using oc apply
- src/devfile/deploy.ts - Main deployment orchestration that resolves
  devfiles, finds deploy commands, executes them, and tracks deployed
  resources in .odo/deploystate.json
- src/devfile/undeploy.ts - Resource cleanup using deploystate.json
  tracking or label-based fallback for orphaned resources

Modified files:
- src/odo/componentTypeDescription.ts - Added DeployedResource and
  DeployState types, extended Kubernetes interface with inlined/uri
- src/devfile/variableResolver.ts - Added resolveApply() and
  resolveKubernetesContent() methods
- src/devfile/devfileCommandRunner.ts - Added apply command handling
- src/openshift/component.ts - Replaced deploy/undeploy implementations,
  added DEP_STARTING and DEP_STOPPING states
- src/odo/command.ts - Removed deploy() and undeploy() methods
- src/util/childProcessUtil.ts - Renamed OdoChannel to OpenshiftChannel
- src/odo/odoWrapper.ts - Updated to use OpenshiftChannel

Added unit tests for variable resolution, deploy/undeploy command logic,
and YAML resource parsing.

Key features:
- Idempotent operations (oc apply) - safe to retry on failure
- State tracking via .odo/deploystate.json for undeploy
- Label-based cleanup fallback for orphaned resources
- Proper state management (DEP -> DEP_STARTING -> DEP_RUNNING)
- Variable resolution in URIs and manifest content
- HTTP URI support for remote manifests

Follows the same pattern as PR redhat-developer#5843 (odo run replacement)

Issue: https://redhat.atlassian.net/browse/CRW-10962
Issue: redhat-developer#4482

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@vrubezhny vrubezhny force-pushed the replace-odo-deploy branch from 1db251e to 8a0ba34 Compare July 8, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant