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

Git plugin ignores Refspec when triggering build on commit nitification

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      Default refspec according to the documentation is

      +refs/heads/*:refs/remotes/REPOSITORYNAME/*

      When I click on "Trigger build" in Stash's pull request overview, my job fails, because it cannot find commit in the specified refspecs (because commit is in pull requests, not in heads).

       > C:\Program Files (x86)\Git\bin\git.exe rev-parse "1c2ead96dfe52f7f0675161f025c2541ede93782^{commit}" # timeout=10
      FATAL: Command "C:\Program Files (x86)\Git\bin\git.exe rev-parse "1c2ead96dfe52f7f0675161f025c2541ede93782^{commit}"" returned status code 128:
      stdout: 1c2ead96dfe52f7f0675161f025c2541ede93782^{commit}
      
      stderr: fatal: ambiguous argument '1c2ead96dfe52f7f0675161f025c2541ede93782^{commit}': unknown revision or path not in the working tree.
      Use '--' to separate paths from revisions, like this:
      'git <command> [<revision>...] -- [<file>...]'
      
      hudson.plugins.git.GitException: Command "C:\Program Files (x86)\Git\bin\git.exe rev-parse "1c2ead96dfe52f7f0675161f025c2541ede93782^{commit}"" returned status code 128:
      stdout: 1c2ead96dfe52f7f0675161f025c2541ede93782^{commit}
      
      stderr: fatal: ambiguous argument '1c2ead96dfe52f7f0675161f025c2541ede93782^{commit}': unknown revision or path not in the working tree.
      Use '--' to separate paths from revisions, like this:
      'git <command> [<revision>...] -- [<file>...]'
      

          [JENKINS-25049] Git plugin ignores Refspec when triggering build on commit nitification

          In Stash, you can disable sending the SHA1 when notifying Jenkins. This of course breaks the "Trigger build" button in pull requests...

          Matthieu Weber added a comment - In Stash, you can disable sending the SHA1 when notifying Jenkins. This of course breaks the "Trigger build" button in pull requests...

          This is no more that a workaround as it is required in some cases to force building every commit, pushed to git. While, omitting SHA1 commit hash in notifyCommit should sometimes squash several commits into one build.

          Pavel Baranchikov added a comment - This is no more that a workaround as it is required in some cases to force building every commit, pushed to git. While, omitting SHA1 commit hash in notifyCommit should sometimes squash several commits into one build.

          Yes, but we decided that the inability to use the "trigger build" button was the lesser of two evils. And for other reasons, we also downgraded the Stash webhook that is triggering the builds. This is of course not a long-term solution, that's why we hope for an improvement in Jenkins' GIT plugin (one solution this problem could be to implement my proposal in JENKINS-25708).

          Matthieu Weber added a comment - Yes, but we decided that the inability to use the "trigger build" button was the lesser of two evils. And for other reasons, we also downgraded the Stash webhook that is triggering the builds. This is of course not a long-term solution, that's why we hope for an improvement in Jenkins' GIT plugin (one solution this problem could be to implement my proposal in JENKINS-25708 ).

          Pavel Baranchikov added a comment - - edited

          According to merged pull request #90, you can use fresh version of Stash Jenkins Webhook plugin.

          Pavel Baranchikov added a comment - - edited According to merged pull request #90 , you can use fresh version of Stash Jenkins Webhook plugin.

            Unassigned Unassigned
            pbaranchikov Pavel Baranchikov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: