jenkinsci / jenkinsci/git-plugin
[JENKINS-30287] Environment variables are not expanded in tag names when publishing
- Dominant language
- Java
- Stars
- 694
- Forks
- 1.1k
- Avg merge
- 1h 29m
- Merged PRs (30d)
- 3
Description
I'm using the Git Publisher post-build action to try and push a tag that was created during the build.
The tag name is placed into an environment variable via the line:
export BUILD_VERSION=`node -e "console.log(require('./package.json').version);"`
The Git Publisher is then configured to push the Tag $BUILD_VERSION
Rather than push it, I get an error in my build console:
> git tag -l $BUILD_VERSION # timeout=10
ERROR: Publisher hudson.plugins.git.GitPublisher aborted due to exception
hudson.AbortException: Tag $BUILD_VERSION does not exist and Create Tag is not specified, so failing.
at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:287)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1784)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
---
Originally reported by dancrumb, imported from: Environment variables are not expanded in tag names when publishing
Raw content of original issue
I'm using the Git Publisher post-build action to try and push a tag that was created during the build.
The tag name is placed into an environment variable via the line:
export BUILD_VERSION=`node -e "console.log(require('./package.json').version);"`The Git Publisher is then configured to push the Tag $BUILD_VERSION
Rather than push it, I get an error in my build console:
> git tag -l $BUILD_VERSION # timeout=10
ERROR: Publisher hudson.plugins.git.GitPublisher aborted due to exception
hudson.AbortException: Tag $BUILD_VERSION does not exist and Create Tag is not specified, so failing.
at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:287)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1784)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
environment
```
System Properties
Name ↓
Value
executable-war /usr/lib/jenkins/jenkins.war
file.encoding UTF-8
file.encoding.pkg sun.io
file.separator /
hudson.diyChunking true
java.awt.graphicsenv sun.awt.X11GraphicsEnvironment
java.awt.headless true
java.awt.printerjob sun.print.PSPrinterJob
java.class.path /usr/lib/jenkins/jenkins.war
java.class.version 50.0
java.endorsed.dirs /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/endorsed
java.ext.dirs /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/ext:/usr/java/packages/lib/ext
java.home /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre
java.io.tmpdir /tmp
java.library.path /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.protocol.handler.pkgs org.apache.axis.transport|
java.runtime.name OpenJDK Runtime Environment
java.runtime.version 1.6.0_33-b33
java.specification.name Java Platform API Specification
java.specification.vendor Sun Microsystems Inc.
java.specification.version 1.6
java.vendor Sun Microsystems Inc.
java.vendor.url http://java.sun.com/
java.vendor.url.bug http://java.sun.com/cgi-bin/bugreport.cgi
java.version 1.6.0_33
java.vm.info mixed mode
java.vm.name OpenJDK 64-Bit Server VM
java.vm.specification.name Java Virtual Machine Specification
java.vm.specification.vendor Sun Microsystems Inc.
java.vm.specification.version 1.0
java.vm.vendor Sun Microsystems Inc.
java.vm.version 23.25-b01
javamelody.About Monitoring https://wiki.jenkins-ci.org/display/JENKINS/Monitoring
javamelody.analytics-id UA-1335263-7
javamelody.custom-reports Jenkins Info,About Monitoring
javamelody.gzip-compression-disabled true
javamelody.http-transform-pattern /\d+/|/site/.+|avadoc/.+|/ws/.+|obertura/.+|estReport/.+|iolations/file/.+|/user/.+|/static/\w+/|/adjuncts/\w+/|/bound/[\w\-]+
javamelody.Jenkins Info /systemInfo
javamelody.no-database true
javamelody.storage-directory //srv/jenkins/monitoring
javamelody.system-actions-enabled true
JENKINS_HOME /srv/jenkins
jna.platform.library.path /usr/lib64:/lib64:/usr/lib:/lib
jnidispatch.path /tmp/jna--1712433994/jna852656259792851681.tmp
line.separator
mail.smtp.sendpartial true
mail.smtps.sendpartial true
os.arch amd64
os.name Linux
os.version 3.14.20-20.44.amzn1.x86_64
path.separator :
pid 1195
sun.arch.data.model 64
sun.boot.class.path /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/netx.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/plugin.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/rhino.jar:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/classes
sun.boot.library.path /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/amd64
sun.cpu.endian little
sun.cpu.isalist
sun.io.unicode.encoding UnicodeLittle
sun.java.command /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=8009 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20 --prefix=/jenkins
sun.java.launcher SUN_STANDARD
sun.jnu.encoding UTF-8
sun.management.compiler HotSpot 64-Bit Tiered Compilers
sun.os.patch.level unknown
svnkit.http.methods Digest,Basic,NTLM,Negotiate
svnkit.ssh2.persistent false
user.country US
user.dir /
user.home /srv/jenkins
user.language en
user.name jenkins
user.timezone Universal
Environment Variables
Name ↓
Value
_ /etc/alternatives/java
CONSOLETYPE serial
GEM_PATH file:/srv/jenkins/plugins/ruby-runtime/WEB-INF/lib/stapler-jruby-1.209.jar!/gem
HOME /srv/jenkins
LANG en_US.UTF-8
LANGSH_SOURCED 1
LD_LIBRARY_PATH /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.33.x86_64/jre/../lib/amd64
LOGNAME jenkins
NLSPATH /usr/dt/lib/nls/msg/%L/%N.cat
PATH /sbin:/usr/sbin:/bin:/usr/bin
previous N
PREVLEVEL N
PWD /
RUNLEVEL 3
SHELL /bin/bash
SHLVL 3
TERM linux
UPSTART_EVENTS runlevel
UPSTART_INSTANCE
UPSTART_JOB rc
USER jenkins
XFILESEARCHPATH /usr/dt/app-defaults/%L/Dt
Plugins
Name ↓
Version
Enabled
Pinned
ansicolor 0.4.0 true false
ant 1.2 true false
antisamy-markup-formatter 1.3 true true
awseb-deployment-plugin 0.0.3 true false
build-pipeline-plugin 1.4.4 true false
cluster-stats 0.4.5 true false
codedeploy 1.3 true false
configurationslicing 1.41 true false
copyartifact 1.35 true false
credentials 1.22 true true
cvs 2.12 true true
diffplugin 1.4 true false
disk-usage 0.24 true false
external-monitor-job 1.2 true false
git 2.3 true false
git-client 1.18.0 true false
gravatar 2.1 true false
greenballs 1.14 true false
javadoc 1.2 true true
jira 1.41 true false
jquery 1.7.2-1 true false
junit 1.1 true true
ldap 1.11 true true
mailer 1.15 true true
mapdb-api 1.0.6.0 true false
matrix-auth 1.2 true true
matrix-project 1.4 true true
maven-plugin 2.7.1 true true
monitoring 1.53.1 true false
multiple-scms 0.3 true false
next-build-number 1.1 true false
nodejs 0.2.1 true false
pam-auth 1.2 true true
Parameterized-Remote-Trigger 2.1.3 true false
parameterized-trigger 2.25 true false
PrioritySorter 3.4 true false
ruby-runtime 0.12 true false
rvm 0.4 true false
s3 0.7 true false
scm-api 0.2 true false
simple-theme-plugin 0.3 true false
slack 1.8 true false
ssh-credentials 1.11 true true
ssh-slaves 1.8 true true
stashNotifier 1.6 true false
subversion 2.4.4 true true
token-macro 1.10 true false
translation 1.12 true true
windows-slaves 1.0 true false
ws-cleanup 0.25 true false
```
Contributor guide
Assessment
This issue has not been assessed yet.