Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52964

Add a way to tell if an SCMFileSystem.Builder supports an SCMSource class, not just an instance

    XMLWordPrintable

Details

    Description

      This has been annoying for me - I've got a thing that only wants to allow you to choose an SCMSource if that SCMSource has an SCMFileSystem.Builder implementation that's valid for it. SCMFileSystem#supports(SCMSource) (which calls Builder#supports(SCMSource) for each Builder extension) would be fine...except that I want to know which SCMSource implementations are valid in a configuration UI, meaning I don't have instances, just descriptors. So it'd be awfully handy to have Builder#supports(Class<? extends SCMSource>) or Builder#supports(SCMSourceDescriptor).

      Attachments

        Issue Links

          Activity

            abayer Andrew Bayer created issue -
            abayer Andrew Bayer added a comment -

            Maybe Builder#maySupport(SCMSourceDescriptor) would be the way to go - while most implementations in the wild (see the extensions list here just implement Builder#supports(SCMSource) with a simple return source instanceof SomeSCMSourceImpl, GitSCMTelescope actually cares about how the instance is configured. So in that case, there's no way to know definitively whether an SCMSourceDescriptor's SCMSource would be supported without an actual instance of the SCMSource. But I think we can live with that here - calling the new method maySupport implies that it's theoretically possible to use this SCMSourceDescriptor's SCMSource, but it doesn't make any promises that any particular config will be valid...

            abayer Andrew Bayer added a comment - Maybe Builder#maySupport(SCMSourceDescriptor) would be the way to go - while most implementations in the wild (see the extensions list here just implement Builder#supports(SCMSource) with a simple return source instanceof SomeSCMSourceImpl , GitSCMTelescope actually cares about how the instance is configured. So in that case, there's no way to know definitively whether an SCMSourceDescriptor 's SCMSource would be supported without an actual instance of the SCMSource . But I think we can live with that here - calling the new method maySupport implies that it's theoretically possible to use this SCMSourceDescriptor 's SCMSource , but it doesn't make any promises that any particular config will be valid...
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            abayer Andrew Bayer added a comment -

            Got a possible approach, PRs incoming.

            abayer Andrew Bayer added a comment - Got a possible approach, PRs incoming.
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "scm-api PR #58 (Web Link)" [ 21861 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "git PR #623 (Web Link)" [ 21862 ]
            abayer Andrew Bayer made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            markewaite Mark Waite made changes -
            Status Resolved [ 5 ] Fixed but Unreleased [ 10203 ]
            markewaite Mark Waite added a comment -

            Included in git plugin 4.0.0 released Nov 2, 2019

            markewaite Mark Waite added a comment - Included in git plugin 4.0.0 released Nov 2, 2019
            markewaite Mark Waite made changes -
            Status Fixed but Unreleased [ 10203 ] Closed [ 6 ]

            People

              abayer Andrew Bayer
              abayer Andrew Bayer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: