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
[FIXED JENKINS-30564] #46
Conversation
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
🐛 PR does not update existing relevant help texts to point out this special behavior. Besides that implementation issue, this change does not have a firm rationale. It assumes a user configures elastic build timeout before the job even reached a stable behavior and execution time, which makes no sense. OTOH users with aggressive deletion rules and/or frequently failing builds may be impacted by this change although they'd like the existing behavior: If you only keep 20 builds around due to e.g. storage limitations, but would like the elastic timeout to consider all of those that were successful, this change will break your existing timeout logic you rely on. |
To do this is not a problem. It can be easily implemented.
Is not there a similar assumption done with the standard behaviour when there is not already a successful build?
For me this is the work I understand it might have an impact, but I think this change is what an user which start with this plugin will expect. IMHO the current behaviour is not really expected unless you dig into the code. |
@fbelzunc To clarify, the 🐛 is about the incomplete implementation only. The second and third paragraph stand alone as comment. Although I really would prefer to see an actual rationale for this change. So far you only assert that the current behavior is wrong somehow. |
I don't think this is a good way to resolve the problem pointed in JENKINS-30564. I think JENKINS-30564 is caused not for too few builds, but rather for that the project configuration is updated and the expected build duration gets longer. This can happen even when there're sufficient number of builds, and this request doesn't resolve those cases. Though I don't think |
How's work going? |
@ikedam I like your approach. I have just started to work on it. |
@ikedam @daniel-beck Would you mind to take a look at this? |
@@ -22,6 +22,8 @@ | |||
|
|||
private final String numberOfBuilds; | |||
|
|||
private boolean failSafeTimeoutDuration; |
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.
final
@ikedam What do you think now? |
@@ -68,9 +81,17 @@ public long getTimeOut(AbstractBuild<?, ?> build, BuildListener listener) | |||
throws InterruptedException, MacroEvaluationException, IOException { | |||
double elasticTimeout = getElasticTimeout(Integer.parseInt(expandAll(build,listener,getTimeoutPercentage())), build, listener); | |||
if (elasticTimeout == 0) { | |||
return Math.max(MINIMUM_TIMEOUT_MILLISECONDS, Integer.parseInt(expandAll(build, listener, getTimeoutMinutesElasticDefault())) * MINUTES); | |||
if (isFailSafeTimeoutDuration()) { | |||
return Math.max(Integer.parseInt(getTimeoutMinutesElasticDefault()) * 60L * 1000L, Integer.parseInt(expandAll(build, listener, getTimeoutMinutesElasticDefault())) * MINUTES); |
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.
This results timeoutMinutesElasticDefault
anyway.
I don't think we need this if
switch.
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 agree with this.
@ikedam I think I did all in the way you said. Would you mind to review it again? |
Looks good. |
Let me give a try. |
@ikedam Tests added.
|
I also want following test cases:
The latter case may be a little hard to implement as variables are not used in existing tests. |
I added some tests and created #49. |
Yes, I just did it. |
timeoutMinutesElasticDefault
should be used untilnumberOfBuilds
is not reached out.https://issues.jenkins-ci.org/browse/JENKINS-30564
@reviewbybees