Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Markup for headings and links in job output #218

Open
cweagans opened this issue Aug 7, 2024 · 1 comment
Open

Feature request: Markup for headings and links in job output #218

cweagans opened this issue Aug 7, 2024 · 1 comment

Comments

@cweagans
Copy link
Contributor

cweagans commented Aug 7, 2024

We use Jenkins extensively in our infrastructure. One concept in particular has been very useful to us, which is the ability to compose a Pipeline out of multiple jobs. When we run one of these Pipelines (composed of different Stages), we get some output that looks like this: (two different job names covered by red and orange boxes)

CleanShot 2024-08-07 at 14 20 12

In that screenshot at location 1 is the name of the Stage of the pipeline. At location 2, there's a link to the specific job that was started by this pipeline at this step.

In Laminar, this is somewhat easily represented with a job that just does something like this:

laminarc run some-job
laminarc run another-job
# etc

I don't think Laminar should have all of the fancy pipeline modeling that Jenkins has, but I do think that with a couple of small features, it'd be easy to compose pipelines in a more laminar-y way.

  • If my-job:123 is in the output for a given job, my-job is a real job, and 123 is a valid run number for my-job, Laminar could simply turn it into a link to that job run in the job output page.
  • If # Some heading is in the output, format "Some heading" in a more prominent way in the job output page. This isn't strictly necessary, since I can just as easily echo; echo "====== [SOME HEADING] ======"; echo; or something along those lines
  • Add a new subcommand to laminarc: laminarc wait my-job:123. This would allow me to have pipeline stages where multiple jobs are running in parallel:
    echo "# Build"
    linuxBuild=$(laminarc queue build-linux)
    macBuild=$(laminarc queue build-mac)
    windowsBuild=$(laminarc queue build-windows)
    echo "Cross-platform builds in progress:"
    echo $linuxBuild
    echo $macBuild
    echo $windowsBuild
    laminarc wait $linuxBuild
    laminarc wait $macBuild
    laminarc wait $windowsBuild
    
    echo "# Release"
    echo "Release jobs:"
    linuxRelease=$(laminarc queue release-linux buildJob=$linuxBuild)
    macRelease=$(laminarc queue release-mac buildJob=$macBuild)
    windowsRelease=$(laminarc queue release-windows buildJob=$windowsBuild)
    echo "Release jobs in progress:"
    echo $linuxRelease
    echo $macRelease
    echo $windowsRelease
    laminarc wait $linuxRelease
    laminarc wait $macRelease
    laminarc wait $windowsRelease

The output for that might look something like this:

[laminar] Executing cfg/jobs/build-and-release.run

====== [ BUILD ] ======

Builds in progress:
build-linux:123
build-mac:234
build-windows:345


====== [ RELEASE ] ======

Release jobs in progress:
release-linux:321
release-mac:432
release-windows: 543
[laminar] Executing cfg/after

(+ all of the jobname:123 outputs would be HTML links to their respective job/run pages)

If there's some other syntactic sugar that you'd prefer, that's ok too. I was mainly considering ease of implementation. Another option would be something like:

laminarc create-group      # or whatever
laminarc queue my-job:123
laminarc queue another:234
laminarc wait                    # waits for the two jobs queued above to complete, maybe outputs links to the output saying what we're waiting on
@ohwgiles
Copy link
Owner

Sorry for the much delayed response.

If my-job:123 is in the output for a given job, my-job is a real job, and 123 is a valid run number for my-job, Laminar could simply turn it into a link to that job run in the job output page.

laminar already does something like this. If you launch laminarc run from within laminar, it detects this and emits additional control characters, which the UI converts into links. Does this not work for you?

If # Some heading is in the output, format "Some heading" in a more prominent way in the job output page. This isn't strictly necessary, since I can just as easily echo; echo "====== [SOME HEADING] ======"; echo; or something along those lines

I'm not too keen on this idea as it stands, since it appears to modify the actual text of the console output. I'd be more receptive to a feature that styles the UI in a way that is not representable in terminal output. But that aside, would using a custom wrapper around laminarc run resolve this?

Add a new subcommand to laminarc: laminarc wait my-job:123. This would allow me to have pipeline stages where multiple jobs are running in parallel:

Needs some bash-foo, but an existing way to do this based on your script is

echo "# Build"
exec 3< <(laminarc run build-linux)
read <&3 linuxBuild
exec 4< <(laminarc run build-mac)
read <&4 macBuild
exec 5< <(laminarc run build-windows)
read <&5 windowsBuild

echo "Cross-platform builds in progress:"
echo $linuxBuild
echo $macBuild
echo $windowsBuild
wait

echo "# Release"
echo "Release jobs:"
exec 3< <(laminarc run release-linux buildJob=$linuxBuild)
read <&3 linuxRelease
exec 4< <(laminarc run release-mac buildJob=$macBuild)
read <&4 macRelease
exec 5< <(laminarc run release-windows buildJob=$windowsBuild)
read <&5 windowsRelease
echo "Release jobs in progress:"
echo $linuxRelease
echo $macRelease
echo $windowsRelease
wait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants