Skip to content

Conversation

@janario
Copy link
Member

@janario janario commented Dec 22, 2019

Using the custom tool plugin, notice that on Jenkins view configuration it failed with type mismatch

tool:
  customTool:
    installations: |-
      FAILED TO EXPORT
      com.cloudbees.jenkins.plugins.customtools.CustomTool$DescriptorImpl#installations: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.describe(DataBoundConfigurator.java:299)
        at io.jenkins.plugins.casc.Attribute._describe(Attribute.java:264)
        at io.jenkins.plugins.casc.Attribute.describe(Attribute.java:239)
        at io.jenkins.plugins.casc.Configurator.describe(Configurator.java:162)
        at io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator.describe(GlobalConfigurationCategoryConfigurator.java:106)
        at io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator.lambda$describe$3(GlobalConfigurationCategoryConfigurator.java:99)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
        at java.util.Iterator.forEachRemaining(Iterator.java:116)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
        at io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator.describe(GlobalConfigurationCategoryConfigurator.java:99)
        at io.jenkins.plugins.casc.impl.configurators.GlobalConfigurationCategoryConfigurator.describe(GlobalConfigurationCategoryConfigurator.java:30)

With some debugging I notice that the array argument is passed as a list, added some verification to reuse the same converted value when it is an array

Your checklist for this pull request

🚨 Please review the guidelines for contributing to this repository.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.

Copy link
Member

@jetersen jetersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Thanks for contributing

@jetersen jetersen merged commit 0723f98 into jenkinsci:master Dec 22, 2019
@jetersen jetersen added the feature A PR that adds a feature - used by Release Drafter label Jan 2, 2020
@KalleOlaviNiemitalo
Copy link

This fixed JENKINS-60045.

btk3000 pushed a commit to btk3000/custom-tools-plugin that referenced this pull request Feb 6, 2020
Original issue is that JCasC could create jenkins.yaml for customTool section. It happened, because, io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.describe(DataBoundConfigurator.java:299) could work with Arrays.
It was fixed with jenkinsci/configuration-as-code-plugin#1234
. Now it is possible to create quite correct jenkins.yaml, but Jinkins can`t be started it. JENKINS-60976.

This fix replaces array to list provide opportunity to create yaml and configure Jenkins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A PR that adds a feature - used by Release Drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants