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

Integer and decimal step parameters are save as string in Pipeline Editor

    XMLWordPrintable

    Details

    • Sprint:
      1.0
    • Similar Issues:

      Description

      When editing a step with an integer parameter (for example Sleep), the saved value for this parameter is a string, and this make the resulting pipeline failing.

      Here is an sample of what is generated by the pipeline editor

      sleep(time: '5', unit: 'MINUTES')
      

      and what is should have been

      sleep(time: 5, unit: 'MINUTES')
      

       

        Attachments

          Activity

          Hide
          jviolas jeremie violas added a comment -

          I think I tracked where the issue is, and I've submitted this pull request to fix it : https://github.com/jenkinsci/blueocean-pipeline-editor-plugin/pull/30

          Show
          jviolas jeremie violas added a comment - I think I tracked where the issue is, and I've submitted this pull request to fix it :  https://github.com/jenkinsci/blueocean-pipeline-editor-plugin/pull/30
          Hide
          jamesdumay James Dumay added a comment -

          Thanks for the contribution jeremie violas

          Show
          jamesdumay James Dumay added a comment - Thanks for the contribution jeremie violas
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jeremie Violas
          Path:
          src/main/js/components/properties/DecimalPropertyInput.jsx
          src/main/js/components/properties/IntegerPropertyInput.jsx
          http://jenkins-ci.org/commit/blueocean-pipeline-editor-plugin/e0a0d5c3cee8fbe6f79d449570df8de92bddb4b7
          Log:
          JENKINS-42640: Parse the value of the input of integer and decimal parameter before setting it in step data. (#30)

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jeremie Violas Path: src/main/js/components/properties/DecimalPropertyInput.jsx src/main/js/components/properties/IntegerPropertyInput.jsx http://jenkins-ci.org/commit/blueocean-pipeline-editor-plugin/e0a0d5c3cee8fbe6f79d449570df8de92bddb4b7 Log: JENKINS-42640 : Parse the value of the input of integer and decimal parameter before setting it in step data. (#30)
          Hide
          abayer Andrew Bayer added a comment -
          Show
          abayer Andrew Bayer added a comment - Declarative PR up for this (and JENKINS-42551 ) at  https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/133
          Hide
          jamesdumay James Dumay added a comment -

          Thanks a lot Andrew Bayer - appreciate the fast turn around

          Show
          jamesdumay James Dumay added a comment - Thanks a lot Andrew Bayer - appreciate the fast turn around
          Hide
          jamesdumay James Dumay added a comment -

          Thanks again

          Show
          jamesdumay James Dumay added a comment - Thanks again
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Andrew Bayer
          Path:
          pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/DescriptorLookupCache.java
          pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.java
          pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
          pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidatorImpl.groovy
          pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties
          pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
          pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
          pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/validator/JSONValidationTest.java
          pipeline-model-definition/src/test/resources/json/errors/jsonParameterTypeCoercion.json
          http://jenkins-ci.org/commit/pipeline-model-definition-plugin/2b20c589ab6f955c12471c2061e3a2bc01b28079
          Log:
          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.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/DescriptorLookupCache.java pipeline-model-api/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTStep.java pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/validator/ModelValidatorImpl.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/validator/JSONValidationTest.java pipeline-model-definition/src/test/resources/json/errors/jsonParameterTypeCoercion.json http://jenkins-ci.org/commit/pipeline-model-definition-plugin/2b20c589ab6f955c12471c2061e3a2bc01b28079 Log: 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.

            People

            • Assignee:
              jviolas jeremie violas
              Reporter:
              jviolas jeremie violas
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: