Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-61463

PipelineJob trigger deprecation, migration error

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Fixed
    • job-dsl-plugin
    • None
    • Jenkins LTS 2.204.5, job-dsl-plugin 1.77, pipeline job 2.37
    • job-dsl-plugin 1.78

    Description

      Migration page for 1.77 deprecates pipeline trigger, so trying to migrate to new syntax. 

      Change my jobs from:
      triggers {
        cron('@daily')
      }

      To:
      properties {
      pipelineTriggers {
      triggers

      { cron('@daily') }

      }
      }

      DSL processing now fails with:
      13:02:42 ERROR: (fullbyacct.groovy, line 8) No signature of method: javaposse.jobdsl.plugin.structs.DescribableListContext.cron() is applicable for argument types: (java.lang.String) values: [@daily]
      13:02:42 Possible solutions: grep(), print(java.io.PrintWriter), print(java.lang.Object), grep(java.lang.Object), wait(), find()

      Am I missing something?

      Attachments

        Issue Links

          Activity

            ggnanasekaran77 Gnanasekaran Gajendiran added a comment - - edited

            daspilker, For bitbucket-push-and-pull-request-plugin  below one works

            pipelineJob ("TestJob") {
                triggers{
                    bitbucketTriggers {
                        pullRequestCreatedAction()
                    }
                }
                definition {
                    cps {
                        sandbox(true)
                        script("createBranchJobAll()")
                    }
                }
            }
            
            
            

            but not this one

            pipelineJob ("TestJob") {
                properties {
                    pipelineTriggers {
                        triggers {
                            bitbucketTrigger {
                                triggers {
                                    bitBucketPPRPullRequestServerTriggerFilter {
                                        actionFilter {
                                            bitBucketPPRPullRequestServerMergedActionFilter{
                                                allowedBranches('master')
                                                isToApprove(false)
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                definition {
                    cps {
                        sandbox(true)
                        script("cicdPipeline()")
                    }
                }
            }

            reference syntax

             

            Plugin required: bitbucket-push-and-pull-request-plugin 

            ggnanasekaran77 Gnanasekaran Gajendiran added a comment - - edited daspilker , For bitbucket-push-and-pull-request-plugin   below one works pipelineJob ( "TestJob" ) { triggers{ bitbucketTriggers { pullRequestCreatedAction() } } definition { cps { sandbox( true ) script( "createBranchJobAll()" ) } } } but not this one pipelineJob ( "TestJob" ) { properties { pipelineTriggers { triggers { bitbucketTrigger { triggers { bitBucketPPRPullRequestServerTriggerFilter { actionFilter { bitBucketPPRPullRequestServerMergedActionFilter{ allowedBranches( 'master' ) isToApprove( false ) } } } } } } } } definition { cps { sandbox( true ) script( "cicdPipeline()" ) } } } reference syntax   Plugin required:  bitbucket-push-and-pull-request-plugin  

            We are also experiencing the same issue with `cron(...)`. Our workaround is to use the deprecated way.

             

            j_martin Jean-Martin Archer added a comment - We are also experiencing the same issue with `cron(...)`. Our workaround is to use the deprecated way.  
            lukas_bednar Lukas Bednar added a comment - - edited

            We are experiencing the same for gitlab, gerrit trigger and URL Trigger.

             

            pipelineJob ("TestJob") {
                properties {
                    pipelineTriggers {
                        triggers {
                            gitlab {
                                triggerOnMergeRequest(true)
                                triggerOnPush(false)
                            }
                        }
                    }
                }
            }
            
            pipelineJob ("TestJob") {
                properties {
                    pipelineTriggers {
                        triggers {
                            gerrit {
                                triggerOnEvents {
                                    patchsetCreated()
                                    draftPublished()
                                    changeRestored()
                                }
                                gerritProjects {
                                    gerritProject {
                                        pattern('my-project')
                                        branches {
                                            branch {
                                                compareType('reg_exp')
                                                pattern('.*')
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            

             

             

            lukas_bednar Lukas Bednar added a comment - - edited We are experiencing the same for gitlab, gerrit trigger and URL Trigger.   pipelineJob ( "TestJob" ) { properties { pipelineTriggers { triggers { gitlab { triggerOnMergeRequest( true ) triggerOnPush( false ) } } } } } pipelineJob ( "TestJob" ) { properties { pipelineTriggers { triggers { gerrit { triggerOnEvents { patchsetCreated() draftPublished() changeRestored() } gerritProjects { gerritProject { pattern( 'my-project' ) branches { branch { compareType( 'reg_exp' ) pattern( '.*' ) } } } } } } } } }    
            robbinvandamme robbin added a comment -

            Hi,
            I'm also migrating to the new syntax but I can figure out why I keep getting this error:

            javaposse.jobdsl.dsl.DslScriptException: (script, line 3) No signature of method: javaposse.jobdsl.dsl.helpers.properties.PropertiesContext.pipelineTriggers() is applicable for argument types: (script$_run_closure1$_closure2$_closure4) values: [script$_run_closure1$_closure2$_closure4@16f6b021]

            pipelineJob ("TestJob") { 
            properties { 
                  pipelineTriggers { 
                      triggers { 
                           pollSCM { 
                               scmpoll_spec('') 
                           } 
                      } 
                 } 
            } 
            definition { cps { sandbox(true) script("testPipeline()") } } }
            
            

            ggnanasekaran77 I used your example.
            I'm using job_dsl V1.77.

            Any idea? thx in advance!

            robbinvandamme robbin added a comment - Hi, I'm also migrating to the new syntax but I can figure out why I keep getting this error: javaposse.jobdsl.dsl.DslScriptException: (script, line 3) No signature of method: javaposse.jobdsl.dsl.helpers.properties.PropertiesContext.pipelineTriggers() is applicable for argument types: (script$_run_closure1$_closure2$_closure4) values:  [script$_run_closure1$_closure2$_closure4@16f6b021] pipelineJob ( "TestJob" ) { properties { pipelineTriggers { triggers { pollSCM { scmpoll_spec('') } } } } definition { cps { sandbox( true ) script( "testPipeline()" ) } } } ggnanasekaran77  I used your example. I'm using job_dsl V1.77. Any idea? thx in advance!
            parmou Parvesh Mourya added a comment - - edited

            robbinvandamme: check the API for your jenkins installation and see if you are able to find this method under 'freeStyleJob' -> 'triggers' -> 'pollSCM' . 

            The complete API reference is available in your Jenkins installation at https://your.jenkins.installation/plugin/job-dsl/api-viewer/index.html.

            parmou Parvesh Mourya added a comment - - edited robbinvandamme : check the API for your jenkins installation and see if you are able to find this method under 'freeStyleJob' -> 'triggers' -> 'pollSCM' .  The complete API reference is available in your Jenkins installation at https://your.jenkins.installation/plugin/job-dsl/api-viewer/index.html .

            People

              jamietanna Jamie Tanna
              webminster Alan Sparks
              Votes:
              6 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: