Skip to content
Open

Lab17 #4358

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
90366d2
chore(lab01): add app_python structure and ignore venv
versceana Jan 28, 2026
c712cac
fix(lab01): clean gitignore and tests init file
versceana Jan 28, 2026
5953481
feat(lab01): add Flask app, requirements, screenshots and basic docs
versceana Jan 28, 2026
9897746
feat: add lab01 solution
versceana Jan 28, 2026
ed01730
Merge pull request #1 from versceana/lab01
versceana Jan 28, 2026
623af34
feat: add lab02 solution
versceana Feb 4, 2026
64a6a3b
Merge pull request #2 from versceana/lab02
versceana Feb 4, 2026
5d81539
feat(lab03): add tests and CI workflow
versceana Feb 12, 2026
5408fcd
feat(workflow): change main to master and add security job
versceana Feb 12, 2026
dc16534
Merge pull request #3 from versceana/lab03
versceana Feb 12, 2026
221063e
feat(workflow): add Snyk security scan
versceana Feb 12, 2026
e6ac430
feat(workflow): add Python setup and deps install
versceana Feb 12, 2026
e010632
feat(workflow): update deps
versceana Feb 12, 2026
62c1170
feat(workflow): update deps
versceana Feb 12, 2026
5cb583d
feat(workflow): update deps
versceana Feb 12, 2026
bf13027
Merge pull request #4 from versceana/lab03
versceana Feb 12, 2026
96984ab
feat(md): report
versceana Feb 12, 2026
0f6e1f2
Merge pull request #5 from versceana/lab03
versceana Feb 12, 2026
24ce0d6
feat(md): report
versceana Feb 12, 2026
f9b0489
Merge pull request #6 from versceana/lab03
versceana Feb 12, 2026
170d0a1
feat(lab04): add solution
versceana Feb 19, 2026
b6f9a04
Merge pull request #7 from versceana/lab04
versceana Feb 19, 2026
a863d86
feat(lab05): add solution
versceana Feb 25, 2026
63c9e12
Merge pull request #8 from versceana/lab05
versceana Feb 25, 2026
07691a0
lab06: add blocks, tags, docker-compose, wipe, check ci/cd
versceana Mar 18, 2026
358e043
lab06: report
versceana Mar 18, 2026
fdb9497
Merge pull request #9 from versceana/lab06
versceana Mar 18, 2026
dc800ad
lab06: changes
versceana Mar 18, 2026
c38d70b
Merge pull request #10 from versceana/lab06
versceana Mar 18, 2026
96d8672
lab06: changes
versceana Mar 18, 2026
79f597d
Merge pull request #11 from versceana/lab06
versceana Mar 18, 2026
60f42ba
lab06: changes
versceana Mar 18, 2026
07005cd
lab06: correctness lint
versceana Mar 18, 2026
fa6ed9c
lab06: correct workflow....
versceana Mar 18, 2026
eed930c
lab06: correct workflow....
versceana Mar 18, 2026
cc3f07d
lab06: correct workflow....
versceana Mar 18, 2026
65067ac
lab06: correct workflow....
versceana Mar 18, 2026
4b559f7
Merge pull request #12 from versceana/lab06
versceana Mar 18, 2026
81df51f
feat(lab07): add solution
versceana Mar 19, 2026
787e6b9
Merge pull request #13 from versceana/lab07
versceana Mar 19, 2026
f17057a
add solution
versceana Apr 2, 2026
90dadfe
Merge pull request #14 from versceana/lab10
versceana Apr 2, 2026
be8ca01
feat(lab11): add solution
versceana Apr 9, 2026
eec7707
Merge pull request #15 from versceana/lab11
versceana Apr 9, 2026
e8d8d9e
feat(lab12): add solution
versceana Apr 16, 2026
b0775a3
Merge pull request #16 from versceana/lab12
versceana Apr 16, 2026
8f606cb
Lab13: helm, report and screenshots
versceana Apr 23, 2026
d8622d8
delete trash enough
versceana Apr 23, 2026
bfa983d
feat% solution for lab14
versceana Apr 30, 2026
e76c8a2
feat: solution for lab15
versceana May 7, 2026
c98a86a
feat: solution for lab8
versceana May 8, 2026
64505f0
feat(lab09): solution, report and screenshots
versceana May 12, 2026
fc1f772
feat(lab16): solution, report and screenshots
versceana May 12, 2026
f2d2eb4
feat(lab17): solution with report
versceana May 13, 2026
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
75 changes: 75 additions & 0 deletions .github/workflows/ansible-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Ansible Deployment

on:
push:
branches: [master]
paths:
- "app_python/ansible/**"
- "!app_python/ansible/docs/**"
- ".github/workflows/ansible-deploy.yml"
pull_request:
branches: [master]
paths:
- "app_python/ansible/**"

jobs:
lint:
name: Ansible Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
pip install ansible ansible-lint

- name: Run ansible-lint
run: |
cd app_python/ansible
ansible-lint playbooks/*.yml

deploy:
name: Deploy Application
needs: lint
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Ansible and Docker modules
run: |
pip install ansible
ansible-galaxy collection install community.docker

- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.VM_HOST }} >> ~/.ssh/known_hosts

- name: Prepare Vault password
run: echo "${{ secrets.ANSIBLE_VAULT_PASSWORD }}" > /tmp/vault_pass

- name: Deploy with Ansible
run: |
cd app_python/ansible
ansible-playbook playbooks/deploy.yml \
-i inventory/hosts.ini \
--vault-password-file /tmp/vault_pass

- name: Verify Application
run: |
sleep 10
curl -f http://${{ secrets.VM_HOST }}:8000 || exit 1
curl -f http://${{ secrets.VM_HOST }}:8000/health || exit 1
100 changes: 100 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Python CI

on:
push:
branches: [master, lab03]
paths:
- "app_python/**"
- ".github/workflows/python-ci.yml"
pull_request:
branches: [master]
paths:
- "app_python/**"

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: app_python
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: app_python/requirements.txt

- name: Install dependencies
run: pip install -r requirements.txt

- name: Lint with flake8
run: |
pip install flake8
flake8 app.py --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 app.py --count --exit-zero --max-complexity=10 --statistics

- name: Test with pytest
run: pytest tests/ -v

security:
runs-on: ubuntu-latest
needs: test
if: always()
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: "pip"
cache-dependency-path: app_python/requirements.txt

- name: Install dependencies
run: pip install -r app_python/requirements.txt

- name: Install Snyk CLI
run: npm install -g snyk

- name: Run Snyk test
run: snyk test --file=app_python/requirements.txt --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

docker:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
defaults:
run:
working-directory: app_python
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Generate version (CalVer)
id: version
run: echo "version=$(date +%Y.%m.%d)" >> $GITHUB_OUTPUT

- name: Build and push
uses: docker/build-push-action@v5
with:
context: app_python
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/devops-info-service:latest
${{ secrets.DOCKER_USERNAME }}/devops-info-service:${{ steps.version.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max

7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
test
app_python/venv/
__pycache__/
*.py[cod]
.DS_Store
*.log
.env
Loading