feat: update with ssh agent support
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
68b46e4bec
commit
a17c5d1421
@ -26,6 +26,7 @@ steps:
|
|||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
commands:
|
commands:
|
||||||
|
- ssh-add
|
||||||
- cuddle x build_cuddle_image
|
- cuddle x build_cuddle_image
|
||||||
environment:
|
environment:
|
||||||
DOCKER_BUILDKIT: 1
|
DOCKER_BUILDKIT: 1
|
||||||
|
@ -121,12 +121,16 @@ fn pull_parent_cuddle_into_local(
|
|||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let mut rc = RemoteCallbacks::new();
|
let mut rc = RemoteCallbacks::new();
|
||||||
rc.credentials(|_url, username_from_url, _allowed_types| {
|
rc.credentials(|_url, username_from_url, _allowed_types| {
|
||||||
|
if "true".to_string() == std::env::var("CUDDLE_SSH_AGENT").ok().unwrap_or("".into()) {
|
||||||
|
git2::Cred::ssh_key_from_agent(username_from_url.unwrap())
|
||||||
|
} else {
|
||||||
git2::Cred::ssh_key(
|
git2::Cred::ssh_key(
|
||||||
username_from_url.unwrap(),
|
username_from_url.unwrap(),
|
||||||
None,
|
None,
|
||||||
Path::new(&format!("{}/.ssh/id_ed25519", env::var("HOME").unwrap())),
|
Path::new(&format!("{}/.ssh/id_ed25519", env::var("HOME").unwrap())),
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut fo = FetchOptions::new();
|
let mut fo = FetchOptions::new();
|
||||||
|
@ -21,6 +21,7 @@ RUN cargo install --target x86_64-unknown-linux-musl --path cuddle_cli
|
|||||||
FROM docker:dind
|
FROM docker:dind
|
||||||
|
|
||||||
RUN apk add bash git
|
RUN apk add bash git
|
||||||
|
RUN eval `ssh-agent`
|
||||||
|
|
||||||
COPY --from=1password/op:2 /usr/local/bin/op /usr/local/bin/op
|
COPY --from=1password/op:2 /usr/local/bin/op /usr/local/bin/op
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user