Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
konradpabjan committed Aug 15, 2023
1 parent 4193f51 commit 5e40a20
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/artifact/src/internal/upload/blob-upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export async function uploadZipToBlobStorage(

let md5Hash: string | undefined = undefined
const uploadStream = new stream.PassThrough()
const hashStream = crypto.createHash('md5').setEncoding('hex')
const hashStream = crypto.createHash('md5')

zipUploadStream.pipe(uploadStream) // This stream is used for the upload
zipUploadStream.pipe(hashStream) // 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

try {
core.info('Beginning upload of artifact content to blob storage')
Expand All @@ -70,6 +70,7 @@ export async function uploadZipToBlobStorage(
hashStream.end()
md5Hash = hashStream.read() as string
core.info(`MD5 hash of uploaded artifact zip is ${md5Hash}`)

} catch (error) {
core.info(`Failed to upload artifact zip to blob storage, error: ${error}`)
return {
Expand All @@ -78,11 +79,9 @@ export async function uploadZipToBlobStorage(
}

if (uploadByteCount === 0) {
core.warning(
`No data was uploaded to blob storage. Reported upload byte count is 0`
)
core.warning(`No data was uploaded to blob storage. Reported upload byte count is 0`)
return {
isSuccess: false
isSuccess: false,
}
}

Expand Down

0 comments on commit 5e40a20

Please sign in to comment.