Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39899

workflow-lib : declaring several Libraries causes them to overlap

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • RHEL 7.3 for master
      jenkins LTS 2.19.3

      Workflow lib is great, but still suffers some issues.

      Several libraries can be defined in Jenkins configuration. This is great. What I plan is :

      • a global 'core' lib for those boilerplate high level methods everyone need (not many methods, used by lots of people, shared among several jenkins instances)
      • a 'per jenkins instance' lib, see it as a 'per team' lib for any 'team-specific usecases', if they exist

      Mater is : apparently now the lib checkout MUST put 'vars' directory at the root of /jobs/jobId@libs

      So, for instance, my libs are on a git repo, I tried to 'checkout in a specific subdirectory' : it doesn't work

      So, ok, I leave it in default place ... but then I have to make a 'wipe and force clone' checkout.

      in the pipeline I would write this :

      @Library ('lib-one')
      import method1
      
      // at this moment, the checkout is done, methods1 becomes available in classpath etc... great
      
      @Library('lib-two')
      import method2
      
      //at this moment : lib-two is checked out, lib-one is in the way ... that's where the 'wipe' option is handy, it removes lib-one from disk, even if it's still in memory
      //without the 'wipe' option, note that there will be a failure here
      

      As a result there are several issues :

      • performance issues : useless git clone performed at each build
      • hard to setup (I lost hours finding this 'wipe clean chekcout' method
      • lack of readability : for a post-mortem analysis, lib sources that were used are no more available
      • rely on repo availability : this is specific to my situation where we have several SCM, the libs are on a 'less critical' one ... and if it's not available then all jobs fail. If I didn't need to wipe lib-one to get lib-two ... next run would simply use the current cached libs.

      What could work :

      • either have several @libs dirs, but it's probably not that easy
      • or correctly follow the 'checkout in subdir' to look for 'vars' etc...

            Unassigned Unassigned
            squalou squalou jenkins
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: