Skip to content

Commit

Permalink
Update git example
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Krizek committed Dec 10, 2018
1 parent e344ad0 commit 8f0b3ed
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/example-git.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ handler () {
EVENT_DATA=$1
echo $EVENT_DATA

REPO=$(echo $EVENT_DATA | jq ."repository")
REPO=$(echo $EVENT_DATA | jq -r ."repository")
OWNER=$(echo $EVENT_DATA | jq -r ."owner")
BUCKET=$(echo $EVENT_DATA | jq -r ."bucket")
mkdir -p /tmp/.ssh
aws s3 cp s3://bucket/id_rsa /tmp/.ssh/id_rsa
aws s3 cp s3://$BUCKET/id_rsa /tmp/.ssh/id_rsa
chmod 400 /tmp/.ssh/id_rsa
eval `ssh-agent -s`
export GIT_SSH="/tmp"
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/tmp/.ssh/known_hosts -i /tmp/.ssh/id_rsa"
ssh-add /tmp/.ssh/id_rsa 2>&1
ssh-keyscan github.com >> /tmp/.ssh/known_hosts 2>&1
git clone ssh://[email protected]/owner/repo.git /tmp/repo 2>&1
ls -al /tmp/repo
git clone ssh://[email protected]/$OWNER/$REPO.git /tmp/$REPO 2>&1
ls -al /tmp/$REPO

echo "Successfully cloned repository" >&2
}

0 comments on commit 8f0b3ed

Please sign in to comment.