Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Enable Swarm builds on pipeline.
JENKINS-38233
  • Loading branch information
p4paul committed Oct 14, 2016
1 parent 4cb6dab commit 73b4667
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/org/jenkinsci/plugins/p4/review/ReviewAction.java
Expand Up @@ -4,13 +4,15 @@
import hudson.model.Action;
import hudson.model.Cause;
import hudson.model.CauseAction;
import hudson.model.Job;
import hudson.model.ParameterDefinition;
import hudson.model.ParameterValue;
import hudson.model.ParametersAction;
import hudson.model.Queue;
import hudson.model.StringParameterDefinition;
import hudson.model.StringParameterValue;
import jenkins.model.Jenkins;
import jenkins.model.ParameterizedJobMixIn.ParameterizedJob;
import jenkins.util.TimeDuration;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
Expand All @@ -24,18 +26,19 @@
import java.util.List;
import java.util.logging.Logger;

public class ReviewAction implements Action {
public class ReviewAction<T extends Job<?, ?> & ParameterizedJob> implements Action {

private final AbstractProject<?, ?> project;
private final T project;

public AbstractProject<?, ?> getProject() {
return project;
}

public ReviewAction(AbstractProject<?, ?> project) {
public ReviewAction(T project) {
this.project = project;
}

public T getProject() {
return project;
}

public String getIconFileName() {
return "/plugin/p4/icons/p4.png";
}
Expand Down
@@ -0,0 +1,25 @@
package org.jenkinsci.plugins.p4.review;

import hudson.Extension;
import hudson.model.Action;
import hudson.model.Job;
import jenkins.model.TransientActionFactory;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;

@Extension
public class ReviewActionFactory extends TransientActionFactory<Job> {

@Override
public Class<Job> type() {
return Job.class;
}

@Nonnull
@Override
public Collection<? extends Action> createFor(@Nonnull Job target) {
return Collections.singletonList(new ReviewAction(target));
}
}

3 comments on commit 73b4667

@KangTheTerrible
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this change is to blame but I'm observing a problem where builds are getting ignored while a swarm review queued item exists regardless of the different parameters.

@KangTheTerrible
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I was wrong, it wasn't this change, it was 72cde84. I'll try to reach you directly in case you don't have visibility on these messages. In the meantime I locally rolled back where the safeparameter list was created to the old parameter list type and I'm no longer observing the issue with swarm review builds getting lost in the queue.

@p4paul
Copy link
Contributor Author

@p4paul p4paul commented on 73b4667 Nov 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you raise a JIRA issue and assign it to me @p4paul - that way I hopefully won't forget to look into it.

Please sign in to comment.