Skip to content

Conversation

@dev-hanz-ops
Copy link

@dev-hanz-ops dev-hanz-ops commented Jan 13, 2022

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 of SCMHead. 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 the SCMRevision 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:

  • There is a new test case, however I can not get it to work because my CauseAction/UpstreamCause is not used, and I can't find out why.
  • Is this a viable approach? Esp. seeing that I need to include the branch-source-plugin dependency, I'm not sure. Maybe an Extension Point in a similar manner to the branch source plugin would be better, so that there can be multiple smaller Plugins for each SCMSource to use the upstream SCMRevision?
  • Is there something missing? A thing I already have on my radar is hiding this behind a behavior and turning it off per default, so existing pipelines are not affected.

.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@dev-hanz-ops
Copy link
Author

closing in favor of #157

@dev-hanz-ops dev-hanz-ops deleted the JENKINS-61654_upstream_commit branch January 25, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant