Skip to content

Commit f5a81a8

Browse files
feat: adding fossa scan to workflow (#50)
1 parent 7681e6a commit f5a81a8

File tree

2 files changed

+32
-72
lines changed

2 files changed

+32
-72
lines changed

.github/workflows/reusable-build-test-release.yml

Lines changed: 27 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ on:
3030
OTHER_TA_REQUIRED_CONFIGS:
3131
description: other required configs
3232
required: true
33+
FOSSA_API_KEY:
34+
description: API token for FOSSA app
35+
required: true
3336

3437
jobs:
3538
meta:
@@ -95,33 +98,30 @@ jobs:
9598
id: sample-scanner
9699
env:
97100
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GH_TOKEN }}
98-
compliance-dependencies:
99-
name: compliance-dependencies
100-
runs-on: ubuntu-latest
101101

102+
fossa-scan:
103+
continue-on-error: true
104+
runs-on: ubuntu-latest
102105
steps:
103-
- name: Checkout
104-
uses: actions/checkout@v2
105-
- name: ort-action
106-
uses: splunk/addonfactory-ort-action@v1.6
107-
id: ort-action
108-
with:
109-
WorkDir: .
110-
UsePython3: "3.7"
111-
- name: ort-action-artifacts-reports
112-
uses: actions/upload-artifact@v2
113-
with:
114-
name: analysis-reports
115-
path: |
116-
.ort/reports/*
117-
if: always()
118-
- name: ort-action-artifacts-analyzer
106+
- uses: actions/checkout@v3
107+
- name: run fossa anlyze and create report
108+
run: |
109+
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash
110+
fossa analyze --debug
111+
fossa report attribution --format text > /tmp/THIRDPARTY
112+
env:
113+
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
114+
- name: upload THIRDPARTY file
119115
uses: actions/upload-artifact@v2
120116
with:
121-
name: analysis-analyzer
122-
path: |
123-
.ort/analyzer/*
124-
if: always()
117+
name: THIRDPARTY
118+
path: /tmp/THIRDPARTY
119+
- name: run fossa test
120+
run: |
121+
fossa test --debug
122+
env:
123+
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
124+
125125
compliance-copyrights:
126126
name: compliance-copyrights
127127
runs-on: ubuntu-latest
@@ -183,37 +183,11 @@ jobs:
183183
with:
184184
publishToken: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}
185185

186-
# Commentig it out as a INFRA-35392
187-
# TODO use FOSSA instead of SNYK
188-
189-
# snyk:
190-
# name: security-vuln-snyk
191-
# runs-on: ubuntu-latest
192-
# steps:
193-
# - uses: actions/checkout@v2
194-
# - name: Setup python
195-
# uses: actions/setup-python@v2
196-
# with:
197-
# python-version: 3.7
198-
# - uses: snyk/actions/setup@master
199-
# - uses: actions/setup-go@v2.1.5
200-
# with:
201-
# go-version: "1.13"
202-
# - name: Snyk monitor
203-
# run: snyk test --sarif-file-output=snyk-scan_requirements.sarif --all-projects --print-deps --severity-threshold=high
204-
# env:
205-
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
206-
# - uses: actions/upload-artifact@v2
207-
# if: always()
208-
# with:
209-
# name: snyk-results
210-
# path: snyk-scan_requirements.sarif
211-
212186
build:
213187
name: build
214188
runs-on: ubuntu-latest
215189
needs:
216-
- compliance-dependencies
190+
- fossa-scan
217191
outputs:
218192
buildname: ${{ steps.buildupload.outputs.name }}
219193
steps:
@@ -278,12 +252,11 @@ jobs:
278252
PrNumber: ${{ github.event.number }}
279253
- uses: actions/download-artifact@v2
280254
with:
281-
name: analysis-reports
282-
path: /tmp/analysis-reports
255+
name: THIRDPARTY
256+
path: /tmp/THIRDPARTY
283257
- name: Update Notices
284258
run: |
285-
cp -f /tmp/analysis-reports/NOTICE_default THIRDPARTY || true
286-
cp -f /tmp/analysis-reports/NOTICE_default package/THIRDPARTY || true
259+
cp -f /tmp/THIRDPARTY package/THIRDPARTY
287260
- name: Build Package
288261
id: uccgen
289262
uses: splunk/addonfactory-ucc-generator-action@v1
@@ -1272,7 +1245,6 @@ jobs:
12721245
needs:
12731246
- meta
12741247
- compliance-sample-scanner
1275-
- compliance-dependencies
12761248
- compliance-copyrights
12771249
- lint
12781250
- review_secrets

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,38 +104,26 @@ compliance-sample-scanner
104104
<img src="images/sample_scanner/report_link.png" alt="report_link" style="width:200px;"/>
105105

106106

107-
compliance-dependencies
107+
fossa-scan
108108
=======================
109109

110110
**Description:**
111111

112-
- This action scans a project for third party components and reports the results. This action contains a curation file managed by Splunk Inc.
113-
114-
**Action used:** https://github.com/splunk/addonfactory-ort-action
112+
- This action scans a project for third party components and reports the results. This action checks license compliance and vulnerabilities. This file uses `.fossa.yml` configuration file
115113

116114
**Pass/fail behaviour:**
117115

118-
- This stage fails if there are any errors or dependencies while installing requirements.txt generated from pyproject.toml
116+
- This stage fails if FOSSA finds any license or security issues. Detected issues can be found in FOSSA app site https://app.fossa.com/. Link to direct report is generated per job and printed in logs. License issues should be checked by legal team, vulnerabilities should be solved by TA-dev or TA-qa team with assist of prodsec team if needed (some issues with critical status for example).
119117

120118
**Troubleshooting steps for failures if any:**
121119

122-
- The error log is present in the stage as well as in the artifacts scan-report.xlsx , user should be able to reproduce that in local and fix/update the requirements accordingly.
123-
124-
i.e <img src="images/compliance-dependencies/scan-reports-error.png" alt="scan-reports-error" style="width:200px;"/>
120+
- The error log is present in the stage as well user should be able to reproduce that in local environment with FOSSA CLI tool https://github.com/fossas/fossa-cli
125121

126122

127123
**Artifacts:**
128124

129125
```
130-
analysis-analyzer
131-
- analyzer-result.json
132-
133-
analysis-reports
134-
- scan-report.xlsx
135-
- NOTICE_summary
136-
- NOTICE_default
137-
- bom.spdx.yml
138-
- AsciiDoc_disclosure_document.pdf
126+
THIRDPARTY
139127
```
140128
141129
compliance-copyrights

0 commit comments

Comments
 (0)