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

Replay does not reuse commit on non-multibranch pipeline jobs

    Details

    • Similar Issues:

      Description

      In multibranch jobs, if you 'replay' a build it will reuse the git commit (and assume svn revision etc) of the build in the replay.

      But with non-multibranch pipeline jobs, the latest commit is always used no matter what build is replayed.

      It may have something to do with 'checkout scm' vs 'git url:' being used, but either way I think it should work in the same.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Replay is actually not the central issue. scm for a CpsScmFlowDefinition is not guaranteed to match the commit of Jenkinsfile. This is because it is using hudson.model.SCM, i.e., the old core APIs, which do not support checking out a specific version. In order to fix this we would have to actually deprecate CpsScmFlowDefinition and provide a replacement using scm-api so it would behave more like multibranch, except of course for a predefined branch.

            Show
            jglick Jesse Glick added a comment - Replay is actually not the central issue. scm for a CpsScmFlowDefinition is not guaranteed to match the commit of Jenkinsfile . This is because it is using hudson.model.SCM , i.e., the old core APIs, which do not support checking out a specific version. In order to fix this we would have to actually deprecate CpsScmFlowDefinition and provide a replacement using scm-api so it would behave more like multibranch, except of course for a predefined branch.
            Hide
            jamesdumay James Dumay added a comment -

            Jesse Glick great explanation I think we are going to put less emphasis on this job type in the UI in the future so I'd imagine this isn't as high priority as I thought it might be.

            Show
            jamesdumay James Dumay added a comment - Jesse Glick great explanation I think we are going to put less emphasis on this job type in the UI in the future so I'd imagine this isn't as high priority as I thought it might be.
            Hide
            0x89 Martin Sander added a comment -

            See JENKINS-45808 for suggested workarounds.

            Show
            0x89 Martin Sander added a comment - See JENKINS-45808 for suggested workarounds.
            Hide
            brianjmurrell Brian J Murrell added a comment -

            Replay is actually not the central issue. scm for a CpsScmFlowDefinition is not guaranteed to match the commit of Jenkinsfile. This is because it is using hudson.model.SCM, i.e., the old core APIs, which do not support checking out a specific version. In order to fix this we would have to actually deprecate CpsScmFlowDefinition and provide a replacement using scm-api so it would behave more like multibranch, except of course for a predefined branch.

            Is this why, when I Replay a given build of a given multi-branch pipeline job, the Jenkinsfile is checked out at the commit build I'm Replaying was at, however a checkout in the pipeline job does not get the same commit? Is it because the scm.branches doesn't point at the commit of the Replay but rather points at the branch?

            If so, this is pretty horrible. Shouldn't one be able to depend on the global scm variable containing an accurate representation of what is being checked out (implicitly)? Why does the implicit checkout get the right commit and yet an explicit checkout doesn't?

            Show
            brianjmurrell Brian J Murrell added a comment - Replay is actually not the central issue. scm for a CpsScmFlowDefinition is not guaranteed to match the commit of Jenkinsfile. This is because it is using hudson.model.SCM, i.e., the old core APIs, which do not support checking out a specific version. In order to fix this we would have to actually deprecate CpsScmFlowDefinition and provide a replacement using scm-api so it would behave more like multibranch, except of course for a predefined branch. Is this why, when I Replay a given build of a given multi-branch pipeline job, the Jenkinsfile is checked out at the commit build I'm Replay ing was at, however a checkout in the pipeline job does not get the same commit? Is it because the scm.branches doesn't point at the commit of the Replay but rather points at the branch? If so, this is pretty horrible. Shouldn't one be able to depend on the global scm variable containing an accurate representation of what is being checked out (implicitly)? Why does the implicit checkout get the right commit and yet an explicit checkout doesn't?

              People

              • Assignee:
                Unassigned
                Reporter:
                imeredith Ivan Meredith
              • Votes:
                6 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated: