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

Allow SCMSource and SCMNavigator subtypes to share common traits

      Examples of traits from the JENKINS-43426 epic:

      • There will be a strategy to use switch the checkout to over SSH and this will have a option to select the SSH Credentials for checkout.
      • There will be at least one strategy to subset the branches by name (include / exclude)
        • There will one implementation that uses the existing wildcard style
        • Other strategies may be added later to support different branch name matching rules, e.g. Regex, etc. These secondary strategies do not form part of the MVP but it may prove assist extension point API validation to proof-of-concept implement a second one.
      • There will be three strategies to subset the branches by type:
        • There will be a strategy to select origin branches. This strategy will have a drop-down mode selection:
          • Only origin branches that are not filed as PRs
          • Only origin branches that are filed as PRs
          • All origin branches irrespective of whether filed as PR or not
        • There will be a strategy to select origin PRs. This strategy will have a drop-down mode selection:
          • Merge commit PRs
          • Head commit PRs
          • Both merge commit and head commit PRs
        • There will be a strategy to select fork PRs. This strategy will have a drop-down mode selection:
          • Merge commit PRs
          • Head commit PRs
          • Both merge commit and head commit PRs
      • There will also be a drop-down for trust selection:
          • Show all fork PRs but only trust fork PRs from repository contributors
          • Only show PRs from repository contributors
          • Show and trust all fork PRs
             TBD determine if we need to expose suppression of automatic builds of untrusted PRs here.
        • There will be a proof-of-concept implementation of a tag support branch selector. This is not a feature experienced by users today, but there are api's & code which is ready to provide it. We won't ship this enabled by default in the release.
      • There will be the ability to control a subset of the Git plugin’s additional behaviours for the generated SCM of branches. This will be an applies to all setting. The available options will be subject to a whitelisting extension point (so that plugins can define additional Git behaviours and whitelist them in at the same time). The default whitelist will be:
        • Advanced Checkout behaviours
        • Advanced Clone behaviours
        • Advanced Submodule behaviours
        • Clean after checkout
        • Clean before checkout
        • Custom user name / email address
        • Git LFS pull after checkout
        • Use commit author in changelog (says it requires workspace polling, but really does not / should not require workspace polling)
        • Wipe out repository & force clone

      Acceptance criteria

      • The SCM API provides the concept of a trait that applies to SCMSource and SCMNavigator
      • Traits will be opt-in, i.e. the SCMSource implementation must be written to use traits
      • Common trait implementations can be shared by multiple implementations.
      • Trait implementations can be specific to a single SCMSource or SCMNavigator
      • The SCM API will provide a trait implementation that allows for filtering branches based on include/exclude wildcard name matching
      • The SCM API MockSCM implementation will support traits
      • The common trait implementations in SCM API will have tests
      • The implementers guide will be updated to highlight the trait style of implementation and encourage following that path. 

          [JENKINS-43507] Allow SCMSource and SCMNavigator subtypes to share common traits

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en.properties
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en_US.properties
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_it.properties
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_ja.properties
          http://jenkins-ci.org/commit/git-plugin/f52fe82f16ec96dc1fde3cae53877d455e1ac9e8
          Log:
          JENKINS-43507 US people want to spell things incorrectly

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en.properties src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en_US.properties src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_it.properties src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_ja.properties http://jenkins-ci.org/commit/git-plugin/f52fe82f16ec96dc1fde3cae53877d455e1ac9e8 Log: JENKINS-43507 US people want to spell things incorrectly

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/plugins/git/GitSCMSource.java
          http://jenkins-ci.org/commit/git-plugin/15f218a5aeb3dc52b777c3e7ba4bb35aed1b8ef7
          Log:
          JENKINS-43507 Found some minor bugs in the form validation action method names

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/plugins/git/GitSCMSource.java http://jenkins-ci.org/commit/git-plugin/15f218a5aeb3dc52b777c3e7ba4bb35aed1b8ef7 Log: JENKINS-43507 Found some minor bugs in the form validation action method names

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
          src/main/java/jenkins/plugins/git/GitSCMSource.java
          src/main/java/jenkins/plugins/git/GitSCMSourceContext.java
          src/main/java/jenkins/plugins/git/GitSCMSourceRequest.java
          src/main/java/jenkins/plugins/git/traits/BranchDiscoveryTrait.java
          src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/config.jelly
          src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/help.html
          src/main/resources/jenkins/plugins/git/traits/Messages.properties
          src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java
          src/test/java/jenkins/plugins/git/GitSCMSourceTraitsTest.java
          src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/modern.xml
          src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/pimpped_out.xml
          http://jenkins-ci.org/commit/git-plugin/1c1c664d1a18c600443a3ffe66f2a30ec2bd47ef
          Log:
          JENKINS-43507 Give GitSCMSource a BranchDiscoveryTrait in preparation for JENKINS-33445

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java src/main/java/jenkins/plugins/git/GitSCMSource.java src/main/java/jenkins/plugins/git/GitSCMSourceContext.java src/main/java/jenkins/plugins/git/GitSCMSourceRequest.java src/main/java/jenkins/plugins/git/traits/BranchDiscoveryTrait.java src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/config.jelly src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/help.html src/main/resources/jenkins/plugins/git/traits/Messages.properties src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java src/test/java/jenkins/plugins/git/GitSCMSourceTraitsTest.java src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/modern.xml src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/pimpped_out.xml http://jenkins-ci.org/commit/git-plugin/1c1c664d1a18c600443a3ffe66f2a30ec2bd47ef Log: JENKINS-43507 Give GitSCMSource a BranchDiscoveryTrait in preparation for JENKINS-33445

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/plugins/git/traits/BranchDiscoveryTrait.java
          src/main/java/jenkins/plugins/git/traits/GitSCMExtensionTraitDescriptor.java
          http://jenkins-ci.org/commit/git-plugin/1743eab6b24a52e94847ae3f278c184d0f51eb47
          Log:
          JENKINS-43507 Fix trait drop-down list population

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/plugins/git/traits/BranchDiscoveryTrait.java src/main/java/jenkins/plugins/git/traits/GitSCMExtensionTraitDescriptor.java http://jenkins-ci.org/commit/git-plugin/1743eab6b24a52e94847ae3f278c184d0f51eb47 Log: JENKINS-43507 Fix trait drop-down list population

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en.properties
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en_US.properties
          http://jenkins-ci.org/commit/mercurial-plugin/d632ecb5ec2ad5bfcdf9381b4f4eca34f8406c48
          Log:
          JENKINS-43507 US people want to spell things incorrectly

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en.properties src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en_US.properties http://jenkins-ci.org/commit/mercurial-plugin/d632ecb5ec2ad5bfcdf9381b4f4eca34f8406c48 Log: JENKINS-43507 US people want to spell things incorrectly

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java
          http://jenkins-ci.org/commit/mercurial-plugin/b1bc5a40f01db1d23a3ece9ab8dd5ba3bf1e92b2
          Log:
          JENKINS-43507 Fix trait drop-down list population

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java http://jenkins-ci.org/commit/mercurial-plugin/b1bc5a40f01db1d23a3ece9ab8dd5ba3bf1e92b2 Log: JENKINS-43507 Fix trait drop-down list population

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/8c5447bd5014844dd27943a7b76fd8bc24a7aeb2
          Log:
          JENKINS-43507 Found some minor bugs in the form validation action method names

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java http://jenkins-ci.org/commit/github-branch-source-plugin/8c5447bd5014844dd27943a7b76fd8bc24a7aeb2 Log: JENKINS-43507 Found some minor bugs in the form validation action method names

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceContext.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/2477059d2539af4f414417088f8430061980cdb6
          Log:
          JENKINS-43507 Found some minor documentation errors

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceContext.java http://jenkins-ci.org/commit/github-branch-source-plugin/2477059d2539af4f414417088f8430061980cdb6 Log: JENKINS-43507 Found some minor documentation errors

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/BranchDiscoveryTrait.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/ForkPullRequestDiscoveryTrait.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/OriginPullRequestDiscoveryTrait.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/SSHCheckoutTrait.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/471e5b7b5288628810c4f344647e870fcc96f39f
          Log:
          JENKINS-43507 Fix trait drop-down list population

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/org/jenkinsci/plugins/github_branch_source/BranchDiscoveryTrait.java src/main/java/org/jenkinsci/plugins/github_branch_source/ForkPullRequestDiscoveryTrait.java src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java src/main/java/org/jenkinsci/plugins/github_branch_source/OriginPullRequestDiscoveryTrait.java src/main/java/org/jenkinsci/plugins/github_branch_source/SSHCheckoutTrait.java http://jenkins-ci.org/commit/github-branch-source-plugin/471e5b7b5288628810c4f344647e870fcc96f39f Log: JENKINS-43507 Fix trait drop-down list population

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
          src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigatorTraitsTest.java
          src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceTraitsTest.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/b35932383d8d4cd7185dfd1bd8e3c41c03d31b23
          Log:
          JENKINS-43507 Fresh eyes find and fix fresh bugs

          • Need to upgrade to structs 1.9 to pick up JENKINS-45130
          • Two legacy setters were not purging useless traits, and we were missing tests to verify same
          • Pick up git's -alpha-4

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigator.java src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigatorTraitsTest.java src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceTraitsTest.java http://jenkins-ci.org/commit/github-branch-source-plugin/b35932383d8d4cd7185dfd1bd8e3c41c03d31b23 Log: JENKINS-43507 Fresh eyes find and fix fresh bugs Need to upgrade to structs 1.9 to pick up JENKINS-45130 Two legacy setters were not purging useless traits, and we were missing tests to verify same Pick up git's -alpha-4

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          http://jenkins-ci.org/commit/scm-api-plugin/dc0081a16d00c4de17a64430ae4aacbbbd306bfd
          Log:
          JENKINS-43507 Bump structs to 1.9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml http://jenkins-ci.org/commit/scm-api-plugin/dc0081a16d00c4de17a64430ae4aacbbbd306bfd Log: JENKINS-43507 Bump structs to 1.9

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          http://jenkins-ci.org/commit/branch-api-plugin/baeae5db935b06f6e202ab345236450b388725b9
          Log:
          JENKINS-43507 Bump structs to 1.9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml http://jenkins-ci.org/commit/branch-api-plugin/baeae5db935b06f6e202ab345236450b388725b9 Log: JENKINS-43507 Bump structs to 1.9

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          http://jenkins-ci.org/commit/mercurial-plugin/120115bba0e07af04518ccec06098332ad85c15f
          Log:
          JENKINS-43507 Bump structs to 1.9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml http://jenkins-ci.org/commit/mercurial-plugin/120115bba0e07af04518ccec06098332ad85c15f Log: JENKINS-43507 Bump structs to 1.9

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/hudson/plugins/mercurial/MercurialSCMBuilder.java
          src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java
          src/main/java/hudson/plugins/mercurial/MercurialSCMSourceContext.java
          src/main/java/hudson/plugins/mercurial/MercurialSCMSourceRequest.java
          src/main/java/hudson/plugins/mercurial/MercurialStatus.java
          src/main/java/hudson/plugins/mercurial/traits/CleanMercurialSCMSourceTrait.java
          src/main/java/hudson/plugins/mercurial/traits/MercurialBrowserSCMSourceTrait.java
          src/main/java/hudson/plugins/mercurial/traits/MercurialInstallationSCMSourceTrait.java
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail.jelly
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en.properties
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en_US.properties
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-branchPattern.html
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-clean.html
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-modules.html
          src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-subdir.html
          src/main/resources/hudson/plugins/mercurial/traits/CleanMercurialSCMSourceTrait/help.html
          src/main/resources/hudson/plugins/mercurial/traits/MercurialBrowserSCMSourceTrait/config.jelly
          src/main/resources/hudson/plugins/mercurial/traits/MercurialInstallationSCMSourceTrait/config.jelly
          src/main/resources/hudson/plugins/mercurial/traits/Messages.properties
          http://jenkins-ci.org/commit/mercurial-plugin/bfc7cbd995afc08d0bc0bbefaf741685ab3d2d13
          Log:
          Merge pull request #103 from stephenc/jenkins-43507

          JENKINS-43507 Allow SCMSource and SCMNavigator subtypes to share common traits

          Compare: https://github.com/jenkinsci/mercurial-plugin/compare/eb08ce42afbe...bfc7cbd995af

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/hudson/plugins/mercurial/MercurialSCMBuilder.java src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java src/main/java/hudson/plugins/mercurial/MercurialSCMSourceContext.java src/main/java/hudson/plugins/mercurial/MercurialSCMSourceRequest.java src/main/java/hudson/plugins/mercurial/MercurialStatus.java src/main/java/hudson/plugins/mercurial/traits/CleanMercurialSCMSourceTrait.java src/main/java/hudson/plugins/mercurial/traits/MercurialBrowserSCMSourceTrait.java src/main/java/hudson/plugins/mercurial/traits/MercurialInstallationSCMSourceTrait.java src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail.jelly src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en.properties src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/config-detail_en_US.properties src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-branchPattern.html src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-clean.html src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-modules.html src/main/resources/hudson/plugins/mercurial/MercurialSCMSource/help-subdir.html src/main/resources/hudson/plugins/mercurial/traits/CleanMercurialSCMSourceTrait/help.html src/main/resources/hudson/plugins/mercurial/traits/MercurialBrowserSCMSourceTrait/config.jelly src/main/resources/hudson/plugins/mercurial/traits/MercurialInstallationSCMSourceTrait/config.jelly src/main/resources/hudson/plugins/mercurial/traits/Messages.properties http://jenkins-ci.org/commit/mercurial-plugin/bfc7cbd995afc08d0bc0bbefaf741685ab3d2d13 Log: Merge pull request #103 from stephenc/jenkins-43507 JENKINS-43507 Allow SCMSource and SCMNavigator subtypes to share common traits Compare: https://github.com/jenkinsci/mercurial-plugin/compare/eb08ce42afbe...bfc7cbd995af

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/scm/api/trait/SCMTrait.java
          src/test/java/jenkins/scm/impl/mock/MockSCMNavigator.java
          src/test/java/jenkins/scm/impl/mock/MockSCMSource.java
          http://jenkins-ci.org/commit/scm-api-plugin/82ee345a8c12df789d13a8962ab06e74960e7480
          Log:
          JENKINS-43507 Add some helper methods

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/scm/api/trait/SCMTrait.java src/test/java/jenkins/scm/impl/mock/MockSCMNavigator.java src/test/java/jenkins/scm/impl/mock/MockSCMSource.java http://jenkins-ci.org/commit/scm-api-plugin/82ee345a8c12df789d13a8962ab06e74960e7480 Log: JENKINS-43507 Add some helper methods

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/scm/api/trait/SCMTrait.java
          http://jenkins-ci.org/commit/scm-api-plugin/9cefea35ffc7d92da66c38e5b9b8820246da8890
          Log:
          JENKINS-43507 Add javadoc tag

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/scm/api/trait/SCMTrait.java http://jenkins-ci.org/commit/scm-api-plugin/9cefea35ffc7d92da66c38e5b9b8820246da8890 Log: JENKINS-43507 Add javadoc tag

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          http://jenkins-ci.org/commit/branch-api-plugin/2839698af742de05c0489a7f0ef2630d264c23dc
          Log:
          JENKINS-43507 Pick up new releases

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml http://jenkins-ci.org/commit/branch-api-plugin/2839698af742de05c0489a7f0ef2630d264c23dc Log: JENKINS-43507 Pick up new releases

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java
          http://jenkins-ci.org/commit/mercurial-plugin/19dee71dec66d8f7a6472103f2f07cccccd2e822
          Log:
          JENKINS-43507 Pick up new releases

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java http://jenkins-ci.org/commit/mercurial-plugin/19dee71dec66d8f7a6472103f2f07cccccd2e822 Log: JENKINS-43507 Pick up new releases

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java
          http://jenkins-ci.org/commit/mercurial-plugin/b70384742a237cee0981801de435c4f739d98efb
          Log:
          JENKINS-43507 Findbugs being a bit of a pain

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java http://jenkins-ci.org/commit/mercurial-plugin/b70384742a237cee0981801de435c4f739d98efb Log: JENKINS-43507 Findbugs being a bit of a pain

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java
          http://jenkins-ci.org/commit/mercurial-plugin/f172e22494279f88bc633047c4606ff777677500
          Log:
          Merge pull request #105 from stephenc/jenkins-43507

          JENKINS-43507 Pick up new releases

          Compare: https://github.com/jenkinsci/mercurial-plugin/compare/8e0581ac7045...f172e2249427

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/hudson/plugins/mercurial/MercurialSCMSource.java http://jenkins-ci.org/commit/mercurial-plugin/f172e22494279f88bc633047c4606ff777677500 Log: Merge pull request #105 from stephenc/jenkins-43507 JENKINS-43507 Pick up new releases Compare: https://github.com/jenkinsci/mercurial-plugin/compare/8e0581ac7045...f172e2249427

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/resources/org/jenkinsci/plugins/github_branch_source/ForkPullRequestDiscoveryTrait/help-trust.html
          http://jenkins-ci.org/commit/github-branch-source-plugin/9ec1b734b66488a100ccaf78bb79248289359852
          Log:
          JENKINS-43507 Copy-pasta typo

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/resources/org/jenkinsci/plugins/github_branch_source/ForkPullRequestDiscoveryTrait/help-trust.html http://jenkins-ci.org/commit/github-branch-source-plugin/9ec1b734b66488a100ccaf78bb79248289359852 Log: JENKINS-43507 Copy-pasta typo

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          http://jenkins-ci.org/commit/git-plugin/33434848fe9eb41141878bfc2b72e96068b65fe9
          Log:
          JENKINS-43507 Bump structs to 1.9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml http://jenkins-ci.org/commit/git-plugin/33434848fe9eb41141878bfc2b72e96068b65fe9 Log: JENKINS-43507 Bump structs to 1.9

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
          src/main/java/jenkins/plugins/git/GitSCMSource.java
          http://jenkins-ci.org/commit/git-plugin/d7c3ece2553cf0494a56c766f62a6c9f340bbe4c
          Log:
          JENKINS-43507 Pick up new releases

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java src/main/java/jenkins/plugins/git/GitSCMSource.java http://jenkins-ci.org/commit/git-plugin/d7c3ece2553cf0494a56c766f62a6c9f340bbe4c Log: JENKINS-43507 Pick up new releases

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/jenkins/plugins/git/GitSCMSource.java
          http://jenkins-ci.org/commit/git-plugin/af3d6fd54d85497709a5f6d98d7b94c7d73d3110
          Log:
          JENKINS-43507 Fix tests

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/jenkins/plugins/git/GitSCMSource.java http://jenkins-ci.org/commit/git-plugin/af3d6fd54d85497709a5f6d98d7b94c7d73d3110 Log: JENKINS-43507 Fix tests

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          src/main/java/hudson/plugins/git/GitSCM.java
          src/main/java/hudson/plugins/git/extensions/impl/AuthorInChangelog.java
          src/main/java/hudson/plugins/git/extensions/impl/CheckoutOption.java
          src/main/java/hudson/plugins/git/extensions/impl/CleanBeforeCheckout.java
          src/main/java/hudson/plugins/git/extensions/impl/CleanCheckout.java
          src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java
          src/main/java/hudson/plugins/git/extensions/impl/GitLFSPull.java
          src/main/java/hudson/plugins/git/extensions/impl/IgnoreNotifyCommit.java
          src/main/java/hudson/plugins/git/extensions/impl/LocalBranch.java
          src/main/java/hudson/plugins/git/extensions/impl/PruneStaleBranch.java
          src/main/java/hudson/plugins/git/extensions/impl/SubmoduleOption.java
          src/main/java/hudson/plugins/git/extensions/impl/UserIdentity.java
          src/main/java/hudson/plugins/git/extensions/impl/WipeWorkspace.java
          src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java
          src/main/java/jenkins/plugins/git/GitSCMBuilder.java
          src/main/java/jenkins/plugins/git/GitSCMFileSystem.java
          src/main/java/jenkins/plugins/git/GitSCMSource.java
          src/main/java/jenkins/plugins/git/GitSCMSourceContext.java
          src/main/java/jenkins/plugins/git/GitSCMSourceDefaults.java
          src/main/java/jenkins/plugins/git/GitSCMSourceRequest.java
          src/main/java/jenkins/plugins/git/MethodUtils.java
          src/main/java/jenkins/plugins/git/traits/AuthorInChangelogTrait.java
          src/main/java/jenkins/plugins/git/traits/BranchDiscoveryTrait.java
          src/main/java/jenkins/plugins/git/traits/CheckoutOptionTrait.java
          src/main/java/jenkins/plugins/git/traits/CleanAfterCheckoutTrait.java
          src/main/java/jenkins/plugins/git/traits/CleanBeforeCheckoutTrait.java
          src/main/java/jenkins/plugins/git/traits/CloneOptionTrait.java
          src/main/java/jenkins/plugins/git/traits/GitBrowserSCMSourceTrait.java
          src/main/java/jenkins/plugins/git/traits/GitLFSPullTrait.java
          src/main/java/jenkins/plugins/git/traits/GitSCMExtensionTrait.java
          src/main/java/jenkins/plugins/git/traits/GitSCMExtensionTraitDescriptor.java
          src/main/java/jenkins/plugins/git/traits/GitToolSCMSourceTrait.java
          src/main/java/jenkins/plugins/git/traits/IgnoreOnPushNotificationTrait.java
          src/main/java/jenkins/plugins/git/traits/LocalBranchTrait.java
          src/main/java/jenkins/plugins/git/traits/PruneStaleBranchTrait.java
          src/main/java/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait.java
          src/main/java/jenkins/plugins/git/traits/RemoteNameSCMSourceTrait.java
          src/main/java/jenkins/plugins/git/traits/SubmoduleOptionTrait.java
          src/main/java/jenkins/plugins/git/traits/UserIdentityTrait.java
          src/main/java/jenkins/plugins/git/traits/WipeWorkspaceTrait.java
          src/main/java/jenkins/plugins/git/traits/package-info.java
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail.jelly
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en.properties
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en_US.properties
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_it.properties
          src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_ja.properties
          src/main/resources/jenkins/plugins/git/GitSCMSource/help-excludes.html
          src/main/resources/jenkins/plugins/git/GitSCMSource/help-gitTool.html
          src/main/resources/jenkins/plugins/git/GitSCMSource/help-ignoreOnPushNotifications.html
          src/main/resources/jenkins/plugins/git/GitSCMSource/help-includes.html
          src/main/resources/jenkins/plugins/git/GitSCMSource/help-rawRefSpecs.html
          src/main/resources/jenkins/plugins/git/GitSCMSource/help-remoteName.html
          src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/config.jelly
          src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/help.html
          src/main/resources/jenkins/plugins/git/traits/GitBrowserSCMSourceTrait/config.jelly
          src/main/resources/jenkins/plugins/git/traits/GitSCMExtensionTrait/config.jelly
          src/main/resources/jenkins/plugins/git/traits/GitToolSCMSourceTrait/config.jelly
          src/main/resources/jenkins/plugins/git/traits/LocalBranchTrait/config.jelly
          src/main/resources/jenkins/plugins/git/traits/Messages.properties
          src/main/resources/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait/RefSpecTemplate/config.jelly
          src/main/resources/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait/RefSpecTemplate/help-value.html
          src/main/resources/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait/config.jelly
          src/main/resources/jenkins/plugins/git/traits/RemoteNameSCMSourceTrait/config.jelly
          src/test/java/hudson/plugins/git/browser/GithubWebTest.java
          src/test/java/jenkins/plugins/git/AbstractGitSCMSourceRetrieveHeadsTest.java
          src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java
          src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTrivialTest.java
          src/test/java/jenkins/plugins/git/GitSCMBuilderTest.java
          src/test/java/jenkins/plugins/git/GitSCMSourceTraitsTest.java
          src/test/java/jenkins/plugins/git/traits/GitSCMExtensionTraitTest.java
          src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/modern.xml
          src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/pimpped_out.xml
          http://jenkins-ci.org/commit/git-plugin/dd2b84217cc967bf908c7f2c02beea27973cd884
          Log:
          Merge pull request #494 from stephenc/jenkins-43507

          JENKINS-43507 Allow SCMSource and SCMNavigator subtypes to share common traits

          Compare: https://github.com/jenkinsci/git-plugin/compare/2cfbf64ed55f...dd2b84217cc9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/extensions/impl/AuthorInChangelog.java src/main/java/hudson/plugins/git/extensions/impl/CheckoutOption.java src/main/java/hudson/plugins/git/extensions/impl/CleanBeforeCheckout.java src/main/java/hudson/plugins/git/extensions/impl/CleanCheckout.java src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java src/main/java/hudson/plugins/git/extensions/impl/GitLFSPull.java src/main/java/hudson/plugins/git/extensions/impl/IgnoreNotifyCommit.java src/main/java/hudson/plugins/git/extensions/impl/LocalBranch.java src/main/java/hudson/plugins/git/extensions/impl/PruneStaleBranch.java src/main/java/hudson/plugins/git/extensions/impl/SubmoduleOption.java src/main/java/hudson/plugins/git/extensions/impl/UserIdentity.java src/main/java/hudson/plugins/git/extensions/impl/WipeWorkspace.java src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java src/main/java/jenkins/plugins/git/GitSCMBuilder.java src/main/java/jenkins/plugins/git/GitSCMFileSystem.java src/main/java/jenkins/plugins/git/GitSCMSource.java src/main/java/jenkins/plugins/git/GitSCMSourceContext.java src/main/java/jenkins/plugins/git/GitSCMSourceDefaults.java src/main/java/jenkins/plugins/git/GitSCMSourceRequest.java src/main/java/jenkins/plugins/git/MethodUtils.java src/main/java/jenkins/plugins/git/traits/AuthorInChangelogTrait.java src/main/java/jenkins/plugins/git/traits/BranchDiscoveryTrait.java src/main/java/jenkins/plugins/git/traits/CheckoutOptionTrait.java src/main/java/jenkins/plugins/git/traits/CleanAfterCheckoutTrait.java src/main/java/jenkins/plugins/git/traits/CleanBeforeCheckoutTrait.java src/main/java/jenkins/plugins/git/traits/CloneOptionTrait.java src/main/java/jenkins/plugins/git/traits/GitBrowserSCMSourceTrait.java src/main/java/jenkins/plugins/git/traits/GitLFSPullTrait.java src/main/java/jenkins/plugins/git/traits/GitSCMExtensionTrait.java src/main/java/jenkins/plugins/git/traits/GitSCMExtensionTraitDescriptor.java src/main/java/jenkins/plugins/git/traits/GitToolSCMSourceTrait.java src/main/java/jenkins/plugins/git/traits/IgnoreOnPushNotificationTrait.java src/main/java/jenkins/plugins/git/traits/LocalBranchTrait.java src/main/java/jenkins/plugins/git/traits/PruneStaleBranchTrait.java src/main/java/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait.java src/main/java/jenkins/plugins/git/traits/RemoteNameSCMSourceTrait.java src/main/java/jenkins/plugins/git/traits/SubmoduleOptionTrait.java src/main/java/jenkins/plugins/git/traits/UserIdentityTrait.java src/main/java/jenkins/plugins/git/traits/WipeWorkspaceTrait.java src/main/java/jenkins/plugins/git/traits/package-info.java src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail.jelly src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en.properties src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_en_US.properties src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_it.properties src/main/resources/jenkins/plugins/git/GitSCMSource/config-detail_ja.properties src/main/resources/jenkins/plugins/git/GitSCMSource/help-excludes.html src/main/resources/jenkins/plugins/git/GitSCMSource/help-gitTool.html src/main/resources/jenkins/plugins/git/GitSCMSource/help-ignoreOnPushNotifications.html src/main/resources/jenkins/plugins/git/GitSCMSource/help-includes.html src/main/resources/jenkins/plugins/git/GitSCMSource/help-rawRefSpecs.html src/main/resources/jenkins/plugins/git/GitSCMSource/help-remoteName.html src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/config.jelly src/main/resources/jenkins/plugins/git/traits/BranchDiscoveryTrait/help.html src/main/resources/jenkins/plugins/git/traits/GitBrowserSCMSourceTrait/config.jelly src/main/resources/jenkins/plugins/git/traits/GitSCMExtensionTrait/config.jelly src/main/resources/jenkins/plugins/git/traits/GitToolSCMSourceTrait/config.jelly src/main/resources/jenkins/plugins/git/traits/LocalBranchTrait/config.jelly src/main/resources/jenkins/plugins/git/traits/Messages.properties src/main/resources/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait/RefSpecTemplate/config.jelly src/main/resources/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait/RefSpecTemplate/help-value.html src/main/resources/jenkins/plugins/git/traits/RefSpecsSCMSourceTrait/config.jelly src/main/resources/jenkins/plugins/git/traits/RemoteNameSCMSourceTrait/config.jelly src/test/java/hudson/plugins/git/browser/GithubWebTest.java src/test/java/jenkins/plugins/git/AbstractGitSCMSourceRetrieveHeadsTest.java src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTest.java src/test/java/jenkins/plugins/git/AbstractGitSCMSourceTrivialTest.java src/test/java/jenkins/plugins/git/GitSCMBuilderTest.java src/test/java/jenkins/plugins/git/GitSCMSourceTraitsTest.java src/test/java/jenkins/plugins/git/traits/GitSCMExtensionTraitTest.java src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/modern.xml src/test/resources/jenkins/plugins/git/GitSCMSourceTraitsTest/pimpped_out.xml http://jenkins-ci.org/commit/git-plugin/dd2b84217cc967bf908c7f2c02beea27973cd884 Log: Merge pull request #494 from stephenc/jenkins-43507 JENKINS-43507 Allow SCMSource and SCMNavigator subtypes to share common traits Compare: https://github.com/jenkinsci/git-plugin/compare/2cfbf64ed55f...dd2b84217cc9

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          pom.xml
          http://jenkins-ci.org/commit/github-branch-source-plugin/eb6b6b474c32fa6af3c92e055845b756f8fe779f
          Log:
          JENKINS-43507 Pick up beta-1 releases

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: pom.xml http://jenkins-ci.org/commit/github-branch-source-plugin/eb6b6b474c32fa6af3c92e055845b756f8fe779f Log: JENKINS-43507 Pick up beta-1 releases

          Code changed in jenkins
          User: Stephen Connolly
          Path:
          src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceRequest.java
          src/main/java/org/jenkinsci/plugins/github_branch_source/SSHCheckoutTrait.java
          http://jenkins-ci.org/commit/github-branch-source-plugin/0395a38c496ee437adfcb58fe7762bb51d3cdc6c
          Log:
          JENKINS-43507 Fix more copy-pasta

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceRequest.java src/main/java/org/jenkinsci/plugins/github_branch_source/SSHCheckoutTrait.java http://jenkins-ci.org/commit/github-branch-source-plugin/0395a38c496ee437adfcb58fe7762bb51d3cdc6c Log: JENKINS-43507 Fix more copy-pasta

          John Mellor added a comment -

          So how are you supposed to use this change?
          I have updated to the GitHub Branch Source plugin v2.2.1, which according to the release note, incorporates this change.
          If I add a behaviour to specify the refspec, it gets ignored.
          Is there another shoe to drop in order to get this behaviour, or is this a bug?

          John Mellor added a comment - So how are you supposed to use this change? I have updated to the GitHub Branch Source plugin v2.2.1, which according to the release note, incorporates this change. If I add a behaviour to specify the refspec, it gets ignored. Is there another shoe to drop in order to get this behaviour, or is this a bug?

          alt_jmellor So when you added the additional refspec, was that refspec fetched when cloning?

          The additional refspec is not to define new branches or discovery of branches, rather to control what gets cloned (hence why it's not in the – Repository – section)

          Stephen Connolly added a comment - alt_jmellor So when you added the additional refspec, was that refspec fetched when cloning? The additional refspec is not to define new branches or discovery of branches, rather to control what gets cloned (hence why it's not in the – Repository – section)

          John Mellor added a comment - - edited

          > So when you added the additional refspec, was that refspec fetched when cloning?
          We're specifying a refspec of:

          +refs/tags/*:refs/remotes/@{remote}/tags/*
          

          and expecting it to pull tags. We can see no evidence in the log that this added refspec does anything at all. What should we be seeing?

          John Mellor added a comment - - edited > So when you added the additional refspec, was that refspec fetched when cloning? We're specifying a refspec of: +refs/tags/*:refs/remotes/@{remote}/tags/* and expecting it to pull tags. We can see no evidence in the log that this added refspec does anything at all. What should we be seeing?

          If you want tags you need to add Advanced Clone Behaviours and request tags. No need to add a refspec for tags (because git will handle tags differently)

          Stephen Connolly added a comment - If you want tags you need to add Advanced Clone Behaviours and request tags. No need to add a refspec for tags (because git will handle tags differently)

          John Mellor added a comment -

          We tried the advanced behaviour as suggested, and it does not pull tags.
          You can't request tags, only ignore tags, suggesting pulling tags is a default.

          So, how are you supposed to build a GitHub tag?

          John Mellor added a comment - We tried the advanced behaviour as suggested, and it does not pull tags. You can't request tags, only ignore tags, suggesting pulling tags is a default. So, how are you supposed to build a GitHub tag?

          Requesting tags is adding the behaviour and not selecting "ignore tags"

          Tag discovery has not been implemented yet, so likely you are trying to do something that would be better handled through tag discovery

          Stephen Connolly added a comment - Requesting tags is adding the behaviour and not selecting "ignore tags" Tag discovery has not been implemented yet, so likely you are trying to do something that would be better handled through tag discovery

          Here is a build log without the advanced behaviour

          Note that it says:

           > git config remote.origin.url https://github.com/cloudbeers/jenkins-45666.git # timeout=10
          Fetching without tags
          Fetching upstream changes from https://github.com/cloudbeers/jenkins-45666.git
           > git --version # timeout=10
          using GIT_ASKPASS to set credentials GitHub Personal Access Token
           > git fetch --no-tags --progress https://github.com/cloudbeers/jenkins-45666.git +refs/heads/master:refs/remotes/origin/master
          

          Now I added the advanced clone behaviour like so:

          Then the next build we get:

          Now the build for a branch says:

          Cloning repository https://github.com/cloudbeers/jenkins-45666.git
           > git init /home/jenkins/workspace/foo_master-FZSKR3Q3UA6Q3PNW2MT2SNMQP7UA3IDOLJFZI6LCOV45WBPS7X5Q # timeout=10
          Fetching upstream changes from https://github.com/cloudbeers/jenkins-45666.git
           > git --version # timeout=10
          using GIT_ASKPASS to set credentials GitHub Personal Access Token
           > git fetch --tags --progress https://github.com/cloudbeers/jenkins-45666.git +refs/heads/*:refs/remotes/origin/*
           > git config remote.origin.url https://github.com/cloudbeers/jenkins-45666.git # timeout=10
          

          So you can see the git fetch --tags which is fetching the tags into the clone used for the build

          Stephen Connolly added a comment - Here is a build log without the advanced behaviour Note that it says: > git config remote.origin.url https: //github.com/cloudbeers/jenkins-45666.git # timeout=10 Fetching without tags Fetching upstream changes from https: //github.com/cloudbeers/jenkins-45666.git > git --version # timeout=10 using GIT_ASKPASS to set credentials GitHub Personal Access Token > git fetch --no-tags --progress https: //github.com/cloudbeers/jenkins-45666.git +refs/heads/master:refs/remotes/origin/master Now I added the advanced clone behaviour like so: Then the next build we get: Now the build for a branch says: Cloning repository https: //github.com/cloudbeers/jenkins-45666.git > git init /home/jenkins/workspace/foo_master-FZSKR3Q3UA6Q3PNW2MT2SNMQP7UA3IDOLJFZI6LCOV45WBPS7X5Q # timeout=10 Fetching upstream changes from https: //github.com/cloudbeers/jenkins-45666.git > git --version # timeout=10 using GIT_ASKPASS to set credentials GitHub Personal Access Token > git fetch --tags --progress https: //github.com/cloudbeers/jenkins-45666.git +refs/heads/*:refs/remotes/origin/* > git config remote.origin.url https: //github.com/cloudbeers/jenkins-45666.git # timeout=10 So you can see the git fetch --tags which is fetching the tags into the clone used for the build

          Tag discovery has not been implemented yet

          So this is the missunderstanding

          Stephen, do you have a plan or a JIRA issue for implementing this?

          Thanks

          Alexandru Pătrănescu added a comment - Tag discovery has not been implemented yet So this is the missunderstanding Stephen, do you have a plan or a JIRA issue for implementing this? Thanks

          drealecs that would be JENKINS-34395 IIRC

          Stephen Connolly added a comment - drealecs that would be JENKINS-34395 IIRC

          Similar to alt_jmellor's question, I need tags when checking out our repo in our pipeline scripts.  Our current checkout step is simply

          checkout scm
          

          I don't understand from the previous posts how to add tags to this step

          Trever Wilhelm added a comment - Similar to alt_jmellor 's question, I need tags when checking out our repo in our pipeline scripts.  Our current checkout step is simply checkout scm I don't understand from the previous posts how to add tags to this step

          treverw you need to configure the branch source and just add Advanced Clone Behaviours and then checkout scm will automatically get the tags for you

          Stephen Connolly added a comment - treverw you need to configure the branch source and just add Advanced Clone Behaviours and then checkout scm will automatically get the tags for you

          Hi,

          There is an issue when building pull requests and the clone trait is present with shallow clone option.
          Apparently you need some history in order to be able to do a merge.
          I'm using the Bitbucket Server but I guess this is the same for GitHub...

          How can we fix this?
          a) Disable shallow clone when we know a merge will take place.
          b) Fetch more and more history until you are able to do the merge, checking with merge-base command I guess.

          Can we do this only in one place, maybe in hudson.plugins.git.extensions.impl.PreBuildMerge#decorateMergeCommand? or is it specific to each branch-source-plugin?

          Alexandru Pătrănescu added a comment - Hi, There is an issue when building pull requests and the clone trait is present with shallow clone option. Apparently you need some history in order to be able to do a merge. I'm using the Bitbucket Server but I guess this is the same for GitHub... How can we fix this? a) Disable shallow clone when we know a merge will take place. b) Fetch more and more history until you are able to do the merge, checking with merge-base command I guess. Can we do this only in one place, maybe in hudson.plugins.git.extensions.impl.PreBuildMerge#decorateMergeCommand ? or is it specific to each branch-source-plugin?

          drealecs can you create a separate issue for that.

          Likely we need to go with Disable shallow clone when we know a merge will take place

          For now, that needs to happen in each plugin, but we could refactor https://github.com/jenkinsci/github-branch-source-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github_branch_source/MergeWithGitSCMExtension.java and it's copies into the Git plugin and switch to use that (and have that turn off shallow clone)

          But all that should take place under a separate JIRA from this

          Stephen Connolly added a comment - drealecs can you create a separate issue for that. Likely we need to go with Disable shallow clone when we know a merge will take place For now, that needs to happen in each plugin, but we could refactor https://github.com/jenkinsci/github-branch-source-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github_branch_source/MergeWithGitSCMExtension.java and it's copies into the Git plugin and switch to use that (and have that turn off shallow clone) But all that should take place under a separate JIRA from this

          Created JENKINS-45771.

          Alexandru Pătrănescu added a comment - Created JENKINS-45771 .

          Riko Eksteen added a comment - - edited

          I think this issue, which is marked as minor, contains a massive breaking change, i.e. above-mentioned fetching without tags. I have just spent almost a day trying to figure out why my builds no longer work.

          This started to surface as a build error when referring to a tag that didn't exist, then progressing to figure out that where previously my scm step executed with git fetch --tags, it is now executing with git fetch --no-tags, and then a wild goose chase of trying to downgrade various plugins that were upgraded recently, including the branch source plugin, the pipeline plugin, the pipeline scm plugin, and also the git plugin (which didn't work because other plugins depended on it).

          I also went down the route of trying to change our Jenkinsfile which is using "checkout scm" step to try and specify more configuration options, all without success.

          I eventually searched google for the string "Cloning with configured refspecs honoured and without tags" from my build output, which led me to https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java, and finally this thread.

          To prevent other users being led on this merry chase, I strongly recommend that you make it exceedingly clear that this new feature causes a regression whereby builds that previously fetched with tags now don't.

          It is also very unintuitive and unclear that adding "Advanced clone options" without checking any of its flags or filling out any of its properties magically restores the fetch with tags behaviour.

          It is unexpected that adding something without configuring it would change the behaviour.

          Development tools should lead users into the pit of success, not the pit of failure (and despair!). Please reconsider the impact of this change, or alternatively add a big fat warning for users upgrading to this version that their builds will behave differently now.

          Thanks for the wonderful tool that Jenkins is, and all the great work on the main server, this, and other plugins.

          Riko Eksteen added a comment - - edited I think this issue, which is marked as minor, contains a massive breaking change, i.e. above-mentioned fetching without tags. I have just spent almost a day trying to figure out why my builds no longer work. This started to surface as a build error when referring to a tag that didn't exist, then progressing to figure out that where previously my scm step executed with git fetch --tags, it is now executing with git fetch --no-tags, and then a wild goose chase of trying to downgrade various plugins that were upgraded recently, including the branch source plugin, the pipeline plugin, the pipeline scm plugin, and also the git plugin (which didn't work because other plugins depended on it). I also went down the route of trying to change our Jenkinsfile which is using "checkout scm" step to try and specify more configuration options, all without success. I eventually searched google for the string "Cloning with configured refspecs honoured and without tags" from my build output, which led me to https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/extensions/impl/CloneOption.java,  and finally this thread. To prevent other users being led on this merry chase, I strongly recommend that you make it exceedingly clear that this new feature causes a regression whereby builds that previously fetched with tags now don't. It is also very unintuitive and unclear that adding "Advanced clone options" without checking any of its flags or filling out any of its properties magically restores the fetch with tags behaviour. It is unexpected that adding something without configuring it would change the behaviour. Development tools should lead users into the pit of success, not the pit of failure (and despair!). Please reconsider the impact of this change, or alternatively add a big fat warning for users upgrading to this version that their builds will behave differently now. Thanks for the wonderful tool that Jenkins is, and all the great work on the main server, this, and other plugins.

          Patrick Rose added a comment -

          This is also causing issues for us because the "checkout to subdirectory" option has now been removed. Is there a workaround for that or do I need to handle this manually?

          Patrick Rose added a comment - This is also causing issues for us because the "checkout to subdirectory" option has now been removed. Is there a workaround for that or do I need to handle this manually?

          "Checkout to subdirectory" caused other problems and the correct solution in multibranch has always been to just do

          dir('subdir'){
            checkout scm
          }
          

          instead of

          checkout scm
          

          The extensions that were exposed by mistake have been removed to prevent the bugs that people were encountering

          Stephen Connolly added a comment - "Checkout to subdirectory" caused other problems and the correct solution in multibranch has always been to just do dir( 'subdir' ){ checkout scm } instead of checkout scm The extensions that were exposed by mistake have been removed to prevent the bugs that people were encountering

          Patrick Rose added a comment -

          We're using the declarative syntax, which means we don't have the option of checking out to a subdirectory. Is there a separate workaround we can do?

          Patrick Rose added a comment - We're using the declarative syntax, which means we don't have the option of checking out to a subdirectory. Is there a separate workaround we can do?

          turn off automatic checkout and then you can do the dir trick... abayer can probably tell you how to do that

          Stephen Connolly added a comment - turn off automatic checkout and then you can do the dir trick... abayer can probably tell you how to do that

          Andrew Bayer added a comment -

          Add

          options {
            skipDefaultCheckout(true)
          }
          

          to your pipeline block to skip the default checkout.

          Andrew Bayer added a comment - Add options { skipDefaultCheckout( true ) } to your pipeline block to skip the default checkout.

          Code changed in jenkins
          User: Mark Waite
          Path:
          Jenkinsfile
          http://jenkins-ci.org/commit/git-client-plugin/5cff403b221f58106d85edfcaa2d6ae90a1bc9e0
          Log:
          Clone repo with all history and all tags

          Intentional changes from JENKINS-43507 have reduced server load, disc
          use, and data transfer by honor the refspec which matches the branch of
          the job being built in a multi-branch pipeline, and by not fetching tags.

          Unfortunately, this branch contains tests which assume it is operating
          with a complete clone of the repository, including all tags and all
          branches.

          The tests have been fixed on the master branch, but not on this branch.
          Rather than fix the tests on this branch (with the risk that creates),
          this change modifies the clone to include all history and all tags.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: Jenkinsfile http://jenkins-ci.org/commit/git-client-plugin/5cff403b221f58106d85edfcaa2d6ae90a1bc9e0 Log: Clone repo with all history and all tags Intentional changes from JENKINS-43507 have reduced server load, disc use, and data transfer by honor the refspec which matches the branch of the job being built in a multi-branch pipeline, and by not fetching tags. Unfortunately, this branch contains tests which assume it is operating with a complete clone of the repository, including all tags and all branches. The tests have been fixed on the master branch, but not on this branch. Rather than fix the tests on this branch (with the risk that creates), this change modifies the clone to include all history and all tags.

          Greg Smith added a comment -

          This change – that tags are no longer included by default – also broke all of our builds.

          We are using the Github multi-branch Organization plugin.  I keep seeing reference to "Advanced clone options" – with a cropped screenshot.  Where is this UI?  Is it supposed to be on the configuration page for the Github Organization, because I can't find it.

          We have about 500 github projects that all depend on git tags being present during the build.  Do we have to change all of our builds "checkout scm" lines in all builds to add these options?

          Its a big task to change them all, and also breaks the ability to build old versions of code without any modifications.

          If there is any ability to go back to the old behavior via a global setting, that would be greatly appreciated.  I can not find the referenced UI in the screenshot anywhere under system configuration or Github Organization configuration.

           

           

          Greg Smith added a comment - This change – that tags are no longer included by default – also broke all of our builds. We are using the Github multi-branch Organization plugin.  I keep seeing reference to "Advanced clone options" – with a cropped screenshot.  Where is this UI?  Is it supposed to be on the configuration page for the Github Organization, because I can't find it. We have about 500 github projects that all depend on git tags being present during the build.  Do we have to change all of our builds "checkout scm" lines in all builds to add these options? Its a big task to change them all, and also breaks the ability to build old versions of code without any modifications. If there is any ability to go back to the old behavior via a global setting, that would be greatly appreciated.  I can not find the referenced UI in the screenshot anywhere under system configuration or Github Organization configuration.    

          Greg Smith added a comment - - edited

          OK – Sorry, i was able to find that UI now, via "Add" under "Behaviors" on the github organization UI.

          We added that to our Github organization configuration.  Should that automatically fix all builds using a simple "checkout scm" in their pipeline code?  As we have seen no change in behavior or resolution to the problem yet after adding that extra configuration.

          Under what conditions are those additional behaviors used?

          Greg Smith added a comment - - edited OK – Sorry, i was able to find that UI now, via "Add" under "Behaviors" on the github organization UI. We added that to our Github organization configuration.  Should that automatically fix all builds using a simple "checkout scm" in their pipeline code?  As we have seen no change in behavior or resolution to the problem yet after adding that extra configuration. Under what conditions are those additional behaviors used?

          gregcovertsmith We're using the Bitbucket equivalent; we had to issue a rescan operation for the behaviors to be added on individual sub-jobs.

          Thibault Nélis added a comment - gregcovertsmith We're using the Bitbucket equivalent; we had to issue a rescan operation for the behaviors to be added on individual sub-jobs.

          rikoe We had called out the change in the way the Git SCM Source checks out:

          The GitHub and Bitbucket plugins both inherit their per-branch checkout behaviour from the Git plugin. I am sorry that it was not obvious that you should also pay attention to the class structure changes involved and that the exposure of the ability to configure all of the Git Branch Source's behaviours would now mean that you would get the new Git Branch Source defaults for checking out. Is there some text you think would be good to add to the GitHub Branch Source wiki page that would make this change more obvious?

          Stephen Connolly added a comment - rikoe We had called out the change in the way the Git SCM Source checks out: The GitHub and Bitbucket plugins both inherit their per-branch checkout behaviour from the Git plugin. I am sorry that it was not obvious that you should also pay attention to the class structure changes involved and that the exposure of the ability to configure all of the Git Branch Source's behaviours would now mean that you would get the new Git Branch Source defaults for checking out. Is there some text you think would be good to add to the GitHub Branch Source wiki page that would make this change more obvious?

          Riko Eksteen added a comment -

          stephenconnolly, thanks for your reply. Our process is usually as follows: Jenkins warns us about out-of-date plugins, we hit upgrade for the out-of-date plugins. But not before I go onto the release notes, as far as possible, and check what changed.

          In this instance I think we upgraded from 3.3.2 to 3.4.1. Now that you have pointed out to me that you did specify the changes in the release notes, my take-away is this:

          • I should have read the release notes more carefully to make sure I understand what exactly had changed.
          • From my perspective, changing the plugin to to fetch without tags instead of with tags is a breaking change, it regresses the behaviour that myself - and other people, going by this thread - relied on.
          • If you agree with the former point (which you may not), in semver terms, a breaking change is a new major version, i.e. 4.0 as opposed to 3.x.
          • Irrespective of the above, in terms of the release notes, it would have been great if their was a clearly visible warning in the first line of the release notes indicating that some people may see unexpected behaviour, instead of that information being hidden away in a long paragraph towards the end. (I appreciate that this may only be evident in hindsight.)
          • Even now, when clicking through to the JIRA from the release notes, it is listed in the JIRA properties as a "minor" change, and appears to be quite innocuous, while being anything but - from my (extremely) limited understanding it is quite a major change that affect multiple interlocking plugins.

          Thanks for taking the time to respond and reading my reply!

          Riko Eksteen added a comment - stephenconnolly , thanks for your reply. Our process is usually as follows: Jenkins warns us about out-of-date plugins, we hit upgrade for the out-of-date plugins. But not before I go onto the release notes, as far as possible, and check what changed. In this instance I think we upgraded from 3.3.2 to 3.4.1. Now that you have pointed out to me that you did specify the changes in the release notes, my take-away is this: I should have read the release notes more carefully to make sure I understand what exactly had changed. From my perspective, changing the plugin to to fetch without tags instead of with tags is a breaking change, it regresses the behaviour that myself - and other people, going by this thread - relied on. If you agree with the former point (which you may not), in semver terms, a breaking change is a new major version, i.e. 4.0 as opposed to 3.x. Irrespective of the above, in terms of the release notes, it would have been great if their was a clearly visible warning in the first line of the release notes indicating that some people may see unexpected behaviour, instead of that information being hidden away in a long paragraph towards the end. (I appreciate that this may only be evident in hindsight.) Even now, when clicking through to the JIRA from the release notes, it is listed in the JIRA properties as a "minor" change, and appears to be quite innocuous, while being anything but - from my (extremely) limited understanding it is quite a major change that affect multiple interlocking plugins. Thanks for taking the time to respond and reading my reply!

          This new behaviour is just a nightmare for us, we have upgraded from 3.3.2 to 3.5.0.

          About 2 days spent to try to repair our build based on tags push event and nothing is working as it should...

          "Because each branch job in a multibranch project will only ever build the one specific branch, the default behaviour for a Git Branch Source is now to use a minimal refspec corresponding to just the required branch. Tags will not be checked out by default. If you have a multibranch project that requires the full set of ref-specs (for example, you might have a pipeline that will use some analysis tool on the diff with some other branch) you can restore the previous behaviour by adding the "Advanced Clone Behaviours". Note: In some cases you may also need to add the "Specify ref specs" behaviour."

          This solution just solves nothing, i added the Advanced Clone Behaviours and the "Specify ref specs" and nothing happened the plugin still don't care about our tags. It would be really appreciate to have a clearly detailed sample about how to set your plugin to let it work with tags correctly.

          Ludovic Mercier added a comment - This new behaviour is just a nightmare for us, we have upgraded from 3.3.2 to 3.5.0. About 2 days spent to try to repair our build based on tags push event and nothing is working as it should... "Because each branch job in a multibranch project will only ever build the one specific branch, the default behaviour for a Git Branch Source is now to use a minimal refspec corresponding to just the required branch. Tags will not be checked out by default. If you have a multibranch project that requires the full set of ref-specs (for example, you might have a pipeline that will use some analysis tool on the diff with some other branch) you can restore the previous behaviour by adding the "Advanced Clone Behaviours". Note: In some cases you may also need to add the "Specify ref specs" behaviour." This solution just solves nothing, i added the Advanced Clone Behaviours and the "Specify ref specs" and nothing happened the plugin still don't care about our tags. It would be really appreciate to have a clearly detailed sample about how to set your plugin to let it work with tags correctly.

          ludovic_mercier are you trying to build tags or are you trying to compare against tags?

          If building tags, this is not yet supported (may have accidentally worked previously, but was not intended to work)

          If comparing against tags, have you done a reindex first to update all the job configurations?

          Stephen Connolly added a comment - ludovic_mercier are you trying to build tags or are you trying to compare against tags? If building tags, this is not yet supported (may have accidentally worked previously, but was not intended to work) If comparing against tags, have you done a reindex first to update all the job configurations?

          Hi stephenconnolly,

          Thanks for your time, We were building tags effectively and i must say it's not a good news to read that it shouldn't have worked.

          It seems that we will have to change our strategy and workflow according to this or maybe you have a potential roadmap about this feature.

          Ludovic Mercier added a comment - Hi stephenconnolly , Thanks for your time, We were building tags effectively and i must say it's not a good news to read that it shouldn't have worked. It seems that we will have to change our strategy and workflow according to this or maybe you have a potential roadmap about this feature.

          ludovic_mercier so there are issues with building tags that need to be addressed: 

          • We probably want the concept of interesting heads: JENKINS-45502
            • Old tags are not interesting for sure
            • New tags might be interesting if the user wants to configure it that way
          • Interesting heads is not strictly required for branch-api as there is the ability to define a BranchBuildStrategy and that would allow suppressing automatic builds of tags on project creation (which is really the big issue for tags)
          • Support for implementing tags in the GitHub plugin is being tracked in JENKINS-34395, likely we'll just consolidate the Bitbucket, Git and Gitea implementations of the same feature under this banner 

          HTH

          Stephen Connolly added a comment - ludovic_mercier so there are issues with building tags that need to be addressed:  We probably want the concept of interesting heads: JENKINS-45502 Old tags are not interesting for sure New tags might be interesting if the user wants to configure it that way Interesting heads is not strictly required for branch-api as there is the ability to define a BranchBuildStrategy  and that would allow suppressing automatic builds of tags on project creation (which is really the big issue for tags) Support for implementing tags in the GitHub plugin is being tracked in  JENKINS-34395 , likely we'll just consolidate the Bitbucket, Git and Gitea implementations of the same feature under this banner  HTH

          rikoe

           it is listed in the JIRA properties as a "minor" change

          Nope, it was listed as a PRIORITY of "minor", not a scope.

          The refactoring itself is binary compatible but adds new methods. There are extensive tests of data migration. I believe there is only one use case where we missed a potentially breaking change, namely if you construct the SCMSource instance in your pipeline directly (e.g. for use with resolveScm) in all other cases the existing configuration should have been migrated:

          If you have a migration data set that is not migrating correctly, then that is a bug which should be filed in a separate JIRA and we can add an additional test case for your configuration and then fix it

           

          Stephen Connolly added a comment - rikoe  it is listed in the JIRA properties as a "minor" change Nope, it was listed as a PRIORITY of "minor", not a scope. The refactoring itself is binary compatible but adds new methods. There are extensive tests of data migration. I believe there is only one use case where we missed a potentially breaking change, namely if you construct the SCMSource instance in your pipeline directly (e.g. for use with resolveScm ) in all other cases the existing configuration should have been migrated: https://github.com/jenkinsci/github-branch-source-plugin/blob/f2a9fdd871e218429cd1de198b130596e90ee167/src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceTraitsTest.java#L107-L396  and https://github.com/jenkinsci/github-branch-source-plugin/blob/f2a9fdd871e218429cd1de198b130596e90ee167/src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSourceTraitsTest.java#L800-L1997   https://github.com/jenkinsci/github-branch-source-plugin/blob/f2a9fdd871e218429cd1de198b130596e90ee167/src/test/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMNavigatorTraitsTest.java#L58-L1561 https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/src/test/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMSourceTest.java#L57-L434 https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/e220b43404aca15574c7a9be3724a40587093414/src/test/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketSCMNavigatorTest.java#L53-L461 https://github.com/jenkinsci/git-plugin/blob/e08051a8e571f32887d463c72361123b6b37befb/src/test/java/jenkins/plugins/git/GitSCMSourceTraitsTest.java#L81-L211 If you have a migration data set that is not migrating correctly, then that is a bug which should be filed in a separate JIRA and we can add an additional test case for your configuration and then fix it  

          Greg Smith added a comment -

          Wanted to follow up, and say that once that once we completed a full rescan of our org, the additional behaviors were copied down to each project, and the original behaviors were restored.  This resolved all of our problems.

          Several of the other featured included in this change are very handy, so I wanted to say thanks again, I think this change overall will be be very useful in the long term. 

          Greg Smith added a comment - Wanted to follow up, and say that once that once we completed a full rescan of our org, the additional behaviors were copied down to each project, and the original behaviors were restored.  This resolved all of our problems. Several of the other featured included in this change are very handy, so I wanted to say thanks again, I think this change overall will be be very useful in the long term. 

            stephenconnolly Stephen Connolly
            stephenconnolly Stephen Connolly
            Votes:
            4 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated:
              Resolved: