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

Stable API for reading REST URL from BitbucketSCMSource

      I'd like the Bitbucket Server Integration plugin to provide a stable Java API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an SCMSource and wants to know:

      • Whether this SCMSource came from the Bitbucket Server Integration plugin.
      • The root URI for Bitbucket Server REST APIs.
      • The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
      • Project key
      • Repository slug

      All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as public. However, all the classes are within the package com.atlassian.bitbucket.jenkins.internal (javadoc), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any @Restricted annotations at all.

      Context: https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815 and https://jira.atlassian.com/browse/BSERV-11477?focusedCommentId=2647677&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2647677

          [JENKINS-64691] Stable API for reading REST URL from BitbucketSCMSource

          Kalle Niemitalo created issue -
          Kalle Niemitalo made changes -
          Description Original: I'd like the Bitbucket Server Integration to provide a stable API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}}, which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          New: I'd like the Bitbucket Server Integration plugin to provide a stable API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}}, which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          Kalle Niemitalo made changes -
          Description Original: I'd like the Bitbucket Server Integration plugin to provide a stable API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}}, which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          New: I'd like the Bitbucket Server Integration plugin to provide a stable API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          Kalle Niemitalo made changes -
          Description Original: I'd like the Bitbucket Server Integration plugin to provide a stable API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          New: I'd like the Bitbucket Server Integration plugin to provide a stable API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          Perhaps also similar APIs for freestyle jobs and single-branch pipelines.

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          Kalle Niemitalo made changes -
          Description Original: I'd like the Bitbucket Server Integration plugin to provide a stable API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          Perhaps also similar APIs for freestyle jobs and single-branch pipelines.

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          New: I'd like the Bitbucket Server Integration plugin to provide a stable Java API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          Perhaps also similar APIs for freestyle jobs and single-branch pipelines.

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]

          I imagine there are two ways to do this:

          • Define a stable interface that provides getters for this information. Place the interface in a non-"internal" package, e.g. com.atlassian.bitbucket.jenkins.api.BitbucketRestLocator. Implement the interface in BitbucketSCMSource.
          • Alternatively, document which parts of the API are stable even though they are in "internal" packages. Preferably, add annotations so that other plugins can be verified.

          Kalle Niemitalo added a comment - I imagine there are two ways to do this: Define a stable interface that provides getters for this information. Place the interface in a non-"internal" package, e.g. com.atlassian.bitbucket.jenkins.api.BitbucketRestLocator. Implement the interface in BitbucketSCMSource. Alternatively, document which parts of the API are stable even though they are in "internal" packages. Preferably, add annotations so that other plugins can be verified.
          Kalle Niemitalo made changes -
          Description Original: I'd like the Bitbucket Server Integration plugin to provide a stable Java API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          Perhaps also similar APIs for freestyle jobs and single-branch pipelines.

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          New: I'd like the Bitbucket Server Integration plugin to provide a stable Java API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]

          If the following could be documented as stable, then that would be fine.

          • com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource extends jenkins.scm.api.SCMSource, so that a dependent plugin can check whether the SCMSource is a BitbucketSCMSource
          • com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource#getBitbucketSCMRepository
          • com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getCredentialsId
          • com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getServerId
          • com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getProjectKey
          • com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getRepositorySlug
          • com.atlassian.bitbucket.jenkins.internal.config.BitbucketPluginConfiguration extends jenkins.model.GlobalConfiguration, so that a dependent plugin can call Jenkins#getExtensionList(GlobalConfiguration.class) and recognize BitbucketPluginConfiguration from the results
          • com.atlassian.bitbucket.jenkins.internal.config.BitbucketPluginConfiguration#getServerById
          • com.atlassian.bitbucket.jenkins.internal.config.BitbucketServerConfiguration#getBaseUrl

          Kalle Niemitalo added a comment - If the following could be documented as stable, then that would be fine. com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource extends jenkins.scm.api.SCMSource, so that a dependent plugin can check whether the SCMSource is a BitbucketSCMSource com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource#getBitbucketSCMRepository com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getCredentialsId com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getServerId com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getProjectKey com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMRepository#getRepositorySlug com.atlassian.bitbucket.jenkins.internal.config.BitbucketPluginConfiguration extends jenkins.model.GlobalConfiguration, so that a dependent plugin can call Jenkins#getExtensionList (GlobalConfiguration.class) and recognize BitbucketPluginConfiguration from the results com.atlassian.bitbucket.jenkins.internal.config.BitbucketPluginConfiguration#getServerById com.atlassian.bitbucket.jenkins.internal.config.BitbucketServerConfiguration#getBaseUrl

          Alternatively, if com.atlassian.bitbucket.jenkins.internal.scm.BitbucketJobLinkActionFactory#getBitbucketSCMRepository were public and stable, then com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource would not be needed.

          Kalle Niemitalo added a comment - Alternatively, if com.atlassian.bitbucket.jenkins.internal.scm.BitbucketJobLinkActionFactory#getBitbucketSCMRepository were public and stable, then com.atlassian.bitbucket.jenkins.internal.scm.BitbucketSCMSource would not be needed.
          Kalle Niemitalo made changes -
          Description Original: I'd like the Bitbucket Server Integration plugin to provide a stable Java API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815]
          New: I'd like the Bitbucket Server Integration plugin to provide a stable Java API from which other plugins can read parameters for Bitbucket Server REST APIs. The other plugin has an [SCMSource|https://javadoc.jenkins.io/plugin/scm-api/jenkins/scm/api/SCMSource.html] and wants to know:

          * Whether this SCMSource came from the Bitbucket Server Integration plugin.
          * The root URI for Bitbucket Server REST APIs.
          * The credential ID for Bitbucket Server REST APIs, or the credential itself. Not the admin token from the global configuration.
          * Project key
          * Repository slug

          All of this information is already available from classes and methods that the Bitbucket Server Integration plugin declares as {{public}}. However, all the classes are within the package {{com.atlassian.bitbucket.jenkins.internal}} ([javadoc|https://javadoc.jenkins.io/plugin/atlassian-bitbucket-server-integration/]), which suggests that Atlassian might not want to support them as a stable API. The Bitbucket Server Integration plugin does not have any {{@Restricted}} annotations at all.

          Context: [https://github.com/jenkinsci/checks-api-plugin/issues/65#issuecomment-765024815] and [https://jira.atlassian.com/browse/BSERV-11477?focusedCommentId=2647677&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2647677]

            Unassigned Unassigned
            kon Kalle Niemitalo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: