Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from jenkinsci/throttle-matrix-configurations
[JENKINS-13619] - Throttle matrix configurations
- Loading branch information
Showing
9 changed files
with
211 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/main/java/hudson/plugins/throttleconcurrents/ThrottleMatrixProjectOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2014 Oleg Nenashev, Synopsys Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package hudson.plugins.throttleconcurrents; | ||
|
||
import hudson.Extension; | ||
import hudson.matrix.MatrixBuild; | ||
import hudson.matrix.MatrixConfiguration; | ||
import hudson.model.Describable; | ||
import hudson.model.Descriptor; | ||
import javax.annotation.Nonnull; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* Defines additional options for throttling of {@link MatrixBuild}s and | ||
* @{@link MatrixConfiguration}s. | ||
* This class is intended to be used inside {@link ThrottleJobProperty}. | ||
* @author Oleg Nenashev <o.v.nenashev@gmail.com> | ||
* @since TODO: 1.9.0? | ||
*/ | ||
public class ThrottleMatrixProjectOptions implements Describable<ThrottleMatrixProjectOptions> { | ||
|
||
private final boolean throttleMatrixBuilds; | ||
private final boolean throttleMatrixConfigurations; | ||
|
||
/** | ||
* A default configuration, which retains the behavior from | ||
* version 1.8. | ||
*/ | ||
public static final ThrottleMatrixProjectOptions DEFAULT = | ||
new ThrottleMatrixProjectOptions(true, false); | ||
|
||
@DataBoundConstructor | ||
public ThrottleMatrixProjectOptions(boolean throttleMatrixBuilds, boolean throttleMatrixConfigurations) { | ||
this.throttleMatrixBuilds = throttleMatrixBuilds; | ||
this.throttleMatrixConfigurations = throttleMatrixConfigurations; | ||
} | ||
|
||
public boolean isThrottleMatrixBuilds() { | ||
return throttleMatrixBuilds; | ||
} | ||
|
||
public boolean isThrottleMatrixConfigurations() { | ||
return throttleMatrixConfigurations; | ||
} | ||
|
||
@Extension | ||
public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); | ||
|
||
@Override | ||
public Descriptor<ThrottleMatrixProjectOptions> getDescriptor() { | ||
return DESCRIPTOR; | ||
} | ||
|
||
public static class DescriptorImpl extends Descriptor<ThrottleMatrixProjectOptions> { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return Messages.ThrottleMatrixProjectOptions_DisplayName(); | ||
} | ||
|
||
@Nonnull | ||
public ThrottleMatrixProjectOptions getDefaults() { | ||
return ThrottleMatrixProjectOptions.DEFAULT; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/main/resources/hudson/plugins/throttleconcurrents/Messages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
ThrottleQueueTaskDispatcher.MaxCapacityOnNode=Already running {0} builds on node | ||
ThrottleQueueTaskDispatcher.MaxCapacityTotal=Already running {0} builds across all nodes | ||
ThrottleQueueTaskDispatcher.BuildPending=A build is pending launch | ||
ThrottleQueueTaskDispatcher.BuildPending=A build is pending launch | ||
|
||
ThrottleMatrixProjectOptions.DisplayName=Additional options for Matrix projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...in/resources/hudson/plugins/throttleconcurrents/ThrottleMatrixProjectOptions/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:p="/lib/hudson/project"> | ||
<f:entry field="throttleMatrixBuilds" title="${%throttleMatrixBuilds.title}"> | ||
<f:checkbox default="${descriptor.defaults.throttleMatrixBuilds}"/> | ||
</f:entry> | ||
<f:entry field="throttleMatrixConfigurations" title="${%throttleMatrixConfigurations.title}"> | ||
<f:checkbox default="${descriptor.defaults.throttleMatrixConfigurations}"/> | ||
</f:entry> | ||
</j:jelly> |
2 changes: 2 additions & 0 deletions
2
...sources/hudson/plugins/throttleconcurrents/ThrottleMatrixProjectOptions/config.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
throttleMatrixBuilds.title= Throttle Matrix master builds | ||
throttleMatrixConfigurations.title= Throttle Matrix configuration builds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters