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

Jenkinsfile schema Java API as WorkflowRun action

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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 Andrew Bayer the schema parsing Java API can be exposed as action on WorkflowAction.

        Attachments

          Issue Links

            Activity

            Hide
            svanoort Sam Van Oort added a comment -

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

            Show
            svanoort Sam Van Oort added a comment - Okay so that kind of helps make the use case clear, and makes sense now.
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            michaelneale Michael Neale added a comment -

            Ryan Campbell we were talking about this - is already done.

            Show
            michaelneale Michael Neale added a comment - Ryan Campbell we were talking about this - is already done.
            Hide
            scm_issue_link 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.

            Show
            scm_issue_link 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 .

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                vivek Vivek Pandey
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: