[JIRA] (JENKINS-38284) Handle per-stage configuration in declarative

3 views
Skip to first unread message

andrew.bayer@gmail.com (JIRA)

unread,
Sep 16, 2016, 1:40:02 PM9/16/16
to jenkinsc...@googlegroups.com
Andrew Bayer created an issue
 
Jenkins / Story JENKINS-38284
Handle per-stage configuration in declarative
Issue Type: Story Story
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2016/Sep/16 5:39 PM
Priority: Minor Minor
Reporter: Andrew Bayer

A number of things are going to be extended to support per-stage configuration (for example, notifications and agent) and at least one new thing is coming that will be exclusively per-stage configuration (stage dependency graph). We need to figure out what that'll look like in general before we can implement it for the particular sections.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

pwolf@cloudbees.com (JIRA)

unread,
Sep 16, 2016, 2:03:02 PM9/16/16
to jenkinsc...@googlegroups.com
Patrick Wolf commented on Story JENKINS-38284
 
Re: Handle per-stage configuration in declarative

can we break this into smaller stories?

1. per stage agent
2. per stage notifications
3. stage DAG

I'm a little concerned that matrix, parallel, and DAG are all going to get confused into a big mush of competing ways to do the same thing.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 16, 2016, 2:09:01 PM9/16/16
to jenkinsc...@googlegroups.com

We most definitely will be. This is specifically for figuring out how to present the per-stage configuration in the syntax and model, not the actual configs themselves.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 20, 2016, 4:04:03 PM9/20/16
to jenkinsc...@googlegroups.com

So what I'm thinking right now, due to the complexity of what could be configured and the fact that the configuration has to be separate from the actual steps (since we just execute that closure at runtime, which wouldn't work at all if config directives were mixed up in the steps closure), is something like this:

stage('foo') {
    config {
        agent docker:'foo'
        notifications {
              always {
                  echo "something or other"
              }
        }
    }
    steps {
          sh "./do-something.sh"
    }
}

We'd still support the no-per-stage-config syntax (i.e., steps as the only things in the stage block) - that may be a pain to do in practice, so it's possible we'll end up adding the above as a new config section called, like, stageWithConfig or something along those lines.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 21, 2016, 6:55:02 PM9/21/16
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Story JENKINS-38284
 
Change By: Andrew Bayer
Status: Open In Progress

scm_issue_link@java.net (JIRA)

unread,
Oct 12, 2016, 5:05:02 AM10/12/16
to jenkinsc...@googlegroups.com

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.

andrew.bayer@gmail.com (JIRA)

unread,
Oct 31, 2016, 7:45:01 PM10/31/16
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Fixed
 
Change By: Andrew Bayer
Status: In Progress Resolved
Resolution: Fixed

bitwiseman@gmail.com (JIRA)

unread,
May 27, 2019, 5:40:02 PM5/27/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
Reply all
Reply to author
Forward
0 new messages