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

Warnings plugin doesn't allow environment variables in file names

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • warnings-plugin
    • None
    • Jenkins 1.656
      Centos 5
      Warnings plugin 2.52

      When configuring file names to be scanned for compiler warnings, it would be good to be able to use build environment variables (similar to other fields e.g. the Command field in an Execute Shell box).

      I'd like to be able to enter "${CLEARCASE_VIEWPATH}/vobs/somePath/build_output" into the File Pattern field of Scan Workspace Files. But it doesn't expand the ${CLEARCASE_VIEWPATH}.

      I can work around it by using "*/vobs/somePath/build_output" as that filename is unique. But I shouldn't have to.

          [JENKINS-34157] Warnings plugin doesn't allow environment variables in file names

          Ulli Hafner added a comment -

          I still can't reproduce this. I added now your pattern in the testcase, however everything is correctly expanded.

          Is there still anything missing in the test what is different to your setup?

          How is your BUILD_NUMBER variable computed? Seems that it does contain a totally strange input. Maybe that is the problem?

          Ulli Hafner added a comment - I still can't reproduce this. I added now your pattern in the testcase , however everything is correctly expanded. Is there still anything missing in the test what is different to your setup? How is your BUILD_NUMBER variable computed? Seems that it does contain a totally strange input. Maybe that is the problem?

          Anna Freiholtz added a comment - BUILD_NUMBER is a built in Jenkins environment variable: https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-below

          Ulli Hafner added a comment - - edited

          Yes, I know. I already used in my test. But your number looks quite strange: #1982_M01_13387_B. Is this value changed by a plug-in?

          Ulli Hafner added a comment - - edited Yes, I know. I already used in my test. But your number looks quite strange: #1982_M01_13387_B. Is this value changed by a plug-in?

          Ah, I see.

          1982 is the previous build number. I create a directory for each build using <BUILD_NUMBER>_<Reference> where reference could be M01_13387_B, master or something similar.

          So it seems to me it is only in the setting for file pattern the environment variable is not working for me. But since you cannot reproduce the error, I'm beginning to suspect there is something else interfering...

          Anna Freiholtz added a comment - Ah, I see. 1982 is the previous build number. I create a directory for each build using <BUILD_NUMBER>_<Reference> where reference could be M01_13387_B, master or something similar. So it seems to me it is only in the setting for file pattern the environment variable is not working for me. But since you cannot reproduce the error, I'm beginning to suspect there is something else interfering...

          Ulli Hafner added a comment - - edited

          Do you have a plug-in installed, that changes the build number? Or that works with environment variables?

          Can you add an additional build step (shell command) after your build that just echoes the value of BUILD_NUMBER? Just to be sure...

          echo $BUILD_NUMBER
          

          Ulli Hafner added a comment - - edited Do you have a plug-in installed, that changes the build number? Or that works with environment variables? Can you add an additional build step (shell command) after your build that just echoes the value of BUILD_NUMBER? Just to be sure... echo $BUILD_NUMBER

          Anna Freiholtz added a comment - - edited

          I couldn't shell command, I don't know why. (We never use shell in Jenkins.) So I added a build step Execute Windows Batch Command instead:

          echo %BUILD_NUMBER%
          

          Console output:

          D:\Q1>echo 2186 
          2186
          
          D:\Q1>exit 0 
          [WARNINGS] Parsing warnings in files '${BUILD_NUMBER}_master\ND4\ReleaseTools\Build\Log\warning.log' with parser Warning.log parser
          [WARNINGS] Finding all files that match the pattern ${BUILD_NUMBER}_master\ND4\ReleaseTools\Build\Log\warning.log
          [WARNINGS] Computing warning deltas based on reference build #2181_TP_10564
          

          2181 is the previous successful build.

          My Jenkins job also use the plugin for injecting env variables.

          Anna Freiholtz added a comment - - edited I couldn't shell command, I don't know why. (We never use shell in Jenkins.) So I added a build step Execute Windows Batch Command instead: echo %BUILD_NUMBER% Console output: D:\Q1>echo 2186 2186 D:\Q1>exit 0 [WARNINGS] Parsing warnings in files '${BUILD_NUMBER}_master\ND4\ReleaseTools\Build\Log\warning.log' with parser Warning.log parser [WARNINGS] Finding all files that match the pattern ${BUILD_NUMBER}_master\ND4\ReleaseTools\Build\Log\warning.log [WARNINGS] Computing warning deltas based on reference build #2181_TP_10564 2181 is the previous successful build. My Jenkins job also use the plugin for injecting env variables.

          I tested to create a new Jenkins job where the only build step is

          echo %BUILD_NUMBER%
          

          Console output:

          d:\JenkinsSlave\workspace\TestWarningPlugin>echo 2 
          2
          
          d:\JenkinsSlave\workspace\TestWarningPlugin>exit 0 
          [WARNINGS] Parsing warnings in files '${BUILD_NUMBER}' with parser Texas Instruments Code Composer Studio (C/C++)
          [WARNINGS] Finding all files that match the pattern ${BUILD_NUMBER}
          [WARNINGS] Computing warning deltas based on reference build #1
          

          Anna Freiholtz added a comment - I tested to create a new Jenkins job where the only build step is echo %BUILD_NUMBER% Console output: d:\JenkinsSlave\workspace\TestWarningPlugin>echo 2 2 d:\JenkinsSlave\workspace\TestWarningPlugin>exit 0 [WARNINGS] Parsing warnings in files '${BUILD_NUMBER}' with parser Texas Instruments Code Composer Studio (C/C++) [WARNINGS] Finding all files that match the pattern ${BUILD_NUMBER} [WARNINGS] Computing warning deltas based on reference build #1

          Ulli Hafner added a comment -

          I see. Maybe expansion does not work in the same way on Windows. I'm not sure if I can setup a test fixture that uses a Windows slave.

          Ulli Hafner added a comment - I see. Maybe expansion does not work in the same way on Windows. I'm not sure if I can setup a test fixture that uses a Windows slave.

          I apologize, I was under the impression that I had installed the latest version of the plugin. But I hadn't... Now I have updated the plugin and it is working! Sorry again.

          Anna Freiholtz added a comment - I apologize, I was under the impression that I had installed the latest version of the plugin. But I hadn't... Now I have updated the plugin and it is working! Sorry again.

          Ulli Hafner added a comment -

          When you are reopening an issue it makes sense to write a comment why it is not solved. Or why it happens again.

          Ulli Hafner added a comment - When you are reopening an issue it makes sense to write a comment why it is not solved. Or why it happens again.

            drulli Ulli Hafner
            gfim Graham Menhennitt
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: