I'm able to get a list of projects putting this in the console:

println Jenkins.instance.getAllItems()


However, none of the types shown extend SCMSourceOwner (e.g. 
hudson.model.FreeStyleProject).

The implementation of getAllItems() is checking types 
<https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Items.java#L325-L329>,
 
and since the new scm-api is looking for Items that extend SCMSourceOwner 
<https://github.com/jenkinsci/scm-api-plugin/blob/master/src/main/java/jenkins/scm/api/SCMSourceOwners.java#L69>,
 
the type check fails and the project is excluded from the results. Still 
digging.

On Tuesday, February 24, 2015 at 11:06:33 AM UTC-5, Mark Lewis wrote:
>
> I am Brantley's colleague. Just in case this was tied to security, I 
> converted this block of code 
> <https://github.com/jenkinsci/subversion-plugin/blob/master/src/main/java/jenkins/scm/impl/subversion/SubversionSCMSource.java#L948-L965>
>  to 
> the following Groovy script which should print them all:
>
> import hudson.security.ACL
> import jenkins.scm.api.SCMSource
> import jenkins.scm.api.SCMSourceOwners
> import org.acegisecurity.context.SecurityContextHolder
> import org.acegisecurity.Authentication
>
> Authentication old = SecurityContextHolder.getContext().getAuthentication()
> SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM)
> try {
>   for(SCMSource e in SCMSourceOwners.all()) {
>     println(e)
>   }
> } finally {
>   SecurityContextHolder.getContext().setAuthentication(old)
> }
>
>
> Instead, it prints nothing.
>
>
> On Tuesday, November 11, 2014 at 4:20:52 AM UTC-5, James Telfer wrote:
>>
>> Hi all,
>>
>> I've been working through this issue and trying to read other resources 
>> on post-commit hooks without finding a match for the issue I'm experiencing.
>>
>> My jobs work fine, and SVN polling is working and triggering builds. 
>> However, the post-commit hook in SVN doesn't trigger a build. Instead, the 
>> following is written to the log:
>>
>> Nov 10, 2014 11:50:33 AM 
>>> jenkins.scm.impl.subversion.SubversionSCMSource$ListenerImpl onNotify
>>> INFO: Received post-commit hook from 104ea3cd-1caa-42bb-bcc1-
>>> xxxxxxxxxxxx for revision 120,169 on paths [src/trunk/mgs/, ... 
>>> (correct comma-separated path list)]
>>> Nov 10, 2014 11:50:33 AM 
>>> jenkins.scm.impl.subversion.SubversionSCMSource$ListenerImpl onNotify
>>> INFO: No subversion consumers for UUID 
>>> 104ea3cd-1caa-42bb-bcc1-xxxxxxxxxxxx
>>
>>
>> So far:
>>
>>    - The job is working manually, and via SVN polling
>>    - The SCM trigger does not deny post-commit hooks
>>    - The UUID is correct
>>    - The paths appear to be correct
>>    - The post-commit hook is using basic auth with a valid user name and 
>>    API key (these work -- I used to trigger specific builds using this 
>> script)
>>    - I'm not using the BlameSubversion plugin
>>    - I have Jenkins 1.570 and SVN plugin 2.3.
>>    - The SVN checkout for this item is marked with depth 'empty', but 
>>    the source code appears only to check against the UUID (at this level).
>>    
>> I looked at the code for SubversionSCMSource.onNotify and setup a logger 
>> at level 'FINE' for that class. Nothing interesting. I tried:
>>
>>> for (SCMSourceOwner owner : SCMSourceOwners.all()) { 
>>
>>     println owner 
>>
>> }
>>
>>
>> In the console and found the collection has no elements. I tried:
>>
>>> println Jenkins.instance.getAllItems(SCMSource.class)
>>
>>
>> as well but that's empty too.
>>
>> At this point I'm at a loss. It might need to be anonymous instead of 
>> using basic auth (I'm trying that out) but apart from that I'm out of ideas.
>>
>> Does anyone have any other ideas I can try?
>>
>> Thanks in advance,
>> James
>>
>>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e39dd500-2954-416a-aa55-e1d07ded09c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to