Re: Change GitSCM repository from a plugin

2016-03-21 Thread Iñigo Telleria
Thanks Mark. Reading the source code git plugin I've been able to modify the git repository address. You were right there was DataBoundConstructor to do it, its name is UserRemoteConfig. Iñigo On Friday, 18 March 2016 22:27:44 UTC+1, Mark Waite wrote: > > Since the job uses the remote reposit

Re: Change GitSCM repository from a plugin

2016-03-20 Thread Mark Waite
You might try the instructions at http://stackoverflow.com/questions/12799573/add-remote-via-jgit On Fri, Mar 18, 2016 at 7:14 AM Iñigo Telleria wrote: > Hi, > > I'm developing a Jenkins plugin which copies a job (template-job) and > changes some data. > > To do so, I've written this code in a p

Change GitSCM repository from a plugin

2016-03-19 Thread Iñigo Telleria
Hi, I'm developing a Jenkins plugin which copies a job (template-job) and changes some data. To do so, I've written this code in a plugin: MavenModuleSet template = (MavenModuleSet) jenkins.getItem("template-job"); MavenModuleSet newJob = (MavenModuleSet) jenkins.copy((TopLevelItem) template,

Re: Change GitSCM repository from a plugin

2016-03-19 Thread Mark Waite
Since the job uses the remote repository address which is stored inside the repository, I suggested that you use JGit to modify the job definition in the repository, then rely on the plugin to read the definition from the repository. Alternately, you could look at the source code of the git plugin

Re: Change GitSCM repository from a plugin

2016-03-18 Thread Iñigo Telleria
As far as I've understood JGit is to manage a local or remote repostiry. However, what I need is to modify remote repository address of a job. For example, a job's repository url is http://domain.com/project.git. With the plugin I'm implementing I want to replace that address with another one,