Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Correct syntax for pipelineTriggers

I have a seed job that is based off of DSL. This is what is looks like

pipelineJob("job name") {
        description('Some explanation')
        triggers {
                cron('@midnight')
                upstream('someJob', 'SUCCESS')
        }
        parameters {
        ...

When I run the job, it ends up being unstable with the error message

Warning: (Builds.groovy, line 53) triggers is deprecated

So now Ive re written the code as follows

pipelineJob("job name") {
        description('Some explanation')
        properties {
            pipelineTriggers {
                triggers {
                        cron('@midnight')
                        upstream('someJob', 'SUCCESS')
                }
            }
         parameters {
         ...

And now I get the error

ERROR: (unknown source) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.cron() is applicable for argument types: (java.lang.String) values: [@midnight]
Possible solutions: grep(), print(java.io.PrintWriter), print(java.lang.Object), grep(java.lang.Object), wait(), any()

Now ive re-written it as

pipelineJob("job name") {
        description('Some explanation')
        properties {
            pipelineTriggers {
                triggers {
                        cron{
                            spec('@midnight')
                        }
                        upstream('someJob', 'SUCCESS')
                }
            }
         parameters {
         ...

But now this ends up with the error

ERROR: (Builds.groovy, line 72) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.upstream() is applicable for argument types: (java.lang.String, java.lang.String) values: [someJob, SUCCESS]

What else have I missed here ?

like image 575
jeunii Avatar asked Dec 08 '25 10:12

jeunii


1 Answers

Using the URL <JENKINS_URL>/plugin/job-dsl/api-viewer/index.html#path/pipelineJob-properties-pipelineTriggers-triggers

I got the correct format

        properties {
            pipelineTriggers {
                triggers {
                        cron {
                            spec('@midnight')
                            }
                        upstream{
                            upstreamProjects('someJob')
                            threshold('SUCCESS')
                        }
                }
            }
        }
like image 54
jeunii Avatar answered Dec 11 '25 12:12

jeunii



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!