JENKINS-61654: use rev from upstream where possible #155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses https://issues.jenkins.io/browse/JENKINS-61654
When starting a downstream build using the
build
step, the downstream build will always fetch the head commit ofSCMHead
. When the upstream build was building an older commit, the downstream job runs in a different git context, which is not really desirable.In some cases (same Git/GitHub remote url, same branch, ... - for details see comment on
getUpstreamGitScmRevisionForSameRemote
), we can use theSCMRevision
from upstream and use that one to both fetch the Jenkinsfile as well as checking out the repo.Also, I'd love some more input:
CauseAction
/UpstreamCause
is not used, and I can't find out why.SCMSource
to use the upstreamSCMRevision
?.