Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LAB-1 #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
27 changes: 27 additions & 0 deletions lab_1/scripts/build-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

repository="https://github.com/EPAM-JS-Competency-center/shop-angular-cloudfront.git"
localFolder="/Users/$USER/Desktop/Devops-fundamentals/EPAM-JS-Competency-center"
compressedClientApp="/Users/$USER/Desktop/Devops-fundamentals/EPAM-JS-Competency-center/dist/client-app.tar.gz"
clientAppDir="/Users/$USER/Desktop/Devops-fundamentals/EPAM-JS-Competency-center/dist/app/"
dist="/Users/$USER/Desktop/Devops-fundamentals/EPAM-JS-Competency-center/dist/"
ENV_CONFIGURATION=''

git clone "$repository" "$localFolder"

cd "$localFolder" || exit

npm install

npm run-script build --configuration="$ENV_CONFIGURATION"

if [ -f "$compressedClientApp" ]; then
echo "We've already have compressed file";
rm -i "$compressedClientApp"
echo "Compressed client app was deleted";
fi

tar -zcvf client-app.tar.gz "$clientAppDir"

mv client-app.tar.gz "$dist"

24 changes: 24 additions & 0 deletions lab_1/scripts/quality-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

cd ~/Desktop/Devops-fundamentals/EPAM-JS-Competency-center/ || exit

if npm run lint
then
echo "npm run lint was passed SUCCESS"
else
echo "npm run lint was FAILED"
fi

if npm run test
then
echo "run test was passed SUCCESS"
else
echo "run test was FAILED"
fi

if npm audit
then
echo "npm audit was passed SUCCESS"
else
echo "npm audit was FAILED"
fi
19 changes: 19 additions & 0 deletions lab_1/scripts/update-pipeline-definition.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

lab1Dir="/Users/$USER/Desktop/Devops-fundamentals/devops-fundamentals-course/lab_1"
defaultBranchName="main"

echo -n "Enter a source branch to use (default: $defaultBranchName): "
read -r branchName
branchName=${branchName:-$defaultBranchName}

cd "$lab1Dir" || exit

cp "$lab1Dir"/pipeline.json "$lab1Dir"/pipeline-"$(date +'%m-%d-%Y')".json

jq 'del(.metadata)' pipeline-"$(date +'%m-%d-%Y')".json > tmp.$$.json && mv tmp.$$.json pipeline-"$(date +'%m-%d-%Y')".json
jq '.pipeline.version = .pipeline.version + 1' pipeline-"$(date +'%m-%d-%Y')".json > tmp.$$.json && mv tmp.$$.json pipeline-"$(date +'%m-%d-%Y')".json

jq --arg branchName "$branchName" '.pipeline.stages[0].actions[0].configuration.Branch = $branchName' pipeline-"$(date +'%m-%d-%Y')".json > tmp.$$.json && mv tmp.$$.json pipeline-"$(date +'%m-%d-%Y')".json