Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor (jkube-kit) : Remove RemoveBuildAnnotationsEnricher (#1263) #1412

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

rohanKanojia
Copy link
Member

@rohanKanojia rohanKanojia commented Mar 30, 2022

Description

Fix #1263
Fix #1465

RemoveBuildAnnotationsEnricher seems to be removing maven.jkube.io/source-url annotation which gets added in
DependencyEnricher. This annotation doesn't seem to be getting used anywhere else.

Delete RemoveBuildAnnotationsEnricher & maven.jkube.io/source-url annotation logic inside it to DependencyEnricher

Note that annotations being removed from resource integration tests are due to side effects of PodAnnotationEnricher modifying resource in between DependencyEnricher and RemoveBuildAnnotationsEnricher. They were not cleaned up properly in RemoveBuildAnnotationsEnricher. With the removal of RemoveBuildAnnotationsEnricher and maven.jkube.io/source-url annotation removed within DependencyEnricher, these annotations are not available to PodAnnotationEnricher like before.

See #1263 (comment) for more details.

Signed-off-by: Rohan Kumar rohaan@redhat.com

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

@codecov
Copy link

codecov bot commented Mar 30, 2022

Codecov Report

Merging #1412 (5773ee4) into master (4dfae9e) will decrease coverage by 0.02%.
The diff coverage is n/a.

❗ Current head 5773ee4 differs from pull request most recent head 2ba9434. Consider uploading reports for the commit 2ba9434 to get more accurate results

@@             Coverage Diff              @@
##             master    #1412      +/-   ##
============================================
- Coverage     51.07%   51.04%   -0.03%     
+ Complexity     3801     3800       -1     
============================================
  Files           459      459              
  Lines         20680    20678       -2     
  Branches       2804     2804              
============================================
- Hits          10562    10555       -7     
- Misses         9011     9016       +5     
  Partials       1107     1107              
Impacted Files Coverage Δ
...e/jkube/enricher/generic/ProjectLabelEnricher.java 58.75% <0.00%> (-5.89%) ⬇️
...be/enricher/generic/openshift/ProjectEnricher.java 86.95% <0.00%> (-4.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4dfae9e...2ba9434. Read the comment docs.

@rohanKanojia rohanKanojia marked this pull request as ready for review March 30, 2022 17:46
@rohanKanojia rohanKanojia requested review from manusa and sunix and removed request for manusa March 30, 2022 17:46
Comment on lines 707 to 740
public static void removeResourceSourceUrlAnnotation(KubernetesListBuilder builder) {
builder.accept(new TypedVisitor<ObjectMetaBuilder>() {
@Override
public void visit(ObjectMetaBuilder objectMetaBuilder) {
if (objectMetaBuilder != null) {
objectMetaBuilder.removeFromAnnotations(Constants.RESOURCE_SOURCE_URL_ANNOTATION);
}
}
});
}
Copy link
Member

@manusa manusa Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure why we still keep this and the related call from DependencyEnricher.

I understand that this might come from a Dependency JAR, but if the dependency has an aligned version of JKube, then it shouldn't be necessary.

IMHO it might be fine to keep this, but we should open a Deprecation issue for 2.x milestone, and add a @deprecated note+annotation in this method with a link to the issue. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the annotation, the new method should be marked as deprecated, since we're just adding it temporarily (right?).

Also create the issue to remove this method in 2.0 (plus add it as a comment in the code).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #1465

…-jkube#1263)

RemoveBuildAnnotationsEnricher seems to be removing
`maven.jkube.io/source-url` annotation which gets added in
DependencyEnricher. This annotation doesn't seem to be getting used
anywhere else.

Delete RemoveBuildAnnotationsEnricher & `maven.jkube.io/source-url`
annotation logic inside it to DependencyEnricher

Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@sonarcloud
Copy link

sonarcloud bot commented Apr 22, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@manusa manusa merged commit 48ab34b into eclipse-jkube:master Apr 22, 2022
@rohanKanojia rohanKanojia deleted the pr/issue1263 branch April 22, 2022 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants