Re: [libvirt PATCH 05/33] ci: build.sh: Add a wrapper function executing 'shell' commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 01, 2023 at 10:46:06AM +0100, Daniel P. Berrangé wrote:
> On Thu, Aug 31, 2023 at 03:30:23PM +0100, Daniel P. Berrangé wrote:
> > On Fri, Aug 25, 2023 at 07:55:13PM +0200, Erik Skultety wrote:
> > > This would normally be not needed at all, but the problem here is the
> > > Shell-in-YAML which GitLab interprets. It outputs every command that
> > > appears as a line in the 'script' segment in a color-coded fashion for
> > > easy identification of problems. Well, that useful feature is lost when
> > > there's indirection and one script calls into another in which case it
> > > would only output the respective script name which would make failure
> > > investigation harder. This simple helper tackles that by echoing the
> > > command to be run by any script/function with a color escape sequence
> > > so that we don't lose track of the *actual* shell commands being run as
> > > part of the GitLab job pipelines. An example of what the output then
> > > might look like:
> > >     [RUN COMMAND]: 'meson compile -C build install-web'
> > 
> > FWIW, I happened to come across this
> > 
> >   https://docs.gitlab.com/ee/ci/jobs/index.html#custom-collapsible-sections
> > 
> > which lets scripts output messages in a special format that get
> > turned into collapsible sections when browsing logs in gitlab UI.
> > Not sure it is something we'd use in this specific patch, but
> > might be conceptually useful somewhere.
> 
> This actually works kinda nicely. I added this commit on top of
> yours:
> 
>   https://gitlab.com/berrange/libvirt/-/commit/29f123024c265262e70a409daa00c8634652a1b6
> 
> and an example pipeline is:
> 
>   https://gitlab.com/berrange/libvirt/-/jobs/4997176074
> 
> Notice there are three collapsible sections in the job logs
> 
>   "Running 'meson setup'"
>   "Running 'meson build'"
>   "Running 'meson test'"
> 
> collapsing earlier sections makes it somewhat easier to find the
> phase you're interested in, though its doesn't work so well when
> gitlab truncates the earlier part of the log that's over 500k.
> Not a problem for pipelines on master, but bad for forks.

Not bad. We could improve on it and go as far as print the actual command in
the section header and fallback to what I proposed in local environments.

Let's finish this series first and then you can refine and post your patch as a
follow up improvement.

Erik




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux