Skip to content
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

add builds and connection params to UpdateGitlabCommitStatusStep #1025

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 @@ -13,6 +13,7 @@
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.export.ExportedBean;

import com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty;
import com.dabsquared.gitlabjenkins.gitlab.api.model.BuildState;
import com.dabsquared.gitlabjenkins.util.CommitStatusUpdater;
import com.google.common.collect.ImmutableSet;
Expand All @@ -22,6 +23,9 @@
import hudson.model.TaskListener;
import hudson.util.ListBoxModel;

import java.util.ArrayList;
import java.util.List;

/**
* @author <a href="mailto:robin.mueller@1und1.de">Robin Müller</a>
*/
Expand All @@ -30,6 +34,8 @@ public class UpdateGitLabCommitStatusStep extends Step {

private String name;
private BuildState state;
private List<GitLabBranchBuild> builds = new ArrayList<GitLabBranchBuild>() ;
private GitLabConnectionProperty connection;

@DataBoundConstructor
public UpdateGitLabCommitStatusStep(String name, BuildState state) {
Expand Down Expand Up @@ -60,6 +66,24 @@ public void setState(BuildState state) {
this.state = state;
}

public List<GitLabBranchBuild> getBuilds() {
return builds;
}

@DataBoundSetter
public void setBuilds(List<GitLabBranchBuild> builds) {
this.builds = builds;
}

public GitLabConnectionProperty getConnection() {
return connection;
}

@DataBoundSetter
public void setConnection(GitLabConnectionProperty connection) {
this.connection = connection;
}

public static class UpdateGitLabCommitStatusStepExecution extends AbstractSynchronousStepExecution<Void> {
private static final long serialVersionUID = 1;

Expand All @@ -76,7 +100,7 @@ public static class UpdateGitLabCommitStatusStepExecution extends AbstractSynchr
@Override
protected Void run() throws Exception {
final String name = StringUtils.isEmpty(step.name) ? "jenkins" : step.name;
CommitStatusUpdater.updateCommitStatus(run, null, step.state, name);
CommitStatusUpdater.updateCommitStatus(run, null, step.state, name, step.builds, step.connection);
PendingBuildsAction action = run.getAction(PendingBuildsAction.class);
if (action != null) {
action.startBuild(name);
Expand Down