Skip to content

Commit 115e694

Browse files
committed
feat: add CI with Docker Scout and unit tests
1 parent 2bc48bc commit 115e694

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,35 @@ jobs:
1818
- name: Set up Docker
1919
uses: docker/setup-buildx-action@v3
2020

21-
# 🔥 LOGIN MANUAL (más seguro que el action en forks)
21+
# Login a Docker Hub
2222
- name: Login to Docker Hub
2323
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
2424

25+
# Instalar Docker Scout
2526
- name: Install Docker Scout
2627
run: |
2728
curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
2829
30+
# Verificar instalación
2931
- name: Verify installation
3032
run: docker scout version
3133

34+
# Ejecutar análisis
3235
- name: Run Docker Scout Quickview
3336
run: docker scout quickview alpine
3437

3538
- name: Run Docker Scout CVEs
36-
run: docker scout cves alpine
39+
run: docker scout cves alpine
40+
41+
# =========================
42+
# 🔥 PRUEBAS UNITARIAS
43+
# =========================
44+
45+
- name: Install Python
46+
run: sudo apt-get update && sudo apt-get install -y python3 python3-pip
47+
48+
- name: Install pytest
49+
run: pip3 install pytest
50+
51+
- name: Run unit tests
52+
run: pytest

test_scout.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import subprocess
2+
3+
def test_docker_scout_installed():
4+
result = subprocess.run(
5+
["docker", "scout", "version"],
6+
capture_output=True,
7+
text=True
8+
)
9+
assert result.returncode == 0
10+
11+
12+
def test_docker_scout_quickview():
13+
result = subprocess.run(
14+
["docker", "scout", "quickview", "alpine"],
15+
capture_output=True,
16+
text=True
17+
)
18+
assert "Target" in result.stdout

0 commit comments

Comments
 (0)