JENKINS-43507 added traits to a number of plugins.

      In order to side-step the problem of determining what the common traits for discovery and other cross-implementation concerns should look like, code duplication was used.

      The net result is that each of the implementations has duplicated code for:

      • Discovering Branches
      • Discovering Origin pull requests
      • Discovering Fork pull requests
      • Checking out over SSH
      • Overriding webhook management

      The intent is that these common traits can be moved into SCM API rather than duplicated by every SCM API implementation, but we need to determine the shape of these traits a bit better before that can take place as these traits so far are all effectively DVCS model traits.

      Ideally seeing the shape of traits for Subversion, Perforce and perhaps Accurev or Clearcase would help clarify what is required of a common implementation. 

      There is also the question of how to make the common traits not look common, for example:

      • Discover Branches: when used in Git or Mercurial, this probably does not need any options to be configured because these sources do not have the concept of pull requests. When used in GitHub, Bitbucket, Gitea, etc they do have the concept of pull requests and consequently there are multiple strategies that the user needs to select from.

      In the ideal case we would have just one BranchDiscovery trait, when added to a Git or Mercurial source it would not show any configuration and when added to a GitHub / Bitbucket / Gitea source it would display the strategy selection drop down list.

          [JENKINS-45503] Consolidate common traits into SCM-API

          James Dumay added a comment -

          Note to self: stephenconnolly mentioned this was an important future enhancement

          James Dumay added a comment - Note to self: stephenconnolly mentioned this was an important future enhancement

          Costin Caraivan added a comment - - edited

          Could this be bumped in priority? These traits are used downstream by the job DSL plugin and their lack forces users to restot to the configure block in the job DSL configurations, which is an unsafe hack, basically.

          Costin Caraivan added a comment - - edited Could this be bumped in priority? These traits are used downstream by the job DSL plugin and their lack forces users to restot to the configure block in the job DSL configurations, which is an unsafe hack, basically.

          René Scheibe added a comment -

          stephenconnolly this story was created about 2 years ago with priority "major". May I ask for an update of the current state and future plans?

          René Scheibe added a comment - stephenconnolly this story was created about 2 years ago with priority "major". May I ask for an update of the current state and future plans?

            Unassigned Unassigned
            stephenconnolly Stephen Connolly
            Votes:
            16 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: