I dug into the source code and figured this out.  Jenkins does not attempt 
to parse the groovy code to determine the url, rather it captures the 
actual URLs that were fetched the last time the job ran.  Thus the problem 
I was having was not due to Jenkins not being able to figure out the url 
per se, it was that I was testing by trying to trigger a new test job that 
had never run.  

So for scm hooks and scm polling to work with workflow jobs, the job must 
first run once, and not fail prior to attempting to fetch from smc.  My 
only remaining question is, is this documented anywhere?

On Tuesday, February 3, 2015 at 12:04:01 PM UTC-5, Kenneth Baltrinic wrote:
>
> We are using a function in our cps global library to perform our git 
> fetch.  This function looks something like:
>
> def getFromStash(stashProject, stashRepo) {
>     checkout changelog: true, poll: true, scm: [
>         $class: 'GitSCM',
>         branches: [[name: '*/master']],
>         doGenerateSubmoduleConfigurations: false,
>         submoduleCfg: [],
>         userRemoteConfigs: [[
>             credentialsId: 'e01b632a-4bb4-446b-9d93-793565f2293f',
>             url: "ssh://git@stash:7999/${stashProject}/${stashRepo}.git"
>         ]]
>     ]
> }
>
>
> It appears that using such an approach (which interestingly is *the* example 
> given for using a cps global library) to pulling from SCM breaks the 
> git-hook because the workflow plug-in is unable to determine, without 
> running the workflow, the url that the job is going to pull from. 
>  (Specifically the hook when invoked reports no matching jobs found) 
>
> Is there any way around this?  It seems like this would also break basic 
> SCM polling as well would it not?  Given that this is the example for using 
> a global library, I am hoping there is a right way to do this, because not 
> being able to poll nor be triggered is something of a problem.
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ef45cdea-c544-4f0a-96aa-4b233c88a459%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to