forked from open-metadata/OpenMetadata
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 loc) · 2.48 KB
/
trivy-scan-ingestion-image.yml
File metadata and controls
79 lines (68 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Trivy Scan For OpenMetadata Ingestion Docker Image
on:
pull_request_target:
types: [labeled, opened, synchronize, reopened, ready_for_review]
paths:
- "**/*.py"
- "ingestion/Dockerfile.ci"
concurrency:
group: trivy-ingestion-scan-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-scan:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
permissions:
pull-requests: write
steps:
- name: Wait for the labeler
uses: lewagon/wait-on-check-action@v1.3.4
if: ${{ github.event_name == 'pull_request_target' }}
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: Team Label
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 90
- name: Verify PR labels
uses: jesusvasquez333/verify-pr-label-action@v1.4.0
if: ${{ github.event_name == 'pull_request_target' }}
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
valid-labels: 'safe to test'
pull-request-number: '${{ github.event.pull_request.number }}'
disable-reviews: true # To not auto approve changes
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Prepare for Docker Build
id: prepare
uses: ./.github/actions/prepare-for-docker-build
with:
image: openmetadata-ingestion
tag: trivy
is_ingestion: true
- name: Build Docker Image
run: |
docker build -t openmetadata-ingestion:trivy -f ingestion/Dockerfile.ci .
- name: Run Trivy Image Scan
id: trivy_scan
uses: aquasecurity/trivy-action@master
with:
scan-type: "image"
image-ref: openmetadata-ingestion:trivy
hide-progress: false
ignore-unfixed: true
severity: "HIGH,CRITICAL"
skip-dirs: "/opt/airflow/dags,/home/airflow/ingestion/pipelines"
scan-ref: .
format: 'template'
template: "@.github/trivy/templates/github.tpl"
output: "trivy-results-ingestion.md"
env:
TRIVY_DISABLE_VEX_NOTICE: "true"
- name: Comment Trivy Scan Results on PR
uses: marocchino/sticky-pull-request-comment@v2
with:
path: trivy-results-ingestion.md
header: "trivy-scan-${{ github.workflow }}"