How to configure git clean args?

24 views
Skip to first unread message

Alena Karpova

unread,
May 28, 2024, 6:06:04 AMMay 28
to go-cd
Hi!
My working directory uses  git clean -dff  for cleaning now, but I need  git clean -dffx to be used instead.
I see that there is a flag that configures this, but I can't find how I can set it.

Thank you in advance,
Alena

Chad Wilson

unread,
May 28, 2024, 6:18:19 AMMay 28
to go...@googlegroups.com
Hi Alena

The default behaviour on GoCD git materials has been git clean -dffx since  GoCD 20.6.0 as far as I can tell. You had to specifically opt in for the "old" behaviour of git clean -dff However based on the ticket you raised at https://github.com/gocd/gocd/issues/12806 my guess is that you are using a custom plugin for git materials which has its own logic and does not rely on GoCD's built in git material.

Which plugin is this? Some commonly used ones that still seem to use "git clean -dff" internally are https://github.com/ashwanthkumar/gocd-build-github-pull-requests and https://github.com/TWChennai/gocd-git-path-material-plugin These plugins initially aimed to "copy" GoCD's default behaviour but have diverged over time.

Both would need the plugins to be updated/changed.

A workaround for now may be to clean the entire working directory at GoCD level in the stage configuration (essentially an "rm -rf working-dir") rather than relying on something at material level, but this would require a fresh clone for every build, which some people would rather not do (for speed reasons) when using static agents.

-Chad

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/4f776e6e-46e9-4b63-87ee-47ae8ce2415cn%40googlegroups.com.

Alena Karpova

unread,
May 28, 2024, 10:40:35 AMMay 28
to go-cd
(It was not obvious to me, because I used the plugin just for the trigger)

I was wondering if it was possible to configure this. Just using a workaround at the moment.

I figured it out, thanks a lot!
Alena
вторник, 28 мая 2024 г. в 13:18:19 UTC+3, Chad Wilson:

Chad Wilson

unread,
May 28, 2024, 10:48:13 AMMay 28
to go...@googlegroups.com
Yeah, you'd need to raise an issue on that plugin's repository. Since it's a 3rd party plugin it's up to the plugin author what is configurable or not and such plugins don't "build on top of" the Git support from GoCD - they effectively re-implement it from scratch.

That plugin uses a git-utility library extracted from GoCD at https://github.com/ashwanthkumar/git-cmd which I have commit access to, but do not have the ability to change the dependent plugin. Ashwanth sometimes takes a look at this mail group, so perhaps he will comment :-)

-Chad

Reply all
Reply to author
Forward
0 new messages