Skip to content

Conversation

@TrevorGibson-SR
Copy link

Proposed as a solution to #807

When cloning multiple private GitHub repositories with SSH, you can use the deploy key mapping feature of the webfactory/ssh-agent GitHub action to map specific SSH keys to their respective GitHub repositories. This works as intended when cloning in the main GitHub runner environment, but fails to translate over to the industrial_ci docker environment.

Webfactory/ssh-agent specifically calls this out and suggests to copy the ~/.ssh directory and ~/.gitconfig file into the docker container to ensure the mappings are carried over. This change simply adds two new docker mount arguments to import the SSH configuration into the Docker container's build environment.

Comment on lines +99 to +100
ici_forward_mount /home/runner/.gitconfig rw
ici_forward_mount /home/runner/.ssh rw
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot hardcode Gihub-specific paths.

@mathias-luedtke
Copy link
Member

Please try adding .gitconfig here:

export DOCKER_CREDENTIALS=${DOCKER_CREDENTIALS-.docker .ssh .subversion}

And why would we mount them rw?
This is not advisable for running CI locally.

@mathias-luedtke
Copy link
Member

I think we could just add .gitconfig to

export DOCKER_CREDENTIALS=${DOCKER_CREDENTIALS-.docker .ssh .subversion}

@mathias-luedtke
Copy link
Member

I think we could just add .gitconfig to

#844

@mathias-luedtke
Copy link
Member

@TrevorGibson-SR: The latest version should copy .gitconfig and .ssh. Is there anythings else needed for multiple SSH keys?

@mathias-luedtke
Copy link
Member

To answer my question:

Is there anythings else needed for multiple SSH keys?

webfactory/ssh-agent does not configure the host keys, #902 just uses the known hosts from the GitHub runner.
In addition the generated config does not work inside docker, because of the hard-coded paths, so it needs some patch:
https://github.com/mathias-luedtke/sshtest/blob/main/.github/workflows/main.yml#L46

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.

2 participants