diff --git a/packages/artifact/package-lock.json b/packages/artifact/package-lock.json index 0b29125e..9710156d 100644 --- a/packages/artifact/package-lock.json +++ b/packages/artifact/package-lock.json @@ -19,7 +19,6 @@ "@octokit/request-error": "^5.0.0", "@protobuf-ts/plugin": "^2.2.3-alpha.1", "archiver": "^5.3.1", - "async": "^3.2.5", "crypto": "^1.0.1", "jwt-decode": "^3.1.2", "twirp-ts": "^2.5.0", diff --git a/packages/artifact/package.json b/packages/artifact/package.json index 7796e926..166438f4 100644 --- a/packages/artifact/package.json +++ b/packages/artifact/package.json @@ -50,7 +50,6 @@ "@octokit/request-error": "^5.0.0", "@protobuf-ts/plugin": "^2.2.3-alpha.1", "archiver": "^5.3.1", - "async": "^3.2.5", "crypto": "^1.0.1", "jwt-decode": "^3.1.2", "twirp-ts": "^2.5.0", @@ -65,4 +64,4 @@ "typedoc-plugin-markdown": "^3.17.1", "typescript": "^5.2.2" } -} +} \ No newline at end of file diff --git a/packages/artifact/src/internal/upload/blob-upload.ts b/packages/artifact/src/internal/upload/blob-upload.ts index 6f5bf734..87bb7237 100644 --- a/packages/artifact/src/internal/upload/blob-upload.ts +++ b/packages/artifact/src/internal/upload/blob-upload.ts @@ -52,6 +52,7 @@ export async function uploadZipToBlobStorage( zipUploadStream.pipe(hashStream).setEncoding('hex') // This stream is used to compute a hash of the zip content that gets used. Integrity check core.info('Beginning upload of artifact content to blob storage') + try { await blockBlobClient.uploadStream( uploadStream, diff --git a/packages/artifact/src/internal/upload/upload-artifact.ts b/packages/artifact/src/internal/upload/upload-artifact.ts index f9817262..b8f95201 100644 --- a/packages/artifact/src/internal/upload/upload-artifact.ts +++ b/packages/artifact/src/internal/upload/upload-artifact.ts @@ -72,6 +72,7 @@ export async function uploadArtifact( zipSpecification, options?.compressionLevel ) + // Upload zip to blob storage const uploadResult = await uploadZipToBlobStorage( createArtifactResp.signedUploadUrl, diff --git a/packages/artifact/src/internal/upload/zip.ts b/packages/artifact/src/internal/upload/zip.ts index 953fc79e..f62d5603 100644 --- a/packages/artifact/src/internal/upload/zip.ts +++ b/packages/artifact/src/internal/upload/zip.ts @@ -39,9 +39,9 @@ export async function createZipUploadStream( // register callbacks for various events during the zip lifecycle zip.on('error', zipErrorCallback) zip.on('warning', zipWarningCallback) - zip.on('finish', zipFinishCallback) zip.on('end', zipEndCallback) + for (const file of uploadSpecification) { await new Promise((resolve, reject) => { if (file.sourcePath !== null) { @@ -91,17 +91,17 @@ const zipErrorCallback = (error: any): void => { throw new Error('An error has occurred during zip creation for the artifact') } // eslint-disable-next-line @typescript-eslint/no-explicit-any -const zipWarningCallback = (err: any): void => { - if (err.code === 'ENOENT') { +const zipWarningCallback = (error: any): void => { + if (error.code === 'ENOENT') { core.warning( 'ENOENT warning during artifact zip creation. No such file or directory' ) - core.info(err) + core.info(error) } else { core.warning( - `A non-blocking warning has occurred during artifact zip creation: ${err.code}` + `A non-blocking warning has occurred during artifact zip creation: ${error.code}` ) - core.info(err) + core.info(error) } }