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

Update to the latest jenkins plugin version 4.8 #50

Closed
wants to merge 12 commits into from

Conversation

fr123k
Copy link
Contributor

@fr123k fr123k commented May 9, 2020

  • update the pom definition to the jenkins plugin version 4.1
  • update the plugin specific code to support plugin version 4.1 and
    be fully compatible with the casc plugin (configuration as code)

The already defined tests are all passing at least most of the time. I also
tested the compatibility of the configuration with the version 3.6.0. But i can't
guaranty full compatibility at this point.

I would also like to take over the maintainer role of this plugin and will follow
the take over guide in the next days.

I just came across those plugin working on my own one that needed a way to
prioritize jobs. Instead of implementing this and i spend the time to update this
plugin to the latest jenkins version in order to use the jenkins casc plugin (configuration as code)

Thanks Brad Larson and Magnus Sandberg for providing amnd mainting this plugin.

@fr123k fr123k force-pushed the master branch 3 times, most recently from fd008db to cf9f43b Compare May 17, 2020 19:38
* update the pom definition to the jenkins plugin version 4.1
* update the plugin specific code to support plugin version 4.1 and
  be fully compatible with the casc plugin (configuration as code)
@JungPhilipp
Copy link

We are very interested to get this plugin working with Configuration as Code. Any chance this will get implemented in the near future?

@FnTm
Copy link

FnTm commented Sep 24, 2020

@fr123k thank you for taking the time to do this! I'm also very interested in using priority sorter with JCasC. Are there any news on that front?

@pussinboots
Copy link

Upcoming week i will update the PR and hope for green build light.

pom.xml Outdated
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.1</version>
Copy link
Member

Choose a reason for hiding this comment

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

Now there is 4.8 with a few more updates

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Just a few comments. Looks very promising!

@oleg-nenashev
Copy link
Member

FTR Ownership transfer request: https://groups.google.com/g/jenkinsci-dev/c/7s2xdiHg0QA

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

Would be also great to clean up the commented code. We have commit history if we ever need to retrieve it.
Otherwise it is nice to have a comment explaining why it is commented

@fr123k fr123k changed the title Update to the latest jenkins plugin version 4.1 Update to the latest jenkins plugin version 4.8 Oct 9, 2020
The maintainer information is extracted from the [repository-permissions-updater](https://github.com/jenkins-infra/repository-permissions-updater)
instead.

[WEBSITE-658](https://issues.jenkins-ci.org/browse/WEBSITE-658)
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

I still need to go though the entire code. The changes look good overall, but ithe code does not retain binary compatibility with the previous version. I am also not sure about data compatibility.

What I recommend to do:

  • Change the target version to 3.0-SNAPSHOT. It does not make much sense to try retainining binary compatibility here (famous last word? might make sense to check plugins depending on this one).
  • Add tests which would load the old configuration file (@LoadData annotation in Jenkins Test Harness) and verify that they are properly loaded in the new version. If not, an additiona; migration code or documentation will be needed.

this.jobGroupStrategy = jobGroupStrategy;
this.runExclusive = runExclusive;
this.usePriorityStrategies = usePriorityStrategies;
/*
Copy link
Member

Choose a reason for hiding this comment

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

Copy-pasted from newInstance()? Please either cleanup the comment or add a TODO describing why t is commented out. Also, the entire newIInstance() might not longer be needed when you have a constructor

Choose a reason for hiding this comment

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

The newInstance method is used by the PriorityConfiguration.doPriorityConfigSubmit to serialize the changes done on the /advanced-build-queue configuration page.

At the moment i am missing knowledge on the how this jelly DataBinding works. If this setup is fixed then i guess this method is obsolete.

Choose a reason for hiding this comment

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

For now i removed the not used full args constructor of the JobGroup class.

@@ -140,7 +196,7 @@ public int getPriority() {
* @deprecated Used in 2.x now replaced with dynamic {@link JobGroup#jobGroupStrategy}, will return the view
*/
@Deprecated
@CheckForNull
@CheckForNull
Copy link
Member

Choose a reason for hiding this comment

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

Tabs vs. spaces in this and other files. Maybe it makes sense to just add a bulk refactoring in a follow-up pull request

Choose a reason for hiding this comment

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

In the single commit 89a142e
all tabs are replaced with whitespaces.


private JobGroup() {
@DataBoundConstructor
public JobGroup(int id, String description, int priority, JobInclusionStrategy jobGroupStrategy, boolean runExclusive, boolean usePriorityStrategies, List<? extends PriorityStrategy> priorityStrategies) {
Copy link
Member

Choose a reason for hiding this comment

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

It does not look like you use this constructor anywhere except data binding. For data binding there is no need to repeat fields in the constrictor if you have @DataBoundSetters defined

List<PriorityStrategy> B = priorityStrategyHolders.stream()
.map(holder -> holder.priorityStrategy)
.collect(Collectors.toList());
return B;
}

/**
Copy link
Member

Choose a reason for hiding this comment

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

Most likely, newInstance() is no longer required,unless there are internal dependencies on this deprecated databinding mechanism

Choose a reason for hiding this comment

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

Will keep newInstance and do a Refactoring to the new DataBound mechanism later.
Can you point me to a good documentation or example code of it.

timja pushed a commit to jenkins-infra/repository-permissions-updater that referenced this pull request Oct 9, 2020
Hi as ask in the FTR Ownership transfer request here is the
release permission PR request for the [priority-sorter-plugin](https://github.com/jenkinsci/priority-sorter-plugin)

[FTR Ownership tranfer request](https://groups.google.com/g/jenkinsci-dev/c/7s2xdiHg0QA)
[Priority Sorter PR](jenkinsci/priority-sorter-plugin#50)

Looking forward to my first release to the jenkins Artifactory.

Co-authored-by: Frank Ittermann <frank.ittermann@data4life.care>
Also removed not necessary witespaces as well.
* trailing
* blank lines
@pussinboots
Copy link

Add tests which would load the old configuration file (@loaddata annotation in Jenkins Test Harness) and verify that they are properly loaded in the new version. If not, an additiona; migration code or documentation will be needed.

Under src/test/resources/jenkins/advancedqueue/test/ there a couple of old configuration files that were not changed and still used in all the different tests.

There is only one test that is skipped now MatrixTest.matrix_and_jobs_with_no_configuration its shaky.

At the moment there are no test for JCasC configuration.

@pussinboots
Copy link

pussinboots commented Oct 12, 2020

@jungstar @FnTm

What you can do is to fork this branch and build the plugin your own and install it in jenkins
manually. An example of a JCasC configuration ofr can be obtained from https://github.com/fr123k/jenkins-aws-pulumi/blob/8d5d55ac89db8685c63bc365bd2b39d424594a32/jenkins/config/casc-config/agents.yaml#L39.

On docker hub there is also a image provided that has the new version of this plugin already installed. For this checkout the following github repository https://github.com/fr123k/jocker (jocker - jenkins in docker).

This way you can also provided feedback if something with JCasC and this version of the plugin is not working as expected.

@fr123k fr123k requested a review from oleg-nenashev November 2, 2020 01:10
@oleg-nenashev
Copy link
Member

losing in favor of #51 . Thanks anyway @fr123k !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants