jenkinsci / jenkinsci/git-plugin

[JENKINS-18005] Git Publisher plugin does not use token macro expressions for tag name

Open
#2,285 6 comments 0 reactions 0 assignees View on GitHub
component:git-plugin enhancement 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 configuring the git publisher to push tags back to the origin repository. A user can put token macros in the tag name. However these token macros are not expanded:

Consider the following configuration snippet:

2falsefalseorigin${ENV,var="JOB_NAME"}-tag-that-does-not-exitfalsefalse

This tag does not exist, mostly because I did not want to affect my repo for testing. But the error on the console demonstrates token macro expansion was not done:

Tag ${ENV,var="JOB_NAME"}-tag-that-does-not-exit does not exist and Create Tag is not specified, so failing.

Build step 'Git Publisher' marked build as failure

Notifying upstream projects of job completion

Finished: FAILURE

---
Originally reported by mpower_dodtsair, imported from: Git Publisher plugin does not use token macro expressions for tag name


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • label(s): git-publisher
  • resolution: Unresolved
  • votes: 2
  • watchers: 5
  • imported: 2025-12-02

Raw content of original issue

When configuring the git publisher to push tags back to the origin repository. A user can put token macros in the tag name. However these token macros are not expanded:

Consider the following configuration snippet:

<hudson.plugins.git.GitPublisher plugin="git@1.3.0"><configVersion>2</configVersion><pushMerge>false</pushMerge><pushOnlyIfSuccess>false</pushOnlyIfSuccess><tagsToPush><hudson.plugins.git.GitPublisher_-TagToPush><targetRepoName>origin</targetRepoName><tagName>${ENV,var="JOB_NAME"}-tag-that-does-not-exit</tagName><tagMessage/><createTag>false</createTag><updateTag>false</updateTag></hudson.plugins.git.GitPublisher_-TagToPush></tagsToPush></hudson.plugins.git.GitPublisher>

This tag does not exist, mostly because I did not want to affect my repo for testing. But the error on the console demonstrates token macro expansion was not done:
Tag ${ENV,var="JOB_NAME"}-tag-that-does-not-exit does not exist and Create Tag is not specified, so failing.
Build step 'Git Publisher' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE

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.