Skip to content

Commit

Permalink
Remove usages of Commons Compress (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored May 25, 2024
1 parent 057a518 commit dcc9416
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
import java.util.stream.Stream;
import jenkins.bouncycastle.api.PEMEncodable;
import jenkins.model.Jenkins;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.tools.tar.TarEntry;
import org.apache.tools.tar.TarOutputStream;
import org.jenkinsci.Symbol;
import org.jenkinsci.main.modules.instance_identity.InstanceIdentity;
import org.kohsuke.accmod.Restricted;
Expand Down Expand Up @@ -298,13 +298,13 @@ public void beforeContainerStarted(DockerAPI api, String workdir, DockerTransien
+ "|| :";
final byte[] authorizedKeysCommandAsBytes = authorizedKeysCommand.getBytes(StandardCharsets.UTF_8);
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
TarArchiveOutputStream tar = new TarArchiveOutputStream(bos)) {
TarArchiveEntry entry = new TarArchiveEntry("authorized_key");
TarOutputStream tar = new TarOutputStream(bos)) {
TarEntry entry = new TarEntry("authorized_key");
entry.setSize(authorizedKeysCommandAsBytes.length);
entry.setMode(0700);
tar.putArchiveEntry(entry);
tar.putNextEntry(entry);
tar.write(authorizedKeysCommandAsBytes);
tar.closeArchiveEntry();
tar.closeEntry();
tar.close();
try (InputStream is = new ByteArrayInputStream(bos.toByteArray());
DockerClient client = api.getClient()) {
Expand Down

0 comments on commit dcc9416

Please sign in to comment.