1
0
Fork 0

wait on write stream

pull/1700/head
Vallie Joseph 2024-03-28 18:07:20 +00:00
parent fe0c0de7db
commit 97e4fcfcd5
2 changed files with 30 additions and 7 deletions

View File

@ -52,7 +52,9 @@ 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 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') core.info('Beginning upload of artifact content to blob storage')
try {
await new Promise((resolve, reject) => {
uploadStream.on('readable', async () => {
try { try {
await blockBlobClient.uploadStream( await blockBlobClient.uploadStream(
uploadStream, uploadStream,
@ -60,6 +62,12 @@ export async function uploadZipToBlobStorage(
maxConcurrency, maxConcurrency,
options options
) )
resolve('success')
} catch (error) {
reject(error)
}
})
})
} catch (error) { } catch (error) {
if (NetworkError.isNetworkErrorCode(error?.code)) { if (NetworkError.isNetworkErrorCode(error?.code)) {
throw new NetworkError(error?.code) throw new NetworkError(error?.code)
@ -67,6 +75,20 @@ export async function uploadZipToBlobStorage(
throw error throw error
} }
// try {
// await blockBlobClient.uploadStream(
// uploadStream,
// bufferSize,
// maxConcurrency,
// options
// )
// } catch (error) {
// if (NetworkError.isNetworkErrorCode(error?.code)) {
// throw new NetworkError(error?.code)
// }
// throw error
// }
core.info('Finished uploading artifact content to blob storage!') core.info('Finished uploading artifact content to blob storage!')

View File

@ -53,6 +53,7 @@ export async function createZipUploadStream(
} }
) )
} else { } else {
// add directory to zip
zip.entry(null, {name: file.destinationPath}, function (err, entry) { zip.entry(null, {name: file.destinationPath}, function (err, entry) {
core.debug(`Entry is: ${entry}`) core.debug(`Entry is: ${entry}`)
if (err) reject(err) if (err) reject(err)