修复release编译报错
This commit is contained in:
parent
f67b32b23c
commit
5900a68d83
|
@ -15,7 +15,7 @@ public class BranchData {
|
|||
private String ref;
|
||||
private String sha;
|
||||
private User user;
|
||||
private Project project;
|
||||
private Project repo;
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
|
@ -49,16 +49,12 @@ public class BranchData {
|
|||
this.user = user;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
public Project getRepo() {
|
||||
return repo;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public void setRepo(Project project) {
|
||||
this.project = project;
|
||||
public void setRepo(Project repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +71,7 @@ public class BranchData {
|
|||
.append(sha, branchData.sha)
|
||||
.append(ref, branchData.ref)
|
||||
.append(user, branchData.user)
|
||||
.append(project, branchData.project)
|
||||
.append(repo, branchData.repo)
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
|
@ -86,7 +82,7 @@ public class BranchData {
|
|||
.append(sha)
|
||||
.append(ref)
|
||||
.append(user)
|
||||
.append(project)
|
||||
.append(repo)
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
|
@ -97,7 +93,7 @@ public class BranchData {
|
|||
.append("sha", sha)
|
||||
.append("ref", ref)
|
||||
.append("user", user)
|
||||
.append("project", project)
|
||||
.append("repo", repo)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ public class MergeRequestHook extends WebHook {
|
|||
|
||||
private User user;
|
||||
private User assignee;
|
||||
private Project project;
|
||||
private Project repo;
|
||||
private Action action;
|
||||
private State state;
|
||||
private MergeRequestObjectAttributes objectAttributes;
|
||||
private MergeRequestObjectAttributes pullRequest;
|
||||
private List<MergeRequestLabel> labels;
|
||||
|
||||
public Action getAction() {
|
||||
|
@ -55,30 +55,20 @@ public class MergeRequestHook extends WebHook {
|
|||
this.assignee = assignee;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return project;
|
||||
public Project getRepo() {
|
||||
return repo;
|
||||
}
|
||||
|
||||
public void setProject(Project project) {
|
||||
this.project = project;
|
||||
public void setRepo(Project repo) {
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
// adapt gitee hook
|
||||
public void setRepo(Project project) {
|
||||
this.project = project;
|
||||
public MergeRequestObjectAttributes getPullRequest() {
|
||||
return pullRequest;
|
||||
}
|
||||
|
||||
public MergeRequestObjectAttributes getObjectAttributes() {
|
||||
return objectAttributes;
|
||||
}
|
||||
|
||||
public void setObjectAttributes(MergeRequestObjectAttributes objectAttributes) {
|
||||
this.objectAttributes = objectAttributes;
|
||||
}
|
||||
|
||||
// adapt gitee hook
|
||||
public void setPullRequest(MergeRequestObjectAttributes objectAttributes) {
|
||||
this.objectAttributes = objectAttributes;
|
||||
public void setPullRequest(MergeRequestObjectAttributes pullRequest) {
|
||||
this.pullRequest = pullRequest;
|
||||
}
|
||||
|
||||
public List<MergeRequestLabel> getLabels() {
|
||||
|
@ -90,7 +80,7 @@ public class MergeRequestHook extends WebHook {
|
|||
}
|
||||
|
||||
public String getWebHookDescription() {
|
||||
return getHookName() + " iid = " + objectAttributes.getIid() + " merge commit sha = " + objectAttributes.getMergeCommitSha();
|
||||
return getHookName() + " iid = " + pullRequest.getNumber() + " merge commit sha = " + pullRequest.getMergeCommitSha();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -105,10 +95,10 @@ public class MergeRequestHook extends WebHook {
|
|||
return new EqualsBuilder()
|
||||
.append(user, that.user)
|
||||
.append(assignee, that.assignee)
|
||||
.append(project, that.project)
|
||||
.append(repo, that.repo)
|
||||
.append(action, that.action)
|
||||
.append(state, that.state)
|
||||
.append(objectAttributes, that.objectAttributes)
|
||||
.append(pullRequest, that.pullRequest)
|
||||
.append(labels, that.labels)
|
||||
.isEquals();
|
||||
}
|
||||
|
@ -118,8 +108,8 @@ public class MergeRequestHook extends WebHook {
|
|||
return new HashCodeBuilder(17, 37)
|
||||
.append(user)
|
||||
.append(assignee)
|
||||
.append(project)
|
||||
.append(objectAttributes)
|
||||
.append(repo)
|
||||
.append(pullRequest)
|
||||
.append(labels)
|
||||
.append(state)
|
||||
.append(action)
|
||||
|
@ -131,10 +121,10 @@ public class MergeRequestHook extends WebHook {
|
|||
return new ToStringBuilder(this)
|
||||
.append("user", user)
|
||||
.append("assignee", assignee)
|
||||
.append("project", project)
|
||||
.append("repo", repo)
|
||||
.append("state", state)
|
||||
.append("action", action)
|
||||
.append("objectAttributes", objectAttributes)
|
||||
.append("pullRequest", pullRequest)
|
||||
.append("labels", labels)
|
||||
.toString();
|
||||
}
|
||||
|
|
|
@ -15,13 +15,13 @@ import java.util.Date;
|
|||
public class MergeRequestObjectAttributes {
|
||||
|
||||
private Integer id;
|
||||
private Integer iid;
|
||||
private Integer number;
|
||||
private Integer authorId;
|
||||
private Integer assigneeId;
|
||||
private String title;
|
||||
private Date createdAt;
|
||||
private Date updatedAt;
|
||||
private String description;
|
||||
private String body;
|
||||
private BranchData head;
|
||||
private BranchData base;
|
||||
private String mergeStatus;
|
||||
|
@ -38,12 +38,12 @@ public class MergeRequestObjectAttributes {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getIid() {
|
||||
return iid;
|
||||
public Integer getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(Integer iid) {
|
||||
this.iid = iid;
|
||||
public void setNumber(Integer number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getSourceBranch() {
|
||||
|
@ -55,11 +55,11 @@ public class MergeRequestObjectAttributes {
|
|||
}
|
||||
|
||||
public Integer getSourceProjectId() {
|
||||
return head.getProject().getId();
|
||||
return head.getRepo().getId();
|
||||
}
|
||||
|
||||
public Integer getTargetProjectId() {
|
||||
return base.getProject().getId();
|
||||
return base.getRepo().getId();
|
||||
}
|
||||
|
||||
public Integer getAuthorId() {
|
||||
|
@ -102,20 +102,16 @@ public class MergeRequestObjectAttributes {
|
|||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setBody(String description) {
|
||||
this.description = description;
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
public Project getSource() {
|
||||
return head.getProject();
|
||||
return head.getRepo();
|
||||
}
|
||||
|
||||
public BranchData getHead() {
|
||||
|
@ -135,7 +131,7 @@ public class MergeRequestObjectAttributes {
|
|||
}
|
||||
|
||||
public Project getTarget() {
|
||||
return base.getProject();
|
||||
return base.getRepo();
|
||||
}
|
||||
|
||||
|
||||
|
@ -190,13 +186,13 @@ public class MergeRequestObjectAttributes {
|
|||
MergeRequestObjectAttributes that = (MergeRequestObjectAttributes) o;
|
||||
return new EqualsBuilder()
|
||||
.append(id, that.id)
|
||||
.append(iid, that.iid)
|
||||
.append(number, that.number)
|
||||
.append(authorId, that.authorId)
|
||||
.append(assigneeId, that.assigneeId)
|
||||
.append(title, that.title)
|
||||
.append(createdAt, that.createdAt)
|
||||
.append(updatedAt, that.updatedAt)
|
||||
.append(description, that.description)
|
||||
.append(body, that.body)
|
||||
.append(head, that.head)
|
||||
.append(base, that.base)
|
||||
.append(mergeCommitSha, that.mergeCommitSha)
|
||||
|
@ -211,13 +207,13 @@ public class MergeRequestObjectAttributes {
|
|||
public int hashCode() {
|
||||
return new HashCodeBuilder(17, 37)
|
||||
.append(id)
|
||||
.append(iid)
|
||||
.append(number)
|
||||
.append(authorId)
|
||||
.append(assigneeId)
|
||||
.append(title)
|
||||
.append(createdAt)
|
||||
.append(updatedAt)
|
||||
.append(description)
|
||||
.append(body)
|
||||
.append(head)
|
||||
.append(base)
|
||||
.append(mergeStatus)
|
||||
|
@ -232,13 +228,13 @@ public class MergeRequestObjectAttributes {
|
|||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("id", id)
|
||||
.append("iid", iid)
|
||||
.append("number", number)
|
||||
.append("authorId", authorId)
|
||||
.append("assigneeId", assigneeId)
|
||||
.append("title", title)
|
||||
.append("createdAt", createdAt)
|
||||
.append("updatedAt", updatedAt)
|
||||
.append("description", description)
|
||||
.append("body", body)
|
||||
.append("head", head)
|
||||
.append("base", base)
|
||||
.append("mergeCommitSha", mergeCommitSha)
|
||||
|
|
|
@ -23,7 +23,7 @@ public class Project {
|
|||
private String homepage;
|
||||
private String url;
|
||||
private String sshUrl;
|
||||
private String httpUrl;
|
||||
private String gitHttpUrl;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
|
@ -113,12 +113,12 @@ public class Project {
|
|||
this.sshUrl = sshUrl;
|
||||
}
|
||||
|
||||
public String getHttpUrl() {
|
||||
return httpUrl;
|
||||
public String getGitHttpUrl() {
|
||||
return gitHttpUrl;
|
||||
}
|
||||
|
||||
public void setGitHttpUrl(String httpUrl) {
|
||||
this.httpUrl = httpUrl;
|
||||
public void setGitHttpUrl(String gitHttpUrl) {
|
||||
this.gitHttpUrl = gitHttpUrl;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
|
@ -151,7 +151,7 @@ public class Project {
|
|||
.append(homepage, project.homepage)
|
||||
.append(url, project.url)
|
||||
.append(sshUrl, project.sshUrl)
|
||||
.append(httpUrl, project.httpUrl)
|
||||
.append(gitHttpUrl, project.gitHttpUrl)
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class Project {
|
|||
.append(homepage)
|
||||
.append(url)
|
||||
.append(sshUrl)
|
||||
.append(httpUrl)
|
||||
.append(gitHttpUrl)
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class Project {
|
|||
.append("homepage", homepage)
|
||||
.append("url", url)
|
||||
.append("sshUrl", sshUrl)
|
||||
.append("httpUrl", httpUrl)
|
||||
.append("gitHttpUrl", gitHttpUrl)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,10 +57,10 @@ class MergeRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<M
|
|||
|
||||
@Override
|
||||
public void handle(Job<?, ?> job, MergeRequestHook hook, boolean ciSkip, BranchFilter branchFilter, MergeRequestLabelFilter mergeRequestLabelFilter) {
|
||||
MergeRequestObjectAttributes objectAttributes = hook.getObjectAttributes();
|
||||
MergeRequestObjectAttributes objectAttributes = hook.getPullRequest();
|
||||
|
||||
try {
|
||||
LOGGER.log(Level.INFO, "request hook state=" + hook.getState() + ", action = " + hook.getAction() + " pr iid = " + objectAttributes.getIid() + " hook name = " + hook.getHookName());
|
||||
LOGGER.log(Level.INFO, "request hook state=" + hook.getState() + ", action = " + hook.getAction() + " pr iid = " + objectAttributes.getNumber() + " hook name = " + hook.getHookName());
|
||||
if (isAllowedByConfig(hook)
|
||||
&& isLastCommitNotYetBuild(job, hook)
|
||||
&& isNotSkipWorkInProgressMergeRequest(objectAttributes)) {
|
||||
|
@ -88,9 +88,9 @@ class MergeRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<M
|
|||
|
||||
@Override
|
||||
protected boolean isCiSkip(MergeRequestHook hook) {
|
||||
return hook.getObjectAttributes() != null
|
||||
&& hook.getObjectAttributes().getDescription() != null
|
||||
&& hook.getObjectAttributes().getDescription().contains("[ci-skip]");
|
||||
return hook.getPullRequest() != null
|
||||
&& hook.getPullRequest().getBody() != null
|
||||
&& hook.getPullRequest().getBody().contains("[ci-skip]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,12 +101,12 @@ class MergeRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<M
|
|||
if (!hook.getAction().equals(Action.update)) {
|
||||
return;
|
||||
}
|
||||
this.pendingBuildsHandler.cancelPendingBuilds(job, hook.getObjectAttributes().getSourceProjectId(), hook.getObjectAttributes().getSourceBranch());
|
||||
this.pendingBuildsHandler.cancelPendingBuilds(job, hook.getPullRequest().getSourceProjectId(), hook.getPullRequest().getSourceBranch());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTargetBranch(MergeRequestHook hook) {
|
||||
return hook.getObjectAttributes() == null ? null : hook.getObjectAttributes().getTargetBranch();
|
||||
return hook.getPullRequest() == null ? null : hook.getPullRequest().getTargetBranch();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,35 +118,35 @@ class MergeRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<M
|
|||
protected CauseData retrieveCauseData(MergeRequestHook hook) {
|
||||
return causeData()
|
||||
.withActionType(CauseData.ActionType.MERGE)
|
||||
.withSourceProjectId(hook.getObjectAttributes().getSourceProjectId())
|
||||
.withTargetProjectId(hook.getObjectAttributes().getTargetProjectId())
|
||||
.withBranch(hook.getObjectAttributes().getSourceBranch())
|
||||
.withSourceBranch(hook.getObjectAttributes().getSourceBranch())
|
||||
.withUserName(hook.getObjectAttributes().getHead().getUser().getName())
|
||||
.withUserEmail(hook.getObjectAttributes().getHead().getUser().getEmail())
|
||||
.withSourceRepoHomepage(hook.getObjectAttributes().getSource().getHomepage())
|
||||
.withSourceRepoName(hook.getObjectAttributes().getSource().getName())
|
||||
.withSourceNamespace(hook.getObjectAttributes().getSource().getNamespace())
|
||||
.withSourceRepoUrl(hook.getObjectAttributes().getSource().getUrl())
|
||||
.withSourceRepoSshUrl(hook.getObjectAttributes().getSource().getSshUrl())
|
||||
.withSourceRepoHttpUrl(hook.getObjectAttributes().getSource().getHttpUrl())
|
||||
.withMergeRequestTitle(hook.getObjectAttributes().getTitle())
|
||||
.withMergeRequestDescription(hook.getObjectAttributes().getDescription())
|
||||
.withMergeRequestId(hook.getObjectAttributes().getId())
|
||||
.withMergeRequestIid(hook.getObjectAttributes().getIid())
|
||||
.withSourceProjectId(hook.getPullRequest().getSourceProjectId())
|
||||
.withTargetProjectId(hook.getPullRequest().getTargetProjectId())
|
||||
.withBranch(hook.getPullRequest().getSourceBranch())
|
||||
.withSourceBranch(hook.getPullRequest().getSourceBranch())
|
||||
.withUserName(hook.getPullRequest().getHead().getUser().getName())
|
||||
.withUserEmail(hook.getPullRequest().getHead().getUser().getEmail())
|
||||
.withSourceRepoHomepage(hook.getPullRequest().getSource().getHomepage())
|
||||
.withSourceRepoName(hook.getPullRequest().getSource().getName())
|
||||
.withSourceNamespace(hook.getPullRequest().getSource().getNamespace())
|
||||
.withSourceRepoUrl(hook.getPullRequest().getSource().getUrl())
|
||||
.withSourceRepoSshUrl(hook.getPullRequest().getSource().getSshUrl())
|
||||
.withSourceRepoHttpUrl(hook.getPullRequest().getSource().getGitHttpUrl())
|
||||
.withMergeRequestTitle(hook.getPullRequest().getTitle())
|
||||
.withMergeRequestDescription(hook.getPullRequest().getBody())
|
||||
.withMergeRequestId(hook.getPullRequest().getId())
|
||||
.withMergeRequestIid(hook.getPullRequest().getNumber())
|
||||
.withMergeRequestState(hook.getState().toString())
|
||||
.withMergedByUser(hook.getUser() == null ? null : hook.getUser().getUsername())
|
||||
.withMergeRequestAssignee(hook.getAssignee() == null ? null : hook.getAssignee().getUsername())
|
||||
.withMergeRequestTargetProjectId(hook.getObjectAttributes().getTargetProjectId())
|
||||
.withTargetBranch(hook.getObjectAttributes().getTargetBranch())
|
||||
.withTargetRepoName(hook.getObjectAttributes().getTarget().getName())
|
||||
.withTargetNamespace(hook.getObjectAttributes().getTarget().getNamespace())
|
||||
.withTargetRepoSshUrl(hook.getObjectAttributes().getTarget().getSshUrl())
|
||||
.withTargetRepoHttpUrl(hook.getObjectAttributes().getTarget().getHttpUrl())
|
||||
.withTriggeredByUser(hook.getObjectAttributes().getHead().getUser().getName())
|
||||
.withLastCommit(hook.getObjectAttributes().getMergeCommitSha())
|
||||
.withTargetProjectUrl(hook.getObjectAttributes().getTarget().getUrl())
|
||||
.withPathWithNamespace(hook.getProject().getPathWithNamespace())
|
||||
.withMergeRequestTargetProjectId(hook.getPullRequest().getTargetProjectId())
|
||||
.withTargetBranch(hook.getPullRequest().getTargetBranch())
|
||||
.withTargetRepoName(hook.getPullRequest().getTarget().getName())
|
||||
.withTargetNamespace(hook.getPullRequest().getTarget().getNamespace())
|
||||
.withTargetRepoSshUrl(hook.getPullRequest().getTarget().getSshUrl())
|
||||
.withTargetRepoHttpUrl(hook.getPullRequest().getTarget().getGitHttpUrl())
|
||||
.withTriggeredByUser(hook.getPullRequest().getHead().getUser().getName())
|
||||
.withLastCommit(hook.getPullRequest().getMergeCommitSha())
|
||||
.withTargetProjectUrl(hook.getPullRequest().getTarget().getUrl())
|
||||
.withPathWithNamespace(hook.getRepo().getPathWithNamespace())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -158,23 +158,23 @@ class MergeRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<M
|
|||
@Override
|
||||
protected BuildStatusUpdate retrieveBuildStatusUpdate(MergeRequestHook hook) {
|
||||
return buildStatusUpdate()
|
||||
.withProjectId(hook.getObjectAttributes().getSourceProjectId())
|
||||
.withSha(hook.getObjectAttributes().getMergeCommitSha())
|
||||
.withRef(hook.getObjectAttributes().getSourceBranch())
|
||||
.withProjectId(hook.getPullRequest().getSourceProjectId())
|
||||
.withSha(hook.getPullRequest().getMergeCommitSha())
|
||||
.withRef(hook.getPullRequest().getSourceBranch())
|
||||
.build();
|
||||
}
|
||||
|
||||
private String retrieveRevisionToBuild(MergeRequestHook hook) throws NoRevisionToBuildException {
|
||||
if (hook.getObjectAttributes() != null
|
||||
&& hook.getObjectAttributes().getMergeReferenceName() != null) {
|
||||
return hook.getObjectAttributes().getMergeReferenceName();
|
||||
if (hook.getPullRequest() != null
|
||||
&& hook.getPullRequest().getMergeReferenceName() != null) {
|
||||
return hook.getPullRequest().getMergeReferenceName();
|
||||
} else {
|
||||
throw new NoRevisionToBuildException();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLastCommitNotYetBuild(Job<?, ?> project, MergeRequestHook hook) {
|
||||
MergeRequestObjectAttributes objectAttributes = hook.getObjectAttributes();
|
||||
MergeRequestObjectAttributes objectAttributes = hook.getPullRequest();
|
||||
if (hook != null && hook.getAction() == Action.approved) {
|
||||
LOGGER.log(Level.FINEST, "Skipping LastCommitNotYetBuild check for approve action");
|
||||
return true;
|
||||
|
@ -203,7 +203,7 @@ class MergeRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<M
|
|||
private boolean isNotSkipWorkInProgressMergeRequest(MergeRequestObjectAttributes objectAttributes) {
|
||||
Boolean workInProgress = objectAttributes.getWorkInProgress();
|
||||
if (skipWorkInProgressMergeRequest && workInProgress != null && workInProgress) {
|
||||
LOGGER.log(Level.INFO, "Skip WIP Merge Request #{0} ({1})", toArray(objectAttributes.getIid(), objectAttributes.getTitle()));
|
||||
LOGGER.log(Level.INFO, "Skip WIP Merge Request #{0} ({1})", toArray(objectAttributes.getNumber(), objectAttributes.getTitle()));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -40,8 +40,8 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
@Override
|
||||
protected boolean isCiSkip(NoteHook hook) {
|
||||
return hook.getMergeRequest() != null
|
||||
&& hook.getMergeRequest().getDescription() != null
|
||||
&& hook.getMergeRequest().getDescription().contains("[ci-skip]");
|
||||
&& hook.getMergeRequest().getBody() != null
|
||||
&& hook.getMergeRequest().getBody().contains("[ci-skip]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,17 +69,17 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
.withSourceNamespace(hook.getMergeRequest().getSource().getNamespace())
|
||||
.withSourceRepoUrl(hook.getMergeRequest().getSource().getUrl())
|
||||
.withSourceRepoSshUrl(hook.getMergeRequest().getSource().getSshUrl())
|
||||
.withSourceRepoHttpUrl(hook.getMergeRequest().getSource().getHttpUrl())
|
||||
.withSourceRepoHttpUrl(hook.getMergeRequest().getSource().getGitHttpUrl())
|
||||
.withMergeRequestTitle(hook.getMergeRequest().getTitle())
|
||||
.withMergeRequestDescription(hook.getMergeRequest().getDescription())
|
||||
.withMergeRequestDescription(hook.getMergeRequest().getBody())
|
||||
.withMergeRequestId(hook.getMergeRequest().getId())
|
||||
.withMergeRequestIid(hook.getMergeRequest().getIid())
|
||||
.withMergeRequestIid(hook.getMergeRequest().getNumber())
|
||||
.withMergeRequestTargetProjectId(hook.getMergeRequest().getTargetProjectId())
|
||||
.withTargetBranch(hook.getMergeRequest().getTargetBranch())
|
||||
.withTargetRepoName(hook.getMergeRequest().getTarget().getName())
|
||||
.withTargetNamespace(hook.getMergeRequest().getTarget().getNamespace())
|
||||
.withTargetRepoSshUrl(hook.getMergeRequest().getTarget().getSshUrl())
|
||||
.withTargetRepoHttpUrl(hook.getMergeRequest().getTarget().getHttpUrl())
|
||||
.withTargetRepoHttpUrl(hook.getMergeRequest().getTarget().getGitHttpUrl())
|
||||
.withTriggeredByUser(hook.getMergeRequest().getHead().getUser().getName())
|
||||
.withLastCommit(hook.getMergeRequest().getMergeCommitSha())
|
||||
.withTargetProjectUrl(hook.getMergeRequest().getTarget().getUrl())
|
||||
|
|
|
@ -58,7 +58,7 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<PushHook>
|
|||
.withSourceNamespace(hook.getProject().getNamespace())
|
||||
.withSourceRepoUrl(hook.getProject().getUrl())
|
||||
.withSourceRepoSshUrl(hook.getProject().getSshUrl())
|
||||
.withSourceRepoHttpUrl(hook.getProject().getHttpUrl())
|
||||
.withSourceRepoHttpUrl(hook.getProject().getGitHttpUrl())
|
||||
.withMergeRequestTitle("")
|
||||
.withMergeRequestDescription("")
|
||||
.withMergeRequestId(null)
|
||||
|
|
|
@ -35,21 +35,21 @@ public class MergeRequestBuildAction extends BuildWebHookAction {
|
|||
|
||||
void processForCompatibility() {
|
||||
// url and homepage are introduced in 8.x versions of Gitee
|
||||
final MergeRequestObjectAttributes attributes = this.mergeRequestHook.getObjectAttributes();
|
||||
final MergeRequestObjectAttributes attributes = this.mergeRequestHook.getPullRequest();
|
||||
if (attributes != null) {
|
||||
final Project source = attributes.getSource();
|
||||
if (source != null && source.getHttpUrl() != null) {
|
||||
if (source != null && source.getGitHttpUrl() != null) {
|
||||
if (source.getUrl() == null) {
|
||||
source.setUrl(source.getHttpUrl());
|
||||
source.setUrl(source.getGitHttpUrl());
|
||||
}
|
||||
if (source.getHomepage() == null) {
|
||||
source.setHomepage(source.getHttpUrl().substring(0, source.getHttpUrl().lastIndexOf(".git")));
|
||||
source.setHomepage(source.getGitHttpUrl().substring(0, source.getGitHttpUrl().lastIndexOf(".git")));
|
||||
}
|
||||
}
|
||||
|
||||
// The MergeRequestHookTriggerHandlerImpl is looking for Project
|
||||
if (mergeRequestHook.getProject() == null && attributes.getTarget() != null) {
|
||||
mergeRequestHook.setProject(attributes.getTarget());
|
||||
if (mergeRequestHook.getRepo() == null && attributes.getTarget() != null) {
|
||||
mergeRequestHook.setRepo(attributes.getTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue