Project

General

Profile

Feature #4211

[ce, ee] increase webhook flexibility

Added by Daniel D almost 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
Start date:
31.08.2016
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:

Description

How would I go about if I wanted the webhook being able to trigger a certain branch to build in Jenkins? I'm using Pipeline/Pipeline Multibranch, but regardles, it'd require something like:

http://server/myjenkinsproject/job/< BRANCHNAME >/build

Does Rhodecode provide any environment variables through the webhook setup in the UI that I could pass in for < BRANCHNAME > or is this something I'd have to hand code as an extension?

This feature was requested in community-discussion.

From what I can tell, if we allow template variables in the url, which get interpolated with the event dict, we can get this functionality

eg. http://server/{event['branch']}/build

The problem is (in this particular use case) that there can be multiple branches per push - which complicates matters, not sure how to get around this.

History

#1 Updated by Daniel D almost 3 years ago

  • Description updated (diff)

#2 Updated by Francois Dionne almost 3 years ago

We use TeamCity,

At the moment, TeamCity has to poke RhodeCode repositories to know if there is something new to build. We have so much build configurations that we paused most of the triggers to minimise the amount of request RhodeCode has to manage.

I did some search and TeamCity has a REST API that we could use to start build. This is an example of the cURL request that start a build.

curl -u user:password --request POST http://yourserver:8080/app/rest/buildQueue --header "Content-Type:application/xml" --data-binary @build.xml

Where build.xml has the following structure.

According to me, if you want RhodeCode to trigger build in TeamCity, then there should be general configuration that apply to all “triggers”.
• TeamCity User
• TeamCity User Password
• TeamCity Server URL

Then in each Repository, we should be able to add as many "trigger" as we need with the following parameters to generate the “xml”.
• Branch Name
• BuildType id (Build Configuration ID)

#3 Updated by Francois Dionne almost 3 years ago

Here is the missing XML Structure

<build>
<buildType id="CrmSolutions_Security_Build_Dev"/>
</build>

#4 Updated by Marcin Kuzminski [staff] almost 3 years ago

  • Target version set to v4.5
  • Assignee set to Marcin Kuzminski [staff]
  • Status changed from New to In Progress

#5 Updated by Redmine Integration almost 3 years ago

  • Status changed from In Progress to Resolved

Also available in: Atom PDF