Skip to content

Commit

Permalink
Require Jenkins 2.452.4, depend on commons compress API plugin
Browse files Browse the repository at this point in the history
Jenkins 2.489 removes the commons compress library from Jenkins core.
This plugin depended on the commons compress library being provided
by Jenkins core in order to satisfy the transitive dependency from
truezip-driver-zip.  Make the plugin depend on commons-compress-api
plugin instead of commons-core from Jenkins core so that the plugin can
run on Jenkins versions 2.489 and later.

This issue also blocks the update of the Jenkins acceptance test harness
to use Jenkins 2.489.  The pull request that fails due to the compress
artifacts plugin is:

* jenkinsci/acceptance-test-harness#1860

Testing done:

Confirmed that the released plugin fails when loaded into Jenkins
2.489 after enabling Artifact Management for Builds with the "Compress
Artifacts" setting.  The Pipeline job looks like this:

pipeline {
    agent any
    stages {
        stage('Hello') {
            steps {
                sh 'date >> datefile.txt'
                archiveArtifacts artifacts: 'datefile.txt'
            }
        }
    }
}

Confirmed that the same Pipeline library works correctly with the updated
version of the plugin from this change.
  • Loading branch information
MarkEWaite committed Dec 10, 2024
1 parent 98adbd3 commit 673207b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
13 changes: 9 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.82</version>
<version>4.88</version>
<relativePath />
</parent>
<artifactId>compress-artifacts</artifactId>
Expand All @@ -16,7 +16,8 @@

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.414.3</jenkins.version>
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<truezip.version>7.7.10</truezip.version>
<!-- TODO fix violations -->
Expand Down Expand Up @@ -47,15 +48,19 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.414.x</artifactId>
<version>2982.vdce2153031a_0</version>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3790.va_b_a_2d26d2b_69</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-compress-api</artifactId>
</dependency>
<dependency>
<groupId>de.schlichtherle.truezip</groupId>
<artifactId>truezip-driver-zip</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
zip = new ZipOutputStream(out, Charset.defaultCharset());
}

/*package*/ TrueZipArchiver(OutputStream out, Charset filenamesEncoding) {
zip = new ZipOutputStream(out, filenamesEncoding);
}

@Override
public void visit(final File f, final String _relativePath) throws IOException {
// int mode = IOUtils.mode(f); // TODO
Expand Down Expand Up @@ -101,5 +105,9 @@ private static final class Factory extends ArchiverFactory {
public Archiver create(OutputStream out) throws IOException {
return new TrueZipArchiver(out);
}
@Override
public Archiver create(OutputStream out, Charset filenamesEncoding) throws IOException {
return new TrueZipArchiver(out, filenamesEncoding);
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,12 @@ public void run() {
};

compressor.start();
try {
Thread.sleep(1000);
Thread.sleep(200);

assertTrue(compressor.isAlive());
assertTrue(compressor.isAlive());

assertArrayEquals(new String[0], zs.list());
assertArrayEquals(new VirtualFile[0], zs.list("*"));
} finally {
compressor.stop();
}
assertArrayEquals(new String[0], zs.list());
assertArrayEquals(new VirtualFile[0], zs.list("*"));
}

@Test // This can happen when it was not yet (fully) written or it was deleted
Expand Down

0 comments on commit 673207b

Please sign in to comment.