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

Jenkinsfile schema Java API as WorkflowRun action

      Kyoto has REST API to expose Jenkinsfile schema in JSON format. Pipeline editor in BO needs to call this API and this would needed to be exposed using pipeline API actions so that pipeline editor UI can call it by looking at 'actions' element in pipeline API response.

      As discussed with abayer the schema parsing Java API can be exposed as action on WorkflowAction.

          [JENKINS-38152] Jenkinsfile schema Java API as WorkflowRun action

          Andrew Bayer added a comment -

          So if I remember correctly, what's being looked for here is specifically the stage execution order/info, right? Do we want the synthetic stages too or just the "real" ones?

          Andrew Bayer added a comment - So if I remember correctly, what's being looked for here is specifically the stage execution order/info, right? Do we want the synthetic stages too or just the "real" ones?

          James Dumay added a comment -

          michaelneale vivek the REST endpoint is something we probably want to host under our URL structure at /org/pipelines/My Pipeline/model or something?

          James Dumay added a comment - michaelneale vivek the REST endpoint is something we probably want to host under our URL structure at /org/pipelines/My Pipeline/model or something?

          Sam Van Oort added a comment -

          Do we really need such a complex API just to do ordering? Esp when the new Bismuth APIs will already do ordering, and we already have stage ordering?

          Sam Van Oort added a comment - Do we really need such a complex API just to do ordering? Esp when the new Bismuth APIs will already do ordering, and we already have stage ordering?

          Andrew Bayer added a comment -

          svanoort - what's driving this is Blue Ocean being able to check what stages are going to run but have not run yet. With declarative Pipelines, we can say with certainty what stages/parallel branches are going to be executed in what order from the moment we parse the Jenkinsfile. Hence, this.

          Andrew Bayer added a comment - svanoort - what's driving this is Blue Ocean being able to check what stages are going to run but have not run yet . With declarative Pipelines, we can say with certainty what stages/parallel branches are going to be executed in what order from the moment we parse the Jenkinsfile . Hence, this.

          Sam Van Oort added a comment -

          Okay so that kind of helps make the use case clear, and makes sense now.

          Sam Van Oort added a comment - Okay so that kind of helps make the use case clear, and makes sense now.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTAgent.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBranch.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBuildCondition.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTElement.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTEnvironment.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNamedArgumentList.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNotifications.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPositionalArgumentList.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPostBuild.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTSingleArgument.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStages.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTools.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTreeStep.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy
          src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/actions/ExecutionModelAction.java
          http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f4899b814f15f8dadf153c70f0c3a103f2d757f1
          Log:
          First work on JENKINS-38152 - action/stripped stages

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTAgent.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBranch.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBuildCondition.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTElement.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTEnvironment.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNamedArgumentList.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNotifications.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPositionalArgumentList.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPostBuild.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTSingleArgument.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStages.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTools.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTreeStep.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/actions/ExecutionModelAction.java http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f4899b814f15f8dadf153c70f0c3a103f2d757f1 Log: First work on JENKINS-38152 - action/stripped stages

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          EXTENDING.md
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTAgent.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBranch.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBuildCondition.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTElement.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTEnvironment.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNamedArgumentList.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNotifications.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPositionalArgumentList.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPostBuild.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTSingleArgument.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStages.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTools.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTreeStep.groovy
          src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy
          src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/actions/ExecutionModelAction.java
          src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ModelConverterAction.java
          src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
          src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
          src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ErrorsEndpointOpsTest.java
          src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/SuccessfulEndpointOpsTest.java
          src/test/resources/executionModelAction.groovy
          http://jenkins-ci.org/commit/pipeline-model-definition-plugin/b385ba5d5015504e91ba9e297283282bd4ce94a5
          Log:
          Merge pull request #14 from abayer/jenkins-38152

          JENKINS-38152 - expose execution model on WorkflowRun

          Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/7ae4f284c762...b385ba5d5015

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: EXTENDING.md src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTAgent.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBranch.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBuildCondition.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTElement.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTEnvironment.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNamedArgumentList.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTNotifications.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPositionalArgumentList.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPostBuild.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTSingleArgument.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStages.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTools.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTreeStep.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/actions/ExecutionModelAction.java src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ModelConverterAction.java src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/ErrorsEndpointOpsTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/endpoints/SuccessfulEndpointOpsTest.java src/test/resources/executionModelAction.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/b385ba5d5015504e91ba9e297283282bd4ce94a5 Log: Merge pull request #14 from abayer/jenkins-38152 JENKINS-38152 - expose execution model on WorkflowRun Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/7ae4f284c762...b385ba5d5015

          Michael Neale added a comment -

          campbellr we were talking about this - is already done.

          Michael Neale added a comment - campbellr we were talking about this - is already done.

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
          pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
          pipeline-model-definition/src/test/resources/errors/pipelineStepWithinOtherBlocksFailure.groovy
          http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f25d40a2a5ffe0469ce80b070610d07fcdd3bb2a
          Log:
          [FIXED JENKINS-39011] Error out at parse time when pipeline step is nested.

          We don't want to support nesting the pipeline step within other blocks

          • until JENKINS-38152, we never noticed that this was actually
            possible, since the parse-time validation just ignored any Jenkinsfile
            without a root-level pipeline step, but with JENKINS-38152, we not
            only do another parse round but need to grab the stages from the model
            to attach to the run, so we hit an NPE when there's a pipeline step
            nested under other blocks.

          So - this will now catch when the pipeline step is nested within
          another block and give an error message at parse-time, rather than
          NPEing at runtime. There is a valid use case for wanting to wrap the
          entire build in something like a timeout or timestamper, but we're
          going to address that with JENKINS-37823.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java pipeline-model-definition/src/test/resources/errors/pipelineStepWithinOtherBlocksFailure.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f25d40a2a5ffe0469ce80b070610d07fcdd3bb2a Log: [FIXED JENKINS-39011] Error out at parse time when pipeline step is nested. We don't want to support nesting the pipeline step within other blocks until JENKINS-38152 , we never noticed that this was actually possible, since the parse-time validation just ignored any Jenkinsfile without a root-level pipeline step, but with JENKINS-38152 , we not only do another parse round but need to grab the stages from the model to attach to the run, so we hit an NPE when there's a pipeline step nested under other blocks. So - this will now catch when the pipeline step is nested within another block and give an error message at parse-time, rather than NPEing at runtime. There is a valid use case for wanting to wrap the entire build in something like a timeout or timestamper, but we're going to address that with JENKINS-37823 .

          Liam Newman added a comment -

          Bulk closing resolved issues.

          Liam Newman added a comment - Bulk closing resolved issues.

            abayer Andrew Bayer
            vivek Vivek Pandey
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: