Skip to content

[JENKINS-75679] FilePathPickle deprecated#351

Merged
jglick merged 5 commits intojenkinsci:masterfrom
jglick:FilePathPickle-JENKINS-75679
May 30, 2025
Merged

[JENKINS-75679] FilePathPickle deprecated#351
jglick merged 5 commits intojenkinsci:masterfrom
jglick:FilePathPickle-JENKINS-75679

Conversation

@jglick
Copy link
Member

@jglick jglick commented May 28, 2025

https://issues.jenkins.io/browse/JENKINS-75679

Fixing this for new code in conjunction with docker-commons is straightforward (KeyMaterial.close needs to take a contextual VirtualChannel to reconstruct paths on the agent), but

@jglick jglick added the bug label May 29, 2025
});
@SuppressWarnings("deprecation")
var verboten = FilePathPickle.class.getName();
assertThat(StringEscapeUtils.escapeJava(Files.readString(rr.getHome().toPath().resolve("jobs/p/builds/1/program.dat"), StandardCharsets.ISO_8859_1)), not(containsString(verboten)));
Copy link
Member Author

Choose a reason for hiding this comment

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

Fails without fix.

}
}

private static final class SSHAgentContainer extends GenericContainer<SSHAgentContainer> {
Copy link
Member Author

Choose a reason for hiding this comment

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

A handy utility (superseding the agent support in docker-fixtures) that we might want to publish somewhere. Maybe in JTH though that would then need an optional dep on testcontainers which may be undesirable.

Copy link
Member

Choose a reason for hiding this comment

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

Could go in its own repo, something akin to a Jenkins version of https://github.com/dasniko/testcontainers-keycloak

Copy link
Member Author

Choose a reason for hiding this comment

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

I am currently prototyping something.

@jglick jglick marked this pull request as ready for review May 30, 2025 12:17
@jglick jglick enabled auto-merge May 30, 2025 12:17
Comment on lines +266 to +269
var creds = new BasicSSHUserPrivateKey(CredentialsScope.GLOBAL, null, "jenkins", new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(priv), null, null);
CredentialsProvider.lookupStores(Jenkins.get()).iterator().next().addCredentials(Domain.global(), creds);
var port = getMappedPort(22);
Jenkins.get().addNode(new DumbSlave(name, "/home/jenkins/agent", new SSHLauncher(getHost(), port, creds.getId())));
Copy link
Member Author

Choose a reason for hiding this comment

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

(For use with RealJenkinsRule, would need a bit of refactoring to bind name, host, port, and priv in a record.)

@jglick jglick merged commit a73f881 into jenkinsci:master May 30, 2025
17 checks passed
@jglick jglick deleted the FilePathPickle-JENKINS-75679 branch May 30, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants