From ab23e02c95fd0a66f7b18402a95a6c370a657a5e Mon Sep 17 00:00:00 2001 From: "Jose I. Paris" Date: Thu, 5 Feb 2026 19:33:47 +0100 Subject: [PATCH 1/2] use dynamic PR metadata material name Signed-off-by: Jose I. Paris --- pkg/attestation/crafter/crafter.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/attestation/crafter/crafter.go b/pkg/attestation/crafter/crafter.go index a83f9f080..e24b76a93 100644 --- a/pkg/attestation/crafter/crafter.go +++ b/pkg/attestation/crafter/crafter.go @@ -535,7 +535,8 @@ func (c *Crafter) AutoCollectPRMetadata(ctx context.Context, attestationID strin } // Create a temporary file for the metadata - tmpFile, err := os.CreateTemp("", "pr-metadata-*.json") + materialName := fmt.Sprintf("pr-metadata-%s", metadata.Number) + tmpFile, err := os.CreateTemp("", fmt.Sprintf("%s.json", materialName) if err != nil { return fmt.Errorf("failed to create temp file: %w", err) } @@ -549,7 +550,7 @@ func (c *Crafter) AutoCollectPRMetadata(ctx context.Context, attestationID strin tmpFile.Close() // Add the material using the crafter with explicit CHAINLOOP_PR_INFO type - if _, err := c.AddMaterialContractFree(ctx, attestationID, schemaapi.CraftingSchema_Material_CHAINLOOP_PR_INFO.String(), "pr-metadata", tmpFile.Name(), casBackend, nil); err != nil { + if _, err := c.AddMaterialContractFree(ctx, attestationID, schemaapi.CraftingSchema_Material_CHAINLOOP_PR_INFO.String(), materialName, tmpFile.Name(), casBackend, nil); err != nil { return fmt.Errorf("failed to add PR/MR metadata material: %w", err) } From 35d4a91b2049f63c8179ce87b4bcd38177ebdbc5 Mon Sep 17 00:00:00 2001 From: "Jose I. Paris" Date: Thu, 5 Feb 2026 20:06:08 +0100 Subject: [PATCH 2/2] fix Signed-off-by: Jose I. Paris --- pkg/attestation/crafter/crafter.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/attestation/crafter/crafter.go b/pkg/attestation/crafter/crafter.go index e24b76a93..cbe85aba3 100644 --- a/pkg/attestation/crafter/crafter.go +++ b/pkg/attestation/crafter/crafter.go @@ -536,7 +536,7 @@ func (c *Crafter) AutoCollectPRMetadata(ctx context.Context, attestationID strin // Create a temporary file for the metadata materialName := fmt.Sprintf("pr-metadata-%s", metadata.Number) - tmpFile, err := os.CreateTemp("", fmt.Sprintf("%s.json", materialName) + tmpFile, err := os.CreateTemp("", fmt.Sprintf("%s.json", materialName)) if err != nil { return fmt.Errorf("failed to create temp file: %w", err) }