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

Add SCM metadata to the transactions that are Multibranch Pipelines #184

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

v1v
Copy link
Member

@v1v v1v commented Oct 11, 2021

  • 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
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

🚧

What

Populate the SCM metadata when using Multibranch Pipelines to the transaction.

Why

Help to know what sources are the ones that created the pipeline without the need to go to the Default checkout span.

Action

try {
MultiBranchProject mbp = (MultiBranchProject) run.getParent().getParent();
// TODO: let's support all the sources such as Gitea, GitHub, BitBucket, GitLab (see https://www.jenkins.io/doc/book/pipeline/multibranch/#supporting-pull-requests)
Optional branchSource = mbp.getSCMSources().stream().filter(source -> source instanceof GitSCMSource).findFirst();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional< GitSCMSource> branchSource

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.

2 participants