Background info: our typical SVN layout:
repo_url
-- trunk
---- projectA
---- projectB
---- shared
-- branches
---- branch_name_1
------ projectA
------ shared
---- branch_name_2
------ projectB
------ shared
The projectA, projectB folders in the above structure contain some svn:externals to the shared folder, so I have to define additional credentials (which are actually identical as the ones for the main URL) in the job config SVN section (don't know if this is relevant for my above questions).
Am I close with these guesses? Is there any place where this is documented / explained better that I didn't find?
Can someone here please answer these questions:
- Where should I store the Jenkinsfile? Is there 1 file for all branches or should there be 1 file in each branch?
- Which URL should I configure in the job page as the "project repository base"?
- What patterns should I put in the include/exclude branches boxes?
- Currently we create 2 types of builds for each project : 1 incremental build which runs after each commit (build + test), 1 clean build which runs at night (clean + build + test + create installers). How would we do something like that ? Would that need 2 Jenkinsfiles per project ?
node {
stage 'Checkout'
checkout scm
stage 'Build'
bat 'call jenkins_build.bat'
stage 'Test'
bat 'call jenkins_test.bat'
stage 'Collect testreports'
step ([ $class: 'XUnitPublisher', ... ]) // generated by "Pipeline syntax" utility
stage 'Email notifications'
step ([ $class: 'Mailer', ...]) // generated by "Pipeline syntax" utility
}
So, my current Jenkinsfile is something along these lines:
node {
timestamps {
try {
stage 'Checkout'
checkout scm
// %WORKSPACE% workaround, see https://issues.jenkins-ci.org/browse/JENKINS-33511
bat 'cd > workspace.txt'
env.WORKSPACE = readFile('workspace.txt')
bat 'del workspace.txt'
stage 'Build'
bat 'call jenkins_build.bat'
stage 'Test'
bat 'call jenkins_test.bat'
stage 'Collect testreports'
step ([ $class: 'XUnitPublisher', ... ]) // generated by "Pipeline syntax" utility
} catch (caughtError) {
err = caughtError // not sure if this line is really needed ?
currentBuild.result = "FAILURE"
} finally {
stage 'Email notifications'
step ([ $class: 'Mailer', ...]) // generated by "Pipeline syntax" utility
}
}
}
cl : Command line error D8038: invalid argument 'C:\jenkins\workspace\pipeline_test\trunk%2FprojectA\libraryX\include'After some debugging it seems to be caused by the % sign. If I rename the folder on my own build pc to have a % in the name, I get the same error. I did not find a way to specify or alter the way a sanitized workspace location is generated. However, I did find a similar issue/request reported here: https://issues.jenkins-ci.org/browse/JENKINS-34564 and while looking that one back up, I found https://issues.jenkins-ci.org/browse/JENKINS-30744 which actually contains a workaround. I'll try this workaround right now.