Skip to content

Commit f8e9a8e

Browse files
committed
chore: fix integration test related issues
Signed-off-by: Ben Selwyn-Smith <[email protected]>
1 parent 368afce commit f8e9a8e

File tree

7 files changed

+25
-17
lines changed

7 files changed

+25
-17
lines changed

src/macaron/repo_finder/provenance_finder.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def find_provenance(self, purl: PackageURL) -> InTotoPayload | None:
5454
InTotoPayload | None
5555
The provenance payload if found, or None.
5656
"""
57+
logger.debug("Seeking provenance of: %s", purl)
58+
5759
if determine_abstract_purl_type(purl) == AbstractPurlType.REPOSITORY:
5860
# Do not perform this function for repository type targets.
5961
return None
@@ -282,7 +284,7 @@ def find_provenance_from_ci(self, analyze_ctx: AnalyzeContext, git_obj: Git | No
282284
return None
283285
tags = git_obj.repo.tags
284286
for _tag in tags:
285-
if _tag.commit and _tag.commit == digest:
287+
if _tag.commit and str(_tag.commit) == digest:
286288
tag = str(_tag)
287289
break
288290

src/macaron/slsa_analyzer/analyzer.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,9 @@ def _determine_build_tools(self, analyze_ctx: AnalyzeContext, git_service: BaseG
10451045
if isinstance(git_service, NoneGitService):
10461046
continue
10471047

1048+
if not analyze_ctx.component.repository:
1049+
continue
1050+
10481051
logger.info(
10491052
"Checking if the repo %s uses build tool %s",
10501053
analyze_ctx.component.repository.complete_name,
@@ -1056,10 +1059,13 @@ def _determine_build_tools(self, analyze_ctx: AnalyzeContext, git_service: BaseG
10561059
analyze_ctx.dynamic_data["build_spec"]["tools"].append(build_tool)
10571060

10581061
if not analyze_ctx.dynamic_data["build_spec"]["tools"]:
1059-
logger.info(
1060-
"Unable to discover any build tools for repository %s or the build tools are not supported.",
1061-
analyze_ctx.component.repository.complete_name,
1062-
)
1062+
if analyze_ctx.component.repository:
1063+
logger.info(
1064+
"Unable to discover any build tools for repository %s or the build tools are not supported.",
1065+
analyze_ctx.component.repository.complete_name,
1066+
)
1067+
else:
1068+
logger.info("Unable to discover build tools because repository is None.")
10631069

10641070
def _determine_ci_services(self, analyze_ctx: AnalyzeContext, git_service: BaseGitService) -> None:
10651071
"""Determine the CI services used by the software component."""

tests/integration/cases/micronaut-projects_micronaut-test/micronaut-test.dl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Policy("test_policy", component_id, "") :-
77
check_passed(component_id, "mcn_build_as_code_1"),
88
check_passed(component_id, "mcn_build_script_1"),
99
check_passed(component_id, "mcn_build_service_1"),
10-
check_passed(component_id, "mcn_provenance_available_1"),
11-
check_passed(component_id, "mcn_provenance_level_three_1"),
1210
check_passed(component_id, "mcn_version_control_system_1"),
11+
check_failed(component_id, "mcn_provenance_available_1"),
12+
check_failed(component_id, "mcn_provenance_level_three_1"),
1313
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
1414
check_failed(component_id, "mcn_provenance_derived_commit_1"),
1515
check_failed(component_id, "mcn_provenance_derived_repo_1"),

tests/integration/cases/sigstore_mock/policy.dl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Policy("test_policy", component_id, "") :-
99
check_passed(component_id, "mcn_build_service_1"),
1010
check_passed(component_id, "mcn_provenance_available_1"),
1111
check_passed(component_id, "mcn_version_control_system_1"),
12+
check_passed(component_id, "mcn_provenance_derived_commit_1"),
13+
check_passed(component_id, "mcn_provenance_derived_repo_1"),
1214
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
13-
check_failed(component_id, "mcn_provenance_derived_commit_1"),
14-
check_failed(component_id, "mcn_provenance_derived_repo_1"),
1515
check_failed(component_id, "mcn_provenance_level_three_1"),
1616
check_failed(component_id, "mcn_provenance_witness_level_one_1"),
1717
check_failed(component_id, "mcn_trusted_builder_level_three_1"),

tests/integration/cases/urllib3_expectation_dir/policy.dl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Policy("test_policy", component_id, "") :-
77
check_passed(component_id, "mcn_build_as_code_1"),
88
check_passed(component_id, "mcn_build_script_1"),
99
check_passed(component_id, "mcn_build_service_1"),
10-
check_passed(component_id, "mcn_provenance_available_1"),
11-
check_passed(component_id, "mcn_provenance_expectation_1"),
12-
check_passed(component_id, "mcn_provenance_level_three_1"),
1310
check_passed(component_id, "mcn_version_control_system_1"),
11+
check_failed(component_id, "mcn_provenance_available_1"),
12+
check_failed(component_id, "mcn_provenance_expectation_1"),
13+
check_failed(component_id, "mcn_provenance_level_three_1"),
1414
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
1515
check_failed(component_id, "mcn_provenance_derived_commit_1"),
1616
check_failed(component_id, "mcn_provenance_derived_repo_1"),

tests/integration/cases/urllib3_expectation_file/policy.dl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Policy("test_policy", component_id, "") :-
77
check_passed(component_id, "mcn_build_as_code_1"),
88
check_passed(component_id, "mcn_build_script_1"),
99
check_passed(component_id, "mcn_build_service_1"),
10-
check_passed(component_id, "mcn_provenance_available_1"),
11-
check_passed(component_id, "mcn_provenance_expectation_1"),
12-
check_passed(component_id, "mcn_provenance_level_three_1"),
1310
check_passed(component_id, "mcn_version_control_system_1"),
11+
check_failed(component_id, "mcn_provenance_available_1"),
12+
check_failed(component_id, "mcn_provenance_expectation_1"),
13+
check_failed(component_id, "mcn_provenance_level_three_1"),
1414
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
1515
check_failed(component_id, "mcn_provenance_derived_commit_1"),
1616
check_failed(component_id, "mcn_provenance_derived_repo_1"),

tests/integration/cases/urllib3_invalid_expectation/policy.dl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Policy("test_policy", component_id, "") :-
77
check_passed(component_id, "mcn_build_as_code_1"),
88
check_passed(component_id, "mcn_build_script_1"),
99
check_passed(component_id, "mcn_build_service_1"),
10-
check_passed(component_id, "mcn_provenance_available_1"),
11-
check_passed(component_id, "mcn_provenance_level_three_1"),
1210
check_passed(component_id, "mcn_version_control_system_1"),
11+
check_failed(component_id, "mcn_provenance_available_1"),
12+
check_failed(component_id, "mcn_provenance_level_three_1"),
1313
check_failed(component_id, "mcn_infer_artifact_pipeline_1"),
1414
check_failed(component_id, "mcn_provenance_derived_commit_1"),
1515
check_failed(component_id, "mcn_provenance_derived_repo_1"),

0 commit comments

Comments
 (0)