Fix: Skip already-installed user features in installServerFeatures when custom Maven mirror is configured#34843
Open
riyaaroraa wants to merge 4 commits into
Conversation
When installServerFeatures is called with a custom Maven mirror configured, it was attempting to resolve user features that were already installed in the Liberty usr directory. This caused CWWKF1402E errors when the resolver couldn't find these user features in the Maven repository. The fix: - Extracted filtering logic into filterOutInstalledUserFeatures() helper method - Detects user features using getBundleRepositoryType() which returns 'usr' - Filters out already-installed user features before passing to the resolver - Only applies when isInstallServerFeature is true - Handles various feature name formats (usr:name, name:name, name) - Preserves original feature count for 'all already installed' check Added comprehensive unit tests: - testInstalledUserFeatureFilteredFromInstallServerFeatures: Verifies user features are filtered - testNonUserFeatureNotFiltered: Ensures core Liberty features are not filtered - testUserFeatureNameFormatVariations: Tests usr:name, name:name, and name formats - testNoUserFeaturesInstalled: Verifies behavior when no user features present - testCaseInsensitiveFeatureMatching: Tests case-insensitive feature name matching - testIbmProcessServerScenario: Reproduces the exact reported bug scenario This resolves the issue where Docker builds with Artifactory mirrors would fail when trying to install features on images with pre-installed user features like ibmProcessServer. Related to GitHub issue OpenLiberty#30585
…edUserFeatures - Now catches both default 'usr' extension and custom extensions like 'ibmProcessServer' - Updated comments to reflect 'product extension features' terminology - Added test for custom product extension (ibmProcessServer:ibmProcessServer) - Fixed comment format from 'featureName:featureName' to 'extensionName:featureName' Addresses Sarah's code review feedback on PR OpenLiberty#34843
- Changed getBundleRepositoryType() mock from 'usr' to 'ibmProcessServer' - Added clarifying comment that ibmProcessServer is a custom product extension - This accurately reflects the real scenario from the bug report
- Changed comment from 'user feature' to 'product extension feature' - Ensures consistent terminology throughout the test file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
featureUtility installServerFeaturesis called with a custom Maven mirrorconfigured (e.g. an Artifactory proxy), it fails with:
CWWKF1402E: The following features were not obtained: ibmProcessServer
The root cause is that the resolver passes ALL features from server.xml to the
repository — including user features like
ibmProcessServerthat are alreadyinstalled in the Liberty
usrdirectory and don't exist in Maven at all.With Maven Central (no mirror), the resolver gets a clean 404 for the user
feature and since it's already present in
installedFeatures, it handles itgracefully. But with a custom mirror, the mirror returns a 429 (rate limit) or
connection error instead of a clean 404 — by the time it falls back to Maven
Central, the resolver has already marked the feature resolution as failed.
This was causing Docker builds to fail across multiple teams when they set up
Artifactory mirrors to work around Maven Central rate limiting. Ennio's team
confirmed the workaround was removing
installServerFeaturesand installingfeatures manually — this fix automates that by filtering user features before
they reach the resolver.
Fix
filterOutInstalledUserFeatures()as a package-private methodthat detects user features using
getBundleRepositoryType()returning"usr"installServerFeaturesis called, already-installed user features arefiltered out before being passed to the resolver
usr:featureName,featureName:featureName, and plainfeatureNameALREADY_EXISTScheck forinstallFeatureis preserved using theoriginal feature list size
Testing
Added 6 unit tests to
InstallKernelMapTestcovering:installServerFeatureslistusr:,name:name, plain name)ibmProcessServerscenario from the reported bugReviewe
Note for reviewer: This fix removes already-installed user features from the
resolver input entirely. Please confirm this is safe — specifically that
skipping them won't cause auto-features or internal feature dependencies
to be missed.