Open raj333921 opened 4 years ago
I think you could configure the step without the configure
and use directly ontrackDsl
, like documented at https://github.com/jenkinsci/ontrack-plugin/blob/master/JOB_DSL.md#dsl-step
ontrackDsl {
// Ontrack DSL script
script(String value)
// Injects environment variables
// Can be called several times
environment(String... names)
// Inject property values
properties(String properties)
// Enables or disables the log
log(boolean enabled = true)
}
Don't try to set the usingText
directly - this is converted internally to ScriptLocation
by the Job DSL code - better use the ontrackDsl
method - it's done for this
Using below snippet we are not able to generate Use the provided DSL script in Jenkins
How can i make usingText to true by using ontrackDSLStep? Plugin version: ontrack@3.4.1
But if i use below configuration, I am able to see the content as per expected. configure { node -> node / builders / 'net.nemerosa.ontrack.jenkins.OntrackDSLStep' { usingText true injectEnvironment 'BRANCH' injectProperties '' ontrackLog true sandbox false ignoreFailure false scriptText '''println "BRANCH = ${BRANCH}"
def myBranch = "${BRANCH}" if (myBranch.startsWith('branches/')) { myBranch = myBranch - 'branches/' } myBranch = myBranch.replaceAll('/', '-')
def ontrackBranch = myBranch if (ontrackBranch.endsWith('x')) { ontrackBranch = ontrackBranch - 'x' }