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
23 changes: 23 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
pipeline {
agent{
node{
label 'Built-In'
}
}
stages {
stage('Lambda Deployment') {
when { branch 'develop'}
steps {
timeout(time: 150, unit: 'SECONDS') {
input "Replace Lambda Source Code ?"
}
script {
sh "export AWS_PROFILE=cd-sandbox"
sh "aws --version"

sh "aws lambda update-function-code --function-name lambda-automation-test --zip-file fileb://lambda-function.zip --region us-east-1"
}
}
}
}
}
18 changes: 18 additions & 0 deletions ci/lambda-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

ROLE_ARN=$1
AWS_PROFILE=$2
ROLE_SESSION_NAME=lambda-deployment

# this assumes that the ecr_login has been done before which gives the docker container access to the production server deployment role
CREDENTIALS=`aws sts assume-role --role-arn $1 --role-session-name $ROLE_SESSION_NAME --profile $2`
export AWS_ACCESS_KEY_ID=`echo $CREDENTIALS | jq -r .Credentials.AccessKeyId`
export AWS_SECRET_ACCESS_KEY=`echo $CREDENTIALS | jq -r .Credentials.SecretAccessKey`
export AWS_SESSION_TOKEN=`echo $CREDENTIALS | jq -r .Credentials.SessionToken`
export AWS_DEFAULT_REGION='us-east-1'

echo $AWS_ACCESS_KEY_ID
echo $AWS_SECRET_ACCESS_KEY
echo $AWS_SESSION_TOKEN

aws lambda update-function-code --function-name lambda-automation-test --zip-file fileb://../lambda-function.zip
Binary file added lambda-function.zip
Binary file not shown.