Also, it would be very easy to define a function like cleanNode that would
be a node calling by default deleteDir before running the passed closure.

Possibly this could even be done as a PR on the node step itself, adding a
boolean param to ask for that (?).
Le 22 juin 2016 4:17 PM, "'Björn Pedersen' via Jenkins Users" <
[email protected]> a écrit :

> Hi,
>
> the pipeline tutorial explains workspace quite well:
> https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#allocating-workspaces
> The default workspace created by 'node' is 'locked'  to a single run of
> the appropriate node part. It is not cleared by default.
> If you need more than one  workspace on a node 'ws' and/or 'dir' may be
> handy.
>
> Björn
>
>
> Am Mittwoch, 22. Juni 2016 15:13:10 UTC+2 schrieb James Read:
>>
>> Hi Antonio,
>>
>> So what I think you're saying, is that every workspace assigned is
>> allowed to contain anything - from other jobs, and always deleteDir()
>> should be used if a clean environment is needed?
>>
>> Is there a way to request a empty workspace, that is also deleted after
>> the node{} block completes when using the Pipeline plugin?
>>
>> - James
>>
>> On Tuesday, 21 June 2016 16:30:22 UTC+1, Antonio Muñiz wrote:
>>>
>>>
>>> On Tue, Jun 21, 2016 at 3:20 PM, James Read <[email protected]> wrote:
>>>
>>>> It seems that actually the Pipeline makes the whole Jenkinsfile 1x
>>>> logical job, and the node{} blocks just allow different node selections
>>>> during that job.
>>>
>>>
>>> Not. Every `node` call has its workspace (and it can be erased at any
>>> time by Jenkins core, so you never know if the workspace contains what you
>>> think). Which means that the Jenkinsfile has to be idempotent and don't
>>> rely on workspace contents from previous builds. Actually every node block
>>> should remove/put whatever it needs (you can move things from one node to
>>> another by using `stash`).
>>>
>>> If you request for two nodes in the same Jenkinsfile using different
>>> labels, you would be using two nodes with two separated workspaces (even in
>>> different physical machines!).
>>>
>>>
>>> --
>>> Antonio Muñiz
>>> Software Engineer
>>> CloudBees, Inc.
>>>
>> --
> 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/54f41f3e-98e7-418b-af94-44f1ef29b6ca%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/54f41f3e-98e7-418b-af94-44f1ef29b6ca%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/CANWgJS4e1Kw%2B6ELNcCHhmS1Zc3s93ASC%2BLJe-KSVojiOq2XtvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to