[JIRA] (JENKINS-59466) Nested Views are incompatible with Config as Code

4 views
Skip to first unread message

ataylor@cloudbees.com (JIRA)

unread,
Sep 20, 2019, 3:20:03 PM9/20/19
to jenkinsc...@googlegroups.com
Alex Taylor created an issue
 
Jenkins / Improvement JENKINS-59466
Nested Views are incompatible with Config as Code
Issue Type: Improvement Improvement
Assignee: Ewelina Wilkosz
Components: configuration-as-code-plugin, nested-view-plugin
Created: 2019-09-20 19:19
Priority: Minor Minor
Reporter: Alex Taylor

Issue:
When trying to import a yaml with config as code, if that yml code has nested views then it will fail due to a Null pointer

Steps to reproduce:
1. Create a view with nested views
2. Export that config as code yaml
3. Import the yaml and observe the null pointer

The error:

java.lang.Error: java.lang.reflect.InvocationTargetException
	at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
	at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
	at jenkins.model.Jenkins$5.runTask(Jenkins.java:1095)
	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
	... 8 more
Caused by: java.lang.NullPointerException
	at hudson.plugins.nested_view.NestedView.save(NestedView.java:258)
	at hudson.BulkChange.commit(BulkChange.java:98)
	at io.jenkins.plugins.casc.BaseConfigurator.configure(BaseConfigurator.java:272)

The cause:
This is the code which causes the issue and it appears that the owner while doing an import does not exist.

The fix:
I think we should do a check there for "if no owner then the owner should be the default Jenkins instance.

Thoughts?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

ataylor@cloudbees.com (JIRA)

unread,
Sep 25, 2019, 4:30:01 PM9/25/19
to jenkinsc...@googlegroups.com
Alex Taylor commented on Improvement JENKINS-59466
 
Re: Nested Views are incompatible with Config as Code

So I created this PR which does fix the error but I am not confident that this is the best fix since it would set the owner of all your nested views to the SYSTEM user or Jenkins user. That may be bad practice and make things break...

ataylor@cloudbees.com (JIRA)

unread,
Nov 21, 2019, 8:48:05 AM11/21/19
to jenkinsc...@googlegroups.com

After testing out the PR, I have found that Nested views just pretty much doesnt work with Config as code. This stops if from breaking but the views dont actually work which means either nested views needs to ensure that it is following Config as Code practices or CasC needs to change so that this plugin works with it.

I am assuming the former is going to be easiest.

Technically, this defect is "done" but the plugin still doesnt work with CasC

Reply all
Reply to author
Forward
0 new messages