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

Replay does not reuse commit on non-multibranch pipeline jobs

      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.

          [JENKINS-36453] Replay does not reuse commit on non-multibranch pipeline jobs

          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.

          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.

          James Dumay added a comment -

          jglick 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.

          James Dumay added a comment - jglick 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.

          Martin Sander added a comment -

          See JENKINS-45808 for suggested workarounds.

          Martin Sander added a comment - See JENKINS-45808 for suggested workarounds.

          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?

          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?

            Unassigned Unassigned
            imeredith Ivan Meredith
            Votes:
            8 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: