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

Declarative should override the syntax check for CpsFlowDefinition

    Details

    • Similar Issues:

      Description

      CpsFlowDefinition currently just passes its content through a Groovy compiler. This is not very useful if you are editing Declarative. You would want to know if your agent block is right, etc.

      If it can detect that the script is Declarative (I suppose just look for pipeline as a top-level element, or what?), it should invoke the Declarative instead.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            Not sure what you mean - we piggy-back on the compilation process to do validation of the various sections and directives, but we still need to make sure everything else is valid Groovy to get that far.

            Show
            abayer Andrew Bayer added a comment - Not sure what you mean - we piggy-back on the compilation process to do validation of the various sections and directives, but we still need to make sure everything else is valid Groovy to get that far.
            Hide
            jglick Jesse Glick added a comment -

            we piggy-back on the compilation process to do validation of the various sections and directives

            Really? I did not see any evidence of that happening—only generic Groovy validation. Did you check that this works from doCheckScriptCompile?

            Show
            jglick Jesse Glick added a comment - we piggy-back on the compilation process to do validation of the various sections and directives Really? I did not see any evidence of that happening—only generic Groovy validation. Did you check that this works from doCheckScriptCompile ?
            Hide
            abayer Andrew Bayer added a comment -

            Ooooh, you mean from the UI, not runtime?

            Show
            abayer Andrew Bayer added a comment - Ooooh, you mean from the UI, not runtime?
            Hide
            abayer Andrew Bayer added a comment -

            doCheckScriptCompile doesn't use GroovyDecorator, does it?

            Show
            abayer Andrew Bayer added a comment - doCheckScriptCompile doesn't use GroovyDecorator , does it?
            Hide
            jglick Jesse Glick added a comment -

            Should be easy enough to write a test for this in pipeline-model-definition no?

            Show
            jglick Jesse Glick added a comment - Should be easy enough to write a test for this in pipeline-model-definition no?
            Hide
            abayer Andrew Bayer added a comment -

            I'm still confused. Validation definitely happens at runtime. If it's not happening when you edit in the ACE editor, then doCheckScriptCompile must not be taking into account the GroovyDecoratorImpl.

            Show
            abayer Andrew Bayer added a comment - I'm still confused. Validation definitely happens at runtime. If it's not happening when you edit in the ACE editor, then doCheckScriptCompile must not be taking into account the GroovyDecoratorImpl .
            Hide
            jglick Jesse Glick added a comment -

            IIRC it does call GroovyDecorator, but passes null for the execution, so perhaps your validator is returning early on null? Again, should be easy enough to check in a test + debugger.

            Show
            jglick Jesse Glick added a comment - IIRC it does call GroovyDecorator , but passes null for the execution, so perhaps your validator is returning early on null? Again, should be easy enough to check in a test + debugger.

              People

              • Assignee:
                Unassigned
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: