forked from uaarkoti/customize-build-now-plugin
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To avoid having to change code at 2 places when new labels are introduced, add a class for just labels and use it in global config and in job property. This is a breaking change that once applied a rollback requires manual intervention.
- Loading branch information
1 parent
2f2db10
commit ee4c851
Showing
13 changed files
with
157 additions
and
90 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
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
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
58 changes: 58 additions & 0 deletions
58
src/main/java/org/jenkinsci/plugins/customizebuildnow/Labels.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,58 @@ | ||
package org.jenkinsci.plugins.customizebuildnow; | ||
|
||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import hudson.Extension; | ||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
|
||
public class Labels extends AbstractDescribableImpl<Labels> { | ||
|
||
private String alternateBuildNow; | ||
|
||
private String alternateBuildWithParams; | ||
|
||
private String alternateBuildButton; | ||
|
||
@DataBoundConstructor | ||
public Labels() { | ||
} | ||
|
||
public String getAlternateBuildNow() { | ||
return alternateBuildNow; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setAlternateBuildNow(String alternateBuildNow) { | ||
this.alternateBuildNow = alternateBuildNow; | ||
} | ||
|
||
public String getAlternateBuildWithParams() { | ||
return alternateBuildWithParams; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setAlternateBuildWithParams(String alternateBuildWithParams) { | ||
this.alternateBuildWithParams = alternateBuildWithParams; | ||
} | ||
|
||
public String getAlternateBuildButton() { | ||
return alternateBuildButton; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setAlternateBuildButton(String alternateBuildButton) { | ||
this.alternateBuildButton = alternateBuildButton; | ||
} | ||
|
||
@Extension | ||
public static class DescriptorImpl extends Descriptor<Labels> { | ||
|
||
@NonNull | ||
@Override | ||
public String getDisplayName() { | ||
return ""; | ||
} | ||
} | ||
} |
10 changes: 1 addition & 9 deletions
10
...ces/org/jenkinsci/plugins/customizebuildnow/AlternateBuildLabelConfiguration/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 |
---|---|---|
@@ -1,14 +1,6 @@ | ||
<?jelly escape-by-default='true'?> | ||
<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"> | ||
<f:section title="${%Alternative Labels for Build Links and Buttons}"> | ||
<f:entry title="${%New Label for Build Now}" field="alternateBuildNow"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:entry title="${%New Label for Build with Parameters}" field="alternateBuildWithParams"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:entry title="${%New Label for Build Button}" field="alternateBuildButton"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:property field="labels"/> | ||
</f:section> | ||
</j:jelly> |
10 changes: 1 addition & 9 deletions
10
...sources/org/jenkinsci/plugins/customizebuildnow/BuildNowTextProperty/config-details.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 |
---|---|---|
@@ -1,12 +1,4 @@ | ||
<?jelly escape-by-default='true'?> | ||
<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"> | ||
<f:entry title="${%New Label for Build Now}" field="alternateBuildNow"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:entry title="${%New Label for Build with Parameters}" field="alternateBuildWithParams"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:entry title="${%New Label for Build Button}" field="alternateBuildButton"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:property field="labels"/> | ||
</j:jelly> |
12 changes: 12 additions & 0 deletions
12
src/main/resources/org/jenkinsci/plugins/customizebuildnow/Labels/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,12 @@ | ||
<?jelly escape-by-default='true'?> | ||
<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"> | ||
<f:entry title="${%New Label for Build Now}" field="alternateBuildNow"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:entry title="${%New Label for Build with Parameters}" field="alternateBuildWithParams"> | ||
<f:textbox/> | ||
</f:entry> | ||
<f:entry title="${%New Label for Build Button}" field="alternateBuildButton"> | ||
<f:textbox/> | ||
</f:entry> | ||
</j:jelly> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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