File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,15 +142,12 @@ export class Cosign {
142142 bundlePayload = obj as SerializedBundle ;
143143 }
144144
145- if ( bundlePayload && signatureManifestDigest ) {
145+ if ( bundlePayload && ( signatureManifestDigest || signatureManifestFallbackDigest ) ) {
146+ errors = undefined ; // clear errors if we have both payload and manifest digest
146147 break ;
147148 }
148149 }
149150
150- if ( ! errors && ! bundlePayload ) {
151- throw new Error ( `Cannot find signature bundle from cosign command output: ${ logs } ` ) ;
152- }
153-
154151 return {
155152 bundle : bundlePayload ,
156153 signatureManifestDigest : signatureManifestDigest || signatureManifestFallbackDigest ,
Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ export class Sigstore {
106106 const errorMessages = signResult . errors . map ( e => `- [${ e . code } ] ${ e . message } : ${ e . detail } ` ) . join ( '\n' ) ;
107107 throw new Error ( `Cosign sign command failed with errors:\n${ errorMessages } ` ) ;
108108 } else {
109- throw new Error ( `Cosign sign command failed with exit code ${ execRes . exitCode } ` ) ;
109+ // prettier-ignore
110+ throw new Error ( `Cosign sign command failed with: ${ execRes . stderr . trim ( ) . split ( / \r ? \n / ) . filter ( line => line . length > 0 ) . pop ( ) ?? 'unknown error' } ` ) ;
110111 }
111112 }
112113 const parsedBundle = Sigstore . parseBundle ( bundleFromJSON ( signResult . bundle ) ) ;
@@ -209,7 +210,8 @@ export class Sigstore {
209210 throw lastError ;
210211 }
211212 } else {
212- throw new Error ( `Cosign verify command failed: ${ execRes . stderr } ` ) ;
213+ // prettier-ignore
214+ throw new Error ( `Cosign verify command failed with: ${ execRes . stderr . trim ( ) . split ( / \r ? \n / ) . filter ( line => line . length > 0 ) . pop ( ) ?? 'unknown error' } ` ) ;
213215 }
214216 }
215217 }
You can’t perform that action at this time.
0 commit comments