Skip to content

Commit 61284bd

Browse files
committed
StashBuildTrigger: Make field defaults match config.jelly
That makes the Pipeline Snippet Generator skip arguments from the trigger call if those arguments have default values. Keep default values for the skip phrase and the build phrase in the descriptor, so they can be used both in config.jelly and in the code.
1 parent eefa7fe commit 61284bd

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashBuildTrigger.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ public class StashBuildTrigger extends Trigger<Job<?, ?>> {
4444

4545
// Optional settings
4646
private boolean ignoreSsl;
47-
private String targetBranchesToBuild;
47+
private String targetBranchesToBuild = "";
4848
private boolean checkDestinationCommit;
4949
private boolean checkNotConflicted;
5050
private boolean checkMergeable;
51-
private boolean checkProbeMergeStatus;
51+
private boolean checkProbeMergeStatus = true;
5252
private boolean mergeOnSuccess;
5353
private boolean deletePreviousBuildFinishComments;
5454
private boolean cancelOutdatedJobsEnabled;
55-
private String ciSkipPhrases;
55+
private String ciSkipPhrases = DescriptorImpl.DEFAULT_CI_SKIP_PHRASES;
5656
private boolean onlyBuildOnComment;
57-
private String ciBuildPhrases;
57+
private String ciBuildPhrases = DescriptorImpl.DEFAULT_CI_BUILD_PHRASES;
5858

5959
private transient StashPullRequestsBuilder stashPullRequestsBuilder;
6060

@@ -217,7 +217,7 @@ public void setOnlyBuildOnComment(boolean onlyBuildOnComment) {
217217
}
218218

219219
public String getCiBuildPhrases() {
220-
return ciBuildPhrases == null ? "test this please" : ciBuildPhrases;
220+
return ciBuildPhrases;
221221
}
222222

223223
@DataBoundSetter
@@ -264,6 +264,9 @@ public void stop() {
264264
}
265265

266266
public static final class DescriptorImpl extends TriggerDescriptor {
267+
public static final String DEFAULT_CI_SKIP_PHRASES = "NO TEST";
268+
public static final String DEFAULT_CI_BUILD_PHRASES = "test this please";
269+
267270
public DescriptorImpl() {
268271
load();
269272
}

src/main/resources/stashpullrequestbuilder/stashpullrequestbuilder/StashBuildTrigger/config.jelly

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@
4444
<f:checkbox default="false"/>
4545
</f:entry>
4646
<f:entry title="Phrase to disable builds" field="ciSkipPhrases">
47-
<f:textbox default="NO TEST" />
47+
<f:textbox default="${descriptor.DEFAULT_CI_SKIP_PHRASES}"/>
4848
</f:entry>
4949
<f:entry title="Only build if asked with the build phrase" field="onlyBuildOnComment">
5050
<f:checkbox default="false"/>
5151
</f:entry>
5252
<f:entry title="Phrase to request a (re-)build" field="ciBuildPhrases">
53-
<f:textbox default="test this please"/>
53+
<f:textbox default="${descriptor.DEFAULT_CI_BUILD_PHRASES}"/>
5454
</f:entry>
5555
</f:advanced>
5656
</j:jelly>

0 commit comments

Comments
 (0)