兼容1.1.4 版本更新pr字段类型
This commit is contained in:
parent
915031ac44
commit
980fe373dd
|
@ -68,7 +68,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
private boolean triggerOnOpenPullRequest = true;
|
||||
private boolean triggerOnPipelineEvent = false;
|
||||
private boolean triggerOnAcceptedPullRequest = false;
|
||||
private int triggerOnUpdatePullRequest = 3;
|
||||
private String triggerOnUpdatePullRequest = "3";
|
||||
private boolean triggerOnClosedPullRequest = false;
|
||||
private boolean triggerOnApprovedPullRequest = false;
|
||||
private boolean triggerOnTestedPullRequest = false;
|
||||
|
@ -108,7 +108,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
@GeneratePojoBuilder(intoPackage = "*.builder.generated", withFactoryMethod = "*")
|
||||
public GiteePushTrigger(boolean triggerOnPush,
|
||||
boolean triggerOnOpenPullRequest,
|
||||
int triggerOnUpdatePullRequest,
|
||||
String triggerOnUpdatePullRequest,
|
||||
boolean triggerOnAcceptedPullRequest,
|
||||
boolean triggerOnClosedPullRequest,
|
||||
boolean triggerOnNoteRequest, String noteRegex,
|
||||
|
@ -209,7 +209,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
return triggerOnTestedPullRequest;
|
||||
}
|
||||
|
||||
public int getTriggerOnUpdatePullRequest() {
|
||||
public String getTriggerOnUpdatePullRequest() {
|
||||
return triggerOnUpdatePullRequest;
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
}
|
||||
|
||||
@DataBoundSetter
|
||||
public void setTriggerOnUpdatePullRequest(int triggerOnUpdatePullRequest) {
|
||||
public void setTriggerOnUpdatePullRequest(String triggerOnUpdatePullRequest) {
|
||||
this.triggerOnUpdatePullRequest = triggerOnUpdatePullRequest;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
private PullRequestHookTriggerHandlerFactory() {}
|
||||
|
||||
public static PullRequestHookTriggerHandler newPullRequestHookTriggerHandler(boolean triggerOnOpenPullRequest,
|
||||
int triggerOnUpdatePullRequest,
|
||||
String triggerOnUpdatePullRequest,
|
||||
boolean triggerOnAcceptedPullRequest,
|
||||
boolean triggerOnClosedPullRequest,
|
||||
boolean skipWorkInProgressPullRequest,
|
||||
|
@ -24,7 +24,7 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
boolean cancelPendingBuildsOnUpdate,
|
||||
boolean ciSkipFroTestNotRequired) {
|
||||
if (triggerOnOpenPullRequest
|
||||
|| (triggerOnUpdatePullRequest > 0)
|
||||
|| !("0".equals(triggerOnUpdatePullRequest) || "false".equals(triggerOnUpdatePullRequest))
|
||||
|| triggerOnAcceptedPullRequest
|
||||
|| triggerOnClosedPullRequest
|
||||
|| triggerOnApprovedPullRequest
|
||||
|
@ -53,17 +53,21 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
}
|
||||
|
||||
|
||||
private static List<ActionDesc> retrieveAllowedActionDesces(int triggerOnUpdatePullRequest) {
|
||||
private static List<ActionDesc> retrieveAllowedActionDesces(String triggerOnUpdatePullRequest) {
|
||||
List<ActionDesc> allowedActionDesces =new ArrayList<>();
|
||||
|
||||
switch(triggerOnUpdatePullRequest){
|
||||
case 1:
|
||||
case "1":
|
||||
allowedActionDesces.add(ActionDesc.source_branch_changed);
|
||||
break;
|
||||
case 2:
|
||||
case "2":
|
||||
allowedActionDesces.add(ActionDesc.target_branch_changed);
|
||||
break;
|
||||
case 3:
|
||||
case "3":
|
||||
allowedActionDesces.add(ActionDesc.source_branch_changed);
|
||||
allowedActionDesces.add(ActionDesc.target_branch_changed);
|
||||
break;
|
||||
case "true":
|
||||
allowedActionDesces.add(ActionDesc.source_branch_changed);
|
||||
allowedActionDesces.add(ActionDesc.target_branch_changed);
|
||||
break;
|
||||
|
@ -73,7 +77,7 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
|
||||
|
||||
private static List<Action> retrieveAllowedActions(boolean triggerOnOpenPullRequest,
|
||||
int triggerOnUpdatePullRequest,
|
||||
String triggerOnUpdatePullRequest,
|
||||
boolean triggerOnAcceptedPullRequest,
|
||||
boolean triggerOnClosedPullRequest,
|
||||
boolean triggerOnApprovedPullRequest,
|
||||
|
@ -84,7 +88,7 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
allowedActions.add(Action.open);
|
||||
}
|
||||
|
||||
if (triggerOnUpdatePullRequest > 0) {
|
||||
if (!("0".equals(triggerOnUpdatePullRequest) || "false".equals(triggerOnUpdatePullRequest))) {
|
||||
allowedActions.add(Action.update);
|
||||
}
|
||||
|
||||
|
@ -108,14 +112,14 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
}
|
||||
|
||||
private static List<State> retrieveAllowedStates(boolean triggerOnOpenPullRequest,
|
||||
int triggerOnUpdatePullRequest,
|
||||
String triggerOnUpdatePullRequest,
|
||||
boolean triggerOnAcceptedPullRequest,
|
||||
boolean triggerOnClosedPullRequest,
|
||||
boolean triggerOnApprovedPullRequest,
|
||||
boolean triggerOnTestedPullRequest) {
|
||||
List<State> result = new ArrayList<>();
|
||||
if (triggerOnOpenPullRequest
|
||||
|| triggerOnUpdatePullRequest > 0
|
||||
|| !("0".equals(triggerOnUpdatePullRequest) || "false".equals(triggerOnUpdatePullRequest))
|
||||
|| triggerOnApprovedPullRequest
|
||||
|| triggerOnTestedPullRequest) {
|
||||
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
|
||||
<f:entry name="triggerOnUpdatePullRequest" title="${%Updated.Pull.Request}">
|
||||
<select name="triggerOnUpdatePullRequest" field="triggerOnUpdatePullRequest">
|
||||
<option value='0' selected = "${instance.triggerOnUpdatePullRequest.toString() == '0'}">None</option>
|
||||
<option value='3' selected = "${instance.triggerOnUpdatePullRequest.toString() == '3'}">Both Source and Target Branch updated</option>
|
||||
<option value='1' selected = "${instance.triggerOnUpdatePullRequest.toString() == '1'}">Source Branch updated</option>
|
||||
<option value='2' selected = "${instance.triggerOnUpdatePullRequest.toString() == '2'}">Target Branch updated</option>
|
||||
<option value="0" selected = "${(instance.triggerOnUpdatePullRequest.equals('0') || instance.triggerOnUpdatePullRequest.toString().equals('false')) ? 'true':null}">None</option>
|
||||
<option value="3" selected = "${(instance.triggerOnUpdatePullRequest.equals('3') || instance.triggerOnUpdatePullRequest.toString().equals('true')) ? 'true':null}">Both Source and Target Branch updated</option>
|
||||
<option value="1" selected = "${instance.triggerOnUpdatePullRequest.equals('1') ? 'true':null}">Source Branch updated</option>
|
||||
<option value="2" selected = "${instance.triggerOnUpdatePullRequest.equals('2') ? 'true':null}">Target Branch updated</option>
|
||||
</select>
|
||||
</f:entry>
|
||||
|
||||
|
|
Loading…
Reference in New Issue