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

Conditions are evaluated for each actions

    XMLWordPrintable

Details

    Description

      Following case:

      Flexible Publish
          Conditional Action
              Run?: String match
                  String1: ${Test1}
                  String2: expected
              Action
                  some action 1
                  some action 2
      

      In this case, string matching is evaluated each for some action 1 and some action 2.
      The condition should be evaluated only one for the configuration as:

      • It can be a problem if there is a condition with side-effects.
      • Users can expect the condition will be evaluated only once as they configured that only once in the configuration page.
      • Users can configure like this if they really want the condition evaluated for each time:
        Flexible Publish
            Conditional Action
                Run?: String match
                    String1: ${Test1}
                    String2: expected
                Action
                    some action 1
            Conditional Action
                Run?: String match
                    String1: ${Test1}
                    String2: expected
                Action
                    some action 2
        

      Attachments

        Activity

          ikedam ikedam added a comment -

          Anyway, conditions are evaluated every time in prebuild, post-build, aggregations...

          ikedam ikedam added a comment - Anyway, conditions are evaluated every time in prebuild, post-build, aggregations...

          This is designed functionality. Current design that it allows to not configure the same statement for every publisher and evaluation must be evaluated every time to ensure that action need to be executed, i.e. "build status" that can be failed by one of previous actions.
          If it not obvious, than add help page.
          Don't treat things that you doesn't understand as a bugs.

          Case "evaluate once" makes sense, but will be enhancement.

          integer Kanstantsin Shautsou added a comment - This is designed functionality. Current design that it allows to not configure the same statement for every publisher and evaluation must be evaluated every time to ensure that action need to be executed, i.e. "build status" that can be failed by one of previous actions. If it not obvious, than add help page. Don't treat things that you doesn't understand as a bugs. Case "evaluate once" makes sense, but will be enhancement.

          Also if you want exclude evaluation, then add "flexible publish" in actions and set "execute always" with group of Actions.

          integer Kanstantsin Shautsou added a comment - Also if you want exclude evaluation, then add "flexible publish" in actions and set "execute always" with group of Actions.
          ikedam ikedam added a comment - https://github.com/jenkinsci/flexible-publish-plugin/pull/12
          ikedam ikedam added a comment -

          The fix is released in flexible-publish-0.15.
          It will be available in a day.

          ikedam ikedam added a comment - The fix is released in flexible-publish-0.15. It will be available in a day.

          Fix for what? There is no issue here at all.

          integer Kanstantsin Shautsou added a comment - Fix for what? There is no issue here at all.

          If you still didn't get, then you can execute flexible-publish from flexible-publish for grouping actions without evaluations

          if (HeaveCondition 1){
            flexible-publish {
             (execution always) {
              publisher 1
              publisher 2
             }
            }
          }
          

          As i see current change broke all already configured setups.

          integer Kanstantsin Shautsou added a comment - If you still didn't get, then you can execute flexible-publish from flexible-publish for grouping actions without evaluations if (HeaveCondition 1){ flexible-publish { (execution always) { publisher 1 publisher 2 } } } As i see current change broke all already configured setups.

          So now, if i have setup that do 'git push release' 'push released artifacts' for Condition build=SUCCESS i will have release artifacts upload even if git push failed?!

          integer Kanstantsin Shautsou added a comment - So now, if i have setup that do 'git push release' 'push released artifacts' for Condition build=SUCCESS i will have release artifacts upload even if git push failed?!
          danielbeck Daniel Beck added a comment -

          integer IIUC you can just use one condition per step.

          danielbeck Daniel Beck added a comment - integer IIUC you can just use one condition per step.
          danielbeck Daniel Beck added a comment - ikedam Consider declaring configuration incompatibility so users know their jobs may behave differently. https://wiki.jenkins-ci.org/display/JENKINS/Marking+a+new+plugin+version+as+incompatible+with+older+versions Examples: https://github.com/jenkinsci/ldap-plugin/blob/master/pom.xml#L121 https://github.com/jenkinsci/build-flow-plugin/blob/master/pom.xml#L106

          I know that i can use, i don't appreciate breaking current setups when any behaviour can be achieved in current functionality. All was needed is a help file with description. Also such destroying change can have readResolve() for splitting current configuration. But my opinion is now -1 for such style changes.

          integer Kanstantsin Shautsou added a comment - I know that i can use, i don't appreciate breaking current setups when any behaviour can be achieved in current functionality. All was needed is a help file with description. Also such destroying change can have readResolve() for splitting current configuration. But my opinion is now -1 for such style changes.

          Code changed in jenkins
          User: ikedam
          Path:
          pom.xml
          http://jenkins-ci.org/commit/flexible-publish-plugin/bc5e694170d0a3d1f52955634e1fa8cfbd718210
          Log:
          JENKINS-27171 Displays compatibility warnings in the update center for flexible-publish < 0.15.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: pom.xml http://jenkins-ci.org/commit/flexible-publish-plugin/bc5e694170d0a3d1f52955634e1fa8cfbd718210 Log: JENKINS-27171 Displays compatibility warnings in the update center for flexible-publish < 0.15.

          Code changed in jenkins
          User: ikedam
          Path:
          pom.xml
          http://jenkins-ci.org/commit/flexible-publish-plugin/6ce459851649d8858a8646cbc95e01ba92faf143
          Log:
          Merge pull request #13 from ikedam/feature/JENKINS-27171_CompatibleSinceVersion0.15

          JENKINS-27171 Displays compatibility warnings in the update center for flexible-publish < 0.15.

          Compare: https://github.com/jenkinsci/flexible-publish-plugin/compare/f4c0283c6252...6ce459851649

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ikedam Path: pom.xml http://jenkins-ci.org/commit/flexible-publish-plugin/6ce459851649d8858a8646cbc95e01ba92faf143 Log: Merge pull request #13 from ikedam/feature/ JENKINS-27171 _CompatibleSinceVersion0.15 JENKINS-27171 Displays compatibility warnings in the update center for flexible-publish < 0.15. Compare: https://github.com/jenkinsci/flexible-publish-plugin/compare/f4c0283c6252...6ce459851649
          ikedam ikedam added a comment -

          Released 0.15.1, which displays the compatibility warning for flexible-publish 0.14.1 and earlier. It will be available in a day.
          I decided to release that immediately as the compatibility warning is useful for users only before they upgrade flexible-publish to 0.15.

          ikedam ikedam added a comment - Released 0.15.1, which displays the compatibility warning for flexible-publish 0.14.1 and earlier. It will be available in a day. I decided to release that immediately as the compatibility warning is useful for users only before they upgrade flexible-publish to 0.15.

          People

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

            Dates

              Created:
              Updated:
              Resolved: