Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34856

build_timeout-plugin timeout causes exception in token marco plugin

      I recently installed several plugin and jenkins updates (now on jenkins 2.4). It appears there is a conflict between build_timeout-plugin and the Token Macro Plugin. When I try and run job with a timeout I get the following:

      FATAL: Could not evaluate macro
      org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'timeout' in '${timeout}'
      at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:207)
      at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:246)
      at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:232)
      at hudson.plugins.build_timeout.BuildTimeOutStrategy.expandAll(BuildTimeOutStrategy.java:108)
      at hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy.getTimeOut(AbsoluteTimeOutStrategy.java:44)
      at hudson.plugins.build_timeout.BuildTimeoutWrapper$EnvironmentImpl.<init>(BuildTimeoutWrapper.java:166)
      at hudson.plugins.build_timeout.BuildTimeoutWrapper.setUp(BuildTimeoutWrapper.java:211)
      at hudson.model.Build$BuildExecution.doRun(Build.java:156)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      at hudson.model.Run.execute(Run.java:1741)
      at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:410)
      FATAL: Unrecognized macro 'timeout' in '${timeout}'

      If I remove the build-timeout-plugin the error goes away.

        1. config.xml
          5 kB
        2. config(bob).xml
          4 kB
        3. screen1.png
          screen1.png
          71 kB
        4. screen2.png
          screen2.png
          74 kB
        5. screen3.png
          screen3.png
          60 kB

          [JENKINS-34856] build_timeout-plugin timeout causes exception in token marco plugin

          Oleg Nenashev added a comment -

          I suspect it's a flexible behavior, but needs to be investigated.
          Try the following expression:

          ${ENV,var="timeout"} 
          

          Oleg Nenashev added a comment - I suspect it's a flexible behavior, but needs to be investigated. Try the following expression: ${ENV,var="timeout"}

          ikedam added a comment -

          I want to know more details about how you configured the project
          (as it sounds like a setup issue).

          Would you report steps to reproduce the problem?
          Or you can attach config.xml of the project, which is located at ${JENKINS_HOME}/jobs/(project name)/config.xml

          ikedam added a comment - I want to know more details about how you configured the project (as it sounds like a setup issue). Would you report steps to reproduce the problem? Or you can attach config.xml of the project, which is located at ${JENKINS_HOME}/jobs/(project name)/config.xml

          Ian McDonald added a comment -

          Attached requested config.xml

          Ian McDonald added a comment - Attached requested config.xml

          ikedam added a comment -

          The variable "timeout" is not defined. It should fail.
          What's your expected behavior?

          ikedam added a comment - The variable "timeout" is not defined. It should fail. What's your expected behavior?

          Ian McDonald added a comment -

          I pass in timeout as a job parameter. So it should be define and I have had my configuration for several months. It has only been recently that it has stopped working which I think is because I either update my Jenkins version or got plugin updates.

          Ian McDonald added a comment - I pass in timeout as a job parameter. So it should be define and I have had my configuration for several months. It has only been recently that it has stopped working which I think is because I either update my Jenkins version or got plugin updates.

          ikedam added a comment -

          > I pass in timeout as a job parameter.

          No, you don't.
          You look pass only "base_dir" and "type".
          (As far as I can see from config.xml)

          Would you attach the screenshot of the configuration of the project?

          ikedam added a comment - > I pass in timeout as a job parameter. No, you don't. You look pass only "base_dir" and "type". (As far as I can see from config.xml) Would you attach the screenshot of the configuration of the project?

          Ian McDonald added a comment -

          Sorry, I had removed the timeout parameter when trying to debug the issue. I have continued to debug the issue and have created a simple configuration that illustrates the issue. I created a Multi-configuration project (elastic-axis plugin) called bob. I have attached config.xml file for bob as config(bob).xml and have attached screen1.png, screen2.png, screen3.png to show how bob is configured.

          You will see in the bob project I have a base_dir parameter set to /var/tmp. Then in the build portion of bob I have an execute shell with:

          cd $base_dir
          pwd
          cd ${base_dir}
          pwd

          When I execute the job i get this output:
          Started by upstream project "bob" build number 1
          originally caused by:
          Started by user Ian McDonald
          [EnvInject] - Loading node environment variables.
          Building remotely on imb-151 (target) in workspace /home/auto/targets/imb-151/imb-151/workspace/bob/test/imb-151
          [imb-151] $ bash -xe /tmp/hudson2764339436810864180.sh
          + cd
          + pwd
          /home/iamcdonald
          + cd
          + pwd
          /home/iamcdonald
          Finished: SUCCESS

          Initially I though that the error was being generated within the build_timeout plugin, but after further investigation it seems that the parameters that are being defined are not being passed to the execution shell in a Multi-configuration project?

          Ian McDonald added a comment - Sorry, I had removed the timeout parameter when trying to debug the issue. I have continued to debug the issue and have created a simple configuration that illustrates the issue. I created a Multi-configuration project (elastic-axis plugin) called bob. I have attached config.xml file for bob as config(bob).xml and have attached screen1.png, screen2.png, screen3.png to show how bob is configured. You will see in the bob project I have a base_dir parameter set to /var/tmp. Then in the build portion of bob I have an execute shell with: cd $base_dir pwd cd ${base_dir} pwd When I execute the job i get this output: Started by upstream project "bob" build number 1 originally caused by: Started by user Ian McDonald [EnvInject] - Loading node environment variables. Building remotely on imb-151 (target) in workspace /home/auto/targets/imb-151/imb-151/workspace/bob/test/imb-151 [imb-151] $ bash -xe /tmp/hudson2764339436810864180.sh + cd + pwd /home/iamcdonald + cd + pwd /home/iamcdonald Finished: SUCCESS Initially I though that the error was being generated within the build_timeout plugin, but after further investigation it seems that the parameters that are being defined are not being passed to the execution shell in a Multi-configuration project?

          ikedam added a comment -

          Sounds a serious regression of Jenkins core (or matrix project).
          You'd better to use LTS versions (now 1.651.2) as weekly releases are often unstable.

          ikedam added a comment - Sounds a serious regression of Jenkins core (or matrix project). You'd better to use LTS versions (now 1.651.2) as weekly releases are often unstable.

          ikedam added a comment -

          The issue is reported in JENKINS-34758.
          It looks an issue since 1.651.2.
          Please use 1.651.1.

          ikedam added a comment - The issue is reported in JENKINS-34758 . It looks an issue since 1.651.2. Please use 1.651.1.

            ikedam ikedam
            imcdonald Ian McDonald
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: