jenkinsci / jenkinsci/workflow-cps-plugin

[JENKINS-66331] Inaccurate documentation about GIT_COMMIT environment variable

Open
#1,607 0 comments 0 reactions 0 assignees View on GitHub
component:workflow-cps-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
186
Forks
212
Avg merge
12h 12m
Merged PRs (30d)
8

Description

https://github.com/jenkinsci/workflow-cps-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly says:


SCM-specific variables such as GIT_COMMIT are not automatically defined as environment variables


 

However with today's stable Jenkins (2.289.3) and plugins, running this Jenkinsfile:

```
pipeline {
agent any
stages {
stage('Stage') {
steps {
sh 'echo $GIT_COMMIT'
}
}
}
}
```

does print out the Git commit, showing the documentation is inaccurate.

---
Originally reported by maxb, imported from: Inaccurate documentation about GIT_COMMIT environment variable


  • status: Open
  • priority: Minor
  • component(s): workflow-cps-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-07

Raw content of original issue

https://github.com/jenkinsci/workflow-cps-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly says:


SCM-specific variables such as <code>GIT_COMMIT</code> are not automatically defined as environment variables


 

However with today's stable Jenkins (2.289.3) and plugins, running this Jenkinsfile:



pipeline {

agent any
stages {
stage('Stage') {
steps {
sh 'echo $GIT_COMMIT'
}
}
}
}


does print out the Git commit, showing the documentation is inaccurate.

Contributor guide

Open the contributing guide

Research direction

Open src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly and compare its GIT_COMMIT statement with the Jenkinsfile behavior reported in the issue. Update the documentation so it accurately describes the variable's availability; done when the help text no longer contradicts the demonstrated pipeline.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.