jenkinsci / jenkinsci/git-plugin

[JENKINS-12921] Trigger fails to build with "Null value not allowed as an environment variable: GIT_BRANCH" error

Open
#2,116 9 comments 0 reactions 0 assignees View on GitHub
component:gerrit-trigger-plugin component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

When a build is started by the Gerrit Trigger, it always fails with the error and

stack track pasted below:

Manually triggered by user admin for Gerrit: http://localhost:8080/79

Building in workspace /mntf/jenkins/jobs/GerritBuilder/workspace

Checkout:workspace / /mntf/jenkins/jobs/GerritBuilder/workspace - hudson.remoting.LocalChannel@​72cbb9

Using strategy: Gerrit Trigger

Checkout:workspace / /mntf/jenkins/jobs/GerritBuilder/workspace - hudson.remoting.LocalChannel@​72cbb9

Fetching changes from 1 remote Git repository

Fetching upstream changes from ssh://jenkins@​localhost:29418/myrepo.git

Commencing build of Revision 4514e900f88eb22c7c006aa8b8971f55e08b0324 ()

FATAL: Null value not allowed as an environment variable: GIT_BRANCH

java.lang.IllegalArgumentException: Null value not allowed as an environment variable: GIT_BRANCH

at hudson.EnvVars.put(EnvVars.java:162)

at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)

at hudson.model.AbstractProject.checkout(AbstractProject.java:1195)

at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:576)

at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)

at hudson.model.Run.run(Run.java:1409)

at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:481)

at hudson.model.ResourceController.execute(ResourceController.java:88)

at hudson.model.Executor.run(Executor.java:238)

The configuration of the trigger is along the lines given in Alex Blewitt's article (http://www.infoq.com/articles/Gerrit-jenkins-hudson). Specifically, the project and branch are configure as:

Path - ** - Path - **

Searching the forums, mailing lists, and irc logs did not yield a solution, so we're assuming it's a bug and not

a config issue.

---
Originally reported by ronk, imported from: Trigger fails to build with "Null value not allowed as an environment variable: GIT_BRANCH" error


  • status: Open
  • priority: Major
  • component(s): gerrit-trigger-plugin, git-plugin
  • resolution: Unresolved
  • votes: 7
  • watchers: 11
  • imported: 2025-12-02

Raw content of original issue

When a build is started by the Gerrit Trigger, it always fails with the error and
stack track pasted below:

Manually triggered by user admin for Gerrit: http://localhost:8080/79
Building in workspace /mntf/jenkins/jobs/GerritBuilder/workspace
Checkout:workspace / /mntf/jenkins/jobs/GerritBuilder/workspace - hudson.remoting.LocalChannel@72cbb9
Using strategy: Gerrit Trigger
Checkout:workspace / /mntf/jenkins/jobs/GerritBuilder/workspace - hudson.remoting.LocalChannel@72cbb9
Fetching changes from 1 remote Git repository
Fetching upstream changes from ssh://jenkins@localhost:29418/myrepo.git
Commencing build of Revision 4514e900f88eb22c7c006aa8b8971f55e08b0324 ()
FATAL: Null value not allowed as an environment variable: GIT_BRANCH
java.lang.IllegalArgumentException: Null value not allowed as an environment variable: GIT_BRANCH
at hudson.EnvVars.put(EnvVars.java:162)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1101)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1195)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:576)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)
at hudson.model.Run.run(Run.java:1409)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:481)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)

The configuration of the trigger is along the lines given in Alex Blewitt's article (http://www.infoq.com/articles/Gerrit-jenkins-hudson). Specifically, the project and branch are configure as:

Path - ** - Path - **

Searching the forums, mailing lists, and irc logs did not yield a solution, so we're assuming it's a bug and not
a config issue.

  • environment: Ubuntu server, Jenkins 1.451, Gerrit Trigger 2.4.0, Git Plugin 1.1.15

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.