[JIRA] (JENKINS-37788) Pipeline Config: Eliminate the "isConstant" AST/JSON field

0 views
Skip to first unread message

andrew.bayer@gmail.com (JIRA)

unread,
Aug 29, 2016, 3:53:01 PM8/29/16
to jenkinsc...@googlegroups.com
Andrew Bayer created an issue
 
Jenkins / Improvement JENKINS-37788
Pipeline Config: Eliminate the "isConstant" AST/JSON field
Issue Type: Improvement Improvement
Assignee: Andrew Bayer
Components: pipeline-config-plugin
Created: 2016/Aug/29 7:52 PM
Environment: Pipeline Config 0.1
Priority: Minor Minor
Reporter: Andrew Bayer

We've got a field for values called "isConstant" that doesn't serve a very clear purpose - right now, it's basically just used in two places - to determine whether to actually try type-casting in validation and to decide which subtype of ConfigASTValue is used when parsing from JSON. So...we probably don't need it, or if we do need it, we need to actually do something more useful and determinant with it.

In the first case, which is probably the one that actually matters, since that's what cares which ConfigASTValue subtype is used, we use it to determine whether to try casting for parameter validation. Without that check, we end up with errors for things like [$class: ...] legacy metastep syntax, which are String when they get to us in validation currently, so can't be cast to Map as they'd need to be. So beyond the confusion of isConstant, we're also not actually doing validation of legacy metastep 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 23, 2016, 5:03:01 PM9/23/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Improvement JENKINS-37788
 
Re: Pipeline Config: Eliminate the "isConstant" AST/JSON field

This needs more discussion with Kohsuke Kawaguchi to understand what it's intended for in the first place. I'm resurrecting my month-old experiments on removing it, but I think they broke. =)

andrew.bayer@gmail.com (JIRA)

unread,
Sep 23, 2016, 5:15:01 PM9/23/16
to jenkinsc...@googlegroups.com

Aaaand yup, specifically echo('['+acmeVar.baz()+']'), which is valid by the declarative subset, doesn't work right. We do need isConstant so we can know whether the value is a literal or not. If it's not a literal, we need to know that so we can evaluate it.

mneale@cloudbees.com (JIRA)

unread,
Sep 29, 2016, 4:02:39 AM9/29/16
to jenkinsc...@googlegroups.com

This won't work with a graphical editor (think about it for a bit)

mneale@cloudbees.com (JIRA)

unread,
Sep 29, 2016, 5:03:01 AM9/29/16
to jenkinsc...@googlegroups.com

Actually this may be able to work... and be useful even (Andrew has explained what it means to me). I take it back.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 29, 2016, 10:41:01 AM9/29/16
to jenkinsc...@googlegroups.com

I'm going to rename this to "isLiteral" since that's a more accurate/meaningful description and then we'll close this.

andrew.bayer@gmail.com (JIRA)

unread,
Sep 30, 2016, 2:38:02 AM9/30/16
to jenkinsc...@googlegroups.com
Andrew Bayer started work on Improvement JENKINS-37788
 
Change By: Andrew Bayer
Status: Open In Progress

andrew.bayer@gmail.com (JIRA)

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

andrew.bayer@gmail.com (JIRA)

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

scm_issue_link@java.net (JIRA)

unread,
Oct 5, 2016, 4:32:02 AM10/5/16
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon commented on Improvement JENKINS-37788
 
Re: Pipeline Config: Eliminate the "isConstant" AST/JSON field

Code changed in jenkins
User: Andrew Bayer
Path:
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTValue.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidator.groovy
src/main/resources/ast-schema.json
src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/validator/JSONValidationTest.java
src/test/resources/json/agentAny.json
src/test/resources/json/agentDocker.json
src/test/resources/json/agentLabel.json
src/test/resources/json/agentNoneWithNode.json
src/test/resources/json/errors/emptyEnvironment.json
src/test/resources/json/errors/emptyNotifications.json
src/test/resources/json/errors/emptyParallel.json
src/test/resources/json/errors/emptyPostBuild.json
src/test/resources/json/errors/emptyStages.json
src/test/resources/json/errors/invalidBuildCondition.json
src/test/resources/json/errors/malformed.json
src/test/resources/json/errors/missingAgent.json
src/test/resources/json/errors/missingRequiredStepParameters.json
src/test/resources/json/errors/missingStages.json
src/test/resources/json/errors/notInstalledToolType.json
src/test/resources/json/errors/notInstalledToolVersion.json
src/test/resources/json/errors/rejectParallelMixedInSteps.json
src/test/resources/json/errors/rejectStageInSteps.json
src/test/resources/json/errors/stageWithoutName.json
src/test/resources/json/errors/unknownStepParameter.json
src/test/resources/json/errors/unlistedToolType.json
src/test/resources/json/globalLibrarySuccess.json
src/test/resources/json/legacyMetaStepSyntax.json
src/test/resources/json/metaStepSyntax.json
src/test/resources/json/parallelPipeline.json
src/test/resources/json/postBuildAndNotifications.json
src/test/resources/json/simpleEnvironment.json
src/test/resources/json/simpleNotification.json
src/test/resources/json/simplePipeline.json
src/test/resources/json/simplePostBuild.json
src/test/resources/json/simpleScript.json
src/test/resources/json/simpleTools.json
src/test/resources/json/twoStagePipeline.json
src/test/resources/json/validStepParameters.json
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/670ecdb55ea6b5ab7e9083fd44079af61fe229c0
Log:
[FIXED JENKINS-37788] Use isLiteral instead of isConstant.

scm_issue_link@java.net (JIRA)

unread,
Oct 5, 2016, 10:24:01 AM10/5/16
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Andrew Bayer
Path:
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTValue.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/JSONParser.groovy
src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidator.groovy
src/main/resources/ast-schema.json
src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java

src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java

[FIXED JENKINS-37788] Use isLiteral instead of isConstant.

andrew.bayer@gmail.com (JIRA)

unread,
Oct 10, 2016, 7:42:01 AM10/10/16
to jenkinsc...@googlegroups.com

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:16 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