-
Notifications
You must be signed in to change notification settings - Fork 720
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
sort Attributes and RootElementConfigurator according to Extension ordinal #1394
Conversation
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.
One separate improvement I could see is double check that RootElementConfigurator are sorted after ordinal as well, this should solve the many issues we had with job dsl sometimes loading too soon.
@@ -298,7 +301,8 @@ public T check(CNode c, ConfigurationContext context) throws ConfiguratorExcepti | |||
*/ | |||
protected void configure(Mapping config, T instance, boolean dryrun, ConfigurationContext context) throws ConfiguratorException { | |||
final Set<Attribute<T,?>> attributes = describe(); | |||
for (Attribute<T,?> attribute : attributes) { | |||
List<Attribute<T, ?>> sortedAttributes = sortAttributes(attributes); |
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.
As this is the protected configure
block I feel safe to say that other plugins providing configurators will also be sorted according to the ordinal.
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.
lgtm
@peachy-devops do you want to test this to see if it fixes your issue?
You'll be able to download a version from there: https://ci.jenkins.io/blue/organizations/jenkins/Plugins%2Fconfiguration-as-code-plugin/detail/PR-1394/1/artifacts once the build finishes
plugin/src/main/java/io/jenkins/plugins/casc/BaseConfigurator.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Tim Jacomb <t.jacomb@kainos.com>
Codecov Report
@@ Coverage Diff @@
## master #1394 +/- ##
============================================
+ Coverage 79.29% 79.37% +0.07%
- Complexity 790 796 +6
============================================
Files 66 66
Lines 2314 2322 +8
Branches 324 322 -2
============================================
+ Hits 1835 1843 +8
Misses 378 378
Partials 101 101
|
@timja I'll try if I can. Can you please provide me the steps on how install it using a dockerfile? Not sure where to insert the hpi file for Jenkins to install it. I tried updating via GUI and updated successfully but I need to have it on a dockerfile. Here is the dockerfile I sent to @jetersen
|
You can either pass a URL to the plugin or use the incrementals repo: Sample: |
😨 Jenkins failed on deploy due to Windows agent exploding! |
Works out :) |
@timja your solution worked! 😄 |
This ensures for instance Credentials are loaded first.
Jenkins Configurator is loaded second.
Seed Job is loaded last.
Testing this is pretty hard due to how Jenkins Test harness fixes the Jenkins location url 😓
But as shown below the sorting works and should allow some sense of order when configuring location and resourceRoot.
Before:
After:
Here you have RootElementConfigurator after, just imagine the the before as an totally unsorted list 🤣
fixes #1383
fixes #619
fixes #876
Your checklist for this pull request
🚨 Please review the guidelines for contributing to this repository.