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

Declarative should override the syntax check for CpsFlowDefinition

      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.

          [JENKINS-43401] Declarative should override the syntax check for CpsFlowDefinition

          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.

          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.

          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?

          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 ?

          Andrew Bayer added a comment -

          Ooooh, you mean from the UI, not runtime?

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

          Andrew Bayer added a comment -

          doCheckScriptCompile doesn't use GroovyDecorator, does it?

          Andrew Bayer added a comment - doCheckScriptCompile doesn't use GroovyDecorator , does it?

          Jesse Glick added a comment -

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

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

          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.

          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 .

          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.

          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.

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

              Created:
              Updated: