Skip to content

Commit

Permalink
Store private key as env variable and ssh-add
Browse files Browse the repository at this point in the history
- contents of ~/.ssh/gerrit in jenkins is now stored as an environment variable ID_RSA
  • Loading branch information
Athmika-HS committed Mar 28, 2022
1 parent 12b5528 commit 381aa8b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/docker-execute
Original file line number Diff line number Diff line change
Expand Up @@ -229,21 +229,24 @@ docker run --privileged=true -dit \
-e PACKAGE_NAME=$PACKAGE_NAME \
-e REPO_NAME=$REPO_NAME \
-e SSH_KEY=$SSH_KEY \
-e PRIV_KEY=$(cat ${HOME}/.ssh/gerrit) \
--env "LOCAL_GITHUB_ACCESS_TOKEN=$LOCAL_GITHUB_ACCESS_TOKEN" \
"${DOCKER_OPTS[@]}" \
--cap-add=SYS_PTRACE \
"$IMAGE_NAME" "${CONTAINER_ARGS[@]}"

#docker exec ${CONTAINER_NAME} bash -c 'echo $SSH_AUTH_SOCK'
echo "Docker exec:-"

#docker exec ${CONTAINER_NAME} bash -c 'chmod dependabot:dependabot /home/dependabot/dependabot-core/tmp';
docker exec -u 0 ${CONTAINER_NAME} bash -c 'ls -ald /home/dependabot/dependabot-core/tmp;
docker exec ${CONTAINER_NAME} bash -c 'ls -ald /home/dependabot/dependabot-core/tmp;
ls -ald /home/dependabot/dependabot-core;
echo "UID: $(id -u)"
echo "GID: $(id -g)"
whoami;
ls -la /home/dependabot/.ssh;
eval $(ssh-agent -s);
ssh-add $PRIV_KEY;
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" jenkins@gerrit.helpshift.com gerrit query --current-patch-set project:${REPO_NAME} branch:feature/dependabot | grep revision | tr -s " " | cut -d " " -f 3); \
Expand Down

0 comments on commit 381aa8b

Please sign in to comment.