Commit 5e8ae239 authored by Syed Bilal Raees's avatar Syed Bilal Raees

test

parent 1fcc4b8a
#!/bin/bash
# Written by Mohsin, Kashif, Muzamal and Bilal
# Date: Aug 18, 2022
# Version = 1.0
# set -x
if [ $# -lt 1 ]; then
echo -e "usage: $0 <blue | yellow | red> <all | lambda_name >
Examples:
1. script_name blue audit-trail-diff-lambda
2. script_name blue all
exit 2
fi
#####################
# Declaring Variables
#####################
ENVIRONMENT=$(echo $1 | tr '[:upper:]' '[:lower:]')
LAMBDA_NAME=$(echo $2 | tr '[:upper:]' '[:lower:]')
#Setting Working Directory
PATH_SET=/tmp/color_environment_fix_lambda
if [ ! -d “$PATH_SET” ]; then
mkdir -p $PATH_SET
else
# rm -rf $PATH_SET
mkdir -p $PATH_SET
fi
Function_Serverless(){
cd $PATH_SET
git clone https://github.com/Science37/$LAMBDA_NAME.git
cd $LAMBDA_NAME
??????
?????
}
Function_SAM(){
cd $PATH_SET
git clone https://github.com/Science37/$LAMBDA_NAME.git
cd $LAMBDA_NAME
npm install
aws cloudformation package --template ./sam-$ENVIRONMENT.yml --s3-bucket s37-$ENVIRONMENT-lambda --s3-prefix LAMBDA_NAME-$ENVIRONMENT --output-template-file output.yml
aws cloudformation deploy --template-file ./output.yml --stack-name
$LAMBDA_NAME-$ENVIRONMENT --capabilities CAPABILITY_IAM
}
#####################
# Main
#####################
If [ “$LAMBDA_NAME” = “all” ]; then
echo “it will update the all Lambdas”
#Declaring and array
declare -a lambda_array_sam=(
"audit-trail-migration-lambda"
"audit-trail-diff-lambda"
"audit-trail-queue-lambda"
)
declare -a lambda_array_serverless=(
"nora-rules-api-lambda"
"nora-email-template-api-lambda"
)
# SAM Based Lambdas:
# "audit-trail-migration-lambda"
# "audit-trail-diff-lambda"
# "Audit-trail-queue-lambda"
# ServerLess Based Lambdas:
# "nora-rules-api-lambda"
# "nora-email-template-api-lambda"
for LAMBDA_NAME in "${lambda_array_sam[@]}"
do
echo “Updating Lambda: $LAMBDA_NAME
Function_SAM
done
for LAMBDA_NAME in "${lambda_array_serverless[@]}"
do
echo “Updating Lambda: $LAMBDA_NAME
Function_Serverless
done
else
If [ $LAMBDA_NAME = "nora-rules-api-lambda" || $LAMBDA_NAME = "nora-email-template-api-lambda" ] ; then
Function_Serverless
else
Function_SAM
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment