Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
59996a1
Added editorconfig
Nov 13, 2023
3a66ee3
Added first workflow with editor config step
Nov 13, 2023
3adc7da
Corrected pipeline syntax
Nov 13, 2023
2d8ac81
Reformatted
Nov 13, 2023
48ec4a6
Emptied Dockerfile
Nov 13, 2023
b4a4dc3
Emptied editorconfig for now
Nov 13, 2023
672e928
Added step for checking if editor config exists
Nov 13, 2023
4bca8f2
Added check if conforming to editorconfig
Nov 13, 2023
51fc109
Added check if conforming to editorconfig
Nov 13, 2023
e0cc9ac
Fixed syntax
Nov 13, 2023
0c1f3a0
Emptied editor config
Nov 13, 2023
f90bcfc
Added Pylint step to pipeline
Nov 13, 2023
a416402
Fixed formatting
Nov 13, 2023
2124f22
Changed to older version of Ubuntu to see if runs will be faster
Nov 13, 2023
b2196a6
Put correct version of ubuntu
Nov 13, 2023
3048bce
Reformatted for Pylint
Nov 13, 2023
c343523
Changed pylint running
Nov 13, 2023
e638719
Added quotation marks
Nov 13, 2023
498a9a5
Checking all py files
Nov 13, 2023
7814871
Checking all py files
Nov 13, 2023
7f27ccc
Checking only the app folder
Nov 13, 2023
73ca899
Added init file
Nov 13, 2023
76409ef
Added reqs to app folder
Nov 13, 2023
16905eb
Changed path for pylint
Nov 13, 2023
a120cff
Changed path for pylint
Nov 13, 2023
a0d6086
Changed action for pylint
Nov 13, 2023
b361942
Added markdown check
Nov 13, 2023
b42ae50
Fixed typo
Nov 13, 2023
bb4283f
Running unit test
Nov 13, 2023
80b45ed
Running unit test
Nov 13, 2023
bd20e0f
Changed python version
Nov 13, 2023
ef41a92
Changed python version
Nov 13, 2023
63cb761
Changed python version
Nov 13, 2023
23d4d8d
Changed python version
Nov 13, 2023
1eb6212
Added gitleaks step
Nov 13, 2023
76ed583
Fixed indentation:
Nov 13, 2023
26ba93f
Added SonarCloud step
Nov 13, 2023
6e41a2a
Added Snyk check
Nov 13, 2023
881b53d
Added dependencies:
Nov 13, 2023
ec34dc3
fixing sonar cloud
Nov 13, 2023
379f40d
Updated workflow with more dependencies between jobs
Nov 15, 2023
319afb1
Added step in the pipeline to build and push Docker image
Nov 15, 2023
e983254
Fixed typo in runner name; Testing docker build and push
Nov 15, 2023
1a12132
Fixed typo in secret name
Nov 15, 2023
e109022
Uncommented Dockerfile
Nov 15, 2023
062ba18
Put in correct verion of ubuntu
Nov 15, 2023
5ec7322
Put in correct number values everywhere
Nov 15, 2023
bad7845
Fixed more wrong versions
Nov 15, 2023
c2f72b7
Added prefix to tags in docker/build-push-action
Nov 15, 2023
2d8d1f9
Added Trivy step
Nov 15, 2023
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
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
# indent_style = space
# indent_size = 4
127 changes: 127 additions & 0 deletions .github/workflows/commit-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Commit pipeline
run-name: ${{ github.actor }} made a commit

on:
push:
branches:
- ftr/*

jobs:
editorconfig:
name: "Check for .editorconfig"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: check-editorconfig-existence
if: ${{ hashFiles('.editorconfig') == '' }}
run: echo '.editorconfig exists'

- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker

pylint:
name: "Check with Pylint"
runs-on: ubuntu-latest
steps:
- uses: cclauss/GitHub-Action-for-pylint@0.7.0

black:
name: "Check formatting with Black"
runs-on: ubuntu-latest
steps:
- uses: psf/black@stable

markdown-check:
name: "Check markdown"
runs-on: ubuntu-latest
steps:
- uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: .

unit-test:
name: "Run unit test"
runs-on: ubuntu-latest
needs:
- editorconfig
- pylint
- black
- markdown-check
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: pip install -r requirements.txt
working-directory: ./app
- run: python -m unittest
working-directory: ./app

gitleaks:
name: "Check for leaks in secrets with gitleaks"
runs-on: ubuntu-latest
needs: unit-test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

sonar_cloud:
name: "Run SonarCloud"
runs-on: ubuntu-latest
needs: gitleaks
steps:
- uses: actions/checkout@v4
- uses: AppThreat/sast-scan-action@master
with:
type: "python"

vulnerability:
name: "Check for vulnerabilities with Snyk"
runs-on: ubuntu-latest
needs: sonar_cloud
steps:
- uses: actions/checkout@v4
- uses: snyk/actions/python-3.10@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=high

docker-build-push:
name: "Build Docker image, check for vulneratibilities and push"
runs-on: ubuntu-latest
needs: vulnerability
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v3
- name: "Set up BuildX"
uses: docker/setup-buildx-action@v3
- name: "Login to Docker Hub"
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN}}
- name: "Build and export to Docker (without push)"
uses: docker/build-push-action@v3
with:
context: .
load: true
tags: evelonche/app:${{ github.sha }}
- name: "Scan image"
uses: aquasecurity/trivy-action@master
with:
image-ref:
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'


3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM ubuntu:22.04 as builder

RUN apt-get update \
&& apt-get upgrade -y

RUN apt-get install software-properties-common -y \
&& add-apt-repository ppa:deadsnakes/ppa -y \
&& apt-get update
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# devops_upskill_2023
Repository with my exercises and projects for the DevOps course I am taking.

Repository with my exercises and projects for the DevOps course I am taking.
Empty file added app/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ def hello_world():


if __name__ == "__main__":
app.run(host="0.0.0.0")
app.run(host="0.0.0.0")
1 change: 0 additions & 1 deletion app/app_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ def test_hello_world(self):

if __name__ == "__main__":
unittest.main()

8 changes: 8 additions & 0 deletions app/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blinker==1.6.3 ; python_version >= "3.10" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.10" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.10" and python_version < "4.0" and platform_system == "Windows"
flask==3.0.0 ; python_version >= "3.10" and python_version < "4.0"
itsdangerous==2.1.2 ; python_version >= "3.10" and python_version < "4.0"
jinja2==3.1.2 ; python_version >= "3.10" and python_version < "4.0"
markupsafe==2.1.3 ; python_version >= "3.10" and python_version < "4.0"
werkzeug==3.0.0 ; python_version >= "3.10" and python_version < "4.0"