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

Support limiting minimum instances to a time range #404

Merged
merged 1 commit into from
Dec 12, 2019

Conversation

erikhakansson
Copy link
Contributor

Follow-up to PR #401, this PR adds the option to limit minimum number of instances to a specific time range.

I got some wishes for that from work so that we don't have build agents up and running all weekend when no one is working.

image

@res0nance res0nance self-requested a review September 30, 2019 02:55
@res0nance res0nance added the enhancement Feature additions or enhancements label Sep 30, 2019
@erikhakansson erikhakansson reopened this Oct 1, 2019
@erikhakansson erikhakansson reopened this Oct 2, 2019
@erikhakansson erikhakansson reopened this Oct 3, 2019
@erikhakansson erikhakansson reopened this Oct 7, 2019
Copy link
Contributor

@res0nance res0nance left a comment

Choose a reason for hiding this comment

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

Looks alright, seems like a nice addition to the original feature

@res0nance res0nance requested review from jvz and thoulen October 17, 2019 08:04
@@ -130,6 +130,8 @@

private int minimumNumberOfInstances;

private MinimumNumberOfInstancesTimeRangeConfig minimumNumberOfInstancesTimeRangeConfig;
Copy link

Choose a reason for hiding this comment

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

What about old configs not having this property? Should you manage that in readResolve?

Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC There is a nullcheck for its usage

Copy link

Choose a reason for hiding this comment

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

Right!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, there's a null check. And I did a quick check now and couldn't find anywhere that I had missed checking. :)

@res0nance res0nance closed this Oct 31, 2019
@res0nance res0nance reopened this Oct 31, 2019
@res0nance res0nance requested a review from jvz November 5, 2019 04:23
@jvz
Copy link
Member

jvz commented Nov 5, 2019

I won't have time to review this for a couple days.

@res0nance
Copy link
Contributor

@jvz do you have the bandwidth to review this?

Copy link

@varyvol varyvol left a comment

Choose a reason for hiding this comment

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

A small suggestion but looks fine!

}

// For some reason, all days will validate against this method so no need to repeat for each day.
public FormValidation doCheckMonday(@QueryParameter boolean monday,
Copy link

Choose a reason for hiding this comment

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

Maybe a different name if it's valid for all days?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally, yes, but it's some sort of Jelly magic based on the field names.

Copy link
Member

@jvz jvz left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for tests, too!

import java.util.Map;

public class MinimumNumberOfInstancesTimeRangeConfig {

Copy link

Choose a reason for hiding this comment

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

The field names are excessively long due to the class name prefix. Is this prefix required?

</f:entry>
</f:rowSet>
</f:optionalBlock>
<f:entry />
Copy link

Choose a reason for hiding this comment

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

Is this empty entry element required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not required, but it gets really cramped and ugly without it.

@res0nance
Copy link
Contributor

Merging tomorrow if no one has any objections

@res0nance res0nance merged commit 2f0d800 into jenkinsci:master Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature additions or enhancements
Projects
None yet
5 participants