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

Error if no "agent" specified

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      If you create a pipeline model with no agent specified you get an error message:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 3: Missing required section 'agent' @ line 3, column 1.
         pipeline{
         ^
      
      1 error
      
      	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:410)
      	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:373)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213)
      	at hudson.model.ResourceController.execute(ResourceController.java:98)
      	at hudson.model.Executor.run(Executor.java:410)
      Finished: FAILURE
      

      Rather than throwing an error should we default to no label node: agent label:""

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            James Dumay Open a JIRA and give me a sense of what you mean?

            Show
            abayer Andrew Bayer added a comment - James Dumay Open a JIRA and give me a sense of what you mean?
            Hide
            abayer Andrew Bayer added a comment -

            So I'm about to push a PR adding agent any - with the current implementation of agent (i.e., before it's pluggable), that's as far as we can go in terms of constant options (i.e., just any and none). I'm leaving agent as required, though.

            Show
            abayer Andrew Bayer added a comment - So I'm about to push a PR adding agent any - with the current implementation of agent (i.e., before it's pluggable), that's as far as we can go in terms of constant options (i.e., just any and none ). I'm leaving agent as required, though.
            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/12 adding agent any
            Hide
            abayer Andrew Bayer added a comment -

            Merged - will be released in Pipeline Model 0.3

            Show
            abayer Andrew Bayer added a comment - Merged - will be released in Pipeline Model 0.3
            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/ast/ModelASTAgent.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidator.groovy
            src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
            src/test/resources/agentAny.groovy
            src/test/resources/json/agentAny.json
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/0fe3ea8ae72ea0be692e0a093fb4473507c53532
            Log:
            [FIXED JENKINS-37932] Add "agent any"

            Better approach for "run anywhere". I think this gets rid of any need
            to make the agent section optional, at least for now.

            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/ast/ModelASTAgent.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidator.groovy src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java src/test/resources/agentAny.groovy src/test/resources/json/agentAny.json http://jenkins-ci.org/commit/pipeline-model-definition-plugin/0fe3ea8ae72ea0be692e0a093fb4473507c53532 Log: [FIXED JENKINS-37932] Add "agent any" Better approach for "run anywhere". I think this gets rid of any need to make the agent section optional, at least for now.

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                hrmpw Patrick Wolf
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: