Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging multiline commands

Tags:

gitlab-ci

I've read everything at Split multi-line commands docs and searched on the net, but I couldn't find a way to always print the full executed script that is collapsed.

I was having a problem with script that was similar to this:

.common-script: &common-script |
   command 1
   command 2
   command x

job:
  script:
      - cd somewhere
      - *common-script 

My problem is that when there is a faulty script it takes a considerable amount of time for a simple error to be found. This is because GitLab cuts the command output for such a long command.

What I've found out as a partial solution was to use docker and a similar setup for the scenario reproduction, but this is not always feasible and it is still time consuming.

Is there a smarter way to debug such issues?

like image 502
Nikolay Babanov Avatar asked Nov 28 '25 14:11

Nikolay Babanov


1 Answers

To be honest, I have the same problem and I can't find a good tool for this yet.
So it would be cool to find out :)

At the moment, I use the built-in pipeline editor in Gitlab for this purpose. You can find here: Side panel -> Build (Red) -> Pipeline editor (Green) -> Full configuration (Yellow).

Where to find Full configuration

You can also edit code in the editor and see full configuration without committing any changes.
I usually work in the IDE, after which I copy all the text from the file and paste it into this editor, and run through the tabs: Validate, Full configuration, Visualize.

like image 106
Michael Linker Avatar answered Nov 30 '25 05:11

Michael Linker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!