Issues with Custom Command in version 22.3.0

27 views
Skip to first unread message

Tsanko Stoev

unread,
Nov 28, 2022, 2:54:25 PM11/28/22
to go...@googlegroups.com
Hello All,

We recently upgraded to GoCD 22.3.0 and started experiencing issues with Custom Commands. 
Attached  is an example of a command that is failing. This is on a Windows OS. I can run the same command successfully in command prompt on the server. 
Thanks in advance for your help.

Tsanko


image001 (1).png

Sriram Narayanan

unread,
Nov 28, 2022, 5:56:15 PM11/28/22
to go...@googlegroups.com
As a temporary workaround, could you move that copy Command into a batch file and verify if that works?

Many of us follow the habit of running commands via version-controlled shell scripts that are used as materials. This decouples the commands from the orchestration tool, provides version control, enables us to take advantage of a script file rather than just a single command, use a variety of scripting languages, keep the gocd configuration focused on orchestrating script execution, reduces change in the gocd configuration, etc.

So if you use a script file as a material and get it to work, please do consider continuing to use the script file

As for the reason the custom command failed, is that a custom command or a task in a job? I have a vague recollection that Chad fixed some stuff related to Windows paths earlier this year but he could confirm or the change log could show it. 

— Sriram

--
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/CAGWsXCAc-XKyhkzxFZ7WKrRjUD2LyN4zbmK7Vn0-8WPx7TcWWA%40mail.gmail.com.

Tsanko Stoev

unread,
Nov 28, 2022, 6:15:47 PM11/28/22
to go...@googlegroups.com
I figured it out. Apparently version 22.3 is really picky about spaces. The arguments section had a space after the argument which resulted in weird stuff happening. I guess the lesson is: be careful with spaces in the arguments when using a Custom Command.
Thanks.

Tsanko

Chad Wilson

unread,
Nov 28, 2022, 8:23:18 PM11/28/22
to go...@googlegroups.com
It's perhaps more accidentally picky in some areas as a side effect of fixing a number of other bugs. See https://github.com/gocd/gocd/pull/10625

Windows cmd is a strange thing and GoCD has some old strange workarounds for args where spaces are detected in them. That older workaround might not be interacting well with the changes to fix some other issues for commands with spaces in paths.

Can you share what the exact args entries looked like from config.xml or UI? I'd like to see exactly where the rogue space was among the args to see if it can be addressed. Don't think there was any intention to make it more picky, but can probably take a look at some point.

-Chad

Tsanko Stoev

unread,
Nov 30, 2022, 3:52:57 PM11/30/22
to go...@googlegroups.com
Hi Chad,

I have attached three screenshots that describe scenarios that used to work but with 22.3.0, they stopped working:

1) Putting arguments in the command line (this one used to work but in my opinion is fine with version 22.3.0 where it only accepts a single command)
2) Putting the arguments on a single line (this one used to work as well and it's probably ok that version 22.3.0 enforces that each argument should be on it's own line)
3) Having a space at the end of an argument (this one I think is a problem as it makes it very sensitive and perhaps there is a way to trim any trailing spaces so that it's not so sensitive)

For now we are aware of these nuances and have adjusted accordingly. 
Thanks.

Tsanko

Example_With_Space_in_Argument.png
Example_With_Arguments_on_One_Line_in_Arguments.png
Example_With_Arguments_on_Command_Line.png

Tsanko Stoev

unread,
Nov 30, 2022, 4:46:10 PM11/30/22
to go...@googlegroups.com
There is another issue I discovered. When you go edit a Custom Command, even if you don't save it, it somehow puts trailing spaces on the first two lines. Why only on those, I have no idea.
Thanks.

Tsanko

Chad Wilson

unread,
Dec 1, 2022, 12:29:32 AM12/1/22
to go...@googlegroups.com
The first two never worked on POSIX style OSes but might have accidentally worked on Windows if the args didn't have spaces in them.

If you can raise an issue at https://github.com/gocd/gocd/issues/new for the latter two and explain your mechanism of configuring (config repo? API? GUi? Editing config XML directly) it'll be more likely to be addressed as there are a number of configuration flows to evaluate and cover.

-Chad

Reply all
Reply to author
Forward
0 new messages