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

ArrayIndexOutOfBoundsException in getPrimaryView when no view exists

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      Jenkins 2.206

      Description

      This exception occurs while defining a view using a job DSL when no other view exists:

      SEVERE  jenkins.InitReactorRunner$1#onTaskFailed: Failed ConfigurationAsCode.init
      java.lang.ArrayIndexOutOfBoundsException: 0
          at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:388)
          at java.util.concurrent.CopyOnWriteArrayList.get(CopyOnWriteArrayList.java:397)
          at hudson.model.ViewGroupMixIn.getPrimaryView(ViewGroupMixIn.java:172)
          at hudson.model.ViewGroupMixIn.getView(ViewGroupMixIn.java:134)
          at jenkins.model.Jenkins.getView(Jenkins.java:1834)
          at javaposse.jobdsl.plugin.JenkinsJobManagement.createOrUpdateView(JenkinsJobManagement.java:175)
          at javaposse.jobdsl.dsl.JobManagement$createOrUpdateView$2.call(Unknown Source)
          at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
          at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
          at javaposse.jobdsl.dsl.AbstractDslScriptLoader$_extractGeneratedViews_closure5.doCall(AbstractDslScriptLoader.groovy:216)
      

      Can be reproduced using the following Dockerfile:

      FROM jenkins/jenkins:latest
      
      RUN echo job-dsl > /usr/share/jenkins/ref/plugins.txt
      RUN echo configuration-as-code >> /usr/share/jenkins/ref/plugins.txt
      RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
      
      RUN echo 2.0 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state
      
      RUN echo 'jenkins:' > /usr/share/jenkins/ref/jenkins.yaml.override
      RUN echo 'jobs:' >> /usr/share/jenkins/ref/jenkins.yaml.override
      RUN echo '  - file: /var/jenkins_home/my-view.groovy' >> /usr/share/jenkins/ref/jenkins.yaml.override
      
      RUN /bin/echo -e "listView('test') {\n\
          description('test desc')\n\
      }" > /usr/share/jenkins/ref/my-view.groovy
      
      ENV JAVA_OPTS -Djenkins.install.runSetupWizard=false
      

      and the following commands:

      • docker build -t testjenkins .
      • docker run -p 8080:8080 -p 50000:50000 -it testjenkins

        Attachments

          Issue Links

            Activity

            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Fixed it 2.206. I am not sure whether it is a good LTS candidate taking the plan to introduce the default view, but I will leave the decision to Oliver Gondža

            Show
            oleg_nenashev Oleg Nenashev added a comment - Fixed it 2.206. I am not sure whether it is a good LTS candidate taking the plan to introduce the default view, but I will leave the decision to Oliver Gondža

              People

              Assignee:
              pilou Pierre-Louis Bonicoli
              Reporter:
              pilou Pierre-Louis Bonicoli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: