jenkinsci / jenkinsci/gerrit-trigger-plugin

[JENKINS-31805] Allow environment variables for triggering gerrit projects

Open
#759 1 comment 0 reactions 0 assignees View on GitHub
component:gerrit-trigger-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
226
Forks
289
PR merge metrics
No merged PRs in 30d

Description

When creating a job, we have to specify what Gerrit project(s) to trigger a build on based on the following rules:

At least one project and branch pattern needs to be specified for a build to be triggered,and you can specify as many gerrit project to trigger on as you want.

Start by specifying the name of the Gerrit project in the left hand text field.

You can specify the name pattern in three different ways, as provided by the "Type" drop-down menu.

Plain: The exact name in Gerrit, case sensitive equality.

Path: ANT style pattern. Ex: "/base/*"

RegExp: Regular expression.

Then provide the name of the branch(es) to trigger on. The same "pattern types" is available as above.

So for example to trigger on all branches in the project you can specify:

Type: Path

Pattern: **

You can add more branch patterns by clicking on "Add Branch" and more projects by clicking "Add Project".

The same syntax works for specifying which file(s) to trigger on (this is only available in version 2.3 or higher of Gerrit).

However, in order to improve its power even further, it could be possible to use $GERRIT_PROJECT as project pattern and $GERRIT_BRANCH as branch pattern (or any other environment variable). That would enable the user to create a single job to build several projects based on the incoming events from Gerrit to Jenkins.

---
Originally reported by thiagocrepaldi, imported from: Allow environment variables for triggering gerrit projects


  • assignee: rsandell
  • status: Open
  • priority: Minor
  • component(s): gerrit-trigger-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-06

Raw content of original issue

When creating a job, we have to specify what Gerrit project(s) to trigger a build on based on the following rules:

At least one project and branch pattern needs to be specified for a build to be triggered,and you can specify as many gerrit project to trigger on as you want.

Start by specifying the name of the Gerrit project in the left hand text field.
You can specify the name pattern in three different ways, as provided by the "Type" drop-down menu.

Plain: The exact name in Gerrit, case sensitive equality.
Path: ANT style pattern. Ex: "/base/*"
RegExp: Regular expression.
Then provide the name of the branch(es) to trigger on. The same "pattern types" is available as above.
So for example to trigger on all branches in the project you can specify:
Type: Path
Pattern: **
You can add more branch patterns by clicking on "Add Branch" and more projects by clicking "Add Project".

The same syntax works for specifying which file(s) to trigger on (this is only available in version 2.3 or higher of Gerrit).

However, in order to improve its power even further, it could be possible to use $GERRIT_PROJECT as project pattern and $GERRIT_BRANCH as branch pattern (or any other environment variable). That would enable the user to create a single job to build several projects based on the incoming events from Gerrit to Jenkins.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the gerrit-trigger-plugin matches incoming Gerrit project and branch names against the configured patterns. Check the existing handling for Plain, Path, and RegExp patterns, then define tests showing that $GERRIT_PROJECT, $GERRIT_BRANCH, and other environment variables can be used in those patterns while preserving current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.