4

My company's Jenkins uses global libraries, which are loaded implicitly.

They are c*** and I don't want them for every pipeline. It takes more than 10 sec to load them.

Does anybody know a way how to suppress them? Thanks!

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
SScholl
  • 598
  • 6
  • 19
  • 1
    To disable global libraries, you can just comment the first line in your `Jenkinsfile` which will usually look something like this: `@Library('my-shared-library@master') _` – Technext Sep 02 '19 at 12:47
  • Did you try the suggestion? – Technext Sep 03 '19 at 10:58
  • 1
    This is not possible. As I wrote, the Libraries are loaded implicitly and are configured by our admins globally. They thought, it would be a good idea to give all users magic functions to be used easily. Other users don't understand shared libraries, so the admins don't want to remove the "load implicitly" option. – SScholl Sep 03 '19 at 17:09

1 Answers1

4

Unfortunately, it is not possible to suppress a global shared pipeline. I ran into a similar issue where I needed a library to apply to majority of the jobs, but only a select few that did not require it.

I do not know the details of your jenkins setup, but my workaround might be able to help. I took advantage of the shared pipeline configuration in Jenkins folders.

Picture of Folder "job"

To do this, you'll need to remove the library(ies) from the Global Settings and instead place them on the folder.

enter image description here

You can then move all of the jobs that require the shared library to that newly created folder. With a folder-defined shared library, you'll now have a degree of separation between the jobs that originally needed the global shared library and jobs that do not require it. If there are a lot of jobs, this will definitely be a bit of a pain to move all of the jobs to correct folder. You'll also want to make sure you move every job that needs the library into the folder, before you remove the global shared library.

Suppressing a shared pipeline would be a good support ticket to provide to the Jenkins team, the functionality would be useful. I'd make good use of it :)