Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

jenkins workspace folder cut in multibranch pipeline

I note that in multibranch pipeline the workspace folder is cut.

For example a project named:

Sample09-Netbeans-MultiBranch-Pipeline-Maven-Svn

that comes from a subversion repository like

https://my-favourite-repo/svn/ProjectsJava/DevOps/Jenkins/Test/test-jenkins-java-maven-multibranch/

with a project folder like

D:ProjectsJavaDevOpsJenkinsTestest-jenkins-java-maven-multibranchrunkmyproject

produce a workspace folder like this

D:Jenkins.jenkinsworkspacepeline-Maven-Svn_trunk_myproject

other types of project whit similar names doesn't have this problem

I found a workaround adding -a node definition -a customWorkspace but when i use it maven doesn't see the settings.xml file and i must directly specify it in the maven command passing a jenkins-global property. No other action can provide it to the command (define a jenkins-config-file, define it in jenkins-maven configuration or in project-maven configuration)

pipeline {
    agent{
        node{
            label 'my-node'
            customWorkspace "${JENKINS_HOME}/Workspace/${JOB_NAME}/${BUILD_NUMBER}"
        }
    }
    stages {
        stage('Build-And-Test') {
            steps {
                withMaven {
                    bat "mvn clean package test -B -s ${MAVEN_SETTINGS}"
                }
            }
        }
    }
}

Why Jenkins cut the folder name only in multibranch pipelines?

There is another way to define the workspace-job-folder-name outside of the jenkinsfile ?

OR

There is a way to let maven see the settings.xml configured in one of the Jenkins configuration?

question from:https://stackoverflow.com/questions/65951843/jenkins-workspace-folder-cut-in-multibranch-pipeline

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Most operating systems have an upper bound on the length of a file name and the length of a directory path. Jenkins pipeline jobs that use full length strings were encountering operating system path limitations (especially the 256 character default limit on Windows).

Pipeline job names were intentionally changed to shorter forms so that they would reduce the likelihood of encountering an operating system or file system limit on path length.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...