mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
[FIXED JENKINS-9300] wrong estimated build time for Maven projects before POMs are parsed
This commit is contained in:
1 parent
3bf4849132
commit
f568a43170
1 file changed
+13
@@ -283,6 +283,9 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
* Returns the estimated duration for this builds.
|
||||
* Takes only the modules into account which are actually being build in
|
||||
* case of incremental builds.
|
||||
*
|
||||
* @return the estimated duration in milliseconds
|
||||
* @since 1.383
|
||||
*/
|
||||
@Override
|
||||
public long getEstimatedDuration() {
|
||||
@@ -294,8 +297,12 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
long result = 0;
|
||||
|
||||
Map<MavenModule, List<MavenBuild>> moduleBuilds = getModuleBuilds();
|
||||
|
||||
boolean noModuleBuildsYet = true;
|
||||
|
||||
for (List<MavenBuild> builds : moduleBuilds.values()) {
|
||||
if (!builds.isEmpty()) {
|
||||
noModuleBuildsYet = false;
|
||||
MavenBuild build = builds.get(0);
|
||||
if (build.getResult() != Result.NOT_BUILT && build.getEstimatedDuration() != -1) {
|
||||
result += build.getEstimatedDuration();
|
||||
@@ -303,6 +310,12 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
}
|
||||
}
|
||||
|
||||
if (noModuleBuildsYet) {
|
||||
// modules not determined, yet, i.e. POM not parsed.
|
||||
// Use best estimation we have:
|
||||
return super.getEstimatedDuration();
|
||||
}
|
||||
|
||||
result += estimateModuleSetBuildDurationOverhead(3);
|
||||
|
||||
return result != 0 ? result : -1;
|
||||
|
||||
Reference in new issue
Block a user