Hi All,

I'm trying to figure out how to use folder-level shared libraries (
https://jenkins.io/doc/book/pipeline/shared-libraries/#folder-level-shared-libraries),
but I haven't been able to find any examples or implementation
documentation. I'm using global share libraries, which work just fine, but
I'd also like to know how to use these folder-level ones as well.

First off here is what is working. I have a normal shared library that I
set up (Manage Jenkins > Configure System > Global Pipeline Libraries) that
points to a repo in my GitHub account. At the top of my declarative
Jenkinsfiles I have the line, `@Library('global-library')`. And I can call
any .groovy file from the vars dir in that repo by simply referencing the
script name in my Jenkinsfile, e.g. jiraCheck().

That is how I do things currently and it works. What I'd like to also do is
have a folder in the project repo with "shared libraries" that are specific
to the project and call it the same way within the Jenkinsfile as global
shared libraries. Here is what I've tried (neither have worked).

In my project repo I have a folder called 'local-library/vars/' and under
those folders I have a file called projSetup.groovy.

```
@Library(['global-library', 'local-library']) _

pipeline {agent none
  stages {
    stage('Test') { agent any
      steps {
        setup() // This comes from global-library
        projSetup() //This should come from local-library
      }
    }
  }
}
```
This method threw an error because it couldn't find the library
'local-library'.

I also tried to just reference the function with a relative path.
```
@Library('global-library') _

pipeline {agent none
  stages {
    stage('Test') { agent any
      steps {
        setup() // This comes from global-library
        local-library/vars/projSetup() //This should come from local-library
      }
    }
  }
}
```
This also threw an error.


Am I trying to use this feature correctly? Even if I'm not, how is this
feature suppose to be used? Thanks for your help.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAL0jAibgcgec9H%2B-m3_%2BgUonMm9h7nY_BjRQ6u1TRL16wRwbXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to