Skip to content

Allow backref setup for pending github status #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import hudson.tasks.Builder;
import jenkins.tasks.SimpleBuildStep;
import org.jenkinsci.plugins.github.common.ExpandableMessage;
import org.jenkinsci.plugins.github.extension.status.GitHubStatusBackrefSource;
import org.jenkinsci.plugins.github.extension.status.GitHubStatusContextSource;
import org.jenkinsci.plugins.github.extension.status.StatusErrorHandler;
import org.jenkinsci.plugins.github.extension.status.misc.ConditionalResult;
Expand All @@ -37,6 +38,7 @@ public class GitHubSetCommitStatusBuilder extends Builder implements SimpleBuild

private ExpandableMessage statusMessage = DEFAULT_MESSAGE;
private GitHubStatusContextSource contextSource = new DefaultCommitContextSource();
private GitHubStatusBackrefSource statusBackrefSource;

@DataBoundConstructor
public GitHubSetCommitStatusBuilder() {
Expand Down Expand Up @@ -73,6 +75,12 @@ public void setContextSource(GitHubStatusContextSource contextSource) {
this.contextSource = contextSource;
}


@DataBoundSetter
public void setStatusBackrefSource(GitHubStatusBackrefSource statusBackrefSource) {
this.statusBackrefSource = statusBackrefSource;
}

@Override
public void perform(@NonNull Run<?, ?> build,
@NonNull FilePath workspace,
Expand All @@ -84,6 +92,7 @@ public void perform(@NonNull Run<?, ?> build,
setter.setCommitShaSource(new BuildDataRevisionShaSource());
setter.setContextSource(contextSource);
setter.setErrorHandlers(Collections.<StatusErrorHandler>singletonList(new ShallowAnyErrorHandler()));
setter.setStatusBackrefSource(statusBackrefSource);

setter.setStatusResultSource(new ConditionalStatusResultSource(
Collections.<ConditionalResult>singletonList(
Expand Down