Getting error while updating the job where pipeline job's definition is in yaml and script path is defined with groovy script.

28 views
Skip to first unread message

Kunal Kapoor

unread,
Jul 22, 2024, 5:39:26 AM7/22/24
to jenkins-job-builder
Hi Team,

I am using 6.4.1 version and my configuration is as follows:

Job's definition (yaml) : 

job definition.png

I am getting below error while updating the job:
error.png

Can someone please help me with the probable cause of this or any changes are required to get a desired output.

- Kunal Kapoor

Tony Chia

unread,
Jul 23, 2024, 10:30:49 AM7/23/24
to Kunal Kapoor, jenkins-job-builder

You cannot put the script-path under dsl
you can do either one of these

with inline dsl

- job:
# id: 'abc'
name: 'latest-chart'
project-type: pipeline

description: |
Created jjb
triggers:
- timed: |
TZ=America/Los_Angeles
H 0 * * *
dsl: |
def str = "Hello"
def num = 5

println str
println num

# script-path: charts.groovy



or with pipeline-scm/script_path
You cannot mix dsl with pipeiine-scm 
```

Note that dsl and pipeline-scm parameters are mutually exclusive.


```

- job:
# id: 'abc'
name: 'latest-chart'
project-type: pipeline
description: |
Created jjb
triggers:
- timed: |
TZ=America/Los_Angeles
H 0 * * *

pipeline-scm:
scm:
- hg:
clean: true
script-path: Jenkinsfile.groovy
lightweight-checkout: true



--
You received this message because you are subscribed to the Google Groups "jenkins-job-builder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins-job-bui...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkins-job-builder/ffa66796-4f59-4bdd-86f2-ba8cbc468635n%40googlegroups.com.


--

Tony Chia

unread,
Jul 23, 2024, 10:30:52 AM7/23/24
to Kunal Kapoor, jenkins-job-builder
Here are the screenshots for the dsl pipeline

When you selected the "pipeline from scm", you get a script path field to enter the path to the groovy file. This matches the pipeline-scm from the yaml file

pipeline_script_from_scm.png

When you selected the "pipeline script" from the definition drop down menu, you get a text box where you can specify the groovy directly. This matches the "dsl" attribute of the yaml file 

pipelin_script_inline_textbox.png

Your original yaml is using "script-path" under the "dsl" attribute which is invalid thus you are getting the stack trace 

Regards,
Tony Chia

--
Reply all
Reply to author
Forward
0 new messages