jenkinsci / jenkinsci/ontrack-plugin

Calling ontrack from Jenkins using OntrackDSLStep

Open
#64 1 comment 0 reactions 0 assignees View on GitHub
job-dsl question
Dominant language
Java
Stars
9
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Using below snippet we are not able to generate Use the provided DSL script in Jenkins
![image](https://user-images.githubusercontent.com/6533418/93579071-538b2b80-f99e-11ea-9122-aa9152ea877a.png)
![image](https://user-images.githubusercontent.com/6533418/93579090-59810c80-f99e-11ea-9275-fa458c13063f.png)

How can i make usingText to true by using ontrackDSLStep?
Plugin version: ontrack@3.4.1
![image](https://user-images.githubusercontent.com/6533418/93579128-6271de00-f99e-11ea-928b-ac31a97b3bc8.png)

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'
}

Contributor guide

Open the contributing guide

Research direction

Start at the OntrackDSLStep entry point and compare the shown Jenkins configuration with the plugin's DSL handling for usingText. Reproduce the issue with ontrack@3.4.1 using the provided snippet, then verify that the step can generate and execute the supplied DSL script with usingText enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.