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
[JENKINS-60393] Ensure all plugins are loaded to configure the defaults #136
Conversation
The change looks good, but given this comes from a bug I think it's worth to have an automated test. |
@Dohbedoh I've been doing some testing and I've found weird this:
Shouldn't they be removed? |
src/main/java/com/cloudbees/hudson/plugins/folder/config/AbstractFolderConfiguration.java
Outdated
Show resolved
Hide resolved
/** | ||
* Auto-configure the default metrics afetr all plugins have been loaded. | ||
*/ | ||
@Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED, before = InitMilestone.JOB_LOADED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember the implications of having both after
and before
rules in the same initializer. But I guess you've verified it works as intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested this yes. I am not sure how to create a test for the initialization though ?
The real fix is to perform the auto configuration outside the constructor and when plugins are loaded: after = InitMilestone.EXTENSIONS_AUGMENTED
. I do believe that this is enough. I added the before = InitMilestone.JOB_LOADED
because I feel this is consistent (the global metrics will be used on Folder's creation)
Co-Authored-By: Robert Sandell <rsandell@cloudbees.com>
@fcojfernandez You are right. Apparently when you remove all metrics, no |
@varyvol @rsandell @fcojfernandez any idea how I can write a test for the component initialization problem ? |
@Dohbedoh I think if you tried to create a folder, then something was logged? I'd say that's what you need to automate. |
} else { | ||
this.setHealthMetrics(Collections.emptyList()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed save()
?
Maybe simpler to
this.setHealthMetrics(Collections.emptyList());
req.bindJSON(this, json);
this.save();
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see now the call to save()
in setHealthMetrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this would save()
twice
We would need to cause the circular dependency first though. It cause the component to not be loaded ( |
See JENKINS-60393: the configuration of the defaults in the constructor of the GlobalConfiguration may cause the loading to fail on startup in some cases
Proposed changelog entries
Submitter checklist
* Use the
Internal:
prefix if the change has no user-visible impact (API, test frameworks, etc.)@fcojfernandez @rsandell