Clickable Links in GoCD pipeline console logs?

75 views
Skip to first unread message

Chris Gillatt

unread,
Sep 13, 2022, 5:39:00 AM9/13/22
to go-cd
Hello all

I was wondering anyone knows if it's possible to have the Console Log in the GoCD GUI for a pipeline run to render a URL as a clickable link? Similar to the behaviour of the iTerm2 terminal emulator.

For example, as part of our pipelines, we run tests such as Dependency Check which we've configured to upload reports to a repo and produce a URL.  The URL is printed in the console log, and we're able to highlight it using ansi colours for it to stand out.  What would be even better is if it was a clickable link too.  Currently users have to copy and paste the URL into a browser to view the report.

Cheers
Chris

Chad Wilson

unread,
Sep 13, 2022, 11:23:11 AM9/13/22
to go...@googlegroups.com
Hi Chris

It doesn't support that by default to my knowledge, i.e I don't believe there is any JavaScript magic running to detect and linkify URLs in the logs.

As an alternative you could configure your pipeline to publish the dependency report as an artifact inside GoCD itself and any GoCD user could view it there, e.g for GoCD's own build (login with the guest user icon)

-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/257e29b5-63cf-4533-9abf-e1bf76c616c3n%40googlegroups.com.

Chris Gillatt

unread,
Sep 14, 2022, 4:37:17 AM9/14/22
to go-cd
Thanks for the reply, Chad

We used to use GoCD's artefacts in this way, but these days we parse the reports as part of an app's SQI so they're stored in Mongo now with some other bits and I'd like not to duplicate. 
Another use case we have is, when a build fails, to produce a link to documentation which exists in our microsite or Confluence instance etc. We have the same limitation in that we're able to highlight a url with colour, but not make it clickable.  I've hacked about with html etc but nothing seemed to work - I figured it might not be possible, but then I thought about the drop-down arrows which expand and contract and wondered if there was a hidden method.

Cheers anyway :)
Chris

Chad Wilson

unread,
Sep 14, 2022, 5:04:54 AM9/14/22
to go...@googlegroups.com
I see. While I can appreciate the general utility, personally I think expanding and hunting through the console logs might be a bit of a clunky approach to this. Most of the (very legacy) JavaScript that does this (pre packing) is here (console_log_*.js) so if you feel like figuring it out and submitting a PR........

As another alternative, what about producing a "custom artifact" which is just a trivial HTML page with your collection of links/useful resources related to the given build?

You could have a task at the end of each build job which just does the equivalent of the below (or use some basic templating language if you'd rather)

cat <<-EOF > useful-links.html
<html>
<head><title>Useful Links</title></head>
<body>
<a href="https://my-server/dependency-report-${GO_PIPELINE_COUNTER}-${GO_STAGE_COUNTER}.html">Dependency Check Report</a>
<a href="https://my-server/deploy-failure-faq/">Common failure causes</a>
</body>
</html>
EOF
echo "Take a look at the 'Useful Links' tab in GoCD to help you understand possible reasons for any failures 🥳"

If you
  1. set the task to runIf: always (so it runs on failures too)
  2. artifact that trivial useful-links.html
  3. create a custom tab for it
... folks might get used to checking that tab as an alternative to the logs. :-)

-Chad

Chris Gillatt

unread,
Sep 14, 2022, 5:16:31 AM9/14/22
to go-cd
Oo yeah thanks for the pointers, I'll take a look.

Thank you!
Chris
Reply all
Reply to author
Forward
0 new messages