Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-cicd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Syed Bilal Raees
terraform-cicd
Commits
5e8ae239
Commit
5e8ae239
authored
Oct 03, 2022
by
Syed Bilal Raees
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
1fcc4b8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
0 deletions
+116
-0
test.sh
test.sh
+116
-0
No files found.
test.sh
0 → 100644
View file @
5e8ae239
#!/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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment