@@ -412,9 +412,6 @@ class SLSAGithubGenericBuildDefinitionV01(ProvenanceBuildDefinition):
412412 def get_build_invocation (self , statement : InTotoV01Statement | InTotoV1Statement ) -> tuple [str | None , str | None ]:
413413 """Retrieve the build invocation information from the given statement.
414414
415- This method is intended to be implemented by subclasses to extract
416- specific invocation details from a provenance statement.
417-
418415 Parameters
419416 ----------
420417 statement : InTotoV1Statement | InTotoV01Statement
@@ -456,9 +453,6 @@ class SLSAGithubActionsBuildDefinitionV1(ProvenanceBuildDefinition):
456453 def get_build_invocation (self , statement : InTotoV01Statement | InTotoV1Statement ) -> tuple [str | None , str | None ]:
457454 """Retrieve the build invocation information from the given statement.
458455
459- This method is intended to be implemented by subclasses to extract
460- specific invocation details from a provenance statement.
461-
462456 Parameters
463457 ----------
464458 statement : InTotoV1Statement | InTotoV01Statement
@@ -496,9 +490,6 @@ class SLSANPMCLIBuildDefinitionV2(ProvenanceBuildDefinition):
496490 def get_build_invocation (self , statement : InTotoV01Statement | InTotoV1Statement ) -> tuple [str | None , str | None ]:
497491 """Retrieve the build invocation information from the given statement.
498492
499- This method is intended to be implemented by subclasses to extract
500- specific invocation details from a provenance statement.
501-
502493 Parameters
503494 ----------
504495 statement : InTotoV1Statement | InTotoV01Statement
@@ -540,9 +531,6 @@ class SLSAGCBBuildDefinitionV1(ProvenanceBuildDefinition):
540531 def get_build_invocation (self , statement : InTotoV01Statement | InTotoV1Statement ) -> tuple [str | None , str | None ]:
541532 """Retrieve the build invocation information from the given statement.
542533
543- This method is intended to be implemented by subclasses to extract
544- specific invocation details from a provenance statement.
545-
546534 Parameters
547535 ----------
548536 statement : InTotoV1Statement | InTotoV01Statement
@@ -576,9 +564,6 @@ class SLSAOCIBuildDefinitionV1(ProvenanceBuildDefinition):
576564 def get_build_invocation (self , statement : InTotoV01Statement | InTotoV1Statement ) -> tuple [str | None , str | None ]:
577565 """Retrieve the build invocation information from the given statement.
578566
579- This method is intended to be implemented by subclasses to extract
580- specific invocation details from a provenance statement.
581-
582567 Parameters
583568 ----------
584569 statement : InTotoV1Statement | InTotoV01Statement
@@ -613,9 +598,6 @@ class WitnessGitLabBuildDefinitionV01(ProvenanceBuildDefinition):
613598 def get_build_invocation (self , statement : InTotoV01Statement | InTotoV1Statement ) -> tuple [str | None , str | None ]:
614599 """Retrieve the build invocation information from the given statement.
615600
616- This method is intended to be implemented by subclasses to extract
617- specific invocation details from a provenance statement.
618-
619601 Parameters
620602 ----------
621603 statement : InTotoV1Statement | InTotoV01Statement
@@ -666,6 +648,7 @@ def get_build_type(statement: InTotoV1Statement | InTotoV01Statement) -> str | N
666648 if statement ["predicate" ] is None :
667649 return None
668650
651+ # Different build provenances might store the buildType field in different sections.
669652 if build_type := json_extract (statement ["predicate" ], ["buildType" ], str ):
670653 return build_type
671654
@@ -695,6 +678,9 @@ def find_build_def(statement: InTotoV01Statement | InTotoV1Statement) -> Provena
695678 Raised when the build definition cannot be found in the provenance statement.
696679 """
697680 build_type = ProvenancePredicate .get_build_type (statement )
681+ if build_type is None :
682+ raise ProvenanceError ("Unable to find buildType in the provenance statement." )
683+
698684 build_defs : list [ProvenanceBuildDefinition ] = [
699685 SLSAGithubGenericBuildDefinitionV01 (),
700686 SLSAGithubActionsBuildDefinitionV1 (),
0 commit comments