支持push webhook触发构建
This commit is contained in:
parent
d21e0aa338
commit
6dc5f9de2c
|
@ -20,7 +20,6 @@ public class PushHook extends WebHook {
|
|||
private String userName;
|
||||
private String userEmail;
|
||||
private String userAvatar;
|
||||
private Integer projectId;
|
||||
private Project project;
|
||||
private List<Commit> commits;
|
||||
private Integer totalCommitsCount;
|
||||
|
@ -82,11 +81,7 @@ public class PushHook extends WebHook {
|
|||
}
|
||||
|
||||
public Integer getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(Integer projectId) {
|
||||
this.projectId = projectId;
|
||||
return getProject().getId();
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
|
@ -97,6 +92,10 @@ public class PushHook extends WebHook {
|
|||
this.project = project;
|
||||
}
|
||||
|
||||
public void setRepository(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public List<Commit> getCommits() {
|
||||
return commits;
|
||||
}
|
||||
|
@ -130,7 +129,6 @@ public class PushHook extends WebHook {
|
|||
.append(userName, pushHook.userName)
|
||||
.append(userEmail, pushHook.userEmail)
|
||||
.append(userAvatar, pushHook.userAvatar)
|
||||
.append(projectId, pushHook.projectId)
|
||||
.append(project, pushHook.project)
|
||||
.append(commits, pushHook.commits)
|
||||
.append(totalCommitsCount, pushHook.totalCommitsCount)
|
||||
|
@ -147,7 +145,6 @@ public class PushHook extends WebHook {
|
|||
.append(userName)
|
||||
.append(userEmail)
|
||||
.append(userAvatar)
|
||||
.append(projectId)
|
||||
.append(project)
|
||||
.append(commits)
|
||||
.append(totalCommitsCount)
|
||||
|
@ -164,7 +161,6 @@ public class PushHook extends WebHook {
|
|||
.append("userName", userName)
|
||||
.append("userEmail", userEmail)
|
||||
.append("userAvatar", userAvatar)
|
||||
.append("projectId", projectId)
|
||||
.append("project", project)
|
||||
.append("commits", commits)
|
||||
.append("totalCommitsCount", totalCommitsCount)
|
||||
|
|
|
@ -11,6 +11,15 @@ public abstract class WebHook {
|
|||
|
||||
private Repository repository;
|
||||
private String objectKind;
|
||||
private String hookName;
|
||||
|
||||
public String getHookName() {
|
||||
return this.hookName;
|
||||
}
|
||||
|
||||
public void setHookName(String hookName) {
|
||||
this.hookName = hookName;
|
||||
}
|
||||
|
||||
public String getObjectKind() {
|
||||
return objectKind;
|
||||
|
@ -40,6 +49,7 @@ public abstract class WebHook {
|
|||
return new EqualsBuilder()
|
||||
.append(repository, webHook.repository)
|
||||
.append(objectKind, webHook.objectKind)
|
||||
.append(hookName, webHook.hookName)
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
|
@ -47,6 +57,7 @@ public abstract class WebHook {
|
|||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 37)
|
||||
.append(repository)
|
||||
.append(hookName)
|
||||
.append(objectKind)
|
||||
.toHashCode();
|
||||
}
|
||||
|
@ -55,6 +66,7 @@ public abstract class WebHook {
|
|||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("repository", repository)
|
||||
.append("hookName", hookName)
|
||||
.append("objectKind", objectKind)
|
||||
.toString();
|
||||
}
|
||||
|
|
|
@ -42,7 +42,9 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<PushHook>
|
|||
|
||||
@Override
|
||||
protected CauseData retrieveCauseData(PushHook hook) {
|
||||
CauseData.ActionType actionType = hook.getObjectKind().equals("tag_push") ? CauseData.ActionType.TAG_PUSH : CauseData.ActionType.PUSH;
|
||||
// fixme 判断是否push tag,Gitee 钩子未有相关数据
|
||||
// CauseData.ActionType actionType = hook.getObjectKind().equals("tag_push") ? CauseData.ActionType.TAG_PUSH : CauseData.ActionType.PUSH;
|
||||
CauseData.ActionType actionType = CauseData.ActionType.PUSH;
|
||||
return causeData()
|
||||
.withActionType(actionType)
|
||||
.withSourceProjectId(hook.getProjectId())
|
||||
|
@ -51,12 +53,12 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<PushHook>
|
|||
.withSourceBranch(getTargetBranch(hook))
|
||||
.withUserName(hook.getUserName())
|
||||
.withUserEmail(hook.getUserEmail())
|
||||
.withSourceRepoHomepage(hook.getRepository().getHomepage())
|
||||
.withSourceRepoName(hook.getRepository().getName())
|
||||
.withSourceRepoHomepage(hook.getProject().getHomepage())
|
||||
.withSourceRepoName(hook.getProject().getName())
|
||||
.withSourceNamespace(hook.getProject().getNamespace())
|
||||
.withSourceRepoUrl(hook.getRepository().getUrl())
|
||||
.withSourceRepoSshUrl(hook.getRepository().getGitSshUrl())
|
||||
.withSourceRepoHttpUrl(hook.getRepository().getGitHttpUrl())
|
||||
.withSourceRepoUrl(hook.getProject().getUrl())
|
||||
.withSourceRepoSshUrl(hook.getProject().getSshUrl())
|
||||
.withSourceRepoHttpUrl(hook.getProject().getHttpUrl())
|
||||
.withMergeRequestTitle("")
|
||||
.withMergeRequestDescription("")
|
||||
.withMergeRequestId(null)
|
||||
|
|
Loading…
Reference in New Issue