Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lambda/lib/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const AWS = require('aws-sdk')
AWS.config.update({ region: 'us-east-1' });
AWS.config.update({ region: 'eu-central-1' });
const codebuild = new AWS.CodeBuild()
const status = require('./status')

Expand All @@ -10,7 +10,8 @@ module.exports.run = (sourceVersion) => {
codebuild.startBuild({
projectName: process.env.PROJECT_NAME,
artifactsOverride: { type: 'NO_ARTIFACTS' },
sourceVersion: sourceVersion
sourceVersion: sourceVersion,
environmentVariablesOverride: [ { name: 'TRIGGERED_BY_GITHUB', value: 'true' } ]
})
.promise()

Expand Down
2 changes: 1 addition & 1 deletion lambda/lib/result.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const AWS = require('aws-sdk')
AWS.config.update({ region: 'us-east-1' });
AWS.config.update({ region: 'eu-central-1' });
const codebuild = new AWS.CodeBuild()
const status = require('./status')
const promiseRetry = require('promise-retry');
Expand Down
2 changes: 1 addition & 1 deletion lambda/lib/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports.update = (status, description, commit, buildId) => {
const ghrepo = client.repo(process.env.GITHUB_PROJECT_NAME)

return new Promise((resolve, reject) => {
const url = `https://console.aws.amazon.com/codebuild/home?region=us-east-1#/builds/${buildId}/view/new`
const url = `https://console.aws.amazon.com/codebuild/home?region=eu-central-1#/builds/${buildId}/view/new`
ghrepo.status(commit, {
"state": status,
"target_url": url,
Expand Down
5 changes: 2 additions & 3 deletions lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"deploy": "zip -q -r package.zip * && aws lambda update-function-code --function-name $PROJECT_NAME --zip-file 'fileb://package.zip'",
"deploy": "zip -q -r package.zip * && aws --profile staging lambda update-function-code --function-name $PROJECT_NAME --zip-file 'fileb://package.zip'",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
Expand All @@ -14,6 +14,5 @@
"octonode": "0.7.7",
"promise-retry": "1.1.1"
},
"devDependencies": {
}
"devDependencies": {}
}
4 changes: 2 additions & 2 deletions resources/create
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

aws cloudformation create-stack \
aws --profile staging cloudformation create-stack \
--stack-name $PROJECT_NAME \
--parameters ParameterKey=GithubProjectName,ParameterValue=$GITHUB_PROJECT_NAME \
ParameterKey=GithubToken,ParameterValue=$GITHUB_TOKEN \
Expand All @@ -11,5 +11,5 @@ aws cloudformation create-stack \
--capabilities CAPABILITY_IAM \
--capabilities CAPABILITY_NAMED_IAM && \

aws cloudformation wait stack-create-complete \
aws --profile staging cloudformation wait stack-create-complete \
--stack-name $PROJECT_NAME
6 changes: 3 additions & 3 deletions resources/find_keys
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# 2 stackname
# 3

key=$(aws cloudformation describe-stacks --stack-name $PROJECT_NAME --query 'Stacks[0].Outputs[?OutputKey==`AccessKeyId`] | [0].OutputValue' --output json | xargs echo)
key=$(aws --profile staging cloudformation describe-stacks --stack-name $PROJECT_NAME --query 'Stacks[0].Outputs[?OutputKey==`AccessKeyId`] | [0].OutputValue' --output json | xargs echo)
echo "AccessKeyId: ${key}"

secret=$(aws cloudformation describe-stacks --stack-name $PROJECT_NAME --query 'Stacks[0].Outputs[?OutputKey==`SecretAccessKey`] | [0].OutputValue' --output json | xargs echo)
secret=$(aws --profile staging cloudformation describe-stacks --stack-name $PROJECT_NAME --query 'Stacks[0].Outputs[?OutputKey==`SecretAccessKey`] | [0].OutputValue' --output json | xargs echo)
echo "SecretAccessKey: ${secret}"

arn=$(aws cloudformation describe-stacks --stack-name $PROJECT_NAME --query 'Stacks[0].Outputs[?OutputKey==`SNSTopic`] | [0].OutputValue' --output json | xargs echo)
arn=$(aws --profile staging cloudformation describe-stacks --stack-name $PROJECT_NAME --query 'Stacks[0].Outputs[?OutputKey==`SNSTopic`] | [0].OutputValue' --output json | xargs echo)
echo "SNSTopic: ${arn}"
8 changes: 3 additions & 5 deletions resources/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ Resources:
- Effect: Allow
Principal:
Service:
- codebuild.us-east-1.amazonaws.com
- codebuild.us-west-2.amazonaws.com
- codebuild.eu-west-1.amazonaws.com
- codebuild.amazonaws.com
Action:
- sts:AssumeRole
Path: "/"
Expand Down Expand Up @@ -81,9 +79,9 @@ Resources:
Environment:
Type: linuxContainer
ComputeType: BUILD_GENERAL1_SMALL
Image: aws/codebuild/nodejs:4.4.7
Image: aws/codebuild/java:openjdk-8
Source:
Location: https://github.com/tatums/aws-sam-example.git
Location: https://github.com/PayU/red-dragon.git
Type: GITHUB
TimeoutInMinutes: 10

Expand Down