-
Improvement
-
Resolution: Unresolved
-
Major
-
None
olamy noticed some problems running tests in a multibranch project using K8S due to the tests using Unix sockets, which imposes a very low limit (PATH_MAX IIRC) on the length of the workspace directory name plus whatever subdirectory your stuff runs in. JENKINS-34564 means that the default branch project workspace path is fairly long in most cases, which caused problems for example with socket-based sshagent before JENKINS-36997 switched to a CLI implementation.
At any rate, the entire reason for selecting a workspace path which is unique among all possible branch projects in the Jenkins instance—to avoid clashes between projects—is moot when using a K8S agent, since these are allocated dynamically within the scope of the build. So while the Slave.workspaceRoot is by default /home/jenkins/workspace, which is fine, the workspace for the build is /home/jenkins/workspace/project-PR-5-ABC123SOMETHINGVERYVERYLONG, which is pointless. Assuming the KubernetesSlave is normally used for a single build, it should just
@Override public FilePath getWorkspaceFor(TopLevelItem item) { if (item.equals(howeverYouDetermineTheOwningBuild().getParent())) { return getWorkspaceRoot().child("main"); } else { return super.getWorkspaceFor(item); } }
so that the build will run inside /home/jenkins/workspace/main—a nice short, predictable name.
- blocks
-
JENKINS-51695 ssh-add fails randomly on Kubernetes
- Resolved
- relates to
-
JENKINS-36997 sshAgent {} inside docker.image().inside {} does not work with long project name
- Resolved
-
JENKINS-34564 Give the ability to choose how the multibranch subprojects will be named.
- Resolved