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

Enable cloning via ssh #24

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

Enable cloning via ssh #24

wants to merge 19 commits into from

Conversation

slinstaedt
Copy link

@slinstaedt slinstaedt commented Jul 22, 2020

The current plugin has some issues, when it comes to clone a repository via ssh instead of http(s):

  1. As the ssh key is passed as environment variable and line breaks might need to be escaped accordingly passing the key into id_rsa with printf instead of echo is appropriate.
  2. Not all git servers use the default ssh port (22) for accessing the git repos (looking at you, stash). Afaik the port is only encoded into DRONE_GIT_SSH_URL, so some parsing magic is necessary to extract the information and trigger ssh-keyscan with the correct parameter. Also DRONE_NETRC_MACHINE is not always matching the ssh host.
  3. Replace DRONE_REMOTE_URL with DRONE_GIT_SSH_URL, so follow up scripts does not need to be touched.

@slinstaedt
Copy link
Author

PS: Please squash, if PR is accepted. I linked the forked repo with docker hub to get automated images while testing out various problems using good old console logging ;)

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.

1 participant