<p>The "correct" way to determine the names for Pipeline step parameters is to use the Pipeline Snippet generator in the web UI:</p>

<p><a href="https://www.jenkins.io/doc/book/pipeline/getting-started/#snippet-generator" rel="nofollow noreferrer">https://www.jenkins.io/doc/book/pipeline/getting-started/#snippet-generator</a></p>

<p>However, based on browsing the <a href="https://github.com/jenkinsci/gerrit-trigger-plugin/blob/b614e75a03b3d75afa63197b035031d905c36a4d/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java" rel="nofollow noreferrer">source code</a>, I am guessing the name of the parameter you are looking for is <code>dependencyJobsNames</code>.</p>

CC BY-SA 4.0
2020-05-11T16:41:40.280Z
2020-05-11T16:41:40.280Z
jayhendren
<p>We do have this configuration in our GUI based Jenkins project, trying to convert it to Jenkins pipeline, couldn't find how to add <code>precurse-build</code> as dependent build as shown in red below.</p>

<p><a href="https://i.sstatic.net/ZqKEf.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZqKEf.png" alt="Gerrit Trigger Plugin options"></a></p>

<p>I added below below pipeline code to trigger the build when<code>run_job</code> is added as gerrit comment, and it works good, would anyone please show me how to add <code>Other jobs on which this job depends</code> to this?</p>

<pre><code>pipeline {
    triggers {
         gerrit dynamicTriggerConfiguration: 'true',
                triggerConfigURL: 'https://some/url/path/trigger.txt',
                serverName: 'gerrit-server',
                triggerOnEvents: [
                    commentAddedContains('^run_job$')
                ]
    }

    stages {
       ...
       ...
</code></pre>

<jenkins><jenkins-pipeline><groovy>
How to add job dependency to gerrit trigger in Jenkins pipeline?
rodee
# How to add job dependency to gerrit trigger in Jenkins pipeline?

(Asked by: username_0 on 2020-05-08)

We do have this configuration in our GUI based Jenkins project, trying to convert it to Jenkins pipeline, couldn't find how to add precurse-build as dependent build as shown in red below.

I added below below pipeline code to trigger the build whenrun_job is added as gerrit comment, and it works good, would anyone please show me how to add Other jobs on which this job depends to this?
pipeline {
    triggers {
         gerrit dynamicTriggerConfiguration: 'true',
                triggerConfigURL: 'https://some/url/path/trigger.txt',
                serverName: 'gerrit-server',
                triggerOnEvents: [
                    commentAddedContains('^run_job$')
                ]
    }

    stages {
       ...
       ...

**Tags:** jenkins, jenkins-pipeline, groovy


---

## 1 answers

### Answer by username_1 on 2020-05-11. Score: 1 | Accepted answer

The "correct" way to determine the names for Pipeline step parameters is to use the Pipeline Snippet generator in the web UI:

<https://www.jenkins.io/doc/book/pipeline/getting-started/#snippet-generator>

However, based on browsing the [source code](https://github.com/jenkinsci/gerrit-trigger-plugin/blob/b614e75a03b3d75afa63197b035031d905c36a4d/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java), I am guessing the name of the parameter you are looking for is `dependencyJobsNames`.


---

