Skip to content

Commit

Permalink
Mount only the .ssh directory and do no copy contents of RSA key
Browse files Browse the repository at this point in the history
- Remove code that copied the keys in another file called id_rsa
- Since the current host user is the user inside docker now, there should be no permission issues to read the SSH key and add the keys to the agent.
  • Loading branch information
iathmika committed Apr 21, 2022
1 parent b966cfb commit 713d5db
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions bin/docker-execute
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ echo "package: $2"
echo "Image: $IMAGE_NAME"
echo "UID: $(id -u)"
echo "GID: $(id -g)"
rm -rf $(pwd)/id_rsa

cat ~/.ssh/gerrit > $(pwd)/id_rsa
# Enable docker buildkit with inline cache builds
export DOCKER_BUILDKIT=1
Expand Down Expand Up @@ -233,7 +233,6 @@ docker run --privileged=true -dit \
-v "$(pwd)/omnibus/script:$CODE_DIR/omnibus/script" \
-v "$(pwd)/tmp:$CODE_DIR/tmp" \
-v "${HOME}/.ssh:/home/dependabot/.ssh:ro" \
-v "$(pwd)/id_rsa:$CODE_DIR/id_rsa" \
--name "$CONTAINER_NAME" \
-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
-e PACKAGE_NAME=$PACKAGE_NAME \
Expand All @@ -254,8 +253,6 @@ echo "UID: $(id -u)"
echo "GID: $(id -g)"
whoami;
eval $(ssh-agent -s);
ssh-add /home/dependabot/dependabot-core/id_rsa;
ssh-add /home/dependabot/.ssh/$(echo $(cat /home/dependabot/.ssh/config | grep IdentityFile) | cut -d " " -f 2 | cut -d "/" -f 3);
for c in $(ssh -p 29418 -o "StrictHostKeyChecking no" [email protected] gerrit query --current-patch-set project:${REPO_NAME} branch:feature/dependabot | grep revision | tr -s " " | cut -d " " -f 3); \
do ssh -p 29418 [email protected] gerrit review $c --abandon; \
Expand Down

0 comments on commit 713d5db

Please sign in to comment.