We are using Jenkins Blue Ocean to build .Net applications on Windows 2012 r2 Jenkins Slaves. We use a Jenkinsfile
inside the git repos to define the build pipelines.
With a couple of the projects we get a build failure due to the workspace build path being too long for Windows to handle.
This generally happens with nuget pack
and npm install
commands which max out the max path.
The specified path, file name, or both are too long.
The fully qualified file name must be less than 260 characters,
and the directory name must be less than 248 characters.
script returned exit code 1
As we can't affect the length of the Visual Studio Solution nuget package paths how do we drop the workspace folder down to something Windows can handle?
Thanks to the suggestion by Mutsa here is what we ended up with in our Jenkinsfile:
pipeline {
agent {
node {
label 'win'
customWorkspace "ws\\${JOB_NAME.replace("%2F", "_")}"
}
}
Which can be seen in context in our .net core Wakeboard UK website repo on GitHub.
So if you wish to change the Jenkins workspace, all you've do is change the path of your JENKINS_HOME. For slave nodes, specify the default workspace on the slave machine in the slave configuration under Manage Jenkins > Manage Nodes > > Configure > Remote FS root.
Accessing Blue Ocean Once a Jenkins environment has Blue Ocean installed and you log in to the Jenkins classic UI, you can access the Blue Ocean UI by selecting Open Blue Ocean on the left side of the screen. Alternatively, you can access Blue Ocean directly by appending /blue to the end of your Jenkins server's URL.
What is Blue Ocean? Blue Ocean rethinks the user experience of Jenkins. Designed from the ground up for Jenkins Pipeline, Blue Ocean reduces clutter and increases clarity for all users.
For declarative pipeline use customworksace option to override the default path within your node, docker or dockerfile section. See example.
agent {
node {
customWorkspace '/some/other/path'
}
It can be a relative path in respect to the workspace root or an absolute path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With