diff --git a/lab_1/scripts/build-client.sh b/lab_1/scripts/build-client.sh new file mode 100755 index 0000000..04d6382 --- /dev/null +++ b/lab_1/scripts/build-client.sh @@ -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" + diff --git a/lab_1/scripts/quality-check.sh b/lab_1/scripts/quality-check.sh new file mode 100755 index 0000000..2271fc0 --- /dev/null +++ b/lab_1/scripts/quality-check.sh @@ -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 diff --git a/lab_1/scripts/update-pipeline-definition.sh b/lab_1/scripts/update-pipeline-definition.sh new file mode 100755 index 0000000..2c66625 --- /dev/null +++ b/lab_1/scripts/update-pipeline-definition.sh @@ -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 + +