Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing archiver package with direct use of zip-stream for fixing macOS upload issues #1690

Open
wants to merge 75 commits into
base: main
Choose a base branch
from

Conversation

vmjoseph
Copy link
Contributor

@vmjoseph vmjoseph commented Mar 15, 2024

This PR replaces the previous archiver package in upload-artifacts for the direct use of the zip-stream so that we can better hook into the finalize portion of the lifecycle. This should resolve issues on macOS where upload streams are incorrectly closed before the upload is finished due to a pre-existing issue with archiver.

Copy link

@Cjuan4631 Cjuan4631 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package-lock.json

@vmjoseph vmjoseph marked this pull request as ready for review April 1, 2024 14:01
@vmjoseph vmjoseph requested review from a team as code owners April 1, 2024 14:01
@vmjoseph vmjoseph marked this pull request as draft April 1, 2024 14:44
@vmjoseph vmjoseph marked this pull request as ready for review April 8, 2024 17:45
Comment on lines +74 to +78
).catch(err => {
throw new InvalidResponseError(
`createZipUploadStream: response from backend was not ok: ${err}`
)
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these awaited async functions should bubble up thrown errors, we shouldn't need this if we have an outer try/catch

Comment on lines +77 to +84
async.eachSeries(uploadSpecification, addFileToZip, (error: unknown) => {
if (error) {
core.error('Failed to add a file to the zip:')
core.info(error.toString()) // Convert error to string
return
}
zip.finalize() // Finalize the archive once all files have been added
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of introducing a new dependency on async, can we just await on a group of these promises?

e.g.

await Promise.all(uploadSpecification.map(addFileToZip))

or something like that? eachSeries does one at a time, does it have to do that for a specific reason? and do we know if this will impact speed?

describe('upload-artifact', () => {
beforeEach(() => {
noopLogs()
// noopLogs()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be uncommented?

)
).catch(err => {
throw new InvalidResponseError(
`createZipUploadStream: response from backend was not ok: ${err}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message might be a bit misleading since errors can come from that function without reaching out to a backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants