Reputation: 21
I want to use shared-library in my job dsl process, but it does not support the @Library.
@Library('shared-library')
def pipelineTemplate = {
//String[] strArray = ${stages}.split(" ")
pipelineJob("${serviceName}-pipeline", {
definition {
cps {
script("""
@Library('shared-library')_
pipeline {
agent any
stages {
echo "Stages --> ${stages}"
${stages.contains("build") ? buildStage() : " "} //build stage is a shared library
${stages.contains("deploy") ? deployStage() : " "}
}
""")
}
}
})
}
pipelineTemplate()
Here, the buildStage() need to be invoked from shared library, but that doesnt seem to work here
Upvotes: 0
Views: 273