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 option to mount host ssh agent (--ssh) #336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ohenning
Copy link

PR Purpose
This PR provides a new setting to the plugin:

ssh_agent-> Pass host ssh agent to the Image. Under the hood this triggers the --ssh option to be set when building the image (https://docs.docker.com/develop/develop-images/build_enhancements/#using-ssh-to-access-private-data-in-builds).

This get's really useful when it's required to access private repositories from inside the Image to build.

Additional Info
For this to work, it's necessary to have DOCKER_BUILDKIT enabled.
Example:

drone.yaml

- name: "publish"
   image: plugins/ecr
   environment:
     DOCKER_BUILDKIT: 1
   settings:
     repo: foo/bar
     ssh_agent: default

Dockerfile

COPY go.mod go.sum* ./
RUN --mount=type=ssh go mod download

the docker plugin documentation might have to be updated.

@d1wilko
Copy link
Contributor

d1wilko commented Oct 19, 2021

Hi @ohenning can you have a look at the failing checks on this one?

We will have a look into this PR over the next few weeks (coming to end of quarter and have features to deliver!) to confirm it doesn't introduce any security vulnerabilities that we should be concerned about :)

Thanks for your work on this!

PS might also be worth a rebase!

@ohenning
Copy link
Author

Hi @d1wilko , thanks for your feedback! Rebasing resolved the failing build! 👍

@lecardozo
Copy link

Hey, @d1wilko! Any new thoughts on this feature? I could benefit from it as well 😃

@bkk-bcd
Copy link

bkk-bcd commented Jun 22, 2022

This is something we need for our drone builds, can you work at getting this merged @d1wilko ?

@eoinmcafee00
Copy link
Contributor

Hey @ohenning

Looks like the branch has conflicts? Can you merge master please?

@bkk-bcd bkk-bcd mentioned this pull request Jun 26, 2022
@bkk-bcd
Copy link

bkk-bcd commented Jun 26, 2022

@jimsheldon @eoinmcafee00 I've addressed the merge conflicts in #369. Can someone take a look so we can get it merged in?

@eoinmcafee00
Copy link
Contributor

Hey @ohenning

Have you been able to verify this change works? This change expects the ability to mount the ssh directory which the docker plugin doesn't support. Can you provide some screenshots of this working, please? Also, it still seems to be complaining about conflicts.

Cheers,
Eoin

@bkk-bcd
Copy link

bkk-bcd commented Jul 9, 2022

I couldn't get this to work, fixes in #369

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.

5 participants