-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Graham Krizek
committed
Dec 10, 2018
1 parent
e344ad0
commit 8f0b3ed
Showing
1 changed file
with
6 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
} |