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

per stage agent directives

    XMLWordPrintable

Details

    Description

      having agent at the global level is nice, but it has come up a few times in conversations that having agents on a per-stage level is worth considering.

      This makes the "blocking for input" case a lot nicer and less wasteful (without the user needing to learn additional node syntax).

      CC jamesdumay hrmpw

      Attachments

        Issue Links

          Activity

            abayer Andrew Bayer added a comment -

            ndeloof - the agent section is going to be pluggable (see JENKINS-38433) so if you want to implement one for Docker Slaves (which, mind you, should be renamed to Docker Agents!), you'll be able to, but the out-of-the-box implementations will be "label", Docker Pipeline, and Dockerfile->Docker Pipeline.

            abayer Andrew Bayer added a comment - ndeloof - the agent section is going to be pluggable (see JENKINS-38433 ) so if you want to implement one for Docker Slaves (which, mind you, should be renamed to Docker Agents!), you'll be able to, but the out-of-the-box implementations will be "label", Docker Pipeline, and Dockerfile->Docker Pipeline.
            abayer Andrew Bayer added a comment - First tentative PR is up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/19 wooo

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStageConfig.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/ClosureContentsChecker.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/StageConfig.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.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/java/org/jenkinsci/plugins/pipeline/modeldefinition/model/MethodMissingWrapperWhitelist.java
            src/main/resources/ast-schema.json
            src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy
            src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
            src/test/resources/json/perStageConfigAgent.json
            src/test/resources/perStageConfigAgent.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/385940d33c4184cb5f5947c00c45d7ed57566c47
            Log:
            JENKINS-38331 Very preliminary version of per-stage agent config

            Honestly, I'm doing this for JENKINS-38284 more, but I needed some
            section to actually have be per-stage to test it, so...tada?

            This is literally the result of three hours of slamming my head
            against the wall over stupid mistakes, so I'm fairly sure there are
            still a plethora of such mistakes in here. But I'm pretty sure it
            works - I just added the JSON version and conversion for
            perStageAgentConfig to this and the tests are actively running as I
            type this, but I got impatient and made a commit now. So ha.

            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/ModelASTStage.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStageConfig.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/ClosureContentsChecker.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/StageConfig.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.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/java/org/jenkinsci/plugins/pipeline/modeldefinition/model/MethodMissingWrapperWhitelist.java src/main/resources/ast-schema.json src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java src/test/resources/json/perStageConfigAgent.json src/test/resources/perStageConfigAgent.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/385940d33c4184cb5f5947c00c45d7ed57566c47 Log: JENKINS-38331 Very preliminary version of per-stage agent config Honestly, I'm doing this for JENKINS-38284 more, but I needed some section to actually have be per-stage to test it, so...tada? This is literally the result of three hours of slamming my head against the wall over stupid mistakes, so I'm fairly sure there are still a plethora of such mistakes in here. But I'm pretty sure it works - I just added the JSON version and conversion for perStageAgentConfig to this and the tests are actively running as I type this, but I got impatient and made a commit now. So ha.

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            SYNTAX.md
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/ClosureContentsChecker.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
            src/main/resources/ast-schema.json
            src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy
            src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ScriptStepTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ToolsTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ExecuteConvertedTest.java
            src/test/resources/abortedNotification.groovy
            src/test/resources/agentAny.groovy
            src/test/resources/agentDocker.groovy
            src/test/resources/agentDockerWithEmptyDockerArgs.groovy
            src/test/resources/agentDockerWithNullDockerArgs.groovy
            src/test/resources/agentLabel.groovy
            src/test/resources/agentNone.groovy
            src/test/resources/agentNoneWithNode.groovy
            src/test/resources/allStagesExist.groovy
            src/test/resources/buildPluginParentPOM.groovy
            src/test/resources/dockerGlobalVariable.groovy
            src/test/resources/dockerGlobalVariableInScript.groovy
            src/test/resources/errors/blockInJobProperties.groovy
            src/test/resources/errors/blockInParameters.groovy
            src/test/resources/errors/blockInTriggers.groovy
            src/test/resources/errors/closureAsMethodCallArg.groovy
            src/test/resources/errors/duplicateEnvironment.groovy
            src/test/resources/errors/duplicateNotificationConditions.groovy
            src/test/resources/errors/duplicatePostBuildConditions.groovy
            src/test/resources/errors/duplicateStageNames.groovy
            src/test/resources/errors/duplicateStepParameter.groovy
            src/test/resources/errors/emptyAgent.groovy
            src/test/resources/errors/emptyEnvironment.groovy
            src/test/resources/errors/emptyJobProperties.groovy
            src/test/resources/errors/emptyNotifications.groovy
            src/test/resources/errors/emptyParallel.groovy
            src/test/resources/errors/emptyParameters.groovy
            src/test/resources/errors/emptyPostBuild.groovy
            src/test/resources/errors/emptyTriggers.groovy
            src/test/resources/errors/globalLibraryNonStepBody.groovy
            src/test/resources/errors/globalLibraryObjectMethodCall.groovy
            src/test/resources/errors/importAndFunctionShouldNotSkipParsing.groovy
            src/test/resources/errors/invalidBuildCondition.groovy
            src/test/resources/errors/invalidMetaStepSyntax.groovy
            src/test/resources/errors/invalidParameterTypeMethodCall.groovy
            src/test/resources/errors/invalidStepParameterType.groovy
            src/test/resources/errors/missingAgent.groovy
            src/test/resources/errors/missingRequiredStepParameters.groovy
            src/test/resources/errors/mixedMethodArgs.groovy
            src/test/resources/errors/notInstalledToolType.groovy
            src/test/resources/errors/notInstalledToolVersion.groovy
            src/test/resources/errors/packageShouldNotSkipParsing.groovy
            src/test/resources/errors/perStageConfigEmptyAgent.groovy
            src/test/resources/errors/perStageConfigEmptySteps.groovy
            src/test/resources/errors/perStageConfigMissingSteps.groovy
            src/test/resources/errors/perStageConfigUnknownSection.groovy
            src/test/resources/errors/rejectMapsForTriggerDefinition.groovy
            src/test/resources/errors/rejectParallelInNotifications.groovy
            src/test/resources/errors/rejectParallelMixedInSteps.groovy
            src/test/resources/errors/rejectPropertiesStepInMethodCall.groovy
            src/test/resources/errors/rejectStageInSteps.groovy
            src/test/resources/errors/stageWithoutName.groovy
            src/test/resources/errors/tooFewMethodCallArgs.groovy
            src/test/resources/errors/unknownStepParameter.groovy
            src/test/resources/errors/unlistedToolType.groovy
            src/test/resources/errors/wrongParameterNameMethodCall.groovy
            src/test/resources/executionModelAction.groovy
            src/test/resources/failingNotifications.groovy
            src/test/resources/failingPipeline.groovy
            src/test/resources/failingPostBuild.groovy
            src/test/resources/globalLibrarySuccess.groovy
            src/test/resources/globalLibrarySuccessInScript.groovy
            src/test/resources/json/errors/perStageConfigEmptySteps.json
            src/test/resources/json/errors/perStageConfigMissingSteps.json
            src/test/resources/json/errors/perStageConfigUnknownSection.json
            src/test/resources/json/perStageConfigAgent.json
            src/test/resources/legacyMetaStepSyntax.groovy
            src/test/resources/metaStepSyntax.groovy
            src/test/resources/multipleProperties.groovy
            src/test/resources/noCheckoutScmInWrongContext.groovy
            src/test/resources/nonLiteralEnvironment.groovy
            src/test/resources/notificationOnChangeChanged.groovy
            src/test/resources/notificationOnChangeFailed.groovy
            src/test/resources/parallelPipeline.groovy
            src/test/resources/perStageConfigAgent.groovy
            src/test/resources/postBuildAndNotifications.groovy
            src/test/resources/shInNotification.groovy
            src/test/resources/simpleEnvironment.groovy
            src/test/resources/simpleJobProperties.groovy
            src/test/resources/simpleNotification.groovy
            src/test/resources/simpleParameters.groovy
            src/test/resources/simplePipeline.groovy
            src/test/resources/simplePostBuild.groovy
            src/test/resources/simpleScript.groovy
            src/test/resources/simpleTools.groovy
            src/test/resources/simpleTriggers.groovy
            src/test/resources/stringsNeedingEscapeLogic.groovy
            src/test/resources/twoStagePipeline.groovy
            src/test/resources/unstableNotification.groovy
            src/test/resources/validStepParameters.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/b7a3ec68779e2b8edc4da667cf9d42551d067fc6
            Log:
            Merge pull request #19 from abayer/jenkins-38331

            JENKINS-38331 Per-stage configuration for agent

            Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/263a17adae4a...b7a3ec68779e

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: SYNTAX.md src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStage.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/ClosureContentsChecker.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Stage.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy src/main/resources/ast-schema.json src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ScriptStepTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ToolsTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ExecuteConvertedTest.java src/test/resources/abortedNotification.groovy src/test/resources/agentAny.groovy src/test/resources/agentDocker.groovy src/test/resources/agentDockerWithEmptyDockerArgs.groovy src/test/resources/agentDockerWithNullDockerArgs.groovy src/test/resources/agentLabel.groovy src/test/resources/agentNone.groovy src/test/resources/agentNoneWithNode.groovy src/test/resources/allStagesExist.groovy src/test/resources/buildPluginParentPOM.groovy src/test/resources/dockerGlobalVariable.groovy src/test/resources/dockerGlobalVariableInScript.groovy src/test/resources/errors/blockInJobProperties.groovy src/test/resources/errors/blockInParameters.groovy src/test/resources/errors/blockInTriggers.groovy src/test/resources/errors/closureAsMethodCallArg.groovy src/test/resources/errors/duplicateEnvironment.groovy src/test/resources/errors/duplicateNotificationConditions.groovy src/test/resources/errors/duplicatePostBuildConditions.groovy src/test/resources/errors/duplicateStageNames.groovy src/test/resources/errors/duplicateStepParameter.groovy src/test/resources/errors/emptyAgent.groovy src/test/resources/errors/emptyEnvironment.groovy src/test/resources/errors/emptyJobProperties.groovy src/test/resources/errors/emptyNotifications.groovy src/test/resources/errors/emptyParallel.groovy src/test/resources/errors/emptyParameters.groovy src/test/resources/errors/emptyPostBuild.groovy src/test/resources/errors/emptyTriggers.groovy src/test/resources/errors/globalLibraryNonStepBody.groovy src/test/resources/errors/globalLibraryObjectMethodCall.groovy src/test/resources/errors/importAndFunctionShouldNotSkipParsing.groovy src/test/resources/errors/invalidBuildCondition.groovy src/test/resources/errors/invalidMetaStepSyntax.groovy src/test/resources/errors/invalidParameterTypeMethodCall.groovy src/test/resources/errors/invalidStepParameterType.groovy src/test/resources/errors/missingAgent.groovy src/test/resources/errors/missingRequiredStepParameters.groovy src/test/resources/errors/mixedMethodArgs.groovy src/test/resources/errors/notInstalledToolType.groovy src/test/resources/errors/notInstalledToolVersion.groovy src/test/resources/errors/packageShouldNotSkipParsing.groovy src/test/resources/errors/perStageConfigEmptyAgent.groovy src/test/resources/errors/perStageConfigEmptySteps.groovy src/test/resources/errors/perStageConfigMissingSteps.groovy src/test/resources/errors/perStageConfigUnknownSection.groovy src/test/resources/errors/rejectMapsForTriggerDefinition.groovy src/test/resources/errors/rejectParallelInNotifications.groovy src/test/resources/errors/rejectParallelMixedInSteps.groovy src/test/resources/errors/rejectPropertiesStepInMethodCall.groovy src/test/resources/errors/rejectStageInSteps.groovy src/test/resources/errors/stageWithoutName.groovy src/test/resources/errors/tooFewMethodCallArgs.groovy src/test/resources/errors/unknownStepParameter.groovy src/test/resources/errors/unlistedToolType.groovy src/test/resources/errors/wrongParameterNameMethodCall.groovy src/test/resources/executionModelAction.groovy src/test/resources/failingNotifications.groovy src/test/resources/failingPipeline.groovy src/test/resources/failingPostBuild.groovy src/test/resources/globalLibrarySuccess.groovy src/test/resources/globalLibrarySuccessInScript.groovy src/test/resources/json/errors/perStageConfigEmptySteps.json src/test/resources/json/errors/perStageConfigMissingSteps.json src/test/resources/json/errors/perStageConfigUnknownSection.json src/test/resources/json/perStageConfigAgent.json src/test/resources/legacyMetaStepSyntax.groovy src/test/resources/metaStepSyntax.groovy src/test/resources/multipleProperties.groovy src/test/resources/noCheckoutScmInWrongContext.groovy src/test/resources/nonLiteralEnvironment.groovy src/test/resources/notificationOnChangeChanged.groovy src/test/resources/notificationOnChangeFailed.groovy src/test/resources/parallelPipeline.groovy src/test/resources/perStageConfigAgent.groovy src/test/resources/postBuildAndNotifications.groovy src/test/resources/shInNotification.groovy src/test/resources/simpleEnvironment.groovy src/test/resources/simpleJobProperties.groovy src/test/resources/simpleNotification.groovy src/test/resources/simpleParameters.groovy src/test/resources/simplePipeline.groovy src/test/resources/simplePostBuild.groovy src/test/resources/simpleScript.groovy src/test/resources/simpleTools.groovy src/test/resources/simpleTriggers.groovy src/test/resources/stringsNeedingEscapeLogic.groovy src/test/resources/twoStagePipeline.groovy src/test/resources/unstableNotification.groovy src/test/resources/validStepParameters.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/b7a3ec68779e2b8edc4da667cf9d42551d067fc6 Log: Merge pull request #19 from abayer/jenkins-38331 JENKINS-38331 Per-stage configuration for agent Compare: https://github.com/jenkinsci/pipeline-model-definition-plugin/compare/263a17adae4a...b7a3ec68779e
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

            People

              abayer Andrew Bayer
              michaelneale Michael Neale
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: