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-server): Support git over ssh #8115

Merged
merged 6 commits into from
Feb 11, 2021
Merged

feat(bitbucket-server): Support git over ssh #8115

merged 6 commits into from
Feb 11, 2021

Conversation

danez
Copy link
Contributor

@danez danez commented Dec 22, 2020

This allows checkout of repositories from bitbucket-server when http access for git is not enabled

Changes:

  • in initRepo() I moved the API calls to be done before the actual git clone, so we can read the clone urls from the API response.
  • Use urls from API response or fallback to current URL generation
    • Try to use http URL from API with injected auth
    • If http not available try to use ssh url
    • Otherwise generate URL from endpoint
  • Removed test does not throw as it was exactly the same as works
  • Added tests for all cases and adjusted the repoMock to be able to configure the clone URLs in the mock response.

Context:

Fixes #6280

This allows to use bitbucket-server instances where https is turned of for git:

Screenshot 2020-12-22 at 12 19 51

Documentation (please check one with an [x])

TBD: Still missing in self-hosted config, Want to figure out how to handle known_hosts for now. See below

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

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

I have verified these changes via:

  • Code inspection only, or
  • Newly added unit tests, or
  • Unit tests + ran on a real repository

I did run real tests with local docker version of bb version 6.0.11 and 7.8.1.

One important thing: The ssh access did NOT work out of the box, because the host verification was not stored in known_hosts. I assume this is not limited to bb-server but also happens with gitlab for example. How is that handled with gitlab? Is this up to the user to add the identification to known_hosts on the machine where renovate is running? I couldn't find anything in the docs about this. I see it was mentioned here #4022 (comment) but not sure what the outcome was.

This allows checkout of repositories from bitbucket-server when http access for git is not enabled
@danez danez marked this pull request as ready for review January 4, 2021 14:18
lib/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
lib/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
lib/platform/bitbucket-server/index.ts Outdated Show resolved Hide resolved
@rarkins rarkins marked this pull request as draft February 3, 2021 15:11
@zeldigas
Copy link
Contributor

zeldigas commented Feb 6, 2021

@danez any chance you have time to address leftover comments? Looks like PR is close to merge :)

@danez
Copy link
Contributor Author

danez commented Feb 6, 2021

@danez any chance you have time to address leftover comments? Looks like PR is close to merge :)

I will

@danez danez dismissed a stale review via 8b9e816 February 6, 2021 19:54
@danez danez marked this pull request as ready for review February 6, 2021 20:57
@zeldigas
Copy link
Contributor

@viceice, @rarkins could you take a look?

@rarkins
Copy link
Collaborator

rarkins commented Feb 11, 2021

Has this been able to be tested on both types of BBS - https URLs and ssh?

@danez
Copy link
Contributor Author

danez commented Feb 11, 2021

Has this been able to be tested on both types of BBS - https URLs and ssh?

I did with a docker image of bbs version 6.0 and 7.8 locally.
As mentioned above the ssh did not work out of the box, and i had to first add the bbs instance to the ssh known_hosts file first in the container where renovate did run. But otherwise it did work.

@rarkins rarkins changed the title feat(bitbucket-server): Support git over ssh on bitbucket-server platform feat(bitbucket-server): Support git over ssh Feb 11, 2021
@rarkins rarkins merged commit 3e2d9ca into renovatebot:master Feb 11, 2021
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 24.46.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@zeldigas
Copy link
Contributor

Thanks a ton!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2021
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.

[bitbucket-server] git clone over ssh
5 participants