Skip to content

Commit aae261a

Browse files
committed
Add job deploy
1 parent a53d86d commit aae261a

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,4 +163,38 @@ jobs:
163163
# - name: Sign imagen en GHCR
164164
# run: cosign sign --yes --key cosign.key "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}" <<< "$COSIGN_PASSWORD"
165165
# - name: Verify imagen (gate)
166-
# run: cosign verify --key cosign.pub "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}"
166+
# run: cosign verify --key cosign.pub "ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}"
167+
168+
169+
# ──────────────────────────────────────────────────────────────────────────────
170+
# Slide 15 — Deploy a K8s local + DAST (ZAP)
171+
# ──────────────────────────────────────────────────────────────────────────────
172+
deploy:
173+
name: Deploy a Kubernetes local (kind/minikube)
174+
runs-on: self-hosted
175+
needs: [sign]
176+
steps:
177+
- uses: actions/checkout@v4
178+
- name: Cargar imagen local al clúster kind
179+
run: kind load docker-image ${IMAGE_NAME}:${IMAGE_TAG} --name ${KIND_CLUSTER}
180+
- name: Helm upgrade/install
181+
run: |
182+
helm upgrade --install ${SERVICE_RELEASE_NAME} charts/demo-app \
183+
--set image.repository=${IMAGE_NAME} \
184+
--set image.tag=${IMAGE_TAG} \
185+
--set service.type=NodePort
186+
- name: Esperar readiness
187+
run: kubectl rollout status deploy/${SERVICE_RELEASE_NAME} --timeout=180s
188+
189+
dast:
190+
name: DAST (OWASP ZAP baseline)
191+
runs-on: self-hosted
192+
needs: [deploy]
193+
steps:
194+
- name: Port-forward al Service y ejecutar ZAP
195+
run: |
196+
kubectl port-forward svc/${SERVICE_RELEASE_NAME} 8080:80 & echo $! > pf.pid
197+
sleep 3
198+
docker run --rm -t owasp/zap2docker-stable \
199+
zap-baseline.py -t http://localhost:8080 -x zap.xml
200+
kill $(cat pf.pid) || true

kind.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
kind: Cluster
2+
apiVersion: kind.x-k8s.io/v1alpha4
3+
nodes:
4+
- role: control-plane
5+
extraPortMappings:
6+
- containerPort: 30080
7+
hostPort: 30080

0 commit comments

Comments
 (0)