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

Bitbucket Branch Source Smart Mirror Support #592

Closed
Maxo112 opened this issue Apr 26, 2022 · 3 comments · Fixed by #796
Closed

Bitbucket Branch Source Smart Mirror Support #592

Maxo112 opened this issue Apr 26, 2022 · 3 comments · Fixed by #796

Comments

@Maxo112
Copy link

Maxo112 commented Apr 26, 2022

What feature do you want to see added?

Since we have large repos on our Bitbucket Server Enterprise environment and have various sites. Would be my wish in Jenkins to select which smart mirror to pull the repository from. Unfortunately, the Jenkins is in a completely different location.

Should it be possible for Jenkins to download directly from the smart mirror we would have an improvement in time by several 100 percent.

Unfortunately, as soon as I try to add the Smart mirror as a Bitbucket server, I get the error.

image

Upstream changes

I don't want to use the GIT plugin, it must explicitly support the Branch Source plugin to support Bitbucket Smart Mirror.

@KalleOlaviNiemitalo
Copy link
Contributor

The Bitbucket Server Integration plugin supports cloning from mirrors. OTOH, it doesn't yet support pull requests, so switching to it is not trivial.

@Maxo112
Copy link
Author

Maxo112 commented Apr 26, 2022

@KalleOlaviNiemitalo That's the problem it doesn't support PRs that's my biggest problem with the plugin :(

@bsnuggs1
Copy link

bsnuggs1 commented Apr 7, 2023

@Maxo112 - The Bitbucket Server Integration plugin supports PRs now...but unfortunately, not in the way you'd expect. It can only trigger re-scans in Jenkins for the source branch. It doesn't actually attempt to do a merge operation and run a build against the result.

andrey-fomin added a commit to andrey-fomin/bitbucket-branch-source-plugin that referenced this issue Jan 10, 2024
A mirrored Git repository can be configured for fetching references.

The mirror is not used in the following cases:
- If the source branch in a pull request resides in a different
  repository, the source branch is fetched from the primary
  repository while the target branch is fetched from the mirror.
- During initial pull request scanning, the mirror isn't used because
  PullRequestSCMHead doesn't contain the hash needed for the build and
  SCMRevision is null. This is the current design limitation and
  can be refactored later.

Cloning from the mirror can only be used with native web-hooks since
plugin web-hooks don't provide a mirror identifier.

For branches and tags, the mirror sync event is used. Thus, at cloning
time, the mirror is already synchronized. However, in the case of a
pull request event, there is no such guarantee. The plugin
optimistically assumes that the mirror is synced and the required
commit hashes exist in the mirrored repository at cloning time. If the
plugin can't find the required hashes, it falls back to the primary repository.

Fixes jenkinsci#592

Co-authors:
- Andrey Fomin https://github.com/andrey-fomin
- Andrei Kouznetchik https://github.com/akouznetchik
- Eugene Mercuriev https://github.com/zamonier
andrey-fomin added a commit to andrey-fomin/bitbucket-branch-source-plugin that referenced this issue Jan 10, 2024
A mirrored Git repository can be configured for fetching references.

The mirror is not used in the following cases:
- If the source branch in a pull request resides in a different
  repository, the source branch is fetched from the primary
  repository while the target branch is fetched from the mirror.
- During initial pull request scanning, the mirror isn't used because
  PullRequestSCMHead doesn't contain the hash needed for the build and
  SCMRevision is null. This is the current design limitation and
  can be refactored later.

Cloning from the mirror can only be used with native web-hooks since
plugin web-hooks don't provide a mirror identifier.

For branches and tags, the mirror sync event is used. Thus, at cloning
time, the mirror is already synchronized. However, in the case of a
pull request event, there is no such guarantee. The plugin
optimistically assumes that the mirror is synced and the required
commit hashes exist in the mirrored repository at cloning time. If the
plugin can't find the required hashes, it falls back to the primary repository.

Fixes jenkinsci#592

Co-authors:
- Andrey Fomin https://github.com/andrey-fomin
- Andrei Kouznetchik https://github.com/akouznetchik
- Eugene Mercuriev https://github.com/zamonier
andrey-fomin added a commit to andrey-fomin/bitbucket-branch-source-plugin that referenced this issue Jan 11, 2024
A mirrored Git repository can be configured for fetching references.

The mirror is not used in the following cases:
- If the source branch in a pull request resides in a different
  repository, the source branch is fetched from the primary
  repository while the target branch is fetched from the mirror.
- During initial pull request scanning, the mirror isn't used because
  PullRequestSCMHead doesn't contain the hash needed for the build and
  SCMRevision is null. This is the current design limitation and
  can be refactored later.

Cloning from the mirror can only be used with native web-hooks since
plugin web-hooks don't provide a mirror identifier.

For branches and tags, the mirror sync event is used. Thus, at cloning
time, the mirror is already synchronized. However, in the case of a
pull request event, there is no such guarantee. The plugin
optimistically assumes that the mirror is synced and the required
commit hashes exist in the mirrored repository at cloning time. If the
plugin can't find the required hashes, it falls back to the primary repository.

Fixes jenkinsci#592

Co-authors:
- Andrey Fomin https://github.com/andrey-fomin
- Andrei Kouznetchik https://github.com/akouznetchik
- Eugene Mercuriev https://github.com/zamonier
lifeofguenter added a commit that referenced this issue Feb 10, 2024
A mirrored Git repository can be configured for fetching references.

The mirror is not used in the following cases:
- If the source branch in a pull request resides in a different
  repository, the source branch is fetched from the primary
  repository while the target branch is fetched from the mirror.
- During initial pull request scanning, the mirror isn't used because
  PullRequestSCMHead doesn't contain the hash needed for the build and
  SCMRevision is null. This is the current design limitation and
  can be refactored later.

Cloning from the mirror can only be used with native web-hooks since
plugin web-hooks don't provide a mirror identifier.

For branches and tags, the mirror sync event is used. Thus, at cloning
time, the mirror is already synchronized. However, in the case of a
pull request event, there is no such guarantee. The plugin
optimistically assumes that the mirror is synced and the required
commit hashes exist in the mirrored repository at cloning time. If the
plugin can't find the required hashes, it falls back to the primary repository.

Fixes #592

Co-authors:
- Andrey Fomin https://github.com/andrey-fomin
- Andrei Kouznetchik https://github.com/akouznetchik
- Eugene Mercuriev https://github.com/zamonier

Co-authored-by: Günter Grodotzki <gunter@grodotzki.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants