While the not-so-helpful error messages from GoCD aren't great - I'm not sure this is the root of your problem? The original error you said you were trying to fix is a pipeline failing with
*'message': "Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.", 'fix': None}* This is an error message from the *shellcheck tool itself* about the script it is checking/linting. It shouldn't be complaining about the environment it is running in. It is telling you that it can't lint/check the script, since it's not sure which semantics/rules to apply on the individual script it is checking (its target shell). See https://github.com/koalaman/shellcheck/wiki/SC2148 Can you check the specific file/script shellcheck is looking at when the pipeline is failing and make sure it has a shebang? Unless you are running shellcheck and checking the dynamically generated temporary scripts GoCD generates (seems unlikely) I'm not sure the root problem you are trying to solve is with GoCD, and instead is somewhere else. Chad PS: The second attempt is failing because # is a special character in GoCD land, used for parameter substitution <https://docs.gocd.org/current/configuration/admin_use_parameters_in_configuration.html>. This might also be why the script executor plugin is failing, but not 100% sure- can you get a stack trace or other error details from the GoCD server logs and perhaps I can take a look? As the second error tries to tell you, to get past the parameter substitution you would probably need an extra hash i.e *##!/bin/sh* However even if you get past these errors, I don't think either option will change the shell because in the two styles - script executor plugin runs "/bin/bash -c YOUR_SCRIPT" - custom command just runs it as if you entered arguments on the command line directly to a bash process, so you'd need a -c argument, and then a line with YOUR_SCRIPT similar to the "syntactic sugar" the script executor plugin gives you. I'm not sure it'd make a lot of sense to add a shebang in either case... On Tue, May 10, 2022 at 1:40 PM Sifu Tian <[email protected]> wrote: > > HI, > > Ive tried both. You can see the second screenshot is the custom command > method. > Both ways don't allow you to save the task if you add #!/bin/sh to the > argument and throw and error. > On Tuesday, May 10, 2022 at 1:00:13 AM UTC-4 [email protected] wrote: > >> On Tue, May 10, 2022 at 11:45 AM Sifu Tian <[email protected]> wrote: >> >>> Hi, >>> >>> I'm sure this is an old issue however I cant seem to find the resolution. >>> >>> I have a script executor with a job that is running a python module >>> defined for shellcheck linter. >>> >> >> Could you use the Custom Command to run a shell script instead? >> That way, all your actions would be within a shell script that you can >> test and store in version control, and then check out and use as a material. >> >> https://docs.gocd.org/current/configuration/admin_add_task.html >> >> I have not used this task executor plugin since I have always relied on >> the Custom Command approach above. >> >> >> >>> >>> The pipeline fails with return error: >>> 'message': "Tips depend on target shell and yours is unknown. Add a >>> shebang or a 'shell' directive.", 'fix': None} >>> >>> It's looking for a shell in the script executor which I thought would be >>> self contained. >>> While attempted to add #!/bin/sh, it wont allow me to save and generates >>> the error: >>> >>> "There was an unknown error performing the operation. Possible reason ()" >>> >>> If I try with just the customer command option I get this error when >>> adding #!/bin/sh: >>> >>> There was an unknown error performing the operation. Possible reason () >>> Error when processing params for '#!/bin/sh' used in field >>> 'argListString', # must be followed by a parameter pattern or escaped by >>> another #. >>> >>> I also found this very old close issue which is a similar issue I'm >>> having. >>> https://github.com/gocd/gocd/issues/817 >>> >>> Any help would be great. >>> [image: Screen Shot 2022-05-09 at 11.43.24 PM.png] >>> [image: Screen Shot 2022-05-09 at 11.42.57 PM.png] >>> >>> -- >>> 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 [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/go-cd/930eef05-427e-413c-9ccd-ee8494b47d86n%40googlegroups.com >>> <https://groups.google.com/d/msgid/go-cd/930eef05-427e-413c-9ccd-ee8494b47d86n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/go-cd/6378d084-2461-4007-bd42-3c236c284ea1n%40googlegroups.com > <https://groups.google.com/d/msgid/go-cd/6378d084-2461-4007-bd42-3c236c284ea1n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAA1RwH8xTAxK%3Din0AkHZhE_QccNOBavvQ3Lr%2Bi6Va3vy2bbdiQ%40mail.gmail.com.
