• Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Critical Critical
    • None
    • 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

      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 
      
      

       

          [JENKINS-59892] Token evaluation fails in GitPlugin

          Moshe Zvi created issue -

          Mark Waite added a comment -

          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 Waite added a comment - 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 Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]

          Moshe Zvi added a comment -

          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. 

           

          Moshe Zvi added a comment - 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 Waite added a comment -

          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?

          Mark Waite added a comment - 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 made changes -
          Attachment New: config.xml [ 49238 ]

          Moshe Zvi added a comment -

          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 added a comment - 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
          Mark Waite made changes -
          Component/s New: envinject-plugin [ 15893 ]

          Mark Waite added a comment - - edited

          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 Waite added a comment - - edited 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 made changes -
          Environment Original: Jenkins 2.176.3, Ubuntu 14.04
          GitPlugin 4.0.0-rc
          TokenMacroPlugin 2.8
          New: Jenkins 2.176.3, Ubuntu 14.04
          Environment Injector Plugin - 2.2.1
          GitPlugin - 3.12.1
          GitClient Plugin - 2.9.0
          TokenMacroPlugin 2.8

            dszczepanik Damian Szczepanik
            moshe_zvi Moshe Zvi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: