Skip to content

Commit 7ff7898

Browse files
Merge pull request #19 from intelops/feat/build_workflow
Feat/build workflow
2 parents 55727e4 + 5d7ae29 commit 7ff7898

File tree

6 files changed

+51
-12
lines changed

6 files changed

+51
-12
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
permissions:
1414
contents: read
15+
id-token: write
1516

1617
jobs:
1718
build:
@@ -31,4 +32,29 @@ jobs:
3132
- name: Build with hachling
3233
run: |
3334
python -m build
34-
ls
35+
ls
36+
- name: Install cosign
37+
uses: sigstore/[email protected]
38+
with:
39+
inputs: dist/scsctl-0.0.3-py3-none-any.whl
40+
- name: Sign with sigstore using GitHub App credentials
41+
run: |
42+
sigstore sign --overwrite dist/scsctl-0.0.3-py3-none-any.whl
43+
- name: Archive production artifacts
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: dist
47+
path: |
48+
dist
49+
- name: Copy dist/scsctl-0.0.3.tar.gz dist/scsctl-0.0.3-py3-none-any.whl to release directory
50+
run: |
51+
mkdir -p release
52+
cp dist/scsctl-0.0.3.tar.gz release/scsctl-0.0.3.tar.gz
53+
cp dist/scsctl-0.0.3-py3-none-any.whl release/scsctl-0.0.3-py3-none-any.whl
54+
55+
- name: Publish distribution 📦 to Test PyPI
56+
uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
59+
repository-url: https://test.pypi.org/legacy/
60+
packages-dir: release

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "scsctl"
7-
version = "0.0.1"
7+
version = "0.0.3"
88
authors = [{name="Jegath S", email="[email protected]" }]
99
description = "Tool for automating Vulnerability Risk Management and Software Supply Chain Security Measures"
1010
readme = "README.md"
11-
dependencies = ['click==8.1.3', 'clickhouse-driver==0.2.6', 'numpy==1.25.0', 'requests==2.31.0','questionary==1.10.0','tabulate==0.9.0']
11+
dependencies = ['click==8.1.3', 'clickhouse-driver==0.2.6', 'numpy==1.25.0', 'requests==2.31.0','questionary==1.10.0','tabulate==0.9.0','kubernetes==27.2.0']
1212
requires-python = ">=3.9"
1313

1414
[project.scripts]

src/scsctl/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ def scan(
164164
if(non_interactive):
165165
click.echo("Sbom report")
166166
click.echo("===========")
167-
print_sbom_report(sbom_report)
167+
print_sbom_report(sbom_report = sbom_report,is_non_interactive = True)
168168
click.echo("Pyroscope detected packages")
169169
click.echo("===========================")
170-
print_pyroscope_packages(pyroscope_data)
170+
print_pyroscope_packages(pyroscope_package_names = pyroscope_data,is_non_interactive = True)
171171
if falco_enabled:
172172
click.echo("Falco detected packages")
173173
click.echo("=======================")
174-
print_falco_packages(falco_found_extra_packages)
174+
print_falco_packages(falco_package_names = falco_found_extra_packages,is_non_interactive = True)
175175
click.echo("Final Report")
176176
click.echo("=============")
177177
click.echo(final_report)

src/scsctl/helper/falco.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,22 @@ def compare_and_find_extra_packages_using_falco(falco_package_names, sbom_packag
6969
return extra_packages
7070

7171

72-
def print_falco_packages(falco_package_names):
72+
def print_falco_packages(falco_package_names,is_non_interactive=False):
7373
headers = ["Packages"]
7474
data = []
7575
for item in falco_package_names:
7676
data.append([item])
7777

78+
width = [100]
79+
80+
if is_non_interactive:
81+
print(tabulate(data, headers=headers, tablefmt="grid",maxcolwidths=width, showindex=list(range(1, len(data) + 1))))
82+
return
83+
84+
7885
chunk_size = 200
7986
index = 0
8087

81-
width = [100]
8288

8389
while index < len(data):
8490
table = tabulate(

src/scsctl/helper/pyroscope.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def get_pyroscope_data(app_details: AppDetails):
2424
return [], False
2525

2626

27-
def print_pyroscope_packages(pyroscope_package_names):
27+
def print_pyroscope_packages(pyroscope_package_names,is_non_interactive = False):
2828
if "total" in pyroscope_package_names:
2929
pyroscope_package_names.remove("total")
3030
if "other" in pyroscope_package_names:
@@ -33,11 +33,15 @@ def print_pyroscope_packages(pyroscope_package_names):
3333
data = []
3434
for item in pyroscope_package_names:
3535
data.append([item])
36+
37+
width = [100]
38+
if is_non_interactive:
39+
print(tabulate(data, headers=headers, tablefmt="grid",maxcolwidths=width, showindex=list(range(1, len(data) + 1))))
40+
return
3641

3742
chunk_size = 200
3843
index = 0
3944

40-
width = [100]
4145

4246
while index < len(data):
4347
table = tabulate(

src/scsctl/helper/trivy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_sbom_report(app_details: AppDetails):
4545
return "", False
4646

4747

48-
def print_sbom_report(sbom_report):
48+
def print_sbom_report(sbom_report,is_non_interactive=False):
4949
sbom_report = json.loads(sbom_report)
5050
sbom_report = sbom_report["Results"]
5151
sbom_report = [item["Vulnerabilities"] for item in sbom_report if item["Class"] != "lang-pkgs"][0]
@@ -71,7 +71,10 @@ def print_sbom_report(sbom_report):
7171

7272
# Change width of the columns (First width is for the index column)
7373
width = [10, 20, 20, 20, 10, 10, 80]
74-
# print(data)
74+
75+
if is_non_interactive:
76+
print(tabulate(data, headers=headers, tablefmt="grid",maxcolwidths=width, showindex=list(range(1, len(data) + 1))))
77+
return
7578

7679
while index < len(data):
7780
table = tabulate(

0 commit comments

Comments
 (0)