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

[FIXED JENKINS-30564] #46

Closed
wants to merge 7 commits into from
Closed

Conversation

fbelzunc
Copy link
Contributor

timeoutMinutesElasticDefault should be used until numberOfBuilds is not reached out.

https://issues.jenkins-ci.org/browse/JENKINS-30564

@reviewbybees

@ghost
Copy link

ghost commented Sep 21, 2015

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.

@daniel-beck
Copy link
Member

🐛 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.

@fbelzunc
Copy link
Contributor Author

PR does not update existing relevant help texts to point out this special behavior.

To do this is not a problem. It can be easily implemented.

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 behaviour and execution time, which makes no sense.

Is not there a similar assumption done with the standard behaviour when there is not already a successful build?

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.

For me this is the work timeoutMinutesElasticDefault will be doing. You should set-up the right value here to avoid any issue.

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.

@daniel-beck
Copy link
Member

@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.

@ikedam
Copy link
Member

ikedam commented Sep 22, 2015

I don't think this is a good way to resolve the problem pointed in JENKINS-30564.
I prefer to add a checkbox "use this as the shortest timeout" to "Timeout minutes".

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 ElasticTimeOutStrategy is applicable to those cases anyway, allowing users configure fail-safe timeout duration is a better approach.

@ikedam
Copy link
Member

ikedam commented Oct 7, 2015

How's work going?

@fbelzunc
Copy link
Contributor Author

@ikedam I like your approach. I have just started to work on it.

@fbelzunc
Copy link
Contributor Author

@ikedam @daniel-beck Would you mind to take a look at this?

@@ -22,6 +22,8 @@

private final String numberOfBuilds;

private boolean failSafeTimeoutDuration;
Copy link
Member

Choose a reason for hiding this comment

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

final

@fbelzunc
Copy link
Contributor Author

@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);
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with this.

@fbelzunc
Copy link
Contributor Author

@ikedam I think I did all in the way you said. Would you mind to review it again?

@ikedam
Copy link
Member

ikedam commented Oct 26, 2015

Looks good.
I want unit tests befere merging.
Do you plan to add them?
If not, I can do that instead.

@fbelzunc
Copy link
Contributor Author

Let me give a try.

@fbelzunc
Copy link
Contributor Author

@ikedam Tests added.

  • Do you think they are ok?

@ikedam
Copy link
Member

ikedam commented Oct 27, 2015

I also want following test cases:

  • A case failSafe... is set to true and the default value is not used (the calcurated timeout is enough long).
  • A case the default value is configured with variables.

The latter case may be a little hard to implement as variables are not used in existing tests.
I suppose you can do that by adding ParametersAction to the build. See also StringParameterValue.

@ikedam
Copy link
Member

ikedam commented Jan 17, 2016

I added some tests and created #49.
Would you review that?

@fbelzunc
Copy link
Contributor Author

Yes, I just did it.

@fbelzunc fbelzunc closed this Jan 19, 2016
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.

None yet

3 participants