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

Add capabilities to fetch ssh dependencies by passing an ssh key #78

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

nagua
Copy link
Contributor

@nagua nagua commented May 10, 2024

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

Currently there is no way in cargo-deny-action to fetch and evaluate ssh dependencies (see #67).
I order to enable the feature this PR introduces four changes:

  1. A new action input to pass a private ssh-key for ssh authentication
  2. A new action input to pass ssh known hosts so a ssh connection can be established
  3. A new action input to use the git cli instead of the build in cargo fetcher to enable ssh git repositories
  4. It adds openssh to the Docker image to allow git to use ssh for cloning

It also updates the rust + cargo_deny version. If you wish to separate these changes, feel free to
change this.

Related Issues

Fixes #67

@nagua nagua requested a review from Jake-Shadle as a code owner May 10, 2024 12:40
@umgefahren
Copy link

umgefahren commented May 26, 2024

Is there any way this could work with webfactory/ssh-agent? I tried this PR in our CI and it doesn't work. However I have other jobs using ssh-agent where it does work.

@nagua
Copy link
Contributor Author

nagua commented Jun 8, 2024

I don't have much experience with ssh-agent. So I would need to investigate that. You would probably need to pass the ssh-agent socket or something like that into the container.

@Jake-Shadle
Copy link
Member

So does this PR actually work, or only in some cases? If it doesn't work in all cases I would be hesitant to merge this because I personally don't need this feature and would then need to rely on contributors to fix/improve it since I wouldn't notice when/how it was broken.

@nagua
Copy link
Contributor Author

nagua commented Jun 27, 2024

@Jake-Shadle I'm not sure what you mean with that. Whenever you have an ssh key that you can pass around as a string to the github action you can use this PR to access crates via ssh. You can currently only use one ssh-key and you cannot use ssh-agent. But I don't know if there is a use-case for that or how it could be implemented.

@umgefahren I looked at that github action and I cannot see a way how this could work with the cargo-deny action. The cargo-deny action spawns a new docker container via the actions.yml. For this to work we would need to mount the SSH_AUTH_SOCK socket into the container. But as far as I can see github doesn't let you specify additional mounts for a docker based action. The only way that I can currently see would be to completely rewrite the action and spawn the container in a host based script ourself.

The only thing we could currently discuss if we need to support more than one ssh-key.

@Jake-Shadle
Copy link
Member

If someone needs multiple keys they can make a PR.

@Jake-Shadle Jake-Shadle merged commit 3f8dc3e into EmbarkStudios:main Jun 27, 2024
1 check passed
@nagua nagua deleted the AddSshAuthentification branch June 27, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't use ssh to fetch private repos
3 participants