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

[Git][Parameterized Trigger] 'Pass-through Git commit' does not include repo URI and breaks pipeline build

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None
    • Jenkins 2.277.3
      git-plugin 4.7.1
      parameterized-trigger 2.40

      Consider the following situation:

      • job1 (classical freestyle)
        • build
        • post
          • Trigger parameterized build on other projects
            • job2 
            • [x] Pass-through Git Commit that was built
      • job2 (pipeline):

      This constellation will fail to build, because the commit-ID passed-through from build of job1 is being used to fetch the pipeline of job2 and also (if it would get so far) would be used for the step2 of the pipeline, but it should only apply to step1.

      The technical issue is that in

      hudson.plugins.git.GitRevisionBuildParameters

      no repoURL is passed to the constructor of

      hudson.plugins.git.RevisionParameterAction.

      That one then, in canOriginateFrom() always returns true and uses the revision ID for all git repos involved in the pipeline.

          [JENKINS-65448] [Git][Parameterized Trigger] 'Pass-through Git commit' does not include repo URI and breaks pipeline build

          Mark Waite added a comment -

          sratz I don't intend to change that behavior. The git step is an intentionally simplified and limited form. Use the checkout step if you need to perform a checkout of a specific SHA-1 or branch that is not the value expected by the git step.

          Mark Waite added a comment - sratz I don't intend to change that behavior. The git step is an intentionally simplified and limited form. Use the checkout step if you need to perform a checkout of a specific SHA-1 or branch that is not the value expected by the git step.

          Sebastian Ratz added a comment - - edited

          I am using the CheckoutSCM step inside the pipeline itself. Maybe that would actually work already for 'step2' in my example. So we can ignore this aspect for now.

          However, the primary issue here is about the pipeline script itself:

          There's just nothing else that can be done here.

          And I don't think the "lastBuiltRevision" of the triggering job1 should influence the pipeline fetching itself here.

          Sebastian Ratz added a comment - - edited I am using the CheckoutSCM step inside the pipeline itself. Maybe that would actually work already for 'step2' in my example. So we can ignore this aspect for now. However, the primary issue here is about the pipeline script itself: There's just nothing else that can be done here. And I don't think the "lastBuiltRevision" of the triggering job1 should influence the pipeline fetching itself here.

          Mark Waite added a comment - - edited

          Thanks for the detailed explanation. I see that the problem is more general than I initially assumed. I hope that it is rare for users to call a Pipeline job from a Freestyle job and pass the git commit from the Freestyle job to the Pipeline job. You might try a work around of passing the git commit in some other way (with a parameter computed in the Freestyle job or some other technique).

          I've created a duplication case in my test environment.

          Mark Waite added a comment - - edited Thanks for the detailed explanation. I see that the problem is more general than I initially assumed. I hope that it is rare for users to call a Pipeline job from a Freestyle job and pass the git commit from the Freestyle job to the Pipeline job. You might try a work around of passing the git commit in some other way (with a parameter computed in the Freestyle job or some other technique). I've created a duplication case in my test environment.

            Unassigned Unassigned
            sratz Sebastian Ratz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: