It helps if you mention the Jenkins version.

On 1.509.3, the following works:

def listView = new ListView("my-view", Jenkins.instance)
listView.includeRegex = "pattern"
listView.includePattern = java.util.regex.Pattern.compile("pattern")
Jenkins.instance.addView(listView)
Jenkins.instance.save()

While there's a ListView#setIncludeRegex(String) on master that does this 
automatically, it was only added in 1.526.

On 25.09.2013, at 23:23, Rui Fernando Hayashi <[email protected]> wrote:

> Hi
> 
> I'm trying to create a view programatically using code like this:
> 
> def listView = new ListView("my-view", Jenkins.instance)
> listView.includeRegex = "myregex"
> Jenkins.instance.addView(listView)
> Jenkins.instance.save()
> 
> The view is created, but the jobs that match the regex are not listed. The 
> jobs are only listed if I edit the view and save it (through the GUI).
> 
> Any ideas?
> 
> Tks
> 
> Rui
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to