-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Support multiple GitHub SSH deploy keys #568
Support multiple GitHub SSH deploy keys #568
Conversation
…hat adds git configs and mounts .ssh/config and public keys to the container, in order to allow multiple sh deploy key trick by webplatform@ssh-agent
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #568 +/- ##
=======================================
Coverage 36.96% 36.96%
=======================================
Files 77 77
Lines 3033 3038 +5
Branches 637 641 +4
=======================================
+ Hits 1121 1123 +2
- Misses 1912 1915 +3
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach looks elegant enough if you ask me.
What do you think @GabLeRoux @davidmfinol @AndrewKahr?
src/model/docker.ts
Outdated
${sshAgent ? `--volume ${sshAgent}:c:/ssh-agent` : ''} \ | ||
${ | ||
sshAgent && !sshPublicKeysDirectoryPath | ||
? `--volume c:/Users/Administrator/.ssh/known_hosts:c:/root/.ssh/known_hosts` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain where c:/root
comes from? Have you tested that this works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested only for linux runner, tried to port to windows as best as I can...
but looking at it again seems that sshAgent
isn't used in Windows anyway so probably I should remove these windows changes enitrely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea better to have working software with missing features than the added complexity of a non working piece of which nobody knows how much of it was intended to work.
Thanks.
…ows runner for now
Looks good to me. |
Thank you for the response! added complementary documentation and |
* add sshPublicKeysDirectoryPath and GIT_CONFIG_EXTENSIONS parameters that adds git configs and mounts .ssh/config and public keys to the container, in order to allow multiple sh deploy key trick by webplatform@ssh-agent * remove sshPublicKeysDirectoryPath and GIT_CONFIG_EXTENSIONS from windows runner for now
This PR's goal is to solve #340, hope it can be a good enough of a solution :)
Background
The webfactory/ssh-agent action handles the issue of authenticating with multiple SSH deploy keys to Github by adding the multiple public keys to the
.ssh
folder with custom file names, and then using them accordingly by addingurl.*.insteadOf
git configs.The problem is that these git configs as well as the SSH public keys are not uploaded to the container, so this mirroring doesn't work in the build.
Changes
sshPublicKeysDirectoryPath
input, which is a custom.ssh
that should contain the public keys andconfig
file.GIT_CONFIG_EXTENSIONS
environment variable to the container, which is a list ofkey=values
configs that can be retrieved fromgit config --list
that the git inside the container will use.Usage
With these changes, it's possible to fix the multiple SSH keys issue by using the following steps:
Checklist
code of conduct
a PR in the documentation repo)