feat: add chart filter input to cve-edge-post workflow
Allow scanning a single catalog (manifests/helm/<chart>/) via the workflow_dispatch chart input, filtering images_final.tsv by chart name before the limit is applied. Empty value scans the full catalog as before.
This commit is contained in:
@@ -5,10 +5,17 @@ name: helm-catalog-cve-edge-post
|
||||
# "scanned_at": "2026-07-13T06:19:44Z", "summary": "CVE-xxxx-xxxxx, ..."}, ...]
|
||||
# 생성된 JSON 은 POST https://edge.gke.paasup.io/api/v1/cve-scans 로 전송한다.
|
||||
# (X-CVE-API-Key 헤더 필요 — Repo Secret CVE_API_KEY, SSL 검증은 --insecure 로 스킵)
|
||||
#
|
||||
# workflow_dispatch 의 chart 입력으로 특정 카탈로그(manifests/helm/<chart>/)만 대상으로
|
||||
# 스캔할 수 있다. 빈 값이면 전체 카탈로그를 스캔한다(스케줄 실행 시 항상 전체).
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
chart:
|
||||
description: '대상 차트명 (manifests/helm/ 하위 디렉토리명, 빈 값=전체)'
|
||||
required: false
|
||||
default: ''
|
||||
limit:
|
||||
description: '대상 이미지 수 상한 (0=전체). 테스트 시 예: 3'
|
||||
required: false
|
||||
@@ -71,15 +78,21 @@ jobs:
|
||||
- name: 이미지 인벤토리 추출
|
||||
run: bash doc/scripts/extract-helm-images.sh "$GITHUB_WORKSPACE/manifests/helm" "$OUT_DIR"
|
||||
|
||||
- name: 스캔 대상 결정 (전체)
|
||||
- name: 스캔 대상 결정 (차트 필터 + 상한)
|
||||
env:
|
||||
CHART: ${{ github.event.inputs.chart || '' }}
|
||||
LIMIT: ${{ github.event.inputs.limit || '0' }}
|
||||
run: |
|
||||
if [ "$LIMIT" -gt 0 ] 2>/dev/null; then
|
||||
cut -f3 "$OUT_DIR/images_final.tsv" | sort -u | head -n "$LIMIT" > "$OUT_DIR/images_scan.txt"
|
||||
if [ -n "$CHART" ]; then
|
||||
awk -F'\t' -v c="$CHART" '$1==c{print $3}' "$OUT_DIR/images_final.tsv" | sort -u > "$OUT_DIR/images_scan.txt"
|
||||
echo "차트 필터: $CHART"
|
||||
else
|
||||
cut -f3 "$OUT_DIR/images_final.tsv" | sort -u > "$OUT_DIR/images_scan.txt"
|
||||
fi
|
||||
if [ "$LIMIT" -gt 0 ] 2>/dev/null; then
|
||||
head -n "$LIMIT" "$OUT_DIR/images_scan.txt" > "$OUT_DIR/images_scan.txt.tmp"
|
||||
mv "$OUT_DIR/images_scan.txt.tmp" "$OUT_DIR/images_scan.txt"
|
||||
fi
|
||||
wc -l "$OUT_DIR/images_scan.txt"
|
||||
|
||||
# SBOM 산출물은 필요 없으므로 trivy image 로 이미지를 직접 스캔한다(SBOM 생성 단계 생략).
|
||||
|
||||
Reference in New Issue
Block a user