I'm writing a module that needs to integrate with Jenkins and I would like to use this API. I need the ability to make requests to more than one Jenkins host. Would it be possible to tweak the jenkins_request function code slightly to decouple it from the jenkins_base_url variable?

Patch to follow.

Comments

littledynamo’s picture

littledynamo’s picture

Title: Allow more than one Jenkins host » Allow requests to multiple Jenkins host
littledynamo’s picture

Title: Allow requests to multiple Jenkins host » Allow requests to multiple Jenkins hosts
littledynamo’s picture

Added comment for new parameter.

skwashd’s picture

Status: Needs review » Needs work

@littledynamo this is an interesting idea. I want to avoid implementing something like CTools exportables for managing Jenkins servers, so we need some way of handling this with {variable}s.

In order to maintain backwards compatibility $url would need to be the last argument in the call to jenkins_request(). The base url would need to be an optional argument for all the functions that call jenkins_request(), as calling jenkins_request() directly is not encouraged and defeats the purpose of having all the other functions.

littledynamo’s picture

@skwashd - thanks for getting back to me. I have implemented the Entity API in my module, so each of the Jenkins hosts will be stored as an entity. This means I wouldn't need to store store URLs as variables in the Jenkins API module.

I'm mainly looking to add the Jenkins API as a dependency for my module and to call the functions directly. Have a gander at runBuild() and getJobs() to see what I mean http://cgit.drupalcode.org/update_trigger_build/tree/src/CIServerTypes/J...

I've attached another patch, which includes the changes as per the feedback in #5.

littledynamo’s picture

Status: Needs work » Needs review