Skip to content
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
70 changes: 70 additions & 0 deletions lab_1/scripts/build-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/bin/bash -
#===============================================================================
#
# FILE: build-client.sh
#
# USAGE: ./build-client.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: YOUR NAME (),
# ORGANIZATION:
# CREATED: 03/13/2023 23:51
# REVISION: ---
#===============================================================================

set -e
set -o pipefail

echo "$PWD"

SCRIPT_DIR=$PWD
#`dirname "$(readlink -f "$BASH_SOURCE")"`
ROOT_DIR=$PWD
#${SCRIPT_DIR%/*}
CLIENT_BUILD_DIR=$ROOT_DIR/dist
ENV_FILE_PATH=$ROOT_DIR/.env
PATH_TO_QUALITY_SCRIPT="$ROOT_DIR/quality-check.sh"



echo "$ROOT_DIR"
echo "$SCRIPT_DIR"
echo "$CLIENT_BUILD_DIR"
echo "$(basename "../$CLIENT_BUILD_DIR")"

currentBuildArchive=$ROOT_DIR/dist/client-app.zip

if [ -e "$ENV_FILE_PATH" ]; then
# for testing environment variables from .env
export $(grep -v '^#' $ENV_FILE_PATH | xargs -d '\n')
else
echo ".env file is not found"
fi

echo "$ENV_CONFIGURATION"

if [ -e "$currentBuildArchive" ]; then
rm -rf "$currentBuildArvhive"
echo "Previous build $currentBuildArchive was successfully removed"
fi

rm -rf $CLIENT_BUILD_DIR

rm -rf node_modules

npm cache clean --force

npm i

source "$PATH_TO_QUALITY_SCRIPT"

npm run build --configuration=${ENV_CONFIGURATION:-"production"} --output-path=$CLIENT_BUILD_DIR

zip -r $currentBuildArchive "$(basename "../$CLIENT_BUILD_DIR")"

echo "The application was successfully build with $ENV_CONFIGURATION configuration."
121 changes: 121 additions & 0 deletions lab_1/scripts/pipeline-18-03-2023.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"pipeline": {
"name": "angular-shop",
"roleArn": "roleArn",
"artifactStore": {
"type": "S3",
"location": "codepipeline-artifactStore-location"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"provider": "GitHub",
"version": "1"
},
"runOrder": 1,
"configuration": {
"Branch": "develop",
"OAuthToken": "****",
"Owner": "",
"PollForSourceChanges": true,
"Repo": "shop-angular-cloudfront"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts": [],
"region": "us-east-1",
"namespace": "SourceVariables"
}
]
},
{
"name": "QualityGate",
"actions": [
{
"name": "LintingAntUnitTesting",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"EnvironmentVariables": "[{\"name\":\"BUILD_CONFIGURATION\",\"value\":\"\",\"type\":\"PLAINTEXT\"}]",
"ProjectName": "client-app-quality"
},
"outputArtifacts": [],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
],
"region": "us-east-1"
}
]
},
{
"name": "Approve",
"actions": [
{
"name": "ManualApproval",
"actionTypeId": {
"category": "Approval",
"owner": "AWS",
"provider": "Manual",
"version": "1"
},
"runOrder": 1,
"configuration": {
"CustomData": "Approve me"
},
"outputArtifacts": [],
"inputArtifacts": [],
"region": "us-east-1"
}
]
},
{
"name": "Build",
"actions": [
{
"name": "BuildAndDeploy",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"EnvironmentVariables": "[{\"name\":\"BUILD_CONFIGURATION\",\"value\":\"\",\"type\":\"PLAINTEXT\"}]",
"ProjectName": "client-app-build"
},
"outputArtifacts": [
{
"name": "BuildArtifact"
}
],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
],
"region": "us-east-1",
"namespace": "BuildVariables"
}
]
}
],
"version": 2
}
}
126 changes: 126 additions & 0 deletions lab_1/scripts/pipeline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
{
"pipeline": {
"name": "angular-shop",
"roleArn": "roleArn",
"artifactStore": {
"type": "S3",
"location": "codepipeline-artifactStore-location"
},
"stages": [
{
"name": "Source",
"actions": [
{
"name": "Source",
"actionTypeId": {
"category": "Source",
"owner": "ThirdParty",
"provider": "GitHub",
"version": "1"
},
"runOrder": 1,
"configuration": {
"Branch": "{{Branch name}}",
"OAuthToken": "****",
"Owner": "{{GitHub Owner}}",
"PollForSourceChanges": "{{PollForSourceChanges}}",
"Repo": "shop-angular-cloudfront"
},
"outputArtifacts": [
{
"name": "SourceArtifact"
}
],
"inputArtifacts": [],
"region": "us-east-1",
"namespace": "SourceVariables"
}
]
},
{
"name": "QualityGate",
"actions": [
{
"name": "LintingAntUnitTesting",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"EnvironmentVariables": "[{\"name\":\"BUILD_CONFIGURATION\",\"value\":\"{{BUILD_CONFIGURATION value}}\",\"type\":\"PLAINTEXT\"}]",
"ProjectName": "client-app-quality"
},
"outputArtifacts": [],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
],
"region": "us-east-1"
}
]
},
{
"name": "Approve",
"actions": [
{
"name": "ManualApproval",
"actionTypeId": {
"category": "Approval",
"owner": "AWS",
"provider": "Manual",
"version": "1"
},
"runOrder": 1,
"configuration": {
"CustomData": "Approve me"
},
"outputArtifacts": [],
"inputArtifacts": [],
"region": "us-east-1"
}
]
},
{
"name": "Build",
"actions": [
{
"name": "BuildAndDeploy",
"actionTypeId": {
"category": "Build",
"owner": "AWS",
"provider": "CodeBuild",
"version": "1"
},
"runOrder": 1,
"configuration": {
"EnvironmentVariables": "[{\"name\":\"BUILD_CONFIGURATION\",\"value\":\"{{BUILD_CONFIGURATION value}}\",\"type\":\"PLAINTEXT\"}]",
"ProjectName": "client-app-build"
},
"outputArtifacts": [
{
"name": "BuildArtifact"
}
],
"inputArtifacts": [
{
"name": "SourceArtifact"
}
],
"region": "us-east-1",
"namespace": "BuildVariables"
}
]
}
],
"version": 1
},
"metadata": {
"pipelineArn": "pipelineArn",
"created": 1586327944.749,
"updated": 1587023189.403
}
}
27 changes: 27 additions & 0 deletions lab_1/scripts/quality-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash -
#===============================================================================
#
# FILE: quality-check.sh
#
# USAGE: ./quality-check.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: YOUR NAME (),
# ORGANIZATION:
# CREATED: 03/14/2023 11:54
# REVISION: ---
#===============================================================================

set -o nounset # Treat unset variables as an error
set -e
set -o pipefail

npm run lint
npm run test
npm run e2e

Loading