-
Notifications
You must be signed in to change notification settings - Fork 259
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
Added repo-mappings and drop-extra-header options #38
Conversation
This solved a 3 day nightmare of a private repo pulling in two other private repos through go modules. Hope it helps! |
31701ba
to
b3227ba
Compare
@shaunco Thank you for the time you invested to understand this issue and for coming up with a PR! And sorry it took me so long to get back to it, I was a bit busy. What I like about your approach is that it does not require to use special URLs with made-up hostnames in the However, I still feel this makes the action way more complicated and thus harder to maintain (also given the fact that we don't have test coverage :-(). So, wouldn't the wrapper script suggested in #30 solve the issue as well, and possibly be usable in other situations (no GH actions) as well when you need multiple deploy keys? What is this extra HTTP header thing about? |
I've seen your comments over at #30, but I'd like to continue the discussion here since it applies to the proposal you made. I agree there's value in using configuration techniques built into So, could we – for the time being – try to reduce this PR somewhat in complexity, by removing things that are not absolutely necessary? Or, to put it another way, things where I'm not yet sure if they are Go-specific? Apart from that, the main two points I'd like to dicuss are a) private keys on disk and b) action configuration/syntax. a) Regarding private keys, I might be wrong, but I've read this PR as if the private keys are written to keyfiles on disk. This is something I've tried to avoid in this action in the first place: Keys are decrytped by GitHub (from secrets), passed into the worker and from there directly into This should not be a show-stopper for this PR, however, since #30 showed that choosing the preferred key in b) Regarding action configuration/syntax, I find the new So, what if we used key comments like in my suggestion in #30? We could go through That might make the order of keys irrelevant and remove the What do you think? |
Nothing in this is go specific, it just happens to be a technique that works everywhere - including go. The "extra HTTP header thing" is described in the README.md For writing keys to disk. I tried a few different ways to get ssh-add to take the keys via stdin, which would be preferred, but was unsuccessful. The technique in #30 still requires that you construct SSH keys in a very particular way, which is something I would like to avoid. I can spend some more time this week trying to get ssh-add from stdin to work. For I'm really not a fan of hiding configuration inside ssh key comments. That makes it really hard for anyone to look at their github action and figure out what is going on, as they'd need to also have access to secrets to see those comments. Having simple configuration of key x is for repo x, key y is for repo y, etc, keeps all knowledge in one place. That said, if having two side by side lists is adding to the confusion, we can combine them: - uses: webfactory/ssh-agent@v0.4.0
with:
ssh-private-key: |
github.com/OWNERX/REPO1 ${{ secrets.FIRST_KEY }}
bitbucket.com/OWNERY/REPO2 ${{ secrets.NEXT_KEY }}
github.com/OWNERX/REPO3 ${{ secrets.ANOTHER_KEY }} however, that will add quite a bit of new complexity to this action's parsing of the keys. |
I tried your fork and it worked elegantly, I really like the idea of having to map the SSH-keys to their corresponding repositories. It is easy to understand and I like the expliciteness of this approach. The instructions you provided were clear enough that I knew the keys needed to be in the same order as their repositories. I didn't even need to drop the extra http header. Many thanks 🙏 |
Updated README.md to include the two new options Fixed build.js to work on windows Fixed homedir lookup for windows Moved param names to const vars at the top and replaced all references
b3227ba
to
d561d1a
Compare
Hey @mpdude 👋🏻 I have been following this PR for a while, and reading through the fantastic work that @shaunco put together. Being able to set up multiple SSH keys to access a wide range of private repositories, instead of being limited to one, would be quite convenient for a lot of us. Obviously, we could use the git-repo-mapping branch on Shaunco's fork, but it seems a bit hacky. It would be nicer if these changes were merged into this nice GitHub Action. Is this going to happen anytime soon? |
Dear @shaunco, dear @Sinclert, @ryanzidago and possibly others, thank you all for your patience and sorry it sometimes takes me longer to get back to this than I'd like to see myself. The deploy key issue is not a pressing issue for my own organisation, so sometimes other issues grab more attention and I am limited in the time I can allocate to this. Please do not understand this as disinterest in your contributions, I definitely appreciate the time and energy you invest! In order to get this along, could we first address a few small changes that seem not 100% related to the basic issue? @shaunco if you'd like to create dedicated PRs for those, we'd have appropriate attribution in the code.
|
If this is really something that is not of interest to you or your team, or you don't have time to merge it, I will happily fork. We have about 40 repos that now depend on my branch at this point, so it isn't a huge deal to make it an proper fork. |
Ok, looking forward to your reply regarding pip/go. Note that the current code does not contain that HTTP header thing I did not fully understand and which I am unsure about has/should have anything to do with this action. Regarding keys: What if we added an additional configuration option using URL -> key fingerprints? |
The HTTP header was unrelated. That was to fix issues with git tag creation in a different repo. The keys all come from org secrets. Our developers don't have access to the fingerprints, and the fingerprint could change at any time (if a key gets rolled). It makes no sense to hardcode a key fingerprint in a github action yml file when the yml is not in control of the key. The method I used in #38 of just having a matched list worked great and was very easy to understand. |
Glad to hear that HTTP header thing was unrelated 👍. I understand that an explicit mapping is not an option in your case. I am sorry when the transition to how it's implemented right now causes additional work for you. However, I don't think that correlating keys and URLs from two input arguments via line number offset is a sane way of configuring things, sorry. |
Two options, that are side by side, is not sane ... but tying together 1 option in a yml file with 1 option that is configured in repo settings, is? |
Updated README.md to include the two new options
Fixed build.js to work on windows
Fixed homedir lookup for windows
Moved param names to const vars at the top and replaced all references
Resolves #30