[JIRA] [git-parameter-plugin] (JENKINS-26799) Multiple SCMs plugin support

74 views
Skip to first unread message

nikolas.falco@finantix.com (JIRA)

unread,
Jul 15, 2015, 7:04:08 AM7/15/15
to jenkinsc...@googlegroups.com
Nikolas Falco commented on New Feature JENKINS-26799
 
Re: Multiple SCMs plugin support

I confirm the same needs. We often must download more than git repositories (as the SVN plugin), because we do not use git submodules.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

rosberglinhares@gmail.com (JIRA)

unread,
Jul 21, 2015, 10:55:01 AM7/21/15
to jenkinsc...@googlegroups.com

Yes, this would be a good feature! I need to query tags from a specific repo (via Git Parameter Plugin) and tag each of them in the post-build phase.

alex.lance@melbourneit.com.au (JIRA)

unread,
Jul 23, 2015, 3:47:01 AM7/23/15
to jenkinsc...@googlegroups.com

This would be an outstanding addition for a CI workflow.

We're trying to build a pipeline that permits developers to deploy their feature branches before they are merged into master.

Often there are projects that have many git repos in them. Being able to dynamically select the branch for each repo at build
time would be extremely useful.

klimas7@gmail.com (JIRA)

unread,
Mar 5, 2016, 4:39:01 PM3/5/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas assigned an issue to Boguslaw Klimas
 
Jenkins / New Feature JENKINS-26799
Multiple SCMs plugin support
Change By: Boguslaw Klimas
Assignee: Niklaus Giger Boguslaw Klimas

dakota.brown@verizonwireless.com (JIRA)

unread,
Aug 25, 2016, 8:51:01 AM8/25/16
to jenkinsc...@googlegroups.com

Boguslaw Klimas,

It looks like this would be a matter of modifying GitParameterDefinition.getProjectSCM() with another option like the RepoSCM

The class of the multiSCM plugin is org.jenkinsci.plugins.multiplescms.MultiSCM

and the method that returns a list of SCMs is for MultiSCM getConfiguredSCMs() which returns a list of SCMs.

If I can find some time in the next few weeks, I'll try to help out with this

This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 9:10:01 AM8/25/16
to jenkinsc...@googlegroups.com

klimas7@gmail.com (JIRA)

unread,
Aug 25, 2016, 9:34:02 AM8/25/16
to jenkinsc...@googlegroups.com

Hi Dakota Brown
This solution perhaps is ok, but method getConfiguredSCMs() which returns a list of SCMs

klimas7@gmail.com (JIRA)

unread,
Aug 25, 2016, 9:40:01 AM8/25/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas edited a comment on New Feature JENKINS-26799
Hi [~luckless]
This solution perhaps is ok, but
the   method getConfiguredSCMs() which returns a *list* of SCMs .
Which SCMs of list I should choose to present in parameters? All/first/add combo to chose scm?
Currently I don't have a good idea to resolve this problem.

Regards
Boguslaw



nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 9:54:02 AM8/25/16
to jenkinsc...@googlegroups.com

I think a solution could be a combo that show a sorted list (so it groups by SCM)

  • SCM Unique Name/TAG1
  • SCM Unique Name/TAG2
  • SCM Unique Name2/BRANCHA
  • SCM Unique Name2/BRANCHB

dakota.brown@verizonwireless.com (JIRA)

unread,
Aug 25, 2016, 10:08:02 AM8/25/16
to jenkinsc...@googlegroups.com

Boguslaw Klimas,

That is where my solution stops being a good one I've been thinking about it but haven't come up with a solution besides choosing the first GitSCM in the list.

For my purposes that would be enough but it isn't universal

Nikolas Falco,

The problem with that solution is that the mutli scm plugin doesn't require unique scm names so long as the subdirectory they check out to is different.

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 11:55:01 AM8/25/16
to jenkinsc...@googlegroups.com

I've debug a little bit and checked actual our jobs.

About unique name:
The unique scm name in a GIT SCM is not required but suggested (as described in the help of additional behaviour "Custom SCM Name"). The method getScmName() to retrieve that name was deprecated and could get null if not defined. Documentation say to use GitSCM.getKey() that always give to you a valid unique name for that git scm repository.

About parameter:
Some our jobs has more than 15 git repository to download before run the build script taken from an SVN repo :\
Actually we have a String Parameter like REPOX_BRANCH for each repository. No sense have only git parameter for all repositories.
I think a good solution was add to actual git parameter definition a combo with the list of all GitSCM.getKey() returned by MultiSCM (optional dependency).
Instead when you execute a new build in getProjectSCM() method in case of MultiSCM it should iterate over getConfiguredSCMs() and return ones that matches the key choosed in job configuration.

dakota.brown@verizonwireless.com (JIRA)

unread,
Aug 25, 2016, 12:09:01 PM8/25/16
to jenkinsc...@googlegroups.com

I think that's part of the difficulty though since that getProjectSCM() method has a return type for a singular SCM object.

At that point, it affects a lot more than just multi-scm plugin. making that return a list of GitSCM objects turns into a high-impact change

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 12:22:02 PM8/25/16
to jenkinsc...@googlegroups.com

No because in the method getProjectSCM() you have to match the selected scmKey you have configured in the job with the ConfiguredSCM()

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 12:25:01 PM8/25/16
to jenkinsc...@googlegroups.com
Nikolas Falco edited a comment on New Feature JENKINS-26799
I've debug a little bit and checked actual our jobs.

+About unique name:+

The unique scm name in a GIT SCM is not required but suggested (as described in the help of additional behaviour "Custom SCM Name"). The method getScmName() to retrieve that name was deprecated and could get null if not defined. Documentation say to use GitSCM.getKey() that always give to you a valid unique name for that git scm repository.

+About parameter:+

Some our jobs has more than 15 git repository to download before run the build script taken from an SVN repo :\
Actually we have a String Parameter like REPOX_BRANCH for each repository. No sense have only git parameter for all repositories.
I think a good solution was add to actual git parameter definition a combo with the list of all GitSCM.getKey() returned by MultiSCM (optional dependency).
Instead when you execute a new build in getProjectSCM() method in case of MultiSCM it should iterate over getConfiguredSCMs() and return ones that one matches the key choosed in job configuration.

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 1:44:03 PM8/25/16
to jenkinsc...@googlegroups.com
Nikolas Falco updated an issue
Change By: Nikolas Falco
Attachment: screenshot-1.png

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 1:46:02 PM8/25/16
to jenkinsc...@googlegroups.com
Nikolas Falco updated an issue
Change By: Nikolas Falco
Attachment: screenshot-2.png

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 1:47:02 PM8/25/16
to jenkinsc...@googlegroups.com

This is only a working POC (proof of concept)
https://github.com/nfalco79/git-parameter-plugin/tree/feature/JENKINS-26799

It works but:

  • here MultiSCM is not an real optional dependency (I do not know if jenkins have some API to avoid Class.forName("") to know if a plugin is installed)
  • missing test case
  • missing handle event when you change repo URL and you have not set an SCM name (why if you not set any SCM Name the SCM key it's the string "git " + repoURL)
  • maybe some faultback for backward compatibility

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 1:49:03 PM8/25/16
to jenkinsc...@googlegroups.com
Nikolas Falco updated an issue
Change By: Nikolas Falco
Attachment: screenshot-3.png

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 1:49:06 PM8/25/16
to jenkinsc...@googlegroups.com
Nikolas Falco updated an issue
Change By: Nikolas Falco
Attachment: screenshot-4.png

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 1:50:03 PM8/25/16
to jenkinsc...@googlegroups.com
Nikolas Falco updated an issue
Change By: Nikolas Falco
Comment:
!screenshot-1.png|thumbnail!

!screenshot-2.png|thumbnail!

*It works but*:
* here MultiSCM is not an real optional dependency (I do not know if jenkins have some API to avoid Class.forName("") to know if a plugin is installed)
* missing test case
* missing handle event when you change repo URL and you have not set an SCM name (why if you not set any SCM Name the SCM key it's the string "git " + repoURL)
* maybe some faultback for backward compatibility

nfalco79@hotmail.com (JIRA)

unread,
Aug 25, 2016, 1:50:06 PM8/25/16
to jenkinsc...@googlegroups.com

This is only a working POC (proof of concept)
https://github.com/nfalco79/git-parameter-plugin/tree/feature/JENKINS-26799

It works but:

  • here MultiSCM is not an real optional dependency (I do not know if jenkins have some API to avoid Class.forName("") to know if a plugin is installed)
  • missing test case
  • missing handle event when you change repo URL and you have not set an SCM name (why if you not set any SCM Name the SCM key it's the string "git " + repoURL)
  • maybe some faultback for backward compatibility

dakota.brown@verizonwireless.com (JIRA)

unread,
Aug 25, 2016, 2:00:01 PM8/25/16
to jenkinsc...@googlegroups.com

I like the general direction. I'll look closely at it when I get the chance

dakota.brown@verizonwireless.com (JIRA)

unread,
Aug 25, 2016, 2:00:02 PM8/25/16
to jenkinsc...@googlegroups.com

dakota.brown@verizonwireless.com (JIRA)

unread,
Aug 25, 2016, 3:18:07 PM8/25/16
to jenkinsc...@googlegroups.com
Dakota Brown updated an issue
Change By: Dakota Brown
Comment:
I like the general direction. I'll look closely at it when I get the chance

klimas7@gmail.com (JIRA)

unread,
Aug 25, 2016, 4:11:01 PM8/25/16
to jenkinsc...@googlegroups.com

Nikolas Falco This is very good POC but

You may not have defined SCM when you add parameter or SCM definition can change after add parameter. Then you not have the actual information about SCM in parameter definition.

I think good and simple solution is a:
Add two option:

  • MultipleSCM: FIRST, ALL, MATCH_REPOSITORY_URL (combo)
  • MultipleSCM Url: ______ (text field - regexp)

'FIRST' is default value.
If you choose 'FIRST' - plugin will take data from first defined SCM (git repository)
'ALL' plugin take data from all defined SCM
'MATCH_REPOSITORY_URL' plugin will take data from all SCM which url match from regular expression.

The advantage of this solution is: you do not need know about defined SCM. and this and this is more flexible solution.

Regards
Boguslaw

klimas7@gmail.com (JIRA)

unread,
Aug 26, 2016, 2:45:02 AM8/26/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas edited a comment on New Feature JENKINS-26799
[~nfalco79] This is very good POC :) but


You may not have defined SCM when you add parameter or SCM definition can change after add parameter. Then you not have the actual information about SCM in parameter definition.

I think good and simple solution is a:
Add two option:
- MultipleSCM: FIRST, ALL, MATCH_REPOSITORY_URL (combo)
- MultipleSCM Url: ______ (text field - regexp)



'FIRST' is default value.
If you choose 'FIRST' - plugin will take data  from first defined SCM (git repository)
'ALL' plugin take data from all defined SCM
'MATCH_REPOSITORY_URL' plugin will take data from all SCM which url match from regular expression.

The advantage of this solution is: you do not need know about defined SCM. and this and this is more flexible solution.

Perhaps is enough option 'MATCH_REPOSITORY_URL' and adding one  text field to configuratin.

Regards
Boguslaw

klimas7@gmail.com (JIRA)

unread,
Aug 26, 2016, 2:45:03 AM8/26/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas edited a comment on New Feature JENKINS-26799
[~nfalco79] This is very good POC :) but

You may not have defined SCM when you add parameter or SCM definition can change after add parameter. Then you not have the actual information about SCM in parameter definition.

I think good and simple solution is a:
Add two option:
- MultipleSCM: FIRST, ALL, MATCH_REPOSITORY_URL (combo)
- MultipleSCM Url: ______ (text field - regexp)


'FIRST' is default value.
If you choose 'FIRST' - plugin will take data  from first defined SCM (git repository)
'ALL' plugin take data from all defined SCM
'MATCH_REPOSITORY_URL' plugin will take data from all SCM which url match from regular expression.

The advantage of this solution is: you do not need know about defined SCM. and this and this is more flexible solution.

Perhaps is enough option and adding one  text field to configuratin.

Regards
Boguslaw

klimas7@gmail.com (JIRA)

unread,
Nov 2, 2016, 4:31:06 PM11/2/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas started work on New Feature JENKINS-26799
 
Change By: Boguslaw Klimas
Status: Open In Progress

nfalco79@hotmail.com (JIRA)

unread,
Nov 3, 2016, 4:57:01 AM11/3/16
to jenkinsc...@googlegroups.com
Nikolas Falco updated an issue
Change By: Nikolas Falco
Attachment: git parameter.jpg

nfalco79@hotmail.com (JIRA)

unread,
Nov 3, 2016, 5:02:01 AM11/3/16
to jenkinsc...@googlegroups.com

Boguslaw Klimas I have some doubts about FIRST and ALL value option.

  • FIRST not work if no SCM defined and maybe I would have the commit or TAG value to do some kinds of work based on parameter value without source code (for example download binary deployed on artifactory with release tag).
  • ALL could be a very confusing if BRANCH or REVISION are selected and more than one SCM is defined
    So the really useful choise is MATCH_REPOSITRY_URL but also in this case you could not use it when no SCM is defined.

The SVN strategy is very simple and usable

You always put the complete git URL and you could also select credential stored in jenkins so more issue JENKINS-28597

klimas7@gmail.com (JIRA)

unread,
Nov 5, 2016, 1:32:02 PM11/5/16
to jenkinsc...@googlegroups.com

Hi Nikolas Falco
The solution to this issue is only part of a larger issue JENKINS-39530.
Finally I will add only one new option in configuration 'Use repository', this option will be a regular expression. It will be taken into account only, when is defined more then one SCM in job.

Regards
Bogusław

klimas7@gmail.com (JIRA)

unread,
Nov 6, 2016, 4:11:01 AM11/6/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas edited a comment on New Feature JENKINS-26799
Hi [~nfalco]
The solution to this issue is only part of a larger issue [JENKINS-39530|https://issues.jenkins-ci.org/browse/JENKINS-39530].

Finally I will add only one new option in configuration 'Use repository', this option will be a regular expression. It will be taken into account only, when is defined more then one SCM in job.
When properties is empty plugin get first SMC from job.

From my perspective, any change must be transparent for current user.
Regards
Bogusław

klimas7@gmail.com (JIRA)

unread,
Nov 19, 2016, 10:44:02 PM11/19/16
to jenkinsc...@googlegroups.com

klimas7@gmail.com (JIRA)

unread,
Nov 19, 2016, 10:45:02 PM11/19/16
to jenkinsc...@googlegroups.com

klimas7@gmail.com (JIRA)

unread,
Nov 27, 2016, 1:46:06 PM11/27/16
to jenkinsc...@googlegroups.com
 

Release 0.7.1

Change By: Boguslaw Klimas
Status: In Review Resolved
Resolution: Fixed

thefelikz@gmail.com (JIRA)

unread,
Dec 14, 2016, 6:37:02 AM12/14/16
to jenkinsc...@googlegroups.com

Apparently does not work when your second SCM cloned to subdir.

thefelikz@gmail.com (JIRA)

unread,
Dec 14, 2016, 6:38:01 AM12/14/16
to jenkinsc...@googlegroups.com
Oleksii Shevchenko edited a comment on New Feature JENKINS-26799
Apparently does not work when your second SCM cloned to subdir (GIT) .

klimas7@gmail.com (JIRA)

unread,
Dec 18, 2016, 4:06:02 PM12/18/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas reopened an issue
 

Hi Oleksii Shevchenko
I reopen this isssue and i will try to fix this

Change By: Boguslaw Klimas
Resolution: Fixed
Status: Resolved Reopened

thefelikz@gmail.com (JIRA)

unread,
Dec 19, 2016, 4:56:01 AM12/19/16
to jenkinsc...@googlegroups.com

Boguslaw Klimas Thanks. So I have 2 git repositories. First is cloned at root of workspace, second to subdir of first repo. Having this setup I am not able to Regexp second repo, only first matching.

klimas7@gmail.com (JIRA)

unread,
Dec 28, 2016, 8:44:02 AM12/28/16
to jenkinsc...@googlegroups.com
Boguslaw Klimas started work on New Feature JENKINS-26799
 
Change By: Boguslaw Klimas
Status: Reopened In Progress

scm_issue_link@java.net (JIRA)

unread,
Feb 6, 2017, 4:53:01 PM2/6/17
to jenkinsc...@googlegroups.com

Code changed in jenkins
User: Boguslaw Klimas
Path:
src/test/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinitionTest.java
http://jenkins-ci.org/commit/git-parameter-plugin/6336b41960434597180ab883b81d8e26e03b3641
Log:
Merge pull request #45 from jenkinsci/feature/JENKINS-26799

Multiple SCMs plugin support

Compare: https://github.com/jenkinsci/git-parameter-plugin/compare/570bf0fbb7b0...6336b4196043

Reply all
Reply to author
Forward
0 new messages