-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
27 lines (23 loc) · 1.27 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -e
reset
# Update to use a different AWS profile
PROFILE=@@AwsCliProfile@@
STACK_NAME=@@PipelineName@@-Inception
echo "Create the initial CloudFormation Stack"
aws --region @@AwsRegion@@ --profile ${PROFILE} cloudformation create-stack --stack-name ${STACK_NAME} --template-body file://aws_seed.yml --parameters file://aws_seed-cli-parameters.json --capabilities "CAPABILITY_NAMED_IAM"
echo "Waiting for the CloudFormation stack to finish being created."
aws --region @@AwsRegion@@ --profile ${PROFILE} cloudformation wait stack-create-complete --stack-name ${STACK_NAME}
# Print out all the CloudFormation outputs.
aws --region @@AwsRegion@@ --profile ${PROFILE} cloudformation describe-stacks --stack-name ${STACK_NAME} --output table --query "Stacks[0].Outputs"
export CODECOMMIT_REPO=`aws --profile ${PROFILE} cloudformation describe-stacks --stack-name ${STACK_NAME} --output text --query "Stacks[0].Outputs[?OutputKey=='CodeCommitRepositoryCloneUrlHttp'].OutputValue"`
echo "Initialising Git repository"
git init
echo "Adding the newly created CodeCommit repository as origin"
git remote add origin ${CODECOMMIT_REPO}
echo "Adding all files"
git add .
echo "CodeCommitting files"
git commit -m "Initial commit"
echo "Pushing to CodeCommit"
git push --set-upstream origin master