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

Gerrit Trigger for Dynamic trigger configuration in Jenkins Pipeline script

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • gerrit-trigger-plugin
    • None

      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?

       

          [JENKINS-51593] Gerrit Trigger for Dynamic trigger configuration in Jenkins Pipeline script

          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?

          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?

          ZackQ 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.

           

          ZackQ 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.  

          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

           

          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  

          Neel Desai added a comment -

          Any Update on this?

          Neel Desai added a comment - Any Update on this?

          S. Panchenko added a comment -

          Any update on this? or possible workaround?

          S. Panchenko added a comment - Any update on this? or possible workaround?

          Neel Desai added a comment -

          Checkout my 1st comment

          Neel Desai added a comment - Checkout my 1st comment

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

              Created:
              Updated: