mohamicorp / stash-jenkins-postreceive-webhook

Webhook used to notify Jenkins when commits are made to Stash
Other
138 stars 98 forks source link

Branch names with slashes not building #27

Closed blewa closed 11 years ago

blewa commented 11 years ago

Hello, I've been trying to test the plugin but am unable to trigger a build for branches with a slash. For example, a branch name of "users/johny" won't build, but the "master" branch will.

mikesir87 commented 11 years ago

Have you tried the current snapshot build, or are you using the currently deployed build?

kuhnroyal commented 11 years ago

AFAIK we don't handle specific branches in the plugin. Maybe this is a Jenkins problem?

blewa commented 11 years ago

@mikesir87 I'm using the build in the store. Is there a fix that I might be missing out on? What's the process like for buliding from the snapshot?

@kuhnroyal I've got project that just builds master that works as expected. Same basic config,

kuhnroyal commented 11 years ago

This plugin only notifies Jenkins that there are changes in the repository by using the repository URL, it currently does not care about branches.

You can build the SNAPSHOT with Maven but you probably have to add some extra Atlassian repositories to the POM to resolve all necessary artifacts.

shaunybee commented 11 years ago

Hi - so given that a single jenkins instance will probably host several CI builds how to tell this plugin which job to build specifically if the URL is only the Jenkins root location?

So if I have say JobA and JobB: http://my_jenkins_server:8080/job/JobA http://my_jenkins_server:8080/job/JobB

How to tell the post commit hook that it should call http://my_jenkins_server:8080/job/JobA and not http://my_jenkins_server:8080/job/JobB if we only provide: http://my_jenkins_server:8080 as the URL? Does it assume that the Jenkins Job have the same name as the Stash project? Also what do we do about usernames and passwords? We would ideally send through an auth token as part of the post call URL: http://my_jenkins_server:8080/job/JobA?token=blahblahblah

mikesir87 commented 11 years ago

To echo @kuhnroyal 's words... no, the plugin does not do anything with branch names. So, this shouldn't be a problem in the plugin, but could be an issue on Jenkin's side.

The plugin works by notifying the Git Plugin (why it's required) with the url of the repository that had changes. When the Git plugin gets this notification, it finds all jobs that use that repo url and then triggers a build on it.

The Git plugin's exposed endpoint is a publicly open endpoint and does not require authentication. So, there's nothing to worry about there.

The link below details the endpoint we are using from the Git plugin. I'm going to go ahead and close this issue as it isn't an issue. But, if you have any more questions, feel free to continue commenting.

https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-Pushnotificationfromrepository

kuhnroyal commented 11 years ago

The plugin works by notifying the Git Plugin (why it's required) with the url of the repository that had changes. When the Git plugin gets this notification, it finds all jobs that use that repo url and then triggers a build on it.

To be more precise, it triggers the Jenkins Git Plugin to check for changes in all jobs that are set to poll the particular Stash repository, if there are changes then Jenkins will schedule a build.

So if you have two jobs, both polling from the same repository but using different branches and there are changes in only one of the branches, then only the job that builds the changed branch will actually be started by Jenkins.

Hope that clears things up a little for you.

shaunybee commented 11 years ago

erf still not working here however.

mikesir87 commented 11 years ago

Doing a search for issues with having slashes in branch names on the Git Plugin turned up a few results. Seems that one that had the most talk on it is the one linked below. Unfortunately, there's nothing we can do about it on our end, as it's a problem with their plugin.

https://issues.jenkins-ci.org/browse/JENKINS-14026