Skip to content

#2373: native package edition - #2500

Open
krystynaShatkovska wants to merge 6 commits into
devonfw:mainfrom
krystynaShatkovska:feature/2373-native-package-edition
Open

krystynaShatkovska wants to merge 6 commits into
devonfw:mainfrom
krystynaShatkovska:feature/2373-native-package-edition

Conversation

@krystynaShatkovska

@krystynaShatkovska krystynaShatkovska commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2373

Two commits building on #2306, unifying edition resolution for native-package (Linux/macOS)
installs into a single model that behaves consistently across all OSes.

Implemented changes:

  • Change 1

GlobalToolCommandlet - one edition-resolution loop
computeInstalledEditionAndVersion() no longer has per-OS if (isLinux) / if (isWindows) branches. It now loops over the tool's editions once and reports the first that's actually installed:

  • New hook getEditionNames() — the editions a tool is known to have, in probe order (default:
    [this.tool]).
  • New hook getInstalledVersionForEdition(edition) — resolves a single edition's version on the current OS (default: the native-package version).
  • Windows: version read from the registry, keyed by edition via getWindowsRegistryAppNames().
  • Linux / macOS: version read via getInstalledVersionForEdition(edition).
    This replaces the old behavior where Linux always reported the tool name as the edition (placeholder), even for multi-edition tools.
  • Change 2

Docker - declare editions, resolve per OS

  • Declares its two editions: docker, rancher (probed in that order, so Docker Desktop wins when
    both are present).
  • getInstalledVersionForEdition:
    • docker → docker-desktop package (Linux) or Docker.app bundle via plutil (macOS)
    • rancher → rancher-desktop package (Linux) or Rancher Desktop.app bundle via plutil (macOS)
  • Removes the separate rdctl version-based Rancher detection and its
    isDockerInstalled/isRancherDesktopInstalled guards — Rancher is now detected through the same
    native-package/bundle path as everything else.

Test instructions

Unit tests (fast, no Docker needed)

Run the two test classes:

cd CLI && mvn -o test -Dtest=GlobalToolCommandletTest,DockerTest

They cover the new behavior directly:

  • GlobalToolCommandletTest#testLinuxInstalledEditionResolvesThroughEditionNames — Linux reports a
    real edition from getEditionNames(), not the tool-name placeholder.
  • DockerTest#testRancherDesktopEditionAndVersionOnLinux — Rancher on Linux resolves to rancher +
    version from the rancher-desktop package (Docker's apt source not consulted).
  • DockerTest#testRancherDesktopEditionAndVersionOnMac — Rancher on macOS resolves to rancher +
    version from Rancher Desktop.app (falling through when Docker Desktop is absent).
  • DockerTest#testDockerDesktopOnMacIsGracefulWhenAppMissing — no edition → returns null gracefully
    (no exception).

Manual test - Docker/Rancher edition + version

Run after install on each OS:

  ide get-edition docker --installed
  ide get-version docker --installed

Expected: edition docker or rancher, version = the installed one, exit 0.
If neither is installed: Tool docker is not installed., exit 1.

Windows
Windows
Install one or both (run the terminal as Administrator - winget install needs elevation):
winget install --id Docker.DockerDesktop
winget install --id SUSE.RancherDesktop
2. Verify the registry key exists (Git Bash mis-quotes the space; use PowerShell):
powershell -NoProfile -Command "(Get-ItemProperty
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Docker Desktop').DisplayVersion"
3. Run the two ide commands.
- Docker only → docker / that DisplayVersion
- Rancher only → rancher / that DisplayVersion
- Both → docker (probed first)

macOS

  1. Install one or both (Docker Desktop.app, Rancher Desktop.app in /Applications).
  2. Run the two ide commands.
    • Docker.app only → docker / CFBundleShortVersionString of Docker.app
    • Rancher only → rancher / version of Rancher Desktop.app
    • Neither → exit 1, not installed

Linux

  1. Install via your package manager (Docker Desktop via apt, or rancher-desktop via apt/zypper).
  2. Run the two ide commands.
    • docker-desktop (apt) only → docker / apt version
    • rancher-desktop only → rancher / package-manager version
    • Neither → exit 1, not installed

Checklist for this PR

Make sure everything is checked before merging this PR. For further info please also see
our DoD.

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary» (e.g. #921: fixed setup.bat and not feature/921 fixed setup.bat). If no issue ID exists, title only.
  • PR top-level comment summaries what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labelled
    with internal
  • You have not changed any dependency in pom.xml files or otherwise if runtime dependencies changed, you have updated our LICENSE.asciidoc
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

Checklist for tool commandlets

Have you added a new «tool» as commandlet? There are the following additional checks:

  • The tool can be installed automatically (during setup via settings) or via the commandlet call
  • The tool is isolated in its IDEasy project, see Sandbox Principle
  • The new tool is added to the table of tools in LICENSE.asciidoc
  • The new commandlet is a command-wrapper for «tool»
  • Proper help texts for all supported languages are added here
  • The new commandlet installs potential dependencies automatically
  • The variables «TOOL»_VERSION and «TOOL»_EDITION are honored by your commandlet
  • The new commandlet is tested on all platforms it is available for or tested on all platforms that are in scope of the linked issue

Follow-up to devonfw#2306. Determine the edition together with the version for
native package manager installs (Linux/macOS) using one consistent
edition-resolution model across all operating systems.

- GlobalToolCommandlet: replace the per-OS if-blocks in
  computeInstalledEditionAndVersion() with a single loop over
  getEditionNames(); add getEditionNames() and
  getInstalledVersionForEdition() hooks.
- Docker: declare its two editions (docker/rancher), resolve each
  edition's version per OS, and cover both in the Windows registry map.
  Drop the separate rdctl-based Rancher detection in favour of the
  shared native-package path.
- Tests: prove Linux editions resolve via getEditionNames() (not the
  tool-name placeholder); update Rancher + macOS tests to the new
  loop semantics.

Fixes devonfw#2373
Complete OS parity for Docker edition resolution (part of devonfw#2373). The
rancher edition now resolves on macOS from the Rancher Desktop.app bundle
(via plutil), mirroring the docker edition, instead of returning null.
Add a test proving the probe order (docker first) falls through to rancher
when Docker Desktop is absent.
On Windows, GlobalToolCommandlet now validates that every declared
edition has a matching entry in getWindowsRegistryAppNames() before
probing the registry. A missing mapping is logged (warn) and the
edition is skipped, instead of crashing or silently probing with a
null app name. Add unit tests covering Docker+Rancher both installed
(resolves to Docker, probed first) and Rancher-only (resolves to Rancher).
…-package-edition

# Conflicts:
#	cli/src/test/java/com/devonfw/tools/ide/tool/GlobalToolCommandletTest.java
@coveralls

coveralls commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 35580652092

Warning

No base build found for commit e224e69 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 74.276%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 19101
Covered Lines: 14823
Line Coverage: 77.6%
Relevant Branches: 8546
Covered Branches: 5712
Branch Coverage: 66.84%
Branches in Coverage %: Yes
Coverage Strength: 3.32 hits per line

💛 - Coveralls

@krystynaShatkovska krystynaShatkovska moved this from 🆕 New to 🏗 In progress in IDEasy board Sep 18, 2026
@krystynaShatkovska krystynaShatkovska added enhancement New feature or request docker docker and esp. DockerDesktop rancher Rancher-Desktop labels Sep 18, 2026
@krystynaShatkovska krystynaShatkovska moved this from 🏗 In progress to Team Review in IDEasy board Sep 18, 2026
@shodiBoy1

Copy link
Copy Markdown
Contributor

Thanks for the fix @krystynaShatkovska
Mac retest of #2500. Please correct me if I misunderstood the expected behavior.
Unit tests - pass

cd cli
mvn test -Dtest=GlobalToolCommandletTest,DockerTest
20 tests, BUILD SUCCESS.

Happy path (Docker Desktop installed) — pass

plutil -extract CFBundleShortVersionString raw /Applications/Docker.app/Contents/Info.plist
# 4.73.0
ide get-edition docker --installed
# docker
ide get-version docker --installed
# 4.73.0
Version matches Docker.app, not docker --version. Good.

When Docker.app is missing — I may have the wrong expectation here

I moved /Applications/Docker.app away (docker CLI still on PATH, Rancher not installed):

ide get-edition docker --installed
# exit=1
ide -d get-edition docker --installed
# plutil ... /Applications/Docker.app/Contents/Info.plist
# failed with exit code 1!
# Step 'ide' ended with failure.
What I expected:

Tool docker is not installed. (exit 1)
if only Rancher is installed → edition rancher
What I got:

exit 1 because plutil failed
no "not installed" message
rancher is never checked (docker is tried first, then it stops)
After restoring Docker.app it worked again: docker / 4.73.0.

I did not install Rancher, because this already stops before rancher is probed.

Is this the intended macOS behavior? Happy to retest if I missed something.

plutil exits non-zero when a .app bundle is absent, which previously made
'get-edition'/'get-version' fail with 'failed with exit code 1!' instead of
reporting the edition as not installed. The IdeLogLevel passed to
runAndGetSingleOutput only controls output logging, not exit-code handling,
so the default THROW_ERR still threw and the edition loop stopped before
probing the next edition (e.g. rancher).

Treat the failed plutil as 'not installed' (return null) so the edition loop
can fall through to the next edition or report the tool as not installed.
Extract the shared plutil logic into getMacAppVersion().

Update the two macOS 'app missing' unit tests to simulate the real failure
(a non-zero exit, i.e. a thrown IllegalStateException) rather than a null
return.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker docker and esp. DockerDesktop enhancement New feature or request rancher Rancher-Desktop

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

GlobalToolCommandlet: determine the edition together with the version for native package manager installs (Linux/macOS)

3 participants