Skip to content

Commit fb4a30e

Browse files
authored
Merge pull request #7 from Cdeth567/lab06
Lab06
2 parents 5910826 + 011feca commit fb4a30e

81 files changed

Lines changed: 30404 additions & 29167 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Ansible Deployment
2+
3+
on:
4+
push:
5+
branches: [master, lab06]
6+
7+
jobs:
8+
lint:
9+
name: Ansible Lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.12'
16+
- name: Install Ansible and ansible-lint
17+
run: pip install ansible ansible-lint
18+
- name: Run ansible-lint
19+
run: |
20+
cd ansible
21+
ansible-lint playbooks/provision.yml playbooks/deploy.yml playbooks/site.yml

.github/workflows/python-ci.yml

Lines changed: 103 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,103 @@
1-
name: Python CI (tests + docker)
2-
3-
on:
4-
push:
5-
branches: [ "master", "lab03" ]
6-
paths:
7-
- "app_python/**"
8-
- ".github/workflows/python-ci.yml"
9-
pull_request:
10-
branches: [ "master" ]
11-
paths:
12-
- "app_python/**"
13-
- ".github/workflows/python-ci.yml"
14-
15-
concurrency:
16-
group: python-ci-${{ github.ref }}
17-
cancel-in-progress: true
18-
19-
permissions:
20-
contents: read
21-
22-
jobs:
23-
test-and-lint:
24-
runs-on: ubuntu-latest
25-
26-
strategy:
27-
fail-fast: true
28-
matrix:
29-
python-version: ["3.12", "3.13"]
30-
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
35-
- name: Set up Python ${{ matrix.python-version }}
36-
uses: actions/setup-python@v5
37-
with:
38-
python-version: ${{ matrix.python-version }}
39-
cache: "pip"
40-
cache-dependency-path: |
41-
app_python/requirements.txt
42-
app_python/requirements-dev.txt
43-
44-
- name: Install dependencies
45-
working-directory: app_python
46-
run: |
47-
python -m pip install --upgrade pip
48-
pip install -r requirements.txt
49-
pip install -r requirements-dev.txt
50-
51-
- name: Lint (ruff)
52-
working-directory: app_python
53-
run: |
54-
ruff check .
55-
56-
- name: Run tests (pytest)
57-
working-directory: app_python
58-
run: |
59-
pytest -q
60-
61-
- name: Install Snyk CLI
62-
run: npm install -g snyk
63-
64-
- name: Snyk scan (dependencies)
65-
continue-on-error: true
66-
env:
67-
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
68-
run: |
69-
cd app_python
70-
snyk test --severity-threshold=high --file=requirements.txt
71-
72-
docker-build-and-push:
73-
runs-on: ubuntu-latest
74-
needs: test-and-lint
75-
76-
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/lab03')
77-
78-
permissions:
79-
contents: read
80-
81-
steps:
82-
- name: Checkout
83-
uses: actions/checkout@v4
84-
85-
- name: Set version (CalVer)
86-
run: |
87-
echo "VERSION=$(date -u +%Y.%m.%d)" >> $GITHUB_ENV
88-
89-
- name: Log in to Docker Hub
90-
uses: docker/login-action@v3
91-
with:
92-
username: ${{ secrets.DOCKERHUB_USERNAME }}
93-
password: ${{ secrets.DOCKERHUB_TOKEN }}
94-
95-
- name: Build and push
96-
uses: docker/build-push-action@v6
97-
with:
98-
context: ./app_python
99-
file: ./app_python/Dockerfile
100-
push: true
101-
tags: |
102-
${{ secrets.DOCKERHUB_USERNAME }}/devops-info-service:${{ env.VERSION }}
103-
${{ secrets.DOCKERHUB_USERNAME }}/devops-info-service:latest
1+
name: Python CI (tests + docker)
2+
3+
on:
4+
push:
5+
branches: [ "master", "lab03" ]
6+
paths:
7+
- "app_python/**"
8+
- ".github/workflows/python-ci.yml"
9+
pull_request:
10+
branches: [ "master" ]
11+
paths:
12+
- "app_python/**"
13+
- ".github/workflows/python-ci.yml"
14+
15+
concurrency:
16+
group: python-ci-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
test-and-lint:
24+
runs-on: ubuntu-latest
25+
26+
strategy:
27+
fail-fast: true
28+
matrix:
29+
python-version: ["3.12", "3.13"]
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
cache: "pip"
40+
cache-dependency-path: |
41+
app_python/requirements.txt
42+
app_python/requirements-dev.txt
43+
44+
- name: Install dependencies
45+
working-directory: app_python
46+
run: |
47+
python -m pip install --upgrade pip
48+
pip install -r requirements.txt
49+
pip install -r requirements-dev.txt
50+
51+
- name: Lint (ruff)
52+
working-directory: app_python
53+
run: |
54+
ruff check .
55+
56+
- name: Run tests (pytest)
57+
working-directory: app_python
58+
run: |
59+
pytest -q
60+
61+
- name: Install Snyk CLI
62+
run: npm install -g snyk
63+
64+
- name: Snyk scan (dependencies)
65+
continue-on-error: true
66+
env:
67+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
68+
run: |
69+
cd app_python
70+
snyk test --severity-threshold=high --file=requirements.txt
71+
72+
docker-build-and-push:
73+
runs-on: ubuntu-latest
74+
needs: test-and-lint
75+
76+
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/lab03')
77+
78+
permissions:
79+
contents: read
80+
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
85+
- name: Set version (CalVer)
86+
run: |
87+
echo "VERSION=$(date -u +%Y.%m.%d)" >> $GITHUB_ENV
88+
89+
- name: Log in to Docker Hub
90+
uses: docker/login-action@v3
91+
with:
92+
username: ${{ secrets.DOCKERHUB_USERNAME }}
93+
password: ${{ secrets.DOCKERHUB_TOKEN }}
94+
95+
- name: Build and push
96+
uses: docker/build-push-action@v6
97+
with:
98+
context: ./app_python
99+
file: ./app_python/Dockerfile
100+
push: true
101+
tags: |
102+
${{ secrets.DOCKERHUB_USERNAME }}/devops-info-service:${{ env.VERSION }}
103+
${{ secrets.DOCKERHUB_USERNAME }}/devops-info-service:latest

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
test
1+
test.vault_pass

0 commit comments

Comments
 (0)