Skip to content

Commit

Permalink
Merge pull request #5 from daniel-beck/pipeline
Browse files Browse the repository at this point in the history
Pipeline support
  • Loading branch information
daniel-beck committed Aug 12, 2017
2 parents 57f1d30 + 4a350bd commit aa9fabf
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<packaging>hpi</packaging>
<url>https://wiki.jenkins-ci.org/display/JENKINS/Compress+Build+Log+Plugin</url>

<properties>
<jenkins.version>2.7.4</jenkins.version>
</properties>

<licenses>
<license>
<name>MIT License</name>
Expand Down Expand Up @@ -49,4 +53,18 @@
</pluginRepository>
</pluginRepositories>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>2.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.6</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import hudson.model.listeners.RunListener;
import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

Expand All @@ -24,6 +25,7 @@ public BuildLogCompressor() {
}

@Extension
@Symbol("compressBuildLog")
public final static class DescriptorImpl extends JobPropertyDescriptor {

@Override
Expand All @@ -33,7 +35,7 @@ public String getDisplayName() {

@Override
public boolean isApplicable(Class<? extends Job> jobType) {
return AbstractProject.class.isAssignableFrom(jobType);
return AbstractProject.class.isAssignableFrom(jobType) || jobType.getName().equals("org.jenkinsci.plugins.workflow.job.WorkflowJob");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import org.jenkinsci.plugins.compressbuildlog.BuildLogCompressor;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;

import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;

import org.jvnet.hudson.test.JenkinsRule;

public class BuildLogCompressorPipelineTest {
@Rule
public JenkinsRule r = new JenkinsRule();

@Test
public void testIsApplicable() throws Exception {
WorkflowJob workflowJob = r.jenkins.createProject(WorkflowJob.class, "pipeline");
Assert.assertNotNull(workflowJob);

BuildLogCompressor.DescriptorImpl descriptor = new BuildLogCompressor.DescriptorImpl();
Assert.assertNotNull(descriptor);

boolean res = descriptor.isApplicable(workflowJob.getClass());
Assert.assertTrue(res);
}
}

0 comments on commit aa9fabf

Please sign in to comment.