drone-docker
drone-docker copied to clipboard
Add option to mount host ssh agent (--ssh)
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.
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!
Hi @d1wilko , thanks for your feedback! Rebasing resolved the failing build! 👍
Hey, @d1wilko! Any new thoughts on this feature? I could benefit from it as well 😃
This is something we need for our drone builds, can you work at getting this merged @d1wilko ?
Hey @ohenning
Looks like the branch has conflicts? Can you merge master please?
@jimsheldon @eoinmcafee00 I've addressed the merge conflicts in #369. Can someone take a look so we can get it merged in?
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
I couldn't get this to work, fixes in #369