修复不同WebHook相同序号的 PR 请求,并发触发的构建被判断为相同构建取消问题
This commit is contained in:
parent
d8badc62f1
commit
4b67166d50
|
@ -85,16 +85,17 @@ public abstract class AbstractWebHookTriggerHandler<H extends WebHook> implement
|
||||||
protected abstract BuildStatusUpdate retrieveBuildStatusUpdate(H hook);
|
protected abstract BuildStatusUpdate retrieveBuildStatusUpdate(H hook);
|
||||||
|
|
||||||
protected URIish retrieveUrIish(WebHook hook, GitSCM gitSCM) {
|
protected URIish retrieveUrIish(WebHook hook, GitSCM gitSCM) {
|
||||||
if (gitSCM == null) {
|
if (hook.getRepository() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<URIish> uris = new ArrayList<URIish>();
|
|
||||||
try {
|
try {
|
||||||
if (hook.getRepository() != null) {
|
if (gitSCM == null) {
|
||||||
uris.add(new URIish(hook.getRepository().getUrl()));
|
return new URIish(hook.getRepository().getGitHttpUrl());
|
||||||
uris.add(new URIish(hook.getRepository().getGitHttpUrl()));
|
|
||||||
uris.add(new URIish(hook.getRepository().getGitSshUrl()));
|
|
||||||
}
|
}
|
||||||
|
List<URIish> uris = new ArrayList<URIish>();
|
||||||
|
uris.add(new URIish(hook.getRepository().getUrl()));
|
||||||
|
uris.add(new URIish(hook.getRepository().getGitHttpUrl()));
|
||||||
|
uris.add(new URIish(hook.getRepository().getGitSshUrl()));
|
||||||
// uri 需与当前项目仓库个url一致,避免触发多个构建
|
// uri 需与当前项目仓库个url一致,避免触发多个构建
|
||||||
for (RemoteConfig remote : gitSCM.getRepositories()) {
|
for (RemoteConfig remote : gitSCM.getRepositories()) {
|
||||||
for (URIish remoteURL : remote.getURIs()) {
|
for (URIish remoteURL : remote.getURIs()) {
|
||||||
|
|
|
@ -139,8 +139,8 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
||||||
|
|
||||||
private String retrieveRevisionToBuild(NoteHook hook) throws NoRevisionToBuildException {
|
private String retrieveRevisionToBuild(NoteHook hook) throws NoRevisionToBuildException {
|
||||||
if (hook.getPullRequest() != null
|
if (hook.getPullRequest() != null
|
||||||
&& hook.getPullRequest().getMergeReferenceName() != null) {
|
&& hook.getPullRequest().getMergeCommitSha() != null) {
|
||||||
return hook.getPullRequest().getMergeReferenceName();
|
return hook.getPullRequest().getMergeCommitSha();
|
||||||
} else {
|
} else {
|
||||||
throw new NoRevisionToBuildException();
|
throw new NoRevisionToBuildException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,8 +203,8 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
||||||
|
|
||||||
private String retrieveRevisionToBuild(PullRequestHook hook) throws NoRevisionToBuildException {
|
private String retrieveRevisionToBuild(PullRequestHook hook) throws NoRevisionToBuildException {
|
||||||
if (hook.getPullRequest() != null
|
if (hook.getPullRequest() != null
|
||||||
&& hook.getPullRequest().getMergeReferenceName() != null) {
|
&& hook.getPullRequest().getMergeCommitSha() != null) {
|
||||||
return hook.getPullRequest().getMergeReferenceName();
|
return hook.getPullRequest().getMergeCommitSha();
|
||||||
} else {
|
} else {
|
||||||
throw new NoRevisionToBuildException();
|
throw new NoRevisionToBuildException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue