Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
PA-10432 Contributing developer param (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
SOOS-JAlvarez committed Aug 8, 2023
1 parent b3d3344 commit 610910a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.11
1.7.12-rc1
23 changes: 23 additions & 0 deletions src/cli/soos.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ def exec(soos_context):

if soos_context.app_version is not None:
structure_api_data["appVersion"] = soos_context.app_version

if soos_context.contributing_developer is not None:
structure_api_data["contributingDeveloper"] = soos_context.contributing_developer

try:
kernel = requests.post(
Expand Down Expand Up @@ -276,6 +279,7 @@ def __init__(self):
self.integration_type = "Script"
self.generate_sarif_report = False
self.github_pat = None
self.contributing_developer = None

def __set_source_code_path__(self, source_code_directory):
"""
Expand Down Expand Up @@ -432,6 +436,11 @@ def load_from_parameters(self, script_args):
self.build_uri = str(script_args.build_uri)
SOOS.console_log("SOOS_BUILD_URI Parameter Loaded: " + self.build_uri)

if script_args.contributing_developer is not None:
if len(script_args.contributing_developer) > 0:
self.contributing_developer = str(script_args.contributing_developer)
SOOS.console_log("SOOS_CONTRIBUTING_DEVELOPER Parameter Loaded: " + self.contributing_developer)

# Operating environment, if missing, will default to platform

if script_args.operating_environment is not None and len(script_args.operating_environment) > 0:
Expand Down Expand Up @@ -555,6 +564,13 @@ def create_scan_metadata(context: SOOSContext) -> Union[CreateScanAPIResponse, E
set_body_value(start_scan_data, 'integrationName', context.integration_name)
set_body_value(start_scan_data, 'appVersion', context.app_version)

if context.contributing_developer is not None:
start_scan_data['contributingDeveloperAudit'] = [{
"source": "EnvironmentVariable",
"sourceName": "commit",
"contributingDeveloperId": context.contributing_developer
}]

headers = generate_header(api_key=context.api_key, content_type="application/json")
data = json.dumps(start_scan_data)

Expand Down Expand Up @@ -1580,6 +1596,13 @@ def register_arguments():
default=False,
required=False
)

parser.add_argument("-cdev", "--contributingDeveloper", dest="contributing_developer",
help="Contributing developer. Intended for internal use only",
type=str,
default=None,
required=False
)

return parser

Expand Down

0 comments on commit 610910a

Please sign in to comment.