add support for cloning Git repository via SSH rather than HTTPS#300
Conversation
merge v0.1.1 into main
release v0.2.0
release v0.3.0
release v0.4.0
release v0.5.0
merge develop into main for release v0.6.0
|
|
||
| git_diff_cmd = ' '.join([ | ||
| f"git fetch origin pull/{pr.number}/head:{pr.number}", | ||
| f"git diff HEAD pr{pr.number} > {pr.number}.diff", |
There was a problem hiding this comment.
if you're now creating the diff like this, shouldn't you remove the curl_cmd above?
There was a problem hiding this comment.
Yes, of course, I'll tackle that too
There was a problem hiding this comment.
@smoors made a good point (in Slack) about this change: this doesn't take into account that there may be changes in the main branch that are not included in the PR branch yet.
So, a better approach would be to:
- fetch the PR branch
- check out the PR branch
git merge main- swap back to
mainbranch git diffgit apply
There was a problem hiding this comment.
This procedure hasn't been implemented yet, right?
A few thoughts:
mainshould probably be the target branch of the PR, for example, for EESSI/2023.06 that would be 2023.06-software.eessi.io?- the
git diffafter the swap back to "main" is really just the plaingit diffor rathergit diff PR_branch?
There was a problem hiding this comment.
to determine base branch for PR (the target branch), maybe git merge-base is useful...
There was a problem hiding this comment.
I'll change this so the new approach based on git is only used when clone_via is set to 'ssh' (so nothing changes for existing bots that listen to a public repo).
That gives us some freedom to experiment with the situation where the target branch has been updated since the branch for the PR was created.
There was a problem hiding this comment.
I've updated this in a99ae60 to only use the git diff approach when clone_git_repo_via is used.
It's still doing only git fetch + git diff, so you could still have issues when the PR branch is way behind on the target branch, I'll try to look into that next.
There was a problem hiding this comment.
created a PR to this PR using git merge-base:
boegel#1
|
This is working as expected now, so marking it ready-for-review. Hopefully @trz42 has time to take a look? |
trz42
left a comment
There was a problem hiding this comment.
Works as intended. See trz42/software-layer#78
The optional settings have to be commented. The intention with listing them, is more to document that they are optional and it could be easily changed in the future if we wish so.
I think, it might be good to add some comments (README.md and app.cfg.example) about what is needed if the ssh key has not a standard name and if it uses a passphrase.
…king it required Co-authored-by: Thomas Röblitz <trz42@users.noreply.github.com>
Co-authored-by: Thomas Röblitz <trz42@users.noreply.github.com>
…app.cfg.example Co-authored-by: Thomas Röblitz <trz42@users.noreply.github.com>
181d29c to
a27452d
Compare
c03e52b to
299b9e8
Compare
…are-layer into git_clone_via_ssh
299b9e8 to
80efece
Compare
80efece to
a99ae60
Compare
|
I haven't actually re-tested this after the changes I've made, and some more changes are required to the |
merge develop into main for release v0.7.0
git diff from merge-base instead of from HEAD
…are-layer into git_clone_via_ssh
|
this works as expected now that we're creating a diff from the one thing that doesn't work with SSH is the |
merging `develop` into `main` for release v0.8.0
update README
|
@trz42 This should be good to go now, can you take a look? It doesn't change anything in the default behavior, but extra feature it adds is essential for working with private repositories, since those can't be cloned via HTTPS. |
…are-layer into git_clone_via_ssh
trz42
left a comment
There was a problem hiding this comment.
Minor comment.
Can you also pull in upstream changes, thus one could test this PR and the PR for allowing no spaces between bot: and build?
| f"{download_pr_comments_cfg[config.DOWNLOAD_PR_COMMENTS_SETTING_PR_DIFF_FAILURE]}" | ||
| f"\n{download_pr_comments_cfg[config.DOWNLOAD_PR_COMMENTS_SETTING_PR_DIFF_TIP]}") |
There was a problem hiding this comment.
These settings should probably be added to the list of required settings.
This is useful when the target repository of PRs that the bot should act on is a private repository.
Opt-in via this in bot configuration file (
app.cfg):(draft PR since this needs actual testing, and perhaps more changes)