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

feat(bitbucket): main branch status for mend app dashboard #32165

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

setchy
Copy link
Collaborator

@setchy setchy commented Oct 27, 2024

Changes

Adds a new optional configuration, bbMendAppDashboardCheck which provides a convenient way to quick-launch the Renovate Dashboard for a repository for users of the Mend App on Bitbucket.

When set, a successful branch status check will be recorded on the repository's main branch, hyperlinking to that repository's Mend Renovate Dashboard page

Context

Screenshot 2024-10-27 at 3 05 41 PM Screenshot 2024-10-27 at 3 06 04 PM

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

@setchy setchy added platform:bitbucket Bitbucket Cloud platform mend-app Used to flag discussions applying to the Mend Renovate App labels Oct 27, 2024
@setchy
Copy link
Collaborator Author

setchy commented Oct 27, 2024

Of course, a Bitbucket Forge App that adds Renovate as a repository left-hand navigation menu would be preferable, but this is may be a sufficient solution in the near-term

@setchy setchy requested a review from rarkins October 27, 2024 21:03
@setchy
Copy link
Collaborator Author

setchy commented Oct 28, 2024

I note that the marketplace listing calls this Mend App. Will happily rename the above config option and status name/description to best fit

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

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

Which of these would you expect?

  • Turn it on by default, almost nobody would want it off
  • Turn it on by default, but in some scenarios users will want it off
  • Turn it off by default, users will need to opt-in

@setchy
Copy link
Collaborator Author

setchy commented Oct 31, 2024

Which of these would you expect?

  • Turn it on by default, almost nobody would want it off
  • Turn it on by default, but in some scenarios users will want it off
  • Turn it off by default, users will need to opt-in

Turn it on by default for Mend App users. I assume you have the ability to control defaults for the managed apps?

lib/modules/platform/bitbucket/index.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

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

We would want to cache the SHA between runs to avoid setting it unnecessarily on future runs. Renovate already ties the repo extract results to defaultBranchSha, so it would be similar to that.

Also, this is in repo config but is done in initRepo() which occurs before repo config is read

@setchy
Copy link
Collaborator Author

setchy commented Nov 1, 2024

I'm not 100% following the ask. I've refactored it to use HEAD so that there isn't a need to resolve or keep track of a SHA.

@rarkins
Copy link
Collaborator

rarkins commented Nov 1, 2024

Your approach will still use one API call per repo per run, even if the head SHA is unchanged. I would like to leverage the repo cache so that we use an API call only when the default branch SHA has changed.

if (bbMendAppDashboardStatus) {
const statusName = 'Renovate Dashboard';

const mendAppDashboardStatus = await getBranchStatusCheck(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Leveraged this existing function, which if I understand internally caches the results @rarkins

Copy link
Collaborator

Choose a reason for hiding this comment

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

Will it cache across runs? I didn't think it did

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not 100% certain, but i think it does... testing locally I was using pnpm cache-clean in order to test first-time behavior

@setchy setchy requested a review from rarkins November 2, 2024 22:13
@rarkins
Copy link
Collaborator

rarkins commented Feb 7, 2025

To clarify, is this the goal?

  • If default branch SHA has changed since previous run, set a Renovate Dependency Dashboard check
  • If default branch SHA hasn't changed, do no API calls (rely on cache to know)

@setchy
Copy link
Collaborator Author

setchy commented Feb 7, 2025

Correct, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mend-app Used to flag discussions applying to the Mend Renovate App platform:bitbucket Bitbucket Cloud platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants