Compare commits
38 Commits
zhangguixi
...
master
Author | SHA1 | Date |
---|---|---|
Guixian Zhang | b073013674 | |
Yashin | f8da78cbf5 | |
yashin | 95fd15985a | |
Guixian Zhang | 7141908ccb | |
Guixian Zhang | 4b6f91c17a | |
yashin | 3dde5acd67 | |
yashin | 3b77cd2c8b | |
Yashin | 7b53f0d613 | |
Guixian Zhang | 9fafeb7c5b | |
yashin | fce5b691b9 | |
yashin | 0588afd9fa | |
Yashin | 4eea07ed96 | |
Guixian Zhang | b4f954e3f1 | |
Guixian Zhang | e1da6195ce | |
silverballer | 73ae3794a3 | |
Guixian Zhang | 416f7ad38f | |
yashin | 9a8855fff2 | |
yashin | bf18ae350e | |
Yashin | 4c16f59c57 | |
Guixian Zhang | d155c42a96 | |
yashin | 879e5027b9 | |
yashin | 6082eb8255 | |
Yashin | a11c8b9201 | |
Guixian Zhang | fe8db03c7d | |
Guixian Zhang | c6c5d50e41 | |
Guixian Zhang | de24a2cce0 | |
Yashin | 12457b66d4 | |
yashin | 68bc6bf280 | |
yashin | 65d027b406 | |
yashin | ed4ede6fad | |
yashin | 51ff954947 | |
yashin | a1ecf59abe | |
yashin | 91d8b61f95 | |
yashin | 474e06c4bf | |
yashin | cf03c22092 | |
yashin | ea04e83e7a | |
yashin | d0a31c7261 | |
yashin | 25957fd1a3 |
|
@ -17,6 +17,7 @@
|
|||
- [新建码云项目WebHook](#新建码云项目WebHook)
|
||||
- [测试推送触发构建](#测试推送触发构建)
|
||||
- [测试PR触发构建](#测试PR触发构建)
|
||||
- [使用脚本配置触发器](#使用脚本配置触发器)
|
||||
- [环境变量](#环境变量)
|
||||
- [用户支持](#用户支持)
|
||||
- [参与贡献](#参与贡献)
|
||||
|
@ -135,11 +136,11 @@ Gitee Jenkins Plugin 是码云基于 [GitLab Plugin](https://github.com/jenkinsc
|
|||
- `[ci-build] trigger build` :commit message 或者 PR 说明包含 `[ci-build]` 时,触发构建。
|
||||
3. `Ignore last commit has build` 该选项可以跳过已经构建过的 Commit 版本。
|
||||
4. `Cancel incomplete build on same Pull Requests` 该选项在 PR 触发构建时,会判断是否存在相同 PR 且未完成的构建,有则取消未完成构建,再进行当前构建。
|
||||
5. `Allowed branches` 可以配置允许构建的分支,目前支持分支名和正则表达式的方式进行过滤。
|
||||
6. `Secret Token for Gitee WebHook` 该选项可以配置 WebHook 的密码,该密码需要与码云 WebHook配置的密码一致方可触发构建。
|
||||
7. 注意:若 PR 状态为不可自动合并,则不触发构建。
|
||||
![触发器配置](https://images.gitee.com/uploads/images/2020/1231/093554_e4c48be9_2102225.png "屏幕截图.png")
|
||||
|
||||
5. `Ignore Pull Request conflicts` 该选项在 PR 触发构建时,会根据 PR 冲突情况选择是否进行构建。
|
||||
6. `Allowed branches` 可以配置允许构建的分支,目前支持分支名和正则表达式的方式进行过滤。
|
||||
7. `Secret Token for Gitee WebHook` 该选项可以配置 WebHook 的密码,该密码需要与码云 WebHook配置的密码一致方可触发构建。
|
||||
8. 注意:若 PR 状态为不可自动合并,则不触发构建。
|
||||
![触发器配置](https://images.gitee.com/uploads/images/2021/0107/171932_e25c8359_2102225.png "屏幕截图.png")
|
||||
### 构建后步骤配置
|
||||
|
||||
前往任务配置的构建后配置: Configure -> Post-build Actions 选项卡
|
||||
|
@ -172,6 +173,65 @@ Gitee Jenkins Plugin 是码云基于 [GitLab Plugin](https://github.com/jenkinsc
|
|||
1. 码云的 WebHook 管理中选择勾选了 Pull Request 的 WebHook 点击测试,观察 Jenkins 任务的构建状态
|
||||
2. 在码云项目中新建一个Pull Request,观察 Jenkins 任务的构建状态
|
||||
|
||||
## 使用脚本配置触发器
|
||||
```groovy
|
||||
pipeline {
|
||||
|
||||
agent any
|
||||
|
||||
triggers {
|
||||
gitee (
|
||||
// 推送代码
|
||||
triggerOnPush: true,
|
||||
// 评论提交记录
|
||||
triggerOnCommitComment: true,
|
||||
// 新建 Pull Requests
|
||||
triggerOnOpenPullRequest: true,
|
||||
// 更新 Pull Requests "0":None "1":Source Branch updated "2":Target Branch updated "3":Both Source and Target Branch updated
|
||||
triggerOnUpdatePullRequest: "1",
|
||||
// 接受 Pull Requests
|
||||
triggerOnAcceptedPullRequest: true,
|
||||
// 关闭 Pull Requests
|
||||
triggerOnClosedPullRequest: true,
|
||||
// 审查通过 Pull Requests
|
||||
triggerOnApprovedPullRequest: true,
|
||||
// 测试通过 Pull Requests
|
||||
triggerOnTestedPullRequest: true,
|
||||
// 评论 Pull Requests
|
||||
triggerOnNoteRequest: true,
|
||||
// 评论内容的正则表达式
|
||||
noteRegex: "build",
|
||||
// 构建指令过滤 "NONE":无 "CI_SKIP":[ci-skip] 指令跳过构建 "CI_BUILD":[ci-build] 指令触发构建
|
||||
buildInstructionFilterType: "NONE",
|
||||
// PR 不要求必须测试时过滤构建
|
||||
ciSkipFroTestNotRequired: false,
|
||||
// 过滤已经构建的 Commit 版本
|
||||
skipLastCommitHasBeenBuild: false,
|
||||
// 取消相同 Pull Requests 未完成构建
|
||||
cancelIncompleteBuildOnSamePullRequest: false,
|
||||
// 允许触发构建的分支 "All":允许所有分支触发构建 "NameBasedFilter":根据分支名过滤 "RegexBasedFilter":根据正则表达式过滤分支
|
||||
branchFilterType: "All",
|
||||
// "NameBasedFilter" - 包括
|
||||
includeBranchesSpec: "include",
|
||||
// "NameBasedFilter" - 排除
|
||||
excludeBranchesSpec: "exclude",
|
||||
// "RegexBasedFilter" - 目标分支的正则表达式
|
||||
targetBranchRegex: "regex",
|
||||
// Gitee WebHook 密码
|
||||
secretToken: "123456"
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps{
|
||||
echo 'Hello world!'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
# 环境变量
|
||||
目前支持环境变量见以下函数,其中不同的 WebHook 触发可能导致有些变量为空,具体请安装插件 [EnvInject Plugin](https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin),于构建中查看 Environment Variables
|
||||
|
||||
|
@ -208,6 +268,9 @@ Gitee Jenkins Plugin 是码云基于 [GitLab Plugin](https://github.com/jenkinsc
|
|||
variables.put("giteeTargetRepoHttpUrl", targetRepoHttpUrl);
|
||||
variables.put("giteeBefore", before);
|
||||
variables.put("giteeAfter", after);
|
||||
variables.put("giteeBeforeCommitSha", before);
|
||||
variables.put("giteeAfterCommitSha", after);
|
||||
variables.put("giteeRef", ref);
|
||||
variables.put("ref", ref);
|
||||
variables.put("beforeSha", beforeSha);
|
||||
variables.put("isTag", isTag);
|
||||
|
@ -217,9 +280,12 @@ Gitee Jenkins Plugin 是码云基于 [GitLab Plugin](https://github.com/jenkinsc
|
|||
variables.put("createdAt", createdAt);
|
||||
variables.put("finishedAt", finishedAt);
|
||||
variables.put("duration", buildDuration);
|
||||
variables.put("jsonBody", jsonBody);
|
||||
variables.put("noteBody", noteBody);
|
||||
variables.putIfNotNull("giteeTriggerPhrase", triggerPhrase);
|
||||
return variables;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
# 用户支持
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
|||
</properties>
|
||||
|
||||
<artifactId>gitee</artifactId>
|
||||
<version>1.1.12-SNAPSHOT</version>
|
||||
<version>1.2.5-SNAPSHOT</version>
|
||||
<name>Gitee Plugin</name>
|
||||
<description>This plugin integrates Gitee to Jenkins by faking a Gitee CI Server. This plugin allows Gitee to trigger builds in Jenkins when code is committed or pull requests are opened/updated. It can also send build status back to Gitee.</description>
|
||||
<url>https://wiki.jenkins.io/display/JENKINS/Gitee+Plugin</url>
|
||||
|
|
|
@ -59,6 +59,8 @@ public final class CauseData {
|
|||
private final String createdAt;
|
||||
private final String finishedAt;
|
||||
private final String buildDuration;
|
||||
private final String jsonBody;
|
||||
private final String noteBody;
|
||||
private final boolean created;
|
||||
private final boolean deleted;
|
||||
|
||||
|
@ -70,7 +72,7 @@ public final class CauseData {
|
|||
String targetRepoSshUrl, String targetRepoHttpUrl, String triggeredByUser, String before, String after, String lastCommit,
|
||||
String targetProjectUrl, String triggerPhrase, String pullRequestState, String mergedByUser, String pullRequestAssignee,
|
||||
String ref, String isTag, String sha, String beforeSha, String status, String stages, String createdAt, String finishedAt,
|
||||
String buildDuration, String pathWithNamespace, boolean created, boolean deleted) {
|
||||
String buildDuration, String pathWithNamespace, boolean created, boolean deleted, String jsonBody, String noteBody) {
|
||||
this.actionType = checkNotNull(actionType, "actionType must not be null.");
|
||||
this.sourceProjectId = checkNotNull(sourceProjectId, "sourceProjectId must not be null.");
|
||||
this.targetProjectId = checkNotNull(targetProjectId, "targetProjectId must not be null.");
|
||||
|
@ -117,6 +119,8 @@ public final class CauseData {
|
|||
this.pathWithNamespace = pathWithNamespace;
|
||||
this.created = created;
|
||||
this.deleted = deleted;
|
||||
this.jsonBody = jsonBody;
|
||||
this.noteBody = noteBody;
|
||||
}
|
||||
|
||||
public Map<String, String> getBuildVariables() {
|
||||
|
@ -162,6 +166,8 @@ public final class CauseData {
|
|||
variables.put("createdAt", createdAt);
|
||||
variables.put("finishedAt", finishedAt);
|
||||
variables.put("duration", buildDuration);
|
||||
variables.put("jsonBody", jsonBody);
|
||||
variables.put("noteBody", noteBody);
|
||||
variables.putIfNotNull("giteeTriggerPhrase", triggerPhrase);
|
||||
return variables;
|
||||
}
|
||||
|
@ -298,6 +304,10 @@ public final class CauseData {
|
|||
|
||||
public String getBuildDuration() { return buildDuration; }
|
||||
|
||||
public String getJsonBody() { return jsonBody; }
|
||||
|
||||
public String getNoteBody() { return noteBody; }
|
||||
|
||||
|
||||
String getShortDescription() {
|
||||
return actionType.getShortDescription(this);
|
||||
|
@ -386,6 +396,8 @@ public final class CauseData {
|
|||
.append(pathWithNamespace, causeData.getPathWithNamespace())
|
||||
.append(created, causeData.getCreated())
|
||||
.append(deleted, causeData.getDeleted())
|
||||
.append(jsonBody, causeData.getJsonBody())
|
||||
.append(noteBody, causeData.getNoteBody())
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
|
@ -435,6 +447,8 @@ public final class CauseData {
|
|||
.append(pathWithNamespace)
|
||||
.append(created)
|
||||
.append(deleted)
|
||||
.append(jsonBody)
|
||||
.append(noteBody)
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
|
@ -484,6 +498,8 @@ public final class CauseData {
|
|||
.append("pathWithNamespace", pathWithNamespace)
|
||||
.append("created", created)
|
||||
.append("deleted", deleted)
|
||||
.append("jsonBody", jsonBody)
|
||||
.append("noteBody", noteBody)
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,12 @@ public abstract class WebHook {
|
|||
private Repository repository;
|
||||
private String objectKind;
|
||||
private String hookName;
|
||||
private String jsonBody;
|
||||
private User sender;
|
||||
|
||||
public String getJsonBody() { return this.jsonBody; }
|
||||
|
||||
public void setJsonBody(String json) { this.jsonBody = json; }
|
||||
|
||||
public String getHookName() {
|
||||
return this.hookName;
|
||||
|
@ -38,6 +44,14 @@ public abstract class WebHook {
|
|||
this.repository = repository;
|
||||
}
|
||||
|
||||
public User getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(User sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
public String getWebHookDescription() {
|
||||
return hookName;
|
||||
}
|
||||
|
@ -55,6 +69,7 @@ public abstract class WebHook {
|
|||
.append(repository, webHook.repository)
|
||||
.append(objectKind, webHook.objectKind)
|
||||
.append(hookName, webHook.hookName)
|
||||
.append(sender, webHook.sender)
|
||||
.isEquals();
|
||||
}
|
||||
|
||||
|
@ -64,6 +79,7 @@ public abstract class WebHook {
|
|||
.append(repository)
|
||||
.append(hookName)
|
||||
.append(objectKind)
|
||||
.append(sender)
|
||||
.toHashCode();
|
||||
}
|
||||
|
||||
|
@ -73,6 +89,7 @@ public abstract class WebHook {
|
|||
.append("repository", repository)
|
||||
.append("hookName", hookName)
|
||||
.append("objectKind", objectKind)
|
||||
.append("sender", sender)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
private boolean triggerOnNoteRequest = true;
|
||||
private String noteRegex = "";
|
||||
private transient boolean ciSkip = true;
|
||||
private BuildInstructionFilterType buildInstructionFilterType;
|
||||
private BuildInstructionFilterType buildInstructionFilterType = BuildInstructionFilterType.NONE;
|
||||
private boolean skipWorkInProgressPullRequest;
|
||||
private boolean ciSkipFroTestNotRequired;
|
||||
private boolean skipLastCommitHasBeenBuild;
|
||||
|
@ -95,6 +95,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
private String pendingBuildName;
|
||||
private boolean cancelPendingBuildsOnUpdate;
|
||||
private boolean cancelIncompleteBuildOnSamePullRequest;
|
||||
private boolean ignorePullRequestConflicts;
|
||||
|
||||
private transient BranchFilter branchFilter;
|
||||
private transient PushHookTriggerHandler pushHookTriggerHandler;
|
||||
|
@ -123,7 +124,8 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
String includeBranchesSpec, String excludeBranchesSpec, String targetBranchRegex,
|
||||
PullRequestLabelFilterConfig pullRequestLabelFilterConfig, String secretToken, boolean triggerOnPipelineEvent,
|
||||
boolean triggerOnApprovedPullRequest, String pendingBuildName, boolean cancelPendingBuildsOnUpdate,
|
||||
boolean cancelIncompleteBuildOnSamePullRequest) {
|
||||
boolean cancelIncompleteBuildOnSamePullRequest,
|
||||
boolean ignorePullRequestConflicts) {
|
||||
this.triggerOnPush = triggerOnPush;
|
||||
this.triggerOnCommitComment = triggerOnCommitComment;
|
||||
this.triggerOnOpenPullRequest = triggerOnOpenPullRequest;
|
||||
|
@ -151,6 +153,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
this.pendingBuildName = pendingBuildName;
|
||||
this.cancelPendingBuildsOnUpdate = cancelPendingBuildsOnUpdate;
|
||||
this.cancelIncompleteBuildOnSamePullRequest = cancelIncompleteBuildOnSamePullRequest;
|
||||
this.ignorePullRequestConflicts = ignorePullRequestConflicts;
|
||||
|
||||
initializeTriggerHandler();
|
||||
initializeBranchFilter();
|
||||
|
@ -204,19 +207,20 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
}
|
||||
|
||||
// 兼容构建指令升级
|
||||
if (!oldConfig.jobsMigrated3) {
|
||||
if (!oldConfig.jobsMigrated4) {
|
||||
for (AbstractProject<?, ?> project : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
|
||||
GiteePushTrigger trigger = project.getTrigger(GiteePushTrigger.class);
|
||||
if (trigger != null) {
|
||||
if (trigger.getCiSkip()) {
|
||||
trigger.setBuildInstructionFilterType(BuildInstructionFilterType.CI_SKIP);
|
||||
} else {
|
||||
} else if (trigger.getBuildInstructionFilterType() == null) {
|
||||
trigger.setBuildInstructionFilterType(BuildInstructionFilterType.NONE);
|
||||
}
|
||||
project.save();
|
||||
}
|
||||
}
|
||||
oldConfig.jobsMigrated3 = true;
|
||||
oldConfig.jobsMigrated3 = false;
|
||||
oldConfig.jobsMigrated4 = true;
|
||||
oldConfig.save();
|
||||
}
|
||||
|
||||
|
@ -334,6 +338,10 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
return cancelIncompleteBuildOnSamePullRequest;
|
||||
}
|
||||
|
||||
public boolean isIgnorePullRequestConflicts() {
|
||||
return ignorePullRequestConflicts;
|
||||
}
|
||||
|
||||
@DataBoundSetter
|
||||
public void setTriggerOnPush(boolean triggerOnPush) {
|
||||
this.triggerOnPush = triggerOnPush;
|
||||
|
@ -491,6 +499,11 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
this.cancelIncompleteBuildOnSamePullRequest = cancelIncompleteBuildOnSamePullRequest;
|
||||
}
|
||||
|
||||
@DataBoundSetter
|
||||
public void setIgnorePullRequestConflicts(boolean ignorePullRequestConflicts) {
|
||||
this.ignorePullRequestConflicts = ignorePullRequestConflicts;
|
||||
}
|
||||
|
||||
// executes when the Trigger receives a push request
|
||||
public void onPost(final PushHook hook) {
|
||||
if (branchFilter == null) {
|
||||
|
@ -545,9 +558,10 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
pullRequestHookTriggerHandler = newPullRequestHookTriggerHandler(triggerOnOpenPullRequest,
|
||||
triggerOnUpdatePullRequest, triggerOnAcceptedPullRequest, triggerOnClosedPullRequest,
|
||||
skipWorkInProgressPullRequest, triggerOnApprovedPullRequest, triggerOnTestedPullRequest, cancelPendingBuildsOnUpdate, ciSkipFroTestNotRequired,
|
||||
cancelIncompleteBuildOnSamePullRequest
|
||||
cancelIncompleteBuildOnSamePullRequest,
|
||||
ignorePullRequestConflicts
|
||||
);
|
||||
noteHookTriggerHandler = newNoteHookTriggerHandler(triggerOnCommitComment, triggerOnNoteRequest, noteRegex, ciSkipFroTestNotRequired, cancelIncompleteBuildOnSamePullRequest);
|
||||
noteHookTriggerHandler = newNoteHookTriggerHandler(triggerOnCommitComment, triggerOnNoteRequest, noteRegex, ciSkipFroTestNotRequired, cancelIncompleteBuildOnSamePullRequest, ignorePullRequestConflicts);
|
||||
pushHookTriggerHandler = newPushHookTriggerHandler(triggerOnPush, skipWorkInProgressPullRequest);
|
||||
pipelineTriggerHandler = newPipelineHookTriggerHandler(triggerOnPipelineEvent);
|
||||
}
|
||||
|
@ -597,6 +611,7 @@ public class GiteePushTrigger extends Trigger<Job<?, ?>> {
|
|||
private boolean jobsMigrated = false;
|
||||
private boolean jobsMigrated2 = false;
|
||||
private boolean jobsMigrated3 = false;
|
||||
private boolean jobsMigrated4 = false;
|
||||
private String GiteeApiToken;
|
||||
private String giteeHostUrl = "";
|
||||
private boolean ignoreCertificateErrors = false;
|
||||
|
|
|
@ -8,9 +8,7 @@ import com.gitee.jenkins.trigger.filter.BranchFilter;
|
|||
import com.gitee.jenkins.trigger.filter.BuildInstructionFilter;
|
||||
import com.gitee.jenkins.trigger.filter.PullRequestLabelFilter;
|
||||
import com.gitee.jenkins.util.LoggerUtil;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.CauseAction;
|
||||
import hudson.model.Job;
|
||||
import hudson.model.*;
|
||||
import hudson.plugins.git.GitSCM;
|
||||
import hudson.plugins.git.RevisionParameterAction;
|
||||
import hudson.scm.SCM;
|
||||
|
@ -19,10 +17,14 @@ import jenkins.triggers.SCMTriggerItem;
|
|||
import net.karneim.pojobuilder.GeneratePojoBuilder;
|
||||
import org.eclipse.jgit.transport.RemoteConfig;
|
||||
import org.eclipse.jgit.transport.URIish;
|
||||
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
@ -89,24 +91,19 @@ public abstract class AbstractWebHookTriggerHandler<H extends WebHook> implement
|
|||
protected abstract BuildStatusUpdate retrieveBuildStatusUpdate(H hook);
|
||||
|
||||
protected URIish retrieveUrIish(WebHook hook, GitSCM gitSCM) {
|
||||
if (hook.getRepository() == null) {
|
||||
if (hook.getRepository() == null || gitSCM == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (gitSCM == null) {
|
||||
return new URIish(hook.getRepository().getGitHttpUrl());
|
||||
}
|
||||
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()));
|
||||
Set<URIish> set = new HashSet<>();
|
||||
set.add(new URIish(hook.getRepository().getUrl()));
|
||||
set.add(new URIish(hook.getRepository().getGitHttpUrl()));
|
||||
set.add(new URIish(hook.getRepository().getGitSshUrl()));
|
||||
// uri 需与当前项目仓库个url一致,避免触发多个构建
|
||||
for (RemoteConfig remote : gitSCM.getRepositories()) {
|
||||
for (URIish remoteURL : remote.getURIs()) {
|
||||
for (URIish uri : uris) {
|
||||
if (remoteURL.equals(uri)) {
|
||||
return uri;
|
||||
}
|
||||
if (set.contains(remoteURL)) {
|
||||
return remoteURL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +145,20 @@ public abstract class AbstractWebHookTriggerHandler<H extends WebHook> implement
|
|||
return null;
|
||||
}
|
||||
|
||||
protected void doStop(Run<?, ?> build) throws IOException, ServletException {
|
||||
if (build.isBuilding()) {
|
||||
if (build instanceof AbstractBuild) {
|
||||
((AbstractBuild) build).doStop();
|
||||
LOGGER.log(Level.WARNING, "Abort incomplete build");
|
||||
} else if (build instanceof WorkflowRun) {
|
||||
((WorkflowRun) build).doStop();
|
||||
LOGGER.log(Level.WARNING, "Abort incomplete build");
|
||||
} else {
|
||||
LOGGER.log(Level.WARNING, "Unable to abort incomplete build, build type not found: " + build.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class BuildStatusUpdate {
|
||||
private final Integer projectId;
|
||||
private final String sha;
|
||||
|
|
|
@ -7,9 +7,9 @@ public final class NoteHookTriggerHandlerFactory {
|
|||
|
||||
private NoteHookTriggerHandlerFactory() {}
|
||||
|
||||
public static NoteHookTriggerHandler newNoteHookTriggerHandler(boolean triggerOnCommitComment, boolean triggerOnNoteRequest, String noteRegex, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest) {
|
||||
public static NoteHookTriggerHandler newNoteHookTriggerHandler(boolean triggerOnCommitComment, boolean triggerOnNoteRequest, String noteRegex, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest, boolean ignorePullRequestConflicts) {
|
||||
if (triggerOnCommitComment || triggerOnNoteRequest) {
|
||||
return new NoteHookTriggerHandlerImpl(triggerOnCommitComment, triggerOnNoteRequest, noteRegex, ciSkipFroTestNotRequired, cancelIncompleteBuildOnSamePullRequest);
|
||||
return new NoteHookTriggerHandlerImpl(triggerOnCommitComment, triggerOnNoteRequest, noteRegex, ciSkipFroTestNotRequired, cancelIncompleteBuildOnSamePullRequest, ignorePullRequestConflicts);
|
||||
} else {
|
||||
return new NopNoteHookTriggerHandler();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import hudson.model.*;
|
|||
import hudson.plugins.git.GitSCM;
|
||||
import hudson.plugins.git.RevisionParameterAction;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.jgit.transport.URIish;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
|
@ -39,13 +40,15 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
private final String noteRegex;
|
||||
private final boolean ciSkipFroTestNotRequired;
|
||||
private final boolean cancelIncompleteBuildOnSamePullRequest;
|
||||
private boolean ignorePullRequestConflicts;
|
||||
|
||||
NoteHookTriggerHandlerImpl(boolean triggerOnCommitComment, boolean triggerOnNoteRequest, String noteRegex, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest) {
|
||||
NoteHookTriggerHandlerImpl(boolean triggerOnCommitComment, boolean triggerOnNoteRequest, String noteRegex, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest, boolean ignorePullRequestConflicts) {
|
||||
this.triggerOnCommitComment = triggerOnCommitComment;
|
||||
this.triggerOnNoteRequest = triggerOnNoteRequest;
|
||||
this.noteRegex = noteRegex;
|
||||
this.ciSkipFroTestNotRequired = ciSkipFroTestNotRequired;
|
||||
this.cancelIncompleteBuildOnSamePullRequest = cancelIncompleteBuildOnSamePullRequest;
|
||||
this.ignorePullRequestConflicts = ignorePullRequestConflicts;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,8 +56,12 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
if (isValidTrigger(hook)) {
|
||||
// 若pr不可自动合并则评论至pr
|
||||
PullRequestObjectAttributes objectAttributes = hook.getPullRequest();
|
||||
if (objectAttributes != null && !objectAttributes.isMergeable()) {
|
||||
if (!ignorePullRequestConflicts && objectAttributes != null && !objectAttributes.isMergeable()) {
|
||||
LOGGER.log(Level.INFO, "This pull request can not be merge");
|
||||
// fixme 无法获取 publisher
|
||||
// java.lang.ClassCastException: org.jenkinsci.plugins.workflow.job.WorkflowJob cannot be cast to hudson.model.AbstractProject
|
||||
// at com.gitee.jenkins.publisher.GiteeMessagePublisher.getFromJob(GiteeMessagePublisher.java:65)
|
||||
// at com.gitee.jenkins.trigger.handler.note.NoteHookTriggerHandlerImpl.handle(NoteHookTriggerHandlerImpl.java:47)
|
||||
GiteeMessagePublisher publisher = GiteeMessagePublisher.getFromJob(job);
|
||||
GiteeClient client = getClient(job);
|
||||
if (publisher != null && client != null) {
|
||||
|
@ -78,7 +85,10 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
|
||||
@Override
|
||||
protected boolean isCiSkip(NoteHook hook, BuildInstructionFilter buildInstructionFilter) {
|
||||
return hook.getPullRequest() == null ? false : !buildInstructionFilter.isBuildAllow(hook.getPullRequest().getBody());
|
||||
if (buildInstructionFilter != null && hook.getPullRequest() != null) {
|
||||
return !buildInstructionFilter.isBuildAllow(hook.getPullRequest().getBody());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,10 +128,7 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
&& causeData.getTargetRepoHttpUrl().equals(hook.getPullRequest().getTarget().getGitHttpUrl())
|
||||
&& causeData.getRef().equals(hook.getPullRequest().getMergeReferenceName())) {
|
||||
try {
|
||||
if (build.isBuilding()) {
|
||||
((AbstractBuild) build).doStop();
|
||||
LOGGER.log(Level.WARNING, "Abort incomplete build");
|
||||
}
|
||||
doStop(build);
|
||||
} catch (ServletException | IOException e) {
|
||||
LOGGER.log(Level.WARNING, "Unable to abort incomplete build", e);
|
||||
}
|
||||
|
@ -163,7 +170,7 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
.withTargetNamespace(hook.getProject().getNamespace())
|
||||
.withTargetRepoSshUrl(hook.getProject().getSshUrl())
|
||||
.withTargetRepoHttpUrl(hook.getProject().getGitHttpUrl())
|
||||
.withTriggeredByUser(hook.getComment().getUser().getName())
|
||||
.withTriggeredByUser(hook.getSender().getName())
|
||||
.withTriggerPhrase(hook.getComment().getBody())
|
||||
.withSha(hook.getComment().getCommitId())
|
||||
.withPathWithNamespace(hook.getProject().getPathWithNamespace())
|
||||
|
@ -194,7 +201,7 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
.withTargetNamespace(hook.getPullRequest().getTarget().getNamespace())
|
||||
.withTargetRepoSshUrl(hook.getPullRequest().getTarget().getSshUrl())
|
||||
.withTargetRepoHttpUrl(hook.getPullRequest().getTarget().getGitHttpUrl())
|
||||
.withTriggeredByUser(hook.getPullRequest().getHead().getUser().getName())
|
||||
.withTriggeredByUser(hook.getSender().getName())
|
||||
.withLastCommit(hook.getPullRequest().getMergeCommitSha())
|
||||
.withSha(hook.getPullRequest().getMergeCommitSha())
|
||||
.withAfter(hook.getPullRequest().getMergeCommitSha())
|
||||
|
@ -202,12 +209,23 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
.withTargetProjectUrl(hook.getPullRequest().getTarget().getUrl())
|
||||
.withTriggerPhrase(hook.getComment().getBody())
|
||||
.withPathWithNamespace(hook.getPullRequest().getBase().getRepo().getPathWithNamespace())
|
||||
.withJsonBody(hook.getJsonBody())
|
||||
.withNoteBody(hook.getComment().getBody())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RevisionParameterAction createRevisionParameter(NoteHook hook, GitSCM gitSCM) throws NoRevisionToBuildException {
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild(hook), retrieveUrIish(hook, gitSCM));
|
||||
// 没有配置git源码管理
|
||||
if (gitSCM == null) {
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild(hook));
|
||||
}
|
||||
URIish urIish = retrieveUrIish(hook, gitSCM);
|
||||
// webhook与git源码管理仓库对不上
|
||||
if (urIish == null) {
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild2(hook));
|
||||
}
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild(hook), urIish);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -224,6 +242,13 @@ class NoteHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<NoteHook>
|
|||
if (hook.getPullRequest().getMergeCommitSha() != null) {
|
||||
return hook.getPullRequest().getMergeCommitSha();
|
||||
}
|
||||
}
|
||||
|
||||
return retrieveRevisionToBuild2(hook);
|
||||
}
|
||||
|
||||
private String retrieveRevisionToBuild2(NoteHook hook) throws NoRevisionToBuildException {
|
||||
if (hook.getPullRequest() != null) {
|
||||
if (hook.getPullRequest().getMergeReferenceName() != null) {
|
||||
return hook.getPullRequest().getMergeReferenceName();
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ class PipelineHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pipel
|
|||
.withCreatedAt(hook.getObjectAttributes().getCreatedAt()==null?"":hook.getObjectAttributes().getCreatedAt().toString())
|
||||
.withFinishedAt(hook.getObjectAttributes().getFinishedAt()==null?"":hook.getObjectAttributes().getFinishedAt().toString())
|
||||
.withBuildDuration(String.valueOf(hook.getObjectAttributes().getDuration()))
|
||||
.withJsonBody(hook.getJsonBody())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
boolean triggerOnTestedPullRequest,
|
||||
boolean cancelPendingBuildsOnUpdate,
|
||||
boolean ciSkipFroTestNotRequired,
|
||||
boolean cancelIncompleteBuildOnSamePullRequest) {
|
||||
boolean cancelIncompleteBuildOnSamePullRequest,
|
||||
boolean ignorePullRequestConflicts) {
|
||||
if (triggerOnOpenPullRequest
|
||||
|| !("0".equals(triggerOnUpdatePullRequest) || "false".equals(triggerOnUpdatePullRequest))
|
||||
|| triggerOnAcceptedPullRequest
|
||||
|
@ -48,7 +49,8 @@ public final class PullRequestHookTriggerHandlerFactory {
|
|||
skipWorkInProgressPullRequest,
|
||||
cancelPendingBuildsOnUpdate,
|
||||
ciSkipFroTestNotRequired,
|
||||
cancelIncompleteBuildOnSamePullRequest);
|
||||
cancelIncompleteBuildOnSamePullRequest,
|
||||
ignorePullRequestConflicts);
|
||||
} else {
|
||||
return new NopPullRequestHookTriggerHandler();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import hudson.model.*;
|
|||
import hudson.plugins.git.GitSCM;
|
||||
import hudson.plugins.git.RevisionParameterAction;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.jgit.transport.URIish;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import java.io.IOException;
|
||||
|
@ -47,12 +48,13 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
|||
private final Collection<ActionDesc> allowedActionDesces;
|
||||
private final boolean cancelPendingBuildsOnUpdate;
|
||||
private final boolean cancelIncompleteBuildOnSamePullRequest;
|
||||
private boolean ignorePullRequestConflicts;
|
||||
|
||||
PullRequestHookTriggerHandlerImpl(Collection<State> allowedStates, boolean skipWorkInProgressPullRequest, boolean cancelPendingBuildsOnUpdate, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest) {
|
||||
this(allowedStates, EnumSet.allOf(Action.class), EnumSet.allOf(ActionDesc.class), skipWorkInProgressPullRequest, cancelPendingBuildsOnUpdate, ciSkipFroTestNotRequired, cancelIncompleteBuildOnSamePullRequest);
|
||||
PullRequestHookTriggerHandlerImpl(Collection<State> allowedStates, boolean skipWorkInProgressPullRequest, boolean cancelPendingBuildsOnUpdate, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest, boolean ignorePullRequestConflicts) {
|
||||
this(allowedStates, EnumSet.allOf(Action.class), EnumSet.allOf(ActionDesc.class), skipWorkInProgressPullRequest, cancelPendingBuildsOnUpdate, ciSkipFroTestNotRequired, cancelIncompleteBuildOnSamePullRequest, ignorePullRequestConflicts);
|
||||
}
|
||||
|
||||
PullRequestHookTriggerHandlerImpl(Collection<State> allowedStates, Collection<Action> allowedActions, Collection<ActionDesc> allowedActionDesces, boolean skipWorkInProgressPullRequest, boolean cancelPendingBuildsOnUpdate, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest) {
|
||||
PullRequestHookTriggerHandlerImpl(Collection<State> allowedStates, Collection<Action> allowedActions, Collection<ActionDesc> allowedActionDesces, boolean skipWorkInProgressPullRequest, boolean cancelPendingBuildsOnUpdate, boolean ciSkipFroTestNotRequired, boolean cancelIncompleteBuildOnSamePullRequest, boolean ignorePullRequestConflicts) {
|
||||
this.allowedStates = allowedStates;
|
||||
this.allowedActions = allowedActions;
|
||||
this.allowedActionDesces = allowedActionDesces;
|
||||
|
@ -60,6 +62,7 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
|||
this.cancelPendingBuildsOnUpdate = cancelPendingBuildsOnUpdate;
|
||||
this.ciSkipFroTestNotRequired = ciSkipFroTestNotRequired;
|
||||
this.cancelIncompleteBuildOnSamePullRequest = cancelIncompleteBuildOnSamePullRequest;
|
||||
this.ignorePullRequestConflicts = ignorePullRequestConflicts;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,7 +81,7 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
|||
}
|
||||
|
||||
// 若pr不可自动合并则评论至pr
|
||||
if (!objectAttributes.isMergeable()) {
|
||||
if (!ignorePullRequestConflicts && !objectAttributes.isMergeable()) {
|
||||
LOGGER.log(Level.INFO, "This pull request can not be merge");
|
||||
GiteeMessagePublisher publisher = GiteeMessagePublisher.getFromJob(job);
|
||||
GiteeClient client = getClient(job);
|
||||
|
@ -113,7 +116,10 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
|||
|
||||
@Override
|
||||
protected boolean isCiSkip(PullRequestHook hook, BuildInstructionFilter buildInstructionFilter) {
|
||||
return hook.getPullRequest() == null ? false : !buildInstructionFilter.isBuildAllow(hook.getPullRequest().getBody());
|
||||
if (buildInstructionFilter != null && hook.getPullRequest() != null) {
|
||||
return !buildInstructionFilter.isBuildAllow(hook.getPullRequest().getBody());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -173,10 +179,7 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
|||
&& causeData.getTargetRepoHttpUrl().equals(hook.getPullRequest().getTarget().getGitHttpUrl())
|
||||
&& causeData.getRef().equals(hook.getPullRequest().getMergeReferenceName())) {
|
||||
try {
|
||||
if (build.isBuilding()) {
|
||||
((AbstractBuild) build).doStop();
|
||||
LOGGER.log(Level.WARNING, "Abort incomplete build");
|
||||
}
|
||||
doStop(build);
|
||||
} catch (ServletException | IOException e) {
|
||||
LOGGER.log(Level.WARNING, "Unable to abort incomplete build", e);
|
||||
}
|
||||
|
@ -225,19 +228,29 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
|||
.withTargetNamespace(hook.getPullRequest().getTarget().getNamespace())
|
||||
.withTargetRepoSshUrl(hook.getPullRequest().getTarget().getSshUrl())
|
||||
.withTargetRepoHttpUrl(hook.getPullRequest().getTarget().getGitHttpUrl())
|
||||
.withTriggeredByUser(hook.getPullRequest().getHead().getUser().getName())
|
||||
.withTriggeredByUser(hook.getSender().getName())
|
||||
.withLastCommit(hook.getPullRequest().getMergeCommitSha())
|
||||
.withSha(hook.getPullRequest().getMergeCommitSha())
|
||||
.withAfter(hook.getPullRequest().getMergeCommitSha())
|
||||
.withRef(hook.getPullRequest().getMergeReferenceName())
|
||||
.withTargetProjectUrl(hook.getPullRequest().getTarget().getUrl())
|
||||
.withPathWithNamespace(hook.getRepo().getPathWithNamespace())
|
||||
.withJsonBody(hook.getJsonBody())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RevisionParameterAction createRevisionParameter(PullRequestHook hook, GitSCM gitSCM) throws NoRevisionToBuildException {
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild(hook), retrieveUrIish(hook, gitSCM));
|
||||
// 没有配置git源码管理
|
||||
if (gitSCM == null) {
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild(hook));
|
||||
}
|
||||
URIish urIish = retrieveUrIish(hook, gitSCM);
|
||||
// webhook与git源码管理仓库对不上
|
||||
if (urIish == null) {
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild2(hook));
|
||||
}
|
||||
return new RevisionParameterAction(retrieveRevisionToBuild(hook), urIish);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -254,6 +267,12 @@ class PullRequestHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<Pu
|
|||
if (hook.getPullRequest().getMergeCommitSha() != null) {
|
||||
return hook.getPullRequest().getMergeCommitSha();
|
||||
}
|
||||
}
|
||||
return retrieveRevisionToBuild2(hook);
|
||||
}
|
||||
|
||||
private String retrieveRevisionToBuild2(PullRequestHook hook) throws NoRevisionToBuildException {
|
||||
if (hook.getPullRequest() != null) {
|
||||
if (hook.getPullRequest().getMergeReferenceName() != null) {
|
||||
return hook.getPullRequest().getMergeReferenceName();
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<PushHook>
|
|||
@Override
|
||||
protected boolean isCiSkip(PushHook hook, BuildInstructionFilter buildInstructionFilter) {
|
||||
List<Commit> commits = hook.getCommits();
|
||||
if (commits != null && !commits.isEmpty()) {
|
||||
if (buildInstructionFilter!= null && commits != null && !commits.isEmpty()) {
|
||||
return !buildInstructionFilter.isBuildAllow(commits.get(commits.size() - 1).getMessage());
|
||||
}
|
||||
return false;
|
||||
|
@ -92,7 +92,7 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<PushHook>
|
|||
.withTargetNamespace("")
|
||||
.withTargetRepoSshUrl("")
|
||||
.withTargetRepoHttpUrl("")
|
||||
.withTriggeredByUser(retrievePushedBy(hook))
|
||||
.withTriggeredByUser(hook.getSender().getName())
|
||||
.withBefore(hook.getBefore())
|
||||
.withAfter(hook.getAfter())
|
||||
.withRef(hook.getRef())
|
||||
|
@ -101,6 +101,7 @@ class PushHookTriggerHandlerImpl extends AbstractWebHookTriggerHandler<PushHook>
|
|||
.withCreated(hook.getCreated())
|
||||
.withDeleted(hook.getDeleted())
|
||||
.withTargetProjectUrl(hook.getProject().getUrl())
|
||||
.withJsonBody(hook.getJsonBody())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ public class NoteBuildAction extends BuildWebHookAction {
|
|||
LOGGER.log(Level.FINE, "Note: {0}", toPrettyPrint(json));
|
||||
this.project = project;
|
||||
this.noteHook = JsonUtil.read(json, NoteHook.class);
|
||||
this.noteHook.setJsonBody(json);
|
||||
this.secretToken = secretToken;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ public class PipelineBuildAction extends BuildWebHookAction {
|
|||
LOGGER.log(Level.FINE, "Pipeline event: {0}", toPrettyPrint(json));
|
||||
this.project = project;
|
||||
this.pipelineBuildHook = JsonUtil.read(json, PipelineHook.class);
|
||||
this.pipelineBuildHook.setJsonBody(json);
|
||||
this.secretToken = secretToken;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ public class PullRequestBuildAction extends BuildWebHookAction {
|
|||
LOGGER.log(Level.FINE, "PullRequest: {0}", toPrettyPrint(json));
|
||||
this.project = project;
|
||||
this.pullRequestHook = JsonUtil.read(json, PullRequestHook.class);
|
||||
this.pullRequestHook.setJsonBody(json);
|
||||
this.secretToken = secretToken;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ public class PushBuildAction extends BuildWebHookAction {
|
|||
LOGGER.log(Level.FINE, "Push: {0}", toPrettyPrint(json));
|
||||
this.project = project;
|
||||
this.pushHook = JsonUtil.read(json, PushHook.class);
|
||||
this.pushHook.setJsonBody(json);
|
||||
this.secretToken = secretToken;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,10 @@
|
|||
<f:checkbox default="false"/>
|
||||
</f:entry>
|
||||
|
||||
<f:entry title="${%Ignore.Pull.Request.Conflicts}" field="ignorePullRequestConflicts" help="/plugin/gitee/help/help-ignore-pull-request-conflicts.html">
|
||||
<f:checkbox default="false"/>
|
||||
</f:entry>
|
||||
|
||||
<f:entry title="${%Allowed.branches}">
|
||||
<table>
|
||||
<!--<f:section title="">-->
|
||||
|
|
|
@ -39,6 +39,7 @@ Exclude=Exclude
|
|||
Include=Include
|
||||
Ignore.Last.Commit.Has.Build=Ignore last commit has been build
|
||||
Cancel.Same.Pull.Request.Incomplete.Build=Cancel incomplete build on same Pull Requests
|
||||
Ignore.Pull.Request.Conflicts=Ignore Pull Request conflicts
|
||||
Comments=Comment Pull Requests
|
||||
Comment.Regex=Comment (regex) for triggering a build
|
||||
Retry.Text=Jenkins please retry a build
|
||||
|
|
|
@ -39,6 +39,7 @@ Exclude=\u6392\u9664
|
|||
Include=\u5305\u62EC
|
||||
Ignore.Last.Commit.Has.Build=\u8FC7\u6EE4\u5DF2\u7ECF\u6784\u5EFA\u7684 Commit \u7248\u672C
|
||||
Cancel.Same.Pull.Request.Incomplete.Build=\u53D6\u6D88\u76F8\u540C Pull Requests \u672A\u5B8C\u6210\u6784\u5EFA
|
||||
Ignore.Pull.Request.Conflicts=\u5FFD\u7565 Pull Request \u51B2\u7A81
|
||||
Comments=\u8BC4\u8BBA Pull Requests
|
||||
Comment.Regex=\u8BC4\u8BBA\u5185\u5BB9\u7684\u6B63\u5219\u8868\u8FBE\u5F0F
|
||||
Retry.Text=Jenkins please retry a build
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<div>
|
||||
当码云 PR 表单中不勾选【必须测试】选项时,则过滤构建。
|
||||
当 Gitee PR 表单中要求测试人数为0时,则过滤构建。
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<div>
|
||||
If this option is selected,
|
||||
the build will be triggered regardless of whether the Pull Request conflicts or not,
|
||||
otherwise the Pull Request conflict will not trigger the build.
|
||||
</div>
|
|
@ -0,0 +1,3 @@
|
|||
<div>
|
||||
若勾选此选项,则无论 Pull Request 是否冲突都将触发构建,否则 Pull Request 冲突即不触发构建
|
||||
</div>
|
Loading…
Reference in New Issue