Skip to content

Commit ee8e5b9

Browse files
committed
ci: add Mend SCA workflow
Signed-off-by: jpragyaj-svg <jpragyaj@gmail.com>
1 parent 140d74d commit ee8e5b9

4 files changed

Lines changed: 88 additions & 38 deletions

File tree

.github/workflows/lint.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
- .github/**
88
- assets/**
99
- docs/**
10-
- .whitesource
1110
- .yamlfmt
1211
- .yamllint
1312
push:
@@ -17,7 +16,6 @@ on:
1716
- .github/**
1817
- assets/**
1918
- docs/**
20-
- .whitesource
2119
- .yamlfmt
2220
- .yamllint
2321
permissions: read-all

.github/workflows/mend.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: Mend SCA Security Scan
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths-ignore:
7+
- .github/**
8+
- assets/**
9+
- docs/**
10+
- .yamlfmt
11+
- .yamllint
12+
push:
13+
branches:
14+
- main
15+
paths-ignore:
16+
- .github/**
17+
- assets/**
18+
- docs/**
19+
- .yamlfmt
20+
- .yamllint
21+
permissions: read-all
22+
jobs:
23+
mend-sca:
24+
name: Mend dependency scan
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
security-events: write
29+
env:
30+
MEND_EMAIL: ${{ secrets.MEND_EMAIL }}
31+
MEND_USER_KEY: ${{ secrets.MEND_USER_KEY }}
32+
MEND_URL: ${{ secrets.MEND_URL }}
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
37+
- name: Set up Python 3.11
38+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
39+
with:
40+
python-version: "3.11"
41+
42+
- name: Install Python dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
46+
47+
- name: Download and install Mend CLI
48+
run: |
49+
curl -fsSL https://downloads.mend.io/cli/linux_amd64/mend -o /usr/local/bin/mend
50+
chmod +x /usr/local/bin/mend
51+
mend version
52+
53+
- name: Run Mend dependency scan
54+
id: mend_scan
55+
continue-on-error: true
56+
run: |
57+
mend dep --dir . --scope "ansible-collection-netscaleradc" --non-interactive --export-results mend-results.json
58+
59+
- name: Convert results to SARIF
60+
if: always() && steps.mend_scan.outcome != 'skipped'
61+
continue-on-error: true
62+
run: |
63+
mend dep --dir . --scope "ansible-collection-netscaleradc" --non-interactive --format sarif --filename mend-output.sarif || true
64+
65+
- name: Upload Mend SARIF to GitHub Security tab
66+
if: always() && hashFiles('mend-output.sarif') != ''
67+
uses: github/codeql-action/upload-sarif@256d634097be96e792d6764f9edaefc4320557b1 # v4
68+
with:
69+
sarif_file: mend-output.sarif
70+
71+
- name: Upload scan results as artifact
72+
if: always()
73+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
74+
with:
75+
name: mend-scan-results
76+
path: |
77+
mend-results.json
78+
mend-output.sarif
79+
retention-days: 30
80+
81+
- name: Fail on scan errors
82+
if: steps.mend_scan.outcome == 'failure'
83+
run: |
84+
echo "::error::Mend dependency scan found vulnerabilities or encountered errors."
85+
exit 1

.github/workflows/trivy.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.whitesource

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"baseBranches": []
77
},
88
"scanSettingsSAST": {
9-
"enableScan": false,
10-
"scanPullRequests": false,
9+
"enableScan": true,
10+
"scanPullRequests": true,
1111
"incrementalScan": true,
12-
"baseBranches": [],
12+
"baseBranches": ["main"],
1313
"snippetSize": 10
1414
},
1515
"checkRunSettings": {

0 commit comments

Comments
 (0)