更改pr命名

This commit is contained in:
yashin 2018-07-25 19:21:07 +08:00
parent c2e44e0ef1
commit a29a7d9a2f
8 changed files with 11 additions and 12 deletions

View File

@ -35,7 +35,7 @@ Gitee Jenkins Plugin 是码云基于 [GitLab Plugin](https://github.com/jenkinsc
- 设置 WebHook 验证密码。 - 设置 WebHook 验证密码。
- 构建后操作可配置 PR 触发的构建结果评论到码云对应的PR中。 - 构建后操作可配置 PR 触发的构建结果评论到码云对应的PR中。
- 构建后操作可配置 PR 触发的构建成功后可自动合并对应PR。 - 构建后操作可配置 PR 触发的构建成功后可自动合并对应PR。
- 不可自动合并的PR不触发构建且若配置了评论到PR的功能则评论到 PR 提示冲突。 - 对于 PR 相关的所有事件,若 PR 代码冲突不可自动合并,则不触发构建;且若配置了评论到PR的功能则评论到 PR 提示冲突。
## 计划中特性 ## 计划中特性
- PR 审查并测试通过触发构建。 - PR 审查并测试通过触发构建。

View File

@ -16,7 +16,7 @@ interface GiteeV5ApiProxy extends GiteeApiProxy {
@PUT @PUT
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/repos/{ownerPath}/{repoPath}/pulls/{prNumber}/merge") @Path("/repos/{ownerPath}/{repoPath}/pulls/{prNumber}/pull")
void acceptPullRequest(@PathParam("ownerPath") String ownerPath, void acceptPullRequest(@PathParam("ownerPath") String ownerPath,
@PathParam("repoPath") String repoPath, @PathParam("repoPath") String repoPath,
@PathParam("prNumber") Integer prNumber); @PathParam("prNumber") Integer prNumber);

View File

@ -80,7 +80,7 @@ public class PullRequestHook extends WebHook {
} }
public String getWebHookDescription() { public String getWebHookDescription() {
return getHookName() + " iid = " + pullRequest.getNumber() + " merge commit sha = " + pullRequest.getMergeCommitSha(); return getHookName() + " iid = " + pullRequest.getNumber() + " pull commit sha = " + pullRequest.getMergeCommitSha();
} }
@Override @Override

View File

@ -12,7 +12,7 @@ import com.gitee.jenkins.publisher.GiteeAcceptPullRequestPublisher;
import com.gitee.jenkins.publisher.GiteeMessagePublisher; import com.gitee.jenkins.publisher.GiteeMessagePublisher;
import com.gitee.jenkins.trigger.filter.*; import com.gitee.jenkins.trigger.filter.*;
import com.gitee.jenkins.trigger.filter.PullRequestLabelFilterConfig; import com.gitee.jenkins.trigger.filter.PullRequestLabelFilterConfig;
import com.gitee.jenkins.trigger.handler.merge.PullRequestHookTriggerHandler; import com.gitee.jenkins.trigger.handler.pull.PullRequestHookTriggerHandler;
import com.gitee.jenkins.trigger.handler.note.NoteHookTriggerHandler; import com.gitee.jenkins.trigger.handler.note.NoteHookTriggerHandler;
import com.gitee.jenkins.trigger.handler.pipeline.PipelineHookTriggerHandler; import com.gitee.jenkins.trigger.handler.pipeline.PipelineHookTriggerHandler;
import com.gitee.jenkins.trigger.handler.push.PushHookTriggerHandler; import com.gitee.jenkins.trigger.handler.push.PushHookTriggerHandler;
@ -47,7 +47,7 @@ import java.io.ObjectStreamException;
import java.security.SecureRandom; import java.security.SecureRandom;
import static com.gitee.jenkins.trigger.filter.BranchFilterConfig.BranchFilterConfigBuilder.branchFilterConfig; import static com.gitee.jenkins.trigger.filter.BranchFilterConfig.BranchFilterConfigBuilder.branchFilterConfig;
import static com.gitee.jenkins.trigger.handler.merge.PullRequestHookTriggerHandlerFactory.newPullRequestHookTriggerHandler; import static com.gitee.jenkins.trigger.handler.pull.PullRequestHookTriggerHandlerFactory.newPullRequestHookTriggerHandler;
import static com.gitee.jenkins.trigger.handler.note.NoteHookTriggerHandlerFactory.newNoteHookTriggerHandler; import static com.gitee.jenkins.trigger.handler.note.NoteHookTriggerHandlerFactory.newNoteHookTriggerHandler;
import static com.gitee.jenkins.trigger.handler.pipeline.PipelineHookTriggerHandlerFactory.newPipelineHookTriggerHandler; import static com.gitee.jenkins.trigger.handler.pipeline.PipelineHookTriggerHandlerFactory.newPipelineHookTriggerHandler;
import static com.gitee.jenkins.trigger.handler.push.PushHookTriggerHandlerFactory.newPushHookTriggerHandler; import static com.gitee.jenkins.trigger.handler.push.PushHookTriggerHandlerFactory.newPushHookTriggerHandler;

View File

@ -1,4 +1,4 @@
package com.gitee.jenkins.trigger.handler.merge; package com.gitee.jenkins.trigger.handler.pull;
import com.gitee.jenkins.gitee.hook.model.PullRequestHook; import com.gitee.jenkins.gitee.hook.model.PullRequestHook;
import com.gitee.jenkins.trigger.filter.BranchFilter; import com.gitee.jenkins.trigger.filter.BranchFilter;

View File

@ -1,4 +1,4 @@
package com.gitee.jenkins.trigger.handler.merge; package com.gitee.jenkins.trigger.handler.pull;
import com.gitee.jenkins.gitee.hook.model.PullRequestHook; import com.gitee.jenkins.gitee.hook.model.PullRequestHook;
import com.gitee.jenkins.trigger.handler.WebHookTriggerHandler; import com.gitee.jenkins.trigger.handler.WebHookTriggerHandler;

View File

@ -1,4 +1,4 @@
package com.gitee.jenkins.trigger.handler.merge; package com.gitee.jenkins.trigger.handler.pull;
import com.gitee.jenkins.gitee.hook.model.Action; import com.gitee.jenkins.gitee.hook.model.Action;
import com.gitee.jenkins.gitee.hook.model.State; import com.gitee.jenkins.gitee.hook.model.State;

View File

@ -1,4 +1,4 @@
package com.gitee.jenkins.trigger.handler.merge; package com.gitee.jenkins.trigger.handler.pull;
import com.gitee.jenkins.cause.CauseData; import com.gitee.jenkins.cause.CauseData;
import com.gitee.jenkins.cause.GiteeWebHookCause; import com.gitee.jenkins.cause.GiteeWebHookCause;
@ -7,7 +7,6 @@ import com.gitee.jenkins.gitee.api.model.PullRequest;
import com.gitee.jenkins.gitee.hook.model.*; import com.gitee.jenkins.gitee.hook.model.*;
import com.gitee.jenkins.gitee.hook.model.PullRequestHook; import com.gitee.jenkins.gitee.hook.model.PullRequestHook;
import com.gitee.jenkins.publisher.GiteeMessagePublisher; import com.gitee.jenkins.publisher.GiteeMessagePublisher;
import com.gitee.jenkins.trigger.GiteePushTrigger;
import com.gitee.jenkins.trigger.exception.NoRevisionToBuildException; import com.gitee.jenkins.trigger.exception.NoRevisionToBuildException;
import com.gitee.jenkins.trigger.filter.BranchFilter; import com.gitee.jenkins.trigger.filter.BranchFilter;
import com.gitee.jenkins.trigger.filter.PullRequestLabelFilter; import com.gitee.jenkins.trigger.filter.PullRequestLabelFilter;
@ -71,13 +70,13 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
// 若pr不可自动合并则评论至pr // 若pr不可自动合并则评论至pr
if (!objectAttributes.can_be_merged()) { if (!objectAttributes.can_be_merged()) {
LOGGER.log(Level.INFO, "This pull request can not be merge"); LOGGER.log(Level.INFO, "This pull request can not be pull");
GiteeMessagePublisher publisher = GiteeMessagePublisher.getFromJob(job); GiteeMessagePublisher publisher = GiteeMessagePublisher.getFromJob(job);
if (publisher != null) { if (publisher != null) {
GiteeClient client = getClient(job); GiteeClient client = getClient(job);
PullRequest pullRequest = new PullRequest(objectAttributes); PullRequest pullRequest = new PullRequest(objectAttributes);
LOGGER.log(Level.INFO, "sending message to gitee....."); LOGGER.log(Level.INFO, "sending message to gitee.....");
client.createPullRequestNote(pullRequest, ":bangbang: This pull request can not be merge! The build will not be triggered. Please manual merge conflict."); client.createPullRequestNote(pullRequest, ":bangbang: This pull request can not be pull! The build will not be triggered. Please manual pull conflict.");
} }
return; return;
} else if (pullRequestLabelFilter.isPullRequestAllowed(labelsNames)) { } else if (pullRequestLabelFilter.isPullRequestAllowed(labelsNames)) {