-
Notifications
You must be signed in to change notification settings - Fork 395
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
Question: Testing Shared Library definition using JenkinsPipelineUnit #70
Comments
Hi @mkobit I've put a basic skeleton example of what I'm doing here: https://github.com/jimcroft/jenkinslib-example. Hope it helps. If that example does help you load your Jenkins library from a local location (rather than an scm source) could you add a comment to #75? Thanks Jim |
Waiting for "local-location" solution too! Meanwhile you can use a copy task in your task initLibraries(type: Copy){
from('./') {
include 'src/**/*'
include 'vars/**/*'
}
into 'build/classes/groovy/test/nextlayerci-example@master'
}
test.dependsOn initLibraries https://github.com/nextlayer-ops/jenkins-pipeline-shared-library-example/blob/master/build.gradle#L12-L20 Btw. If you want to use maven you can use the same trick: |
Meanwhile I've found a better solution. Thanks to the SAP guys ;) https://github.com/SAP/jenkins-library/blob/master/test/groovy/PiperTestBase.groovy#L49-L59 |
Closing in a favor of #31 |
I (finally) released the first version of https://github.com/mkobit/jenkins-pipeline-shared-libraries-gradle-plugin , which is a Gradle plugin intending to aid in the authoring of shared libraries. I'm sure an additional plugin could be added to support consumers of
JenkinsPipelineUnit
for build pipeline authors that also want to test their pipeline.I wrote up an example library at https://github.com/mkobit/jenkins-pipeline-shared-library-example, but was struggling in writing a unit test against the local shared library functionality (at https://github.com/mkobit/jenkins-pipeline-shared-library-example/blob/master/test/unit/groovy/com/mkobit/libraryexample/JPUExampleSpec.groovy right now).
Any suggestions or example to look at for using this as a test harness for Shared Library definition?
The text was updated successfully, but these errors were encountered: