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

fix(reconfigure/pr): find reconfigure pr separately #25954

Merged
merged 27 commits into from Dec 29, 2023

Conversation

RahulGautamSingh
Copy link
Collaborator

@RahulGautamSingh RahulGautamSingh commented Nov 24, 2023

Changes

  • Added a new findReconfigurePr function in supported platforms (GitHub, GitLab, Gitea).
  • For GitHub and GitLab, these functions now make separate GET requests to fetch PRs based on the source branch name.
  • For Gitlab: Modified its toRenovatePR function to ensure that reconfigure PRs are not filtered out from the list of PRs fetched.

Context

Closes: #25754

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Nov 24, 2023

Test Runs:

To do this, I created two accounts on each platform: one user account and one bot account. I then added the bot account as a member/collaborator on the test repositories.

I then proceeded to create a new onboarded repository and a 'reconfigure' branch, along with a corresponding pull request using the user account.

Finally, I ran Renovate against all the repositories using the bot account's token.

Gitlab - Github - Gitea - Bitbucket - Azure

BitbucketServer

image

@RahulGautamSingh RahulGautamSingh marked this pull request as draft November 24, 2023 13:26
@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review November 24, 2023 13:48
@rarkins
Copy link
Collaborator

rarkins commented Nov 24, 2023

What's the reason for only certain platforms?

I think: some platforms retrieve every PR already and do filtering on the Renovate client-side. So for those we don't need a new function and can fall back to findPr()

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Nov 24, 2023

What's the reason for only certain platforms?

Got mixed up a bit. Pushing them soon

I think: some platforms retrieve every PR already and do filtering on the Renovate client-side. So for those we don't need a new function and can fall back to findPr()

Since we have to add a new fn for github, and gitlab which will be available via the platform class. I thought it was cleaner to have the function in all platforms. And in the ones that don't need extra logic just pass it onto findPr from there.

// platform/gitea/index.ts

async function findReconfigurePr(branchName: string){
  return await findPr({ branchName });
},
// workers/repository/reconfigure/index.ts

const reconfigurePr = platform.findReconfigurePr(branchName);

Instead of adding an if-logic to handle this in the reconfigure logic.

// workers/repository/reconfigure/index.ts

let reconfigurePr: Pr|null = null;
switch(platform){
  case "github": reconfigurePr = platform.findReconfigurePr(branchName); break;
  case "gitlab": reconfigurePr = platform.findReconfigurePr(branchName); break;
  default: reconfigurePr = platform.findPr({ branchName, ...});
}

@RahulGautamSingh RahulGautamSingh marked this pull request as draft November 24, 2023 15:06
@rarkins
Copy link
Collaborator

rarkins commented Nov 24, 2023

You could check for the existence of platform.findReconfigurePr() - you don't need to embed platform-awareness into the worker layer

@RahulGautamSingh
Copy link
Collaborator Author

You could check for the existence of platform.findReconfigurePr() - you don't need to embed platform-awareness into the worker layer

Yes, missed that. Thanks.

@RahulGautamSingh

This comment was marked as outdated.

@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review November 27, 2023 10:46
lib/modules/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitea/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitlab/index.ts Outdated Show resolved Hide resolved
lib/workers/repository/reconfigure/index.ts Outdated Show resolved Hide resolved
@RahulGautamSingh RahulGautamSingh marked this pull request as draft November 27, 2023 19:33
@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review November 30, 2023 12:21
@RahulGautamSingh

This comment was marked as outdated.

@RahulGautamSingh RahulGautamSingh marked this pull request as draft November 30, 2023 13:32
@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review November 30, 2023 15:30
lib/modules/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitea/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/github/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/types.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/github/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/github/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitlab/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitlab/index.ts Outdated Show resolved Hide resolved
rarkins
rarkins previously approved these changes Dec 16, 2023
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

otherwise LGTM

lib/modules/platform/bitbucket-server/index.spec.ts Outdated Show resolved Hide resolved
lib/modules/platform/bitbucket/index.spec.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitea/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitea/index.ts Outdated Show resolved Hide resolved
lib/modules/platform/github/index.spec.ts Outdated Show resolved Hide resolved
lib/modules/platform/gitlab/index.spec.ts Outdated Show resolved Hide resolved
@viceice viceice added this pull request to the merge queue Dec 29, 2023
Merged via the queue into renovatebot:main with commit 5f16355 Dec 29, 2023
36 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.111.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

zT-1337 pushed a commit to scm-manager/renovate that referenced this pull request Jan 22, 2024
zT-1337 pushed a commit to scm-manager/renovate that referenced this pull request Jan 24, 2024
zT-1337 pushed a commit to scm-manager/renovate that referenced this pull request Jan 24, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reconfigure Renovate PR check fails to create PR comment
4 participants