Operating system
Client: Windows 10 Pro 64-bit operating system, x64-based processor
Jenkins and all other involved node of Linux: Centos6.8 64-bit
Windows node: windows 2k12R2 64 bit
I am running Jenkins directly
Jenkins is not accessed through a reverse proxy
Installed Jenkins via yum install, I am launching involved agents via SSH.
I am having a Jenkins pipeline project setup where I used Jenkins Pipeline Syntax to build the job in order to run my script that does the further build tasks for us.
My script invokes mainly 4 nodes(Jenkins Server->Linux Node->Windows Node->Repo Node) one inside the other to complete the build successfully.
The big issues we have with Jenkins is that it runs on a timer and subsequent runs clobber the working directory of a previous run if the previous run hasn’t yet finished.
What could be the most optimal and adaptive way in order to tackle the issue and how do we do it in a easily adapt as per our above mentioned setup. Please help me out with the measure to resolve this issue.
Thanks!
Jenkins freestyle project setup where I used Jenkins Pipeline Syntax
hmm that contradicts itself. Either you use freestyle or you have a pipeline job with it’s on DSL, you can’t have both.
Jenkins will not run builds in the same directory unless you uses the option Use custom workspace in a freestyle job.
Jenkins will also not start parallel runs of a freestyle job without enabling the option Execute concurrent builds if necessary
Also for real pipeline job, Jenkins will not use the same workspace for concurrent builds.
@mawinter69 Thanks for pointing this out, I have made the correction now.
I cannot see any of the options enabled that you mentioned above.
For Example:
If a job is ran which has the build trigger set to 3 hours. The job usually completes under 3 hours but sometimes if it takes time more than 3 hours or if someone manually triggers again the build when the previous run is still not complete then the issues arises where our working directory which is same for such cases get clobbered.
How do I handle such cases.
As said before Jenkins will not use the same workspace. It will create a directly parallel to the existing that ends with @2. Without the option Execute concurrent builds if necessary Jenkins will never allow the job to run in parallel, it will stay in the queue.
It will probably help if you provide a screenshot of your job config
So you’re using a pipeline. You have the option Do not allow concurrent builds
The message Running on node1 in /root/work/jenkins/workspace/pj-Pipeline should become Running on node1 in /root/work/jenkins/workspace/pj-Pipeline@2 when you really have parallel builds on the same agent in Jenkins.
Unlikely but maybe you misconfigured an agent (you said you use ssh) and accidently have 2 agents that connect to the same machine, so you might want to check your agent configs if they are correct.