Skip to content

Commit

Permalink
Add step to tag known software in pipeline
Browse files Browse the repository at this point in the history
    * Change name of Docker step from "find_images_linux_distro" to "find_images_os_and_distro"

Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Jul 26, 2021
1 parent 0fb1549 commit b6786b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions scanpipe/pipelines/windows_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
# Visit https://github.com/nexB/scancode.io for support and download.

from scanpipe.pipelines import docker
from scanpipe.pipelines.docker import Docker
from scanpipe.pipes import docker
from scanpipe.pipes import windows


class WindowsDocker(docker.Docker):
class WindowsDocker(Docker):
"""
A pipeline to analyze a Windows Docker image.
"""
Expand All @@ -35,10 +35,11 @@ def steps(cls):
return (
cls.extract_images,
cls.extract_layers,
cls.find_images_linux_distro,
cls.find_images_os_and_distro,
cls.collect_images_information,
cls.collect_and_create_codebase_resources,
cls.collect_and_create_system_packages,
cls.tag_known_software_packages,
cls.tag_uninteresting_codebase_resources,
cls.tag_empty_files,
cls.scan_for_application_packages,
Expand All @@ -47,9 +48,12 @@ def steps(cls):
cls.tag_not_analyzed_codebase_resources,
)

def tag_known_software_packages(self):
windows.tag_known_software(self.project)

def tag_uninteresting_codebase_resources(self):
"""
Flag remaining files not from a system package.
"""
docker.tag_whiteout_codebase_resources(self.project)
windows.tag_uninteresting_codebase_resources(self.project)
windows.tag_uninteresting_windows_codebase_resources(self.project)
2 changes: 1 addition & 1 deletion scanpipe/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_scanpipe_pipelines_pipeline_graph_output_dot(self):
self.assertIn('"extract_images"[label=<<b>extract_images</b>>', output_dot)
self.assertIn('"extract_layers"[label=<<b>extract_layers</b>>', output_dot)
self.assertIn("extract_images -> extract_layers;", output_dot)
self.assertIn("extract_layers -> find_images_linux_distro;", output_dot)
self.assertIn("extract_layers -> find_images_os_and_distro;", output_dot)

def test_scanpipe_management_command_create_project_base(self):
out = StringIO()
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
],
"scancodeio_pipelines": [
"docker = scanpipe.pipelines.docker:Docker",
"windows_docker = scanpipe.pipelines.windows_docker:WindowsDocker",
"load_inventory = scanpipe.pipelines.load_inventory:LoadInventory",
"root_filesystems = scanpipe.pipelines.root_filesystems:RootFS",
"scan_codebase = scanpipe.pipelines.scan_codebase:ScanCodebase",
Expand Down

0 comments on commit b6786b3

Please sign in to comment.