On Tue, Jun 20, 2017 at 8:38 AM Francois Marot <[email protected]>
wrote:

> I converted an old style job to Multibranch Pipeline with a Jenkinsfile
> (declarative syntax).
> Problem is that files from previous build are present in new builds and
> cause numerous problems once packaged.
> In the old-style job, I used to activate the "clean before checkout "
> param of the git plugin.
>
> Problem is that I have no scm step now as it is a Multibranch Pipeline job
> and Jenkins itself is smart enough to checkout from git (in order to access
> the Jenksinfile describing the job).
> So how can I force Jenkins to "clean before checkout" ?
>

You can insert a checkout step into your pipeline definition that will
include the "CleanBeforeCheckout" extension.  An example is
https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-43931/Jenkinsfile .

You can perform a shell step "git clean -xffd" as your first pipeline step
if you prefer.

Mark Waite


> I have seen answers where the previous build deletes the workspace after
> completion but I find it not satisfying to rely on the behavior of previous
> jobs to complete one job.
>
> Regards,
> François
>
> --
> 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/dfec64d8-92fc-49a4-9a09-82c575707d26%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/dfec64d8-92fc-49a4-9a09-82c575707d26%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/CAO49JtGB0G7nm0KYMX-zi4jM0g2NqQ7EFGevWGe0RVQt7MQBeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to