jenkinsci / jenkinsfile-runner

A command line tool to run Jenkinsfile as a function
MIT License
1.14k stars 296 forks source link

Building with custom plugins (1.0-beta-32) #722

Open tiago-teixeira5 opened 2 months ago

tiago-teixeira5 commented 2 months ago

Hello,

This isn't really a bug report or missing documentation, it is more like a discussion, mostly to share my experience with this project. I hope I'm not overstepping or out of scope.

In my use case, I wanted to run the jenkinsfile-runner from a gitlab pipeline. We already have a jenkins infrastructure with multiple agents, lockable resources and pipelines from SCM/git, so, instead of running the jenkins pipeline "directly", I wanted to call/trigger a remote pipeline on our main jenkins controller and wait for it to finish. This would be mostly to have a "blocking call" to Jenkins from Gitlab pipelines, which would be useful on Merge Train pipelines.

To be able to call a remote pipeline, I would need the "Parameterized Remote Trigger" plugin.

I followed the procedure documented on docs/using/EXTENDING_DOCKER.adoc.

It first failed on the packing of the .war file from the jenkins directory due to jar being missing. It seems that it comes with a JDK, which I'd rather not install then.

I then modified the Dockerfile for unix/eclipse-termuin-11-jre so that the war file gets copied from the build stage into the final stage. Extending the image according to the procedure didn't need the war creation anymore and the installation of the plugin was successful (after a few tweaks: --latest false).

Unfortunately, in the extended image, Jenkins complained that it couldn't load the plugins (every one except the newly installed, if I remember correctly).

I probably should've been paying more attention and saving the logs, should I've decided to open a bug report or something similar.

I ended up adding the desired plugin to the payload-dependencies/pom.xml and rebuilding the final image. That was a success (after unrelated struggles with JCasC and credentials).

Now, aside from the time that the build-mvncache takes to build (and log limits on docker's buildkit), I'm pretty satisfied with my build.

Given the procedure for the installation of plugins was failing for me (and possibly others), I wanted to share this alternative procedure to anyone having similar problems and possibly suggest that it gets documented as such (alternative).

Cheers

oleg-nenashev commented 1 week ago

Something I indeed need to check, for the default tooling I hope to return back to it