Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JENKINS-61654: use rev from upstream where possible #155

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