Hi,
I'm trying to find a way to keep a workspace and prevent it from being deleted by Jenkins.
If I have a project called My_Jenkins_Job, and I run it multiple times concurrently, I end up with directories in the form:
./jenkins/workspace/My_Jenkins_Job
./jenkins/workspace/My_Jenkins_Job@2
./jenkins/workspace/My_Jenkins_Job@3
./jenkins/workspace/My_Jenkins_Job@4
If I later run My_Jenkins_Job again, and some of the above are finished, the lowest value workspace is removed and the new job runs under the same directory path.
e.g.
Running: ./jenkins/workspace/My_Jenkins_Job
Finished: ./jenkins/workspace/My_Jenkins_Job@2
Finished: ./jenkins/workspace/My_Jenkins_Job@3
Running: ./jenkins/workspace/My_Jenkins_Job@4
I start a new My_Jenkins_Job, ./jenkins/workspace/My_Jenkins_Job@2 is deleted, then the new job will run under a new ./jenkins/workspace/My_Jenkins_Job@2.
My request is to find out how to occasionally force jenkins to skip a finished directory because I want to keep it.
So:
Running: ./jenkins/workspace/My_Jenkins_Job
Finished & keep: ./jenkins/workspace/My_Jenkins_Job@2
Finished: ./jenkins/workspace/My_Jenkins_Job@3
Running: ./jenkins/workspace/My_Jenkins_Job@4
and I start a new My_Jenkins_Job, ./jenkins/workspace/My_Jenkins_Job@2 is skipped, ./jenkins/workspace/My_Jenkins_Job@3 is deleted, then the new job will run under a new ./jenkins/workspace/My_Jenkins_Job@3.
The options I've seen/thought of are:
Custom Workspace - set a custom workspace for each run. This isn't what I need, as normally I want standard behaviour, i.e. cycle through the workspaces replacing them as they finish. Also, I may decide to keep a workspace after the build has started.
Archive workspace - some of the paths in the job are absolute. I believe that archiving the workspace will move it to another parent directory, which would break all the full paths. Also, this could only be enabled up front
Force the job to keep "building" even when it is finished. This doesn't work if jenkins is restarted, and again it can only be enabled up front.
The only solution that I can think of is to "touch" a file within the workspace e.g.:
./jenkins/workspace/My_Jenkins_Job@2/.jenkins_keepme
And jenkins treats that workspace directory as if it is still building. This way I can manually choose to add the file at any time. Also it works if jenkins is restarted.
Is there anything like this out there? Or does anyone have any suggestions of how else I could get the functionality I'm looking for?
Thanks,
Robert