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

Gerrit Trigger for Dynamic trigger configuration in Jenkins Pipeline script

    Details

    • Similar Issues:

      Description

      It will be nice to have a script/task for gerrit trigger on dynamic configuration to trigger when any change gets merge to master/any branch.

       

      I have Jenkinsfile where I have whole CI/CD process as Jenkins-pipeline code script. I also want to include Build trigger(Gerrit evenets when change merges to master) in my jenkinsfile.

      I searched for all possible ways(https://jenkins.io/doc/pipeline/steps) but I couldn't find any way to do so. Can you please provide this feature?

       

        Attachments

          Activity

          Hide
          neeldesai1992 Neel Desai added a comment -

          Got the script:

          triggers {
          gerrit customUrl: '', gerritProjects: [[branches: [[compareType: 'PLAIN', pattern: 'master']], compareType: 'PLAIN', disableStrictForbiddenFileVerification: false, pattern: 'gitHubRepo/repo1']], serverName: 'gerrit.com', triggerOnEvents: [changeMerged()]
          }

           

          But to make this change permanent, I have to first run it manually then from the next time when any change gets merge to master it is triggering pipeline.

          That means 1st run setting up config.xml with our trigger plugin so the next runs automatically getting triggers because previous run is already setting up config.xml for it. How can I tackle this issue?

          Show
          neeldesai1992 Neel Desai added a comment - Got the script: triggers { gerrit customUrl: '', gerritProjects: [[branches: [ [compareType: 'PLAIN', pattern: 'master'] ], compareType: 'PLAIN', disableStrictForbiddenFileVerification: false, pattern: 'gitHubRepo/repo1']], serverName: 'gerrit.com', triggerOnEvents: [changeMerged()] }   But to make this change permanent, I have to first run it manually then from the next time when any change gets merge to master it is triggering pipeline. That means 1st run setting up config.xml with our trigger plugin so the next runs automatically getting triggers because previous run is already setting up config.xml for it. How can I tackle this issue?
          Hide
          zackq Zhi Qiang Chin added a comment -

          maybe you could trigger the job to run programmatically after creating the job?

          i guess it needs to first run so that Jenkins can register this trigger.

           

          Show
          zackq Zhi Qiang Chin added a comment - maybe you could trigger the job to run programmatically after creating the job? i guess it needs to first run so that Jenkins can register this trigger.  
          Hide
          neeldesai1992 Neel Desai added a comment -

          Then how Jenkins taking entire pipeline directives? Means pipeline, stages, stage, agent all how all these directives gets registered on first run? If we can know this reason then this can help us

           

          Show
          neeldesai1992 Neel Desai added a comment - Then how Jenkins taking entire pipeline directives? Means pipeline, stages, stage, agent all how all these directives gets registered on first run? If we can know this reason then this can help us  
          Hide
          neeldesai1992 Neel Desai added a comment -

          Any Update on this?

          Show
          neeldesai1992 Neel Desai added a comment - Any Update on this?
          Hide
          amdokamal S. Panchenko added a comment -

          Any update on this? or possible workaround?

          Show
          amdokamal S. Panchenko added a comment - Any update on this? or possible workaround?
          Hide
          neeldesai1992 Neel Desai added a comment -

          Checkout my 1st comment

          Show
          neeldesai1992 Neel Desai added a comment - Checkout my 1st comment

            People

            • Assignee:
              rsandell rsandell
              Reporter:
              neeldesai1992 Neel Desai
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: