Hi, 

I want to setup a pipeline for our shared groovy library. It looks like

node ('master') {
    ...    
    stage "CI: Build, unit test"
    ciBuildTest()
    
    stage "CI: Integration test (${env.INTEGRATIONTEST_PIPELINE})"
    // INTEGRATIONTEST_PIPELINE is a property of the job running this file.
    // enables switching of the integration test project without 
modification to the Jenkinsfile itself.
    println "will start now '${env.INTEGRATIONTEST_PIPELINE}' for 
integration tests."
    
    // TODO pass this BRANCHNAME so the triggered job will use shared 
library from this branch.
    build job: "${env.INTEGRATIONTEST_PIPELINE}", propagate: true, wait: 
true, parameters: []
    ...    
}

The job gets triggered - but now I need an option to pass the current 
branch $env.BRANCHNAME to the triggered job. 
Especially, I need to reference the shared library than.

I added a parameter "String: SHARED_LIB_VERSION" to the triggered job, with 
"master" as default:
Inside this job, I tried to reference the lib using the annotation way:

@Library("sharedLibrary@$SHARED_LIB_VERSION")
import myFunctions
....

But i couldnt get this to work.

Is there a way to pass the version of the shared library to a job ? Or to 
the folder, the job is in ?

Thanx for any help, 

Torsten

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5c707014-3587-4889-9a7b-8dd15405a9ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to