[JIRA] (JENKINS-59892) Token evaluation fails in GitPlugin

53 views
Skip to first unread message

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 2:04:02 PM10/22/19
to jenkinsc...@googlegroups.com
Moshe Zvi created an issue
 
Jenkins / Bug JENKINS-59892
Token evaluation fails in GitPlugin
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-plugin
Created: 2019-10-22 18:02
Environment: Jenkins 2.176.3, Ubuntu 14.04
GitPlugin 4.0.0-rc
TokenMacroPlugin 2.8
Priority: Critical Critical
Reporter: Moshe Zvi

We use a macro (${PACKAGE_VERSION}) to push a tag to git after a successful build. 

This used to work, until we started getting this error:

...
[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties file path 'build.properties'
[EnvInject] - Variables injected successfully.
Failed to evaluate name macro:org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'PACKAGE_VERSION' in '#59 (***-${PACKAGE_VERSION})'
Archiving artifacts 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 2:16:02 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-59892
 
Re: Token evaluation fails in GitPlugin

What was the last version where it worked?

The 4.0.0-rc release is a deprecated version with known security issues (SECURITY-1534). Have you tried either updating to the latest pre-releases (git client plugin 3.0.0-beta12 and git plugin 4.0.0-beta12) or downgrading to the most recent production releases (git client plugin 2.9.0 and git plugin 3.12.1)?

Is the failing job a Freestyle job, a Pipeline job, a Multibranch Pipeline job, or some other type of job?

Based on the log message, it appears you're reading environment variables from a file named 'build.properties'. Is that correct?

Please provide more details so that others can duplicate the problem you're seeing.

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 2:17:02 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
 
Change By: Mark Waite
Assignee: Mark Waite

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 2:33:02 PM10/22/19
to jenkinsc...@googlegroups.com
Moshe Zvi commented on Bug JENKINS-59892
 
Re: Token evaluation fails in GitPlugin

The job is a freestyle job, and I've just confirmed this reproduces with git plugin 3.9.1 and 3.12.1. 

The GitClientPlugin version is 3.0.0-rc - I'll try downgrading that as well. 

As for the properties file: I've confirmed it's there and the property is updated. The EnvInject plugin seems to be working properly, but perhaps the interaction with the TokenMacro is incorrect?

Let me know if you need more info, I appreciate you looking into this. 

 

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 3:55:03 PM10/22/19
to jenkinsc...@googlegroups.com

Please provide the job definition that is showing the problem. The config.xml file will show where the token macro replacement is being attempted in the job and may help identify the last version where it worked.

Any idea which version is the last one that was known to work?

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 4:45:02 PM10/22/19
to jenkinsc...@googlegroups.com

The same job was working fine earlier today. It just stopped (no changes to the environment).

[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties file path 'build.properties'
[EnvInject] - Variables injected successfully.
New run name is '#56 (adallomauthgateway-0.161.54)'
Archiving artifacts
using credential mcasjen_vsts_token
 > git tag -l adallomauthgateway-0.161.54 # timeout=10
 > git tag -a -f -m NO_BUILD adallomauthgateway-0.161.54 # timeout=10
Pushing tag adallomauthgateway-0.161.54 to repo origin 

However, it seems like there's actually a problem with EnvInjector: the file is there, and the content is correct, but apparently the injection to the environment doesn't work, since the variables aren't accessible. 

[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties file path 'build.properties'
[EnvInject] - Variables injected successfully.
[authgateway-iteration-161] $ /bin/bash -xe /tmp/****192125430079668331.sh
+ cat build.properties
VERSION=0.161.66
PACKAGE_VERSION=0.161.66
major=0.161
MAJOR_RELEASE=0.161
build_number=69
git_commit=3f4fe1ae90808638a1c3008c4db55bdf81dee182
git_branch=origin/iterations/iteration-161
WEBALLOM_VERSION=0.161.60
+ echo PACKAGE_VERSION=
PACKAGE_VERSION= 
Failed to evaluate name macro:org.****ci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'PACKAGE_VERSION' in '#69 (adallomauthgateway-${PACKAGE_VERSION})'
Archiving artifacts
using credential XXX
 > git tag -l authgateway-${PACKAGE_VERSION} # timeout=10
 > git tag -a -f -m Jenkins Git plugin tagging with authgateway-${PACKAGE_VERSION} authgateway-${PACKAGE_VERSION} # timeout=10
Pushing tag authgateway-${PACKAGE_VERSION} to repo origin
 > git --version # timeout=10
using GIT_ASKPASS to set credentials XXX
 > git push XXX authgateway-${PACKAGE_VERSION}
ERROR: Failed to push tag authgateway-${PACKAGE_VERSION} to origin
hudson.plugins.git.GitException: Command "git push XXX authgateway-${PACKAGE_VERSION}" returned status code 1:
stdout: 
stderr: To XXX
 ! [rejected]        authgateway-${PACKAGE_VERSION} -> authgateway-${PACKAGE_VERSION} (already exists)
error: failed to push some refs to 'XXX'

Could it actually be a problem with setting the build name that causes the error? config.xml

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 4:45:03 PM10/22/19
to jenkinsc...@googlegroups.com
Moshe Zvi updated an issue
 
Change By: Moshe Zvi
Attachment: config.xml

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 5:57:02 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Change By: Mark Waite
Component/s: envinject-plugin

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 5:58:01 PM10/22/19
to jenkinsc...@googlegroups.com

> Could it actually be a problem with setting the build name that causes the error?

I would be very surprised if setting the build name were causing the problem. However, it could be, just seems unlikely.

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 5:59:02 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite edited a comment on Bug JENKINS-59892
> bq. Could it actually be a problem with setting the build name that causes the error?


I would be very surprised if setting the build name were causing the problem.  However, it could be, just seems unlikely.

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 6:37:02 PM10/22/19
to jenkinsc...@googlegroups.com
Moshe Zvi updated an issue
 
Change By: Moshe Zvi
Environment: Jenkins 2.176.3, Ubuntu 14.04
Environment Injector Plugin - 2.2.1
GitPlugin 4 - 3 . 0 12 . 0 1
GitClient Plugin
- rc 2.9.0
TokenMacroPlugin 2.8

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 6:39:03 PM10/22/19
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 6:45:03 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Change By: Mark Waite
Component/s: git-plugin

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 6:46:03 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
Change By: Mark Waite
Component/s: build-name-setter-plugin

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 6:46:03 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Damian Szczepanik
Change By: Mark Waite
Assignee: Damian Szczepanik

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 6:47:02 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-59892
 
Re: Token evaluation fails in GitPlugin

Thanks. That issue is listed as resolved in May 2019. Are you using a version that was released before May 2019?

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 7:55:02 PM10/22/19
to jenkinsc...@googlegroups.com

I'm using the latest available version: 2.0.3. To the best of my knowledge, it was released in September.

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 7:55:02 PM10/22/19
to jenkinsc...@googlegroups.com
Moshe Zvi updated an issue
Change By: Moshe Zvi
Environment:
Jenkins 2.176.3, Ubuntu 14.04
Environment Injector Plugin - 2.2.1
Build Name and Description Setter - 2.0.3
GitPlugin - 3.12.1
GitClient Plugin - 2.9.0
TokenMacroPlugin 2.8

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 8:14:04 PM10/22/19
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-59892
 
Re: Token evaluation fails in GitPlugin

Are you able to install build-name-setter 1.7.1 to see if that resolves the issue?

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 8:19:02 PM10/22/19
to jenkinsc...@googlegroups.com

I'll give it a try.
So basically, revert to the last version before the breaking change in 2.0?

mark.earl.waite@gmail.com (JIRA)

unread,
Oct 22, 2019, 8:23:02 PM10/22/19
to jenkinsc...@googlegroups.com

Yes, that was my idea to test if that is the crucial change that resolves your issue.

moshe.zvi@gmail.com (JIRA)

unread,
Oct 22, 2019, 8:31:02 PM10/22/19
to jenkinsc...@googlegroups.com

OK. I'll find some time to install the plugin.

damian.publicemail@gmail.com (JIRA)

unread,
Oct 23, 2019, 2:56:02 PM10/23/19
to jenkinsc...@googlegroups.com

Based on logs it is clear to me that the build configuration is not correct and this is why macro plugin reports the issue which might be passed over via other plugin.

Fix the configuration first

damian.publicemail@gmail.com (JIRA)

unread,
Oct 23, 2019, 2:57:10 PM10/23/19
to jenkinsc...@googlegroups.com
Damian Szczepanik resolved as Cannot Reproduce
 

Resolving as it works as expected when the configuration is not correct

Change By: Damian Szczepanik
Status: Open Resolved
Resolution: Cannot Reproduce

moshe.zvi@gmail.com (JIRA)

unread,
Oct 23, 2019, 3:32:02 PM10/23/19
to jenkinsc...@googlegroups.com
Moshe Zvi commented on Bug JENKINS-59892
 
Re: Token evaluation fails in GitPlugin

Damian Szczepanik: How is "clear to you" that the configuration is incorrect? This configuration was working correctly, and suddenly stopped.
If you want to close the issue, at least provide some info on how to fix the configuration.

damian.publicemail@gmail.com (JIRA)

unread,
Oct 23, 2019, 4:33:03 PM10/23/19
to jenkinsc...@googlegroups.com

First, you need to prove this error comes from my plugin - you use the same macro a few times for different plugins and I have checked - this one works for me with plugin I develop. Second you are trying to evaluate empty string:
+ echo PACKAGE_VERSION=
PACKAGE_VERSION=

and error says that this is not valid operation. If you analyze output carefully you will notice that the cause of build failure is probably here:

ERROR: Failed to push tag authgateway-${PACKAGE_VERSION} to origin
hudson.plugins.git.GitException: Command "git push XXX authgateway-${PACKAGE_VERSION}" returned

moshe.zvi@gmail.com (JIRA)

unread,
Oct 23, 2019, 5:53:03 PM10/23/19
to jenkinsc...@googlegroups.com

However, the EnvInject plugin is misbehaving, because - as you can plainly see - the content of the file is fine. So I'm guessing an EnvInject issue.
I don't which plugin is yours, but the issue is very much still happening, so please refrain from closing it until we've had a chance to fully examine and resolve.

moshe.zvi@gmail.com (JIRA)

unread,
Oct 23, 2019, 5:53:03 PM10/23/19
to jenkinsc...@googlegroups.com

moshe.zvi@gmail.com (JIRA)

unread,
Oct 23, 2019, 5:53:03 PM10/23/19
to jenkinsc...@googlegroups.com
Change By: Moshe Zvi
Resolution: Cannot Reproduce
Status: Resolved In Review

moshe.zvi@gmail.com (JIRA)

unread,
Oct 23, 2019, 5:53:04 PM10/23/19
to jenkinsc...@googlegroups.com

moshe.zvi@gmail.com (JIRA)

unread,
Oct 24, 2019, 4:56:03 PM10/24/19
to jenkinsc...@googlegroups.com
Change By: Moshe Zvi
Status: In Review Resolved
Resolution: Cannot Reproduce
Reply all
Reply to author
Forward
0 new messages