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

Initialize GitClient credentials before decorating it with extensions

    • Icon: Story Story
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-plugin
    • None

      The GitSCMExtension decorates the GitClient first and then it set the credentials if a credentials ID is provided https://github.com/jenkinsci/git-plugin/blob/git-5.2.2/src/main/java/hudson/plugins/git/GitSCM.java#L929. This behavior was changed a long long time ago though I am not convinced it was intentional https://github.com/jenkinsci/git-plugin/commit/5bbee1ffbfbfe16441b5b5ac09bb2b32fa6fae63.

      Maybe the GitClient should be initialized first (credentials included) and GitSCMExtension at the end.

      Noticed this particular behavior when working on a bug fix for Bitbucket Branch Source that implements an interesting extension to pass the credentials ID: https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/888.v8e6d479a_1730/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/GitClientAuthenticatorExtension.java.

          [JENKINS-73677] Initialize GitClient credentials before decorating it with extensions

          Allan BURDAJEWICZ created issue -
          Allan BURDAJEWICZ made changes -
          Description Original: The {{GitSCMExtension}} decorates the {{GitClient}} first and then it set the credentials if a credentials ID is provided https://github.com/jenkinsci/git-plugin/blob/git-5.2.2/src/main/java/hudson/plugins/git/GitSCM.java#L929.

          This behavior was changed a long long time ago though I am not convinced it was intentional https://github.com/jenkinsci/git-plugin/commit/5bbee1ffbfbfe16441b5b5ac09bb2b32fa6fae63.

          I think that maybe the {{GitClient}} should be initialized first (credentials included) and {{GitSCMExtension}} at the end.

          Noticed this particular behavior when working on a bug fix for Bitbucket Branch Source that implements an interesting extension to pass the credentials ID: https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/888.v8e6d479a_1730/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/GitClientAuthenticatorExtension.java.
          New: The {{GitSCMExtension}} decorates the {{GitClient}} first and then it set the credentials if a credentials ID is provided https://github.com/jenkinsci/git-plugin/blob/git-5.2.2/src/main/java/hudson/plugins/git/GitSCM.java#L929. This behavior was changed a long long time ago though I am not convinced it was intentional https://github.com/jenkinsci/git-plugin/commit/5bbee1ffbfbfe16441b5b5ac09bb2b32fa6fae63.

          Maybe the {{GitClient}} should be initialized first (credentials included) and {{GitSCMExtension}} at the end.

          Noticed this particular behavior when working on a bug fix for Bitbucket Branch Source that implements an interesting extension to pass the credentials ID: https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/888.v8e6d479a_1730/src/main/java/com/cloudbees/jenkins/plugins/bitbucket/GitClientAuthenticatorExtension.java.
          Allan BURDAJEWICZ made changes -
          Assignee Original: Mark Waite [ markewaite ] New: Allan BURDAJEWICZ [ allan_burdajewicz ]
          Allan BURDAJEWICZ made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Allan BURDAJEWICZ made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Mark Waite made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Fixed but Unreleased [ 10203 ]
          Mark Waite made changes -
          Released As New: https://github.com/jenkinsci/git-plugin/releases/tag/git-5.5.0
          Status Original: Fixed but Unreleased [ 10203 ] New: Closed [ 6 ]
          Ruby Paasche made changes -
          Link New: This issue is blocked by JENKINS-73797 [ JENKINS-73797 ]
          Mark Waite made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]
          Allan BURDAJEWICZ made changes -
          Link New: This issue blocks JENKINS-73471 [ JENKINS-73471 ]
          Allan BURDAJEWICZ made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Reopened [ 4 ] New: Fixed but Unreleased [ 10203 ]

            allan_burdajewicz Allan BURDAJEWICZ
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: