8000 :new: Add mixed category to group branches and pull requests by quilicicf · Pull Request #755 · jenkinsci/github-branch-source-plugin · GitHub
[go: up one dir, main page]

Skip to content

🆕 Add mixed category to group branches and pull requests #755

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

Closed
wants to merge 2 commits into from
Closed

🆕 Add mixed category to group branches and pull requests #755

wants to merge 2 commits into from

Conversation

quilicicf
Copy link
@quilicicf quilicicf commented Jan 4, 2024

Description

Most repositories I've worked with professionally had a unique set of requirements that are currently not addressed well by this plugin. We wanted to have:

  • Build branches, except for PoCs/investigation branches
  • Specific behavior for PR builds, ex: Sonar integration to check new code only
  • A single view with all of those jobs

We address almost all of this except for the last part.

  • We use the branch discovery trait with regex filters and branch naming convention for #1
  • We use the pull request (from origin) discovery trait with draft PR filter for #2
  • BUT: we have an issue with jobs "jumping" from the 'Branches' view to the 'Pull Requests' view when we open the PR which is pretty confusing. It also means that people searching for the builds related to a feature can't 'ctrl-f' in a single location.

I think that finding a way to group the branch & PR jobs would be beneficial for lots of users.

See JENKINS-72490.

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description - there are still discussions to be had on the use-case and implementation
  • Automated tests have been added to exercise the changes - there are still discussions to be had on the use-case and implementation
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verify that the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given - there are still discussions to be had on the use-case and implementation

Documentation changes

  • Link to jenkins.io PR, or an explanation for why no doc changes are needed - there are still discussions to be had on the use-case and implementation

Users/aliases to notify

@quilicicf

How to test

I created a public repository to help test the changes.

To test:

  • Pull the branch
  • Run the local Jenkins instance with mvn hpi:run
  • Open the test instance: http://localhost:8080/jenkins
  • Create a multi-branch pipeline job on the test repository (see link above) with the new discovery trait Discover branches & pull requests

    You will probably have to create a GitHub personal access token with content read access to the repository in question to avoid the tiny rate limits of anonymous users on the GitHub REST API. Create a Jenkins credential (usernamePassword) with your login/PAT and use it in the configuration of the branch source in the job.

The test repository is setup so you can see two jobs, one for the master branch, one for PR-1.

The Jenkinsfile in the repository displays the global environment variables that are present only for PRs, you can validate that they are null on master and have values on the PR.

What it looks like

example_on_test_repository

Note: I haven't made the view uncategorized so the Branches view still shows up and is displayed by default which is bad but I'm not sure making it uncategorized is the right way to do this.

@quilicicf quilicicf requested a review from a team as a code owner January 4, 2024 13:49
@jglick
Copy link
Member
jglick commented Jan 4, 2024

This feels like it would make more sense as some sort of option in branch-api.

@quilicicf
Copy link
Author

Yes indeed.
There's a discussion about this in the related issue.
I'll close this PR, let's find a better way to do this.

@quilicicf quilicicf closed this Jan 5, 2024
@quilicicf quilicicf deleted the 62BE master__JENKINS-72490_mixedCategory branch January 5, 2024 15:26
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
0