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

correct build condition evaluation to false, although executes build step

    Details

    • Similar Issues:

      Description

      Steps to reproduce

      1. create create ant build with parametrized boolean var "SKIP_SONAR"
      > the Jobs run executes and shows correct that i checked "SKIP_SONAR" checkbox before run.
      [myProject] $ cmd.exe /C '"D:\buildenv\tools\ant\bin\ant.bat -file build.xml -DSKIP_SONAR=true distribute && exit %%ERRORLEVEL%%"'

      2. after ant build step insert single conistional buil step RUN? "NOT", !Boolean condition, Token SKIP_SONAR, Builder: Invoke Standalone Sonar Analysis.

      The condition evaluatest correct to "[Not] enabling perform for step" but executes the steps anyway. But the NOT shall make i NOT happen.
      see log
      >BUILD SUCCESSFUL
      >Total time: 1 minute 24 seconds
      >Run condition [Not] enabling perform for step [Invoke Standalone Sonar >Analysis]
      >[workspace] $ D:\srv\sonar-runner-2.3\bin\sonar-runner.bat >Dsonar.jdbc.driver=com.mysql.jdbc.Driver ">Dsonar.jdbc.url=jdbc:mysql://mysqlsrv.loc:3306/sonar?>useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true" >******** ******** -Dsonar.host.url=http://mysonarsrv.loc ******** ******** >-Dsonar.projectBaseDir=D:\srv\usrhome\hudson\jobs\myproject\workspace ->Dsonar.sourceEncoding=ISO-8859-1 -Dsonar.sources=src -Dsonar.language=java >-Dsonar.binaries=build/classes -Dsonar.projectVersion=1.0.0 ->sonar.scm.url=scm:svn:https://mysv.loc/svn/myproject/trunk ->Dsonar.tests=unittest -Dsonar.projectName=myproject
      >AD:\srv\sonar-runner-2.3
      >ASonarQube Runner 2.3
      >AJava 1.7.0_25 Oracle Corporation (32-bit)
      >A[Not] enabling perform for stepWindows Server 2008 R2 6.1 x86
      >INFO: Runner configuration file: D:\srv\sonar-runner-2.3\conf\sonar->runner.properties
      >INFO: Project configuration file: NONE
      >INFO: Default locale: "en_US", source code encoding: "ISO-8859-1"
      >INFO: Work directory: >D:\srv\usrhome\hudson\jobs\ArchitectureModules_TRUNK\workspace\.sonar
      >INFO: SonarQube Server 3.5.1
      >09:41:09.704 INFO - Load batch settings
      >09:41:10.801 INFO - User cache: C

        Attachments

          Activity

          Hide
          domi Dominik Bartholdi added a comment -

          As the help for the "Boolean condition" says: "Expand the Token Macro..."
          The help not only tells you this, but also gives you a list of all Macros installed in your Jenkins Installation.

          The one most suitable for your usecase is the ENV TokenMacro and your config should have this in the token field:

          ${ENV,var="SKIP_SONAR"}

          There are many more TokenMacros, a list is available here: https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin
          The Run Condition Plugin also has some examples: https://wiki.jenkins-ci.org/display/JENKINS/Run+Condition+Plugin

          Show
          domi Dominik Bartholdi added a comment - As the help for the "Boolean condition" says: "Expand the Token Macro..." The help not only tells you this, but also gives you a list of all Macros installed in your Jenkins Installation. The one most suitable for your usecase is the ENV TokenMacro and your config should have this in the token field: ${ENV,var="SKIP_SONAR"} There are many more TokenMacros, a list is available here: https://wiki.jenkins-ci.org/display/JENKINS/Token+Macro+Plugin The Run Condition Plugin also has some examples: https://wiki.jenkins-ci.org/display/JENKINS/Run+Condition+Plugin

            People

            • Assignee:
              domi Dominik Bartholdi
              Reporter:
              cforce cforce
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: