Details

    • Similar Issues:

      Description

      This plugin is really good. But currently it doesn't support "Multiple SCMs plugin". If I configure the job with multiple Git repos it wont detect branches.

      This would be a very good feature.

        Attachments

        1. git parameter.jpg
          git parameter.jpg
          12 kB
        2. screenshot-1.png
          screenshot-1.png
          12 kB
        3. screenshot-2.png
          screenshot-2.png
          23 kB
        4. screenshot-3.png
          screenshot-3.png
          22 kB
        5. screenshot-4.png
          screenshot-4.png
          24 kB

          Activity

          Hide
          dirk_hain Dirk Hain added a comment -

          I can confirm the same issue. This plugin would be great but I cannot use it because I need to fetch 2 git repositories.

          Show
          dirk_hain Dirk Hain added a comment - I can confirm the same issue. This plugin would be great but I cannot use it because I need to fetch 2 git repositories.
          Hide
          nfalco79 Nikolas Falco added a comment -

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

          Show
          nfalco79 Nikolas Falco added a comment - I confirm the same needs. We often must download more than git repositories (as the SVN plugin), because we do not use git submodules.
          Hide
          rosberglinhares Rosberg Linhares added a comment -

          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.

          Show
          rosberglinhares Rosberg Linhares added a comment - 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.
          Hide
          alla Alex Lance added a comment -

          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.

          Show
          alla Alex Lance added a comment - 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.
          Hide
          broda20 Dakota Brown added a comment -

          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

          Show
          broda20 Dakota Brown added a comment - 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
          Hide
          nfalco Nikolas Falco added a comment -

          Would be great

          Show
          nfalco Nikolas Falco added a comment - Would be great
          Hide
          klimas7 Boguslaw Klimas added a comment - - edited

          Hi Dakota Brown
          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

          Show
          klimas7 Boguslaw Klimas added a comment - - edited Hi Dakota Brown 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
          Hide
          nfalco Nikolas Falco added a comment -

          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
          Show
          nfalco Nikolas Falco added a comment - 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
          Hide
          broda20 Dakota Brown added a comment -

          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.

          Show
          broda20 Dakota Brown added a comment - 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.
          Hide
          nfalco Nikolas Falco added a comment - - edited

          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 that one matches the key choosed in job configuration.

          Show
          nfalco Nikolas Falco added a comment - - edited 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 that one matches the key choosed in job configuration.
          Hide
          broda20 Dakota Brown added a comment -

          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

          Show
          broda20 Dakota Brown added a comment - 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
          Hide
          nfalco Nikolas Falco added a comment -

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

          Show
          nfalco Nikolas Falco added a comment - No because in the method getProjectSCM() you have to match the selected scmKey you have configured in the job with the ConfiguredSCM()
          Hide
          nfalco Nikolas Falco added a comment -

          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
          Show
          nfalco Nikolas Falco added a comment - 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
          Hide
          broda20 Dakota Brown added a comment -

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

          Show
          broda20 Dakota Brown added a comment - I like the general direction. I'll look closely at it when I get the chance
          Hide
          klimas7 Boguslaw Klimas added a comment - - edited

          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.

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

          Regards
          Boguslaw

          Show
          klimas7 Boguslaw Klimas added a comment - - edited 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. Perhaps is enough option 'MATCH_REPOSITORY_URL' and adding one text field to configuratin. Regards Boguslaw
          Hide
          nfalco Nikolas Falco added a comment -

          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

          Show
          nfalco Nikolas Falco added a comment - 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
          Hide
          klimas7 Boguslaw Klimas added a comment - - edited

          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.
          When properties is empty plugin get first SMC from job.

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

          Show
          klimas7 Boguslaw Klimas added a comment - - edited 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. When properties is empty plugin get first SMC from job. From my perspective, any change must be transparent for current user. Regards Bogusław
          Show
          klimas7 Boguslaw Klimas added a comment - https://github.com/jenkinsci/git-parameter-plugin/pull/41
          Hide
          klimas7 Boguslaw Klimas added a comment -

          Release 0.7.1

          Show
          klimas7 Boguslaw Klimas added a comment - Release 0.7.1
          Hide
          felikz Oleksii Shevchenko added a comment - - edited

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

          Show
          felikz Oleksii Shevchenko added a comment - - edited Apparently does not work when your second SCM cloned to subdir (GIT).
          Hide
          klimas7 Boguslaw Klimas added a comment -

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

          Show
          klimas7 Boguslaw Klimas added a comment - Hi Oleksii Shevchenko I reopen this isssue and i will try to fix this
          Hide
          felikz Oleksii Shevchenko added a comment -

          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.

          Show
          felikz Oleksii Shevchenko added a comment - 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.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          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

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - 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
          Hide
          klimas7 Boguslaw Klimas added a comment -

          release 0.8.1

          Show
          klimas7 Boguslaw Klimas added a comment - release 0.8.1

            People

            • Assignee:
              klimas7 Boguslaw Klimas
              Reporter:
              xfreebird Nicolae Ghimbovschi
            • Votes:
              7 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: