[JIRA] (JENKINS-37824) Pipeline Model: Add sections for build parameters, triggers and general build properties

5 views
Skip to first unread message

andrew.bayer@gmail.com (JIRA)

unread,
Aug 30, 2016, 6:11:02 PM8/30/16
to jenkinsc...@googlegroups.com
Andrew Bayer created an issue
 
Jenkins / Story JENKINS-37824
Pipeline Model: Add sections for build parameters, triggers and general build properties
Issue Type: Story Story
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2016/Aug/30 10:10 PM
Environment: Pipeline Model 0.1
Priority: Minor Minor
Reporter: Andrew Bayer

We're currently blacklisting the properties step from usage within the model, and we're going to stay that way - it can cause waaaaay too much confusion when executed outside of a central control. But that means we need to provide configuration sections for job properties. I'd like to do that as three separate sections - one for each of build parameters, triggers and other job properties.

My reasoning is that the catch-allness of properties is part of its confusion - you can only call it once per Jenkinsfile and you have to have every JobProperty you care about defined in it. I want to add a layer of abstraction over that - the three groupings (parameters, triggers, misc) make sense as three separate sections with different syntax.

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

andrew.bayer@gmail.com (JIRA)

unread,
Sep 22, 2016, 5:10:01 PM9/22/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Story JENKINS-37824
 
Re: Pipeline Model: Add sections for build parameters, triggers and general build properties

Marking this as depending on JENKINS-38285 since this is a good opportunity to make the config sections an ExtensionPoint.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 30, 2016, 10:59:03 AM9/30/16
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Story JENKINS-37824
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

unread,
Sep 30, 2016, 11:05:01 AM9/30/16
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Sep 30, 2016, 11:33:01 AM9/30/16
to jenkinsc...@googlegroups.com

So what I'm trying to figure out here is how to define the properties in their separate sections and translate that into a list of parameters to properties(...). If the properties were all literals, well, that'd be fine. But that'd suck - we want symbols, meaning we want, effectively, lazily evaluated method calls. I have some vague ideas on that front at the moment, but need to keep experimenting to find what might actually work.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 30, 2016, 11:57:02 AM9/30/16
to jenkinsc...@googlegroups.com

So the best bet I've come up with so far is to translate something like:

triggers {
  cron('@daily')
}

properties {
  buildDiscarder(logRotator(numToKeepStr: '1'))
  disableConcurrentBuilds()
}

into a quasi-AST that we can then re-assemble and invoke at runtime. If I could somehow tease each line out into their own closures directly, then we'd be good to go, but I don't see a way to do that currently. And something more like buildDiscarder logRotator(numToKeepStr: '1') (i.e., the syntax we use for tools, agent, etc) doesn't work because logRotator(numToKeepStr: '1') ends up being invoked at parse/config-time. The delegate-fallback approach used in the environment section doesn't, I think, work right here due to the fact that the symbol resolution only works in the right context.

Soooooo. More experimentation to come.

andrew.bayer@gmail.com (JIRA)

unread,
Oct 10, 2016, 12:22:01 PM10/10/16
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Oct 10, 2016, 12:23:01 PM10/10/16
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Oct 11, 2016, 3:30:06 AM10/11/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
pom.xml
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/Utils.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBuildParameter.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTBuildParameters.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTElement.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTJobProperties.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTJobProperty.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTKeyValueOrMethodCallPair.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTMethodArg.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTMethodCallFromArguments.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/ModelASTTrigger.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTTriggers.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTValue.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/JobProperties.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/MethodsToList.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Parameters.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Root.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Tools.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Triggers.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/ModelStepLoader.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/MethodsToListTranslator.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/JobPropertiesTest.java
src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ParametersTest.java
src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/TriggersTest.java
src/test/resources/json/simpleJobProperties.json
src/test/resources/json/simpleParameters.json
src/test/resources/json/simpleTriggers.json
src/test/resources/simpleJobProperties.groovy
src/test/resources/simpleParameters.groovy
src/test/resources/simpleTriggers.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f533ef99e31ce44cbe999653e538ea39fdf772dc
Log:
[FIXED JENKINS-37824] Adding job property-related functionality

More specifically, added "jobProperties", "parameters" and "triggers"
section and related functionality.

This required some fairly complex logic for translating something like
"buildDiscarder(logRotator(numToKeepStr:'1'))" in the config into
something that can do what we need at runtime. Hooray complexity!

andrew.bayer@gmail.com (JIRA)

unread,
Oct 11, 2016, 3:32:02 AM10/11/16
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:26:00 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages