You should treat the workspace filesystem as an internal thing for Jenkins
IMO.

Archiving artefact is one feature to express the things you wanna keep.

If you want to keep a directory structure for later reuse, maybe you could
either zip it and archive it. Or push it somewhere else at the end of your
build?

Le 25 août 2016 5:15 PM, "Robert Beddow" <[email protected]> a écrit :

> 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
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/4ac7d92f-feb3-48b2-bb7b-b88314748b16%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/4ac7d92f-feb3-48b2-bb7b-b88314748b16%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS62wriw_xhZiARDyG-9RRz5Ukv0RwXWWRupvPNYNL6Ohg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to