Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[JENKINS-42640] Fix validation of wrappers and some types
In validating the options contents, we didn't actually look for a StepDescriptor, just a symbol-driven Descriptor. Which won't work for steps! So we never actually validated the contents of wrappers in options. Besides that, we needed to reject converting to int from String/Boolean - that gets through ScriptByteCodeAdapter.castToType, but not runtime.
- Loading branch information
Showing
with
88 additions
and 28 deletions.
- +22 −2 ...model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/DescriptorLookupCache.java
- +2 −2 ...line-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.java
- +2 −2 ...finition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
- +11 −15 ...rc/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidatorImpl.groovy
- +2 −2 ...-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties
- +2 −2 ...definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
- +3 −3 ...-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
- +6 −0 ...on/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/validator/JSONValidationTest.java
- +38 −0 pipeline-model-definition/src/test/resources/json/errors/jsonParameterTypeCoercion.json
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,38 @@ | ||
{"pipeline": { | ||
"stages": [ { | ||
"name": "foo", | ||
"branches": [ { | ||
"name": "default", | ||
"steps": [ { | ||
"name": "echo", | ||
"arguments": [ { | ||
"key": "message", | ||
"value": { | ||
"isLiteral": true, | ||
"value": "hello" | ||
} | ||
}] | ||
}] | ||
}] | ||
}], | ||
"agent": {"type": "none"}, | ||
"options": {"options": [ { | ||
"name": "timeout", | ||
"arguments": [ | ||
{ | ||
"key": "time", | ||
"value": { | ||
"isLiteral": true, | ||
"value": "5" | ||
} | ||
}, | ||
{ | ||
"key": "unit", | ||
"value": { | ||
"isLiteral": true, | ||
"value": "MINUTES" | ||
} | ||
} | ||
] | ||
}]} | ||
}} |