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

DOF: complete module 4 lab 1 #24

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
23 changes: 23 additions & 0 deletions lab_1/scripts/build-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

repository="https://github.com/EPAM-JS-Competency-center/shop-angular-cloudfront.git"
localFolder="/Users/$USER/Desktop/DOF/EPAM-JS-Competency-center"
compressedClientApp="/Users/$USER/Desktop/DOF/EPAM-JS-Competency-center/dist/client-app.zip"
dist="/Users/$USER/Desktop/DOF/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 "Compressed client app already exists";
rm -i "$compressedClientApp"
echo "Compressed client app was deleted";
fi

zip -r client-app.zip "$dist"
19 changes: 19 additions & 0 deletions lab_1/scripts/quality-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

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

echo "Running linting..."
npm run lint

echo "Running unit tests..."
npm run test

echo "Running npm audit..."
npm audit

if [ $? -eq 0 ]; then
echo "Code quality checks passed!"
else
echo "Code quality checks failed. Please check the logs for more information."
exit 1
fi
16 changes: 16 additions & 0 deletions lab_1/scripts/update-pipeline-definition.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

lab1Dir="/Users/$USER/Desktop/DOF/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