Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
316 commits
Select commit Hold shift + click to select a range
e1d0c88
unitest
dimitardd Nov 16, 2024
6abfbce
secrets
dimitardd Nov 16, 2024
a349a8a
test
dimitardd Nov 18, 2024
7edf33b
test
dimitardd Nov 18, 2024
2debbbd
test
dimitardd Nov 18, 2024
de0179a
test
dimitardd Nov 18, 2024
11edee0
test
dimitardd Nov 18, 2024
0771d2c
test
dimitardd Nov 18, 2024
279fa32
testt
dimitardd Nov 18, 2024
d043c63
SONAR_TOKEN
dimitardd Nov 18, 2024
710f723
test
dimitardd Nov 18, 2024
d6d0d4b
dimitardd-281024
dimitardd Nov 18, 2024
f563943
teset
dimitardd Nov 18, 2024
c49f119
test
dimitardd Nov 18, 2024
1a4e6a4
apt-get clean
dimitardd Nov 18, 2024
0d3d28b
dimitardd_devops-programme
dimitardd Nov 18, 2024
b84f9f6
devops-programme
dimitardd Nov 18, 2024
c1b6b03
tesy
dimitardd Nov 18, 2024
a1b6e64
test
dimitardd Nov 18, 2024
bb2002e
dimitardd/dimitar-app02
dimitardd Nov 18, 2024
2882df7
sonarsource/[email protected]
dimitardd Nov 18, 2024
000b309
sonar
dimitardd Nov 18, 2024
53aedef
ttt
dimitardd Nov 18, 2024
eacb63f
app
dimitardd Nov 18, 2024
f9f3cca
app
dimitardd Nov 18, 2024
4334e33
dimitardd-281024
dimitardd Nov 18, 2024
493d179
test
dimitardd Nov 19, 2024
ffaf332
test
dimitardd Nov 19, 2024
572582b
test
dimitardd Nov 19, 2024
9fab8ca
test
dimitardd Nov 19, 2024
6ce2f9e
test
dimitardd Nov 19, 2024
5135e72
sonarcloud-security:
dimitardd Nov 19, 2024
f0e1957
test
dimitardd Nov 19, 2024
6649a18
test
dimitardd Nov 19, 2024
ed4777d
sf
dimitardd Nov 19, 2024
8efc7f3
test
dimitardd Nov 19, 2024
da189df
sonarclud dir app
dimitardd Nov 19, 2024
03bbf65
safsa
dimitardd Nov 19, 2024
8357705
test
dimitardd Nov 19, 2024
13b5ccf
build
dimitardd Nov 25, 2024
dde456c
push
dimitardd Nov 25, 2024
30c670d
full test
dimitardd Nov 25, 2024
54af73e
Update README.md
dimitardd Dec 19, 2024
0c79b3f
terraform init
dimitardd Dec 21, 2024
b81b70f
Update github-actions-demo.yml
dimitardd Jan 9, 2025
23daa4c
Update github-actions-demo.yml
dimitardd Jan 9, 2025
25d0406
Update README.md
dimitardd Jan 9, 2025
75b9d7f
Update README.md
dimitardd Jan 9, 2025
89b7ae1
Update github-actions-demo.yml
dimitardd Jan 9, 2025
acfbc7f
Update github-actions-demo.yml
dimitardd Jan 9, 2025
1f93fe5
Update github-actions-demo.yml
dimitardd Jan 10, 2025
f6ca95d
deplayment
Jan 12, 2025
9167c93
sof-app01
dimitardd Jan 12, 2025
78285dd
change namespace in deplayment
dimitardd Jan 12, 2025
af0585d
namespace changed
dimitardd Jan 12, 2025
3a8fc0d
namespace
dimitardd Jan 12, 2025
814bbcc
image name correction
dimitardd Jan 12, 2025
dd8b7b7
chnage port 3000 in deplayment sof-app01
dimitardd Jan 12, 2025
614d1e1
form
dimitardd Jan 13, 2025
b66c6b4
added gitignore for terraform
dimitardd Jan 13, 2025
8d351c7
Delete terraform/.terraform.lock.hcl
dimitardd Jan 13, 2025
87c6bc8
gitignore terrafrom
dimitardd Jan 13, 2025
7834281
clean repo
dimitardd Jan 13, 2025
eb35f1c
add branch dimitardd-281024 in action plan
dimitardd Jan 13, 2025
d83d621
Run editorconfig-checker
dimitardd Jan 13, 2025
c433100
MD009/no-trailing-spaces Trailing spaces in terraform/README.md
dimitardd Jan 13, 2025
18eb7e9
build green image
dimitardd Jan 13, 2025
4d8f5c0
build Green image
dimitardd Jan 13, 2025
4add8a0
sof-app01 deplayment
dimitardd Jan 13, 2025
600f531
sof-app01 service file
dimitardd Jan 13, 2025
752281a
fix missing symbol in sof-app01-svc
dimitardd Jan 13, 2025
a3a5c6b
add sof-app01 igress file
dimitardd Jan 13, 2025
708132e
add portname on sof-app01 service
dimitardd Jan 13, 2025
42dc6a8
fix sof-app01 ingress
dimitardd Jan 13, 2025
4fb3e4a
build blue immage
dimitardd Jan 13, 2025
eee5295
create rollout plan
dimitardd Jan 13, 2025
040b1e8
sof-app02-service name fix
dimitardd Jan 13, 2025
cb835ed
sof-app02 service target port fix
dimitardd Jan 13, 2025
846360e
add namespace to sof-app02
dimitardd Jan 13, 2025
bd6194c
fix rollout demo
dimitardd Jan 14, 2025
d957d64
fix rollout demo
dimitardd Jan 14, 2025
1f39bcb
rollout ingress
dimitardd Jan 14, 2025
8306d1a
sof-app02 rollout
dimitardd Jan 14, 2025
b8bd862
fix new line ending in sof-app02-service
dimitardd Jan 14, 2025
df1a724
reorganazi terraform per folder
dimitardd Jan 14, 2025
83b8da7
argocd terrafrom provider is desabled for debugging
dimitardd Jan 14, 2025
278323c
gitignor files added
dimitardd Jan 14, 2025
b2187e8
gitignor files
dimitardd Jan 14, 2025
00944e3
fix ~
dimitardd Jan 14, 2025
ccd2771
terrafrom state file location fix
dimitardd Jan 14, 2025
e25ca67
new empty line on end of files
dimitardd Jan 14, 2025
3157669
terraform configuration for application in argocd sof-app01
dimitardd Jan 14, 2025
c82f782
remove description as it is not supported
dimitardd Jan 14, 2025
51970c5
separates terraform argocd application sof-app01
dimitardd Jan 14, 2025
bf53dc3
change sof-app01 image to blue
dimitardd Jan 14, 2025
ffc5e94
update image in sof-app01
dimitardd Jan 14, 2025
68abd1e
enable github action for branch dimitardd-281024
dimitardd Jan 14, 2025
7310526
sof-app01 cert
dimitardd Jan 15, 2025
fb7abbe
sof-app01-tls secret name
dimitardd Jan 15, 2025
bd12a27
sof-app01-tls fir crt and key base64
dimitardd Jan 15, 2025
b7eb1b1
sof-app01-tls
dimitardd Jan 15, 2025
debc82a
sof-app01-tls
dimitardd Jan 15, 2025
1a117c4
sof-app01-tls
dimitardd Jan 15, 2025
5aedbc4
add resorurce limit to sof-app01
dimitardd Jan 15, 2025
517b1d5
deplay Green image
dimitardd Jan 15, 2025
5a7e317
add auto sync in argocd delayment for sof-app01
dimitardd Jan 15, 2025
3b53ba2
deploy Blue image for sof-app01
dimitardd Jan 15, 2025
47321c2
deploy Green image
dimitardd Jan 15, 2025
ada5860
move dockerfile to app folder
dimitardd Jan 15, 2025
cdeea78
fix loacation of docker file for build proccess
dimitardd Jan 15, 2025
709e1ad
dockerfile working dir change
dimitardd Jan 15, 2025
fe65a1b
revert docker file
dimitardd Jan 15, 2025
90d13a9
auto chnage doker image tag in deplayment for sof-app01
dimitardd Jan 16, 2025
7e8b5c7
add sudo for installatiuon of yq under Update deployment
dimitardd Jan 16, 2025
2e2d85f
fixing locatagion for checkout repo
dimitardd Jan 16, 2025
210d3a0
fix location of the folder to replace deplyment image tag with newest
dimitardd Jan 16, 2025
15a8776
fixyng the location of git clone
dimitardd Jan 16, 2025
a6d0994
fixing the location of git clone folder
dimitardd Jan 16, 2025
d9846ee
fix
dimitardd Jan 16, 2025
5d75b19
debug mode
dimitardd Jan 16, 2025
86f9478
debugging
dimitardd Jan 16, 2025
8587172
debugging
dimitardd Jan 16, 2025
68ab94b
image tag green
dimitardd Jan 16, 2025
c777b0b
debug
dimitardd Jan 16, 2025
2911866
debug
dimitardd Jan 16, 2025
0abc51e
debug
dimitardd Jan 16, 2025
b44c349
debug
dimitardd Jan 16, 2025
1c48f50
debug
dimitardd Jan 16, 2025
cfd402f
debug
dimitardd Jan 16, 2025
e5d31c2
debug
dimitardd Jan 16, 2025
02c4548
debug
dimitardd Jan 16, 2025
24ba7e5
install jq
dimitardd Jan 16, 2025
f7f702d
sudo apt-get install jq
dimitardd Jan 16, 2025
941b968
fix
dimitardd Jan 16, 2025
7a763bb
debug
dimitardd Jan 16, 2025
f2db872
debug
dimitardd Jan 16, 2025
be8d5b4
configure git commit to deployment folder
dimitardd Jan 16, 2025
16f8863
missing sudo
dimitardd Jan 16, 2025
17b4e5e
Update image to 16f8863edb5d936e95be1ca6ffff6373b29bb222
dimitardd Jan 16, 2025
7dd2931
enable full action plan
dimitardd Jan 16, 2025
a49c490
addig image new tag in deplayment
dimitardd Jan 16, 2025
89c68d1
Update image to a49c490ed14ef9dc357059be24606c97feae375d
dimitardd Jan 16, 2025
caf4981
enable green imag in sof-app01
dimitardd Jan 16, 2025
077cd1c
PrometheusMetrics implementation
dimitardd Jan 16, 2025
e275101
Installing prometheus for application
dimitardd Jan 16, 2025
1c2d64a
installing prometheus
dimitardd Jan 16, 2025
b22bb06
trying to install prometheus_flask_exporter
dimitardd Jan 16, 2025
5c96d23
installing prometheus_flask_exporter
dimitardd Jan 16, 2025
75b29cc
unittest fix for prometheus_flask_exporter
dimitardd Jan 16, 2025
e9b1476
Update image to 75b29cc938e5a7197eb281c9f87c5f5838048228
dimitardd Jan 16, 2025
56b6807
build new Green image with prometheus
dimitardd Jan 16, 2025
b07c7bf
fix app test Green image with prometheus
dimitardd Jan 16, 2025
9bea76c
Update image to b07c7bf5c0df29652dd1c86ec06463770388fb98
dimitardd Jan 16, 2025
57bb7e9
Build new Blue image with prometheus
dimitardd Jan 16, 2025
9fa8e26
Update image to 57bb7e9bcd3546159be0917df7e87526d8170140
dimitardd Jan 16, 2025
06a2612
manualy deploy sof-app01 Blue image
dimitardd Jan 16, 2025
b044463
deplay Green image in sof-app01
dimitardd Jan 16, 2025
59f79b1
update sof-app01 up to 15 replicas
dimitardd Jan 16, 2025
8eddf7a
switch to Blue image in sof-app01
dimitardd Jan 16, 2025
7274b3a
update image in rollouts for blue and green
dimitardd Jan 16, 2025
16503b5
sof-app02 with Blue image and prometheus
dimitardd Jan 16, 2025
ec15dad
sof-app01 latest image
dimitardd Jan 17, 2025
774321b
scale down sof-app01 to 9
dimitardd Jan 17, 2025
e0b1dc1
build Yellow image
dimitardd Jan 17, 2025
3dcd8ff
Update image to e0b1dc1bb0edf9e161d17d7ba1565844b64e8e37
dimitardd Jan 17, 2025
8fd2725
added Yellow image
dimitardd Jan 17, 2025
edae683
sof-app01 Bllue image deplayment
dimitardd Jan 17, 2025
8c23f1f
deplay Green image to sof-app01
dimitardd Jan 17, 2025
e24d2e1
add readme.md files
dimitardd Jan 17, 2025
9309e81
sof-app01 blue image
dimitardd Jan 17, 2025
faf4337
build fresh image
dimitardd Jan 17, 2025
00cf48a
sof-app01 tls update
dimitardd Jan 17, 2025
e43cebf
sof-app-cert
dimitardd Jan 17, 2025
0d9ae0a
markdownlint ignor for md
dimitardd Jan 17, 2025
1b111ef
Update image to 0d9ae0a5d5dae11bbf53ae8dfec05b30d34aafd7
dimitardd Jan 17, 2025
0468b23
pre-commit hooks
dimitardd Jan 17, 2025
f2c570e
Update image to 0468b23703d1557081e3f3c7b2b841c02b880484
dimitardd Jan 17, 2025
56e4605
- id: terraform-fmt in pre-commit hook
dimitardd Jan 17, 2025
31a2db0
Update image to 56e460596f70a74313417d3b7a6c605784e6b083
dimitardd Jan 17, 2025
3f8cbc0
terraform_fmt
dimitardd Jan 17, 2025
850aa86
Update image to 3f8cbc0d09f014a1b7513ca29ea32497444f1bfa
dimitardd Jan 17, 2025
29120b7
etect-secrets
dimitardd Jan 17, 2025
ed32629
Update image to 29120b7605e4f216cd172e5b0131b7ef9a02e580
dimitardd Jan 17, 2025
207e179
terraform_fmt
dimitardd Jan 17, 2025
77fe57c
Update image to 207e179a46ce047db5ac0d73ec2a1b0fb9352514
dimitardd Jan 17, 2025
515d33c
add files to path to ignore github action
dimitardd Jan 17, 2025
a435a16
path ignor for github action
dimitardd Jan 17, 2025
6409c8e
cleaning pre-commit hook
dimitardd Jan 17, 2025
64f1140
vault test integration for sof-app01
dimitardd Jan 19, 2025
ccda7a0
configute vault for sof-app01
dimitardd Jan 19, 2025
a51f18f
remove test aprt for vault in sof-app01
dimitardd Jan 19, 2025
e8d1956
sof-app01 autoscaling
dimitardd Jan 21, 2025
7b18a95
sof-autoscaling ram to 5%
dimitardd Jan 21, 2025
fa4fdec
sof-app01 autoscaling ram set to 50%
dimitardd Jan 21, 2025
ca4d1fb
rename sof-app01 hpa
dimitardd Jan 21, 2025
3afbfa4
reorganize files in deplayment for sof-app01
dimitardd Jan 21, 2025
150913e
checking analysis template for sof-app02
dimitardd Jan 22, 2025
9d882f2
remove tmp file
dimitardd Jan 22, 2025
ee39df4
change namespace for sof-app02
dimitardd Jan 22, 2025
f06c238
add to terraform sof-app02
dimitardd Jan 22, 2025
d6e8920
Update image to f06c238537dfbc6d381a22a7b893823eed98e652
dimitardd Jan 22, 2025
1a3efc7
cofigure vault to keep cert and key
dimitardd Jan 22, 2025
336da99
change sof-app01 to be point to mian
dimitardd Jan 25, 2025
5c2b5ea
Update image to 336da99178145fad0915c2ea2c83f62574f0bc8f
dimitardd Jan 25, 2025
75044e5
Update deplayment for ArgoCD
dimitardd Jan 25, 2025
95b7763
Update deplayment for ArgoCD
dimitardd Jan 25, 2025
b5a5165
Update image to 95b77639a6441855f72b7d551259992145a1a3b6
dimitardd Jan 25, 2025
a98548e
terrafrorm ction plan
dimitardd Jan 25, 2025
abeeee8
ignor githuba action for terraform
dimitardd Jan 25, 2025
90cc192
change terraform action plan to include dimitardd as branche
dimitardd Jan 25, 2025
ccf2d35
terrafrorm ction plan
dimitardd Jan 25, 2025
614d041
ignor githuba action for terraform
dimitardd Jan 25, 2025
b28a35f
change terraform action plan to include dimitardd as branche
dimitardd Jan 25, 2025
1a66e7e
Update image to 336da99178145fad0915c2ea2c83f62574f0bc8f
dimitardd Jan 25, 2025
9818d9d
github action location for terraform
dimitardd Jan 25, 2025
4656e68
terraform location files
dimitardd Jan 25, 2025
1a77e59
sof-app01 terraform test
dimitardd Jan 25, 2025
80264a5
disable backend location
dimitardd Jan 25, 2025
95c5e19
new terraform pat for sof-app01 in self-worker
dimitardd Jan 25, 2025
4e11395
test github action terraform
dimitardd Jan 25, 2025
3cc484f
separate jibs for run kube settings and terraform plan
dimitardd Jan 25, 2025
065ccc9
sof-app01 limit 1
dimitardd Jan 25, 2025
385d58a
test githuv action
dimitardd Jan 25, 2025
8f2a8d3
terraform applay in github action
dimitardd Jan 26, 2025
034a4ad
terraform action sof-app01
dimitardd Jan 26, 2025
c470661
ignor github action to start if chnage yml for action plan
dimitardd Jan 26, 2025
b74d490
add variabled chnaged dir in teeraform
dimitardd Jan 26, 2025
65d54b5
sof-app02 state tf file location
dimitardd Jan 26, 2025
79ff96c
sof-app02 parameter change
dimitardd Jan 26, 2025
5165b20
test dinamic folder selectin in terraform action plan
dimitardd Jan 26, 2025
03f280d
test auto selection terraform fir
dimitardd Jan 26, 2025
3c25ba4
AUTO SELECT DIR IN TERRAFORM
dimitardd Jan 26, 2025
b028518
auto select folder
dimitardd Jan 26, 2025
0d35d47
terraform auto select
dimitardd Jan 26, 2025
613ecb2
add schedule on terraform
dimitardd Jan 26, 2025
5978590
set brancher for github action triger
dimitardd Jan 26, 2025
b0d94e5
Merge branch 'dimitardd-281024'
dimitardd Jan 26, 2025
7819cdb
commit
dimitardd Jan 26, 2025
2fa14cf
mage fix
dimitardd Jan 26, 2025
2b80cf3
fix sof-app02
dimitardd Jan 26, 2025
8875bd0
fix sof-app01
dimitardd Jan 26, 2025
038a245
rmeove sof-app02 argo analisys
dimitardd Jan 26, 2025
0c4efff
new imagge in sof-app01
dimitardd Jan 26, 2025
1e56fe5
change betta apiversion on sof-app02
dimitardd Jan 26, 2025
63d0c5a
alpha1 avi version for sof-app02
dimitardd Jan 26, 2025
f9d8cad
Build new immage
dimitardd Jan 26, 2025
d751d63
Update image to f9d8cadb0337ee5794a01a2be80dd6ac1c99d065
dimitardd Jan 26, 2025
90fa7b0
change image for sof-app02
dimitardd Jan 27, 2025
459a77b
disable cron for terraform run
dimitardd Jan 28, 2025
4c8c26f
Update image to 459a77b624815c64d21a78a8eb4b014fba74ceac
dimitardd Jan 28, 2025
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
33 changes: 33 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# EditorConfig is awesome: https://editorconfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8

# 4 space indentation
[*.py]
indent_style = space
indent_size = 4

# Tab indentation (no size specified)
[Makefile]
indent_style = tab

# Indentation override for all JS under lib directory
[lib/**.js]
indent_style = space
indent_size = 2

# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2
74 changes: 74 additions & 0 deletions .github/workflows/github-action-terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: GitHub Actions Terraform
run-name: ${{ github.actor }} Terraform GitHub Actions 🚀
on:
schedule:
# Runs every Hour from 8AM to 5PM on weekdays
#- cron: '0 8-17 * * 1-5'
push:
paths:
- 'terraform/**'
- 'github/workflows/github-action-terraform.yml'
branches:
- main
- infra-*
jobs:
Terraform-action:
runs-on: self-hosted
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.10.5
- name: Determine changed directories
id: changed_dirs
run: |
echo "Finding changed directories..."
dirs=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- terraform/ | grep -o 'terraform/[^/]*' | sort -u)
changed_dirs=$(echo "$dirs" | tr '\n' ',' | sed 's/,$//')
echo "Changed directories: $dirs"
echo "changed_dirs=$changed_dirs" >> $GITHUB_ENV
- name: Check for changes in Terraform directories
id: check_changes
run: |
if [ -z "$changed_dirs" ]; then
echo "No changes in Terraform directories."
echo "should_run=false" >> $GITHUB_ENV
else
echo "Changes detected in: $changed_dirs"
echo "should_run=true" >> $GITHUB_ENV
fi
echo $should_run
- name: Terraform Init
if: env.should_run == 'true'
run: |
for dir in ${changed_dirs//,/ }; do
echo "Initializing Terraform in directory: $dir"
cd /opt/actions-runner/_work/devops-programme/devops-programme/$dir
terraform init
done
- name: Kubernetes access preparation
if: env.should_run == 'true'
run: |
export KUBECONFIG=~/.kube/sof-lab03
kubectl config set-context sof-lab03
kubectl port-forward svc/argo-cd-7-1734333419-argocd-server -n argocd 8080:443 &
- name: Terraform Plan
if: env.should_run == 'true'
run: |
for dir in ${changed_dirs//,/ }; do
echo "Running Terraform plan in directory: $dir"
cd /opt/actions-runner/_work/devops-programme/devops-programme/$dir
terraform plan
done
- name: Terraform Apply
if: env.should_run == 'true'
run: |
for dir in ${changed_dirs//,/ }; do
echo "Applying Terraform changes in directory: $dir"
cd /opt/actions-runner/_work/devops-programme/devops-programme/$dir
terraform apply -auto-approve
done
174 changes: 174 additions & 0 deletions .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: GitHub Actions Demo
run-name: ${{ github.actor }} is deploying with GitHub Actions🚀
on:
push:
paths-ignore:
- '_homework/*'
- 'deployment/*'
- 'terraform/*'
- 'rollout/*'
- '.pre-commit-config.yaml'
- '.gitignore'
- '.editorconfig'
- '*.md'
- 'LICENSE'
- 'github/workflows/github-action-terraform.yml'
- 'github/workflows/github-actions-demo.yml'
branches:
- main
- feature-*
env:
IMAGE_TAG: dimitardd/dimitar-app02
jobs:
Pylint:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Node version
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
cache: 'pip'
- run: |
pip install pylint black flake8 flask prometheus_flask_exporter
npm install -g markdownlint-cli editorconfig-checker
- name: Check Editorconfig
run: editorconfig-checker
- name: Analysing the code with pylint
run: pylint --disable=C0111,C0114,C0115,C0116 $(git ls-files '*.py')
- name: Markdownlint config file
run: |
echo '{
"MD012": false,
"MD013": false,
"line-lenght": false
}' > .markdownlint.json
- name: Markdown lint check
run: markdownlint -i '{**/*.md}' -i '{terraform/*.md}' -i '{*.md}' -i node_modules
UnitTest:
needs: Pylint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- run: |
pip install flask prometheus_flask_exporter
- name: Run app test
run: |
cd app
python -m unittest app_test.py
CheckforSecrets:
needs: UnitTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Gitleaks scan
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TrivySecurity:
runs-on: ubuntu-latest
needs: UnitTest
steps:
- uses: actions/checkout@v4
- name: Trivy Vulnerability Scan
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-output.sarif'
severity: 'CRITICAL'
- name: Trivy Scan Output
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-output.sarif'
SonarcloudSecurity:
runs-on: ubuntu-latest
needs: UnitTest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: app
args: >
-Dsonar.projectKey=dimitardd_devops-programme
-Dsonar.organization=dimitardd
Build-Test:
name: Build Image and Test
runs-on: ubuntu-latest
if: ${{ !cancelled() && !failure() }}
needs: [ SonarcloudSecurity, TrivySecurity, CheckforSecrets ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build an image from Dockerfile
run: |
docker build -t ${{ env.IMAGE_TAG }}:${{ github.sha }} .
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: '${{ env.IMAGE_TAG }}:${{ github.sha }}'
format: 'sarif'
output: 'trivy-results-container.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results-container.sarif'
UploadtoDockerHub:
name: Push container to docker hub
runs-on: ubuntu-latest
if: ${{ !cancelled() && !failure() }}
needs: [ Build-Test ]
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push
uses: docker/build-push-action@v6
with:
push: true
tags: '${{ env.IMAGE_TAG }}:${{ github.sha }}'
if: success() # Only push if get login is ok
PushforArgoCD:
name: Update deplayment for ArgoCD
runs-on: ubuntu-latest
if: ${{ !cancelled() && !failure() }}
needs: [ UploadtoDockerHub ]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update sof-app01 deployment image
run: |
sudo snap install yq
sudo apt-get install git -y
IMAGE_NEWTAG=$(echo ${{ github.sha }})
/usr/bin/yq eval ".spec.template.spec.containers[0].image = \"dimitardd/dimitar-app02:${IMAGE_NEWTAG}\"" -i deployment/sof-app01.yaml
git config --local user.email "[email protected]"
git config --local user.name "Dimitar Dimitrov"
git add $GITHUB_WORKSPACE/deployment/sof-app01.yaml
git commit -m "Update image to ${{ github.sha }}"
git push origin main
env:
github_token: ${{ secrets.GIT_TOKEN }}
GITHUB_SHA: ${{ github.sha }}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ __pycache__/
# C extensions
*.so

# terrafomr
*.terraform.lock.hcl
terraform/.terraform
**/.terraform/*
terraform/.terraform.lock.hcl
terrafrom/*/.terraform.lock.hcl
terraform/**/*/.terraform.lock.hcl
terrafrom/**/.terraform.lock.hcl
terrafrom/kubernetes/~/

# Distribution / packaging
.Python
build/
Expand Down
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-yaml
- id: trailing-whitespace
- id: check-added-large-files
- id: check-merge-conflict
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaks
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.97.0
hooks:
- id: terraform_fmt
args:
- --args=--recursive
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:22.04

LABEL maintainer="[email protected]"
LABEL version="5.0"

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
python3 \
python3-pip && \
apt-get clean && \
groupadd -r appgroup && \
useradd -r -g appgroup appuser

WORKDIR /app

COPY --chown=appuser:appgroup --chmod=755 ./app .

RUN pip3 install flask==3.0.0 prometheus_flask_exporter

USER appuser

CMD ["python3", "app.py"]
36 changes: 0 additions & 36 deletions M1-3-Ansible/README.md

This file was deleted.

Loading