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

Fix connection errors if a retry is encountered #82

Merged
merged 3 commits into from
May 18, 2020

Conversation

konradpabjan
Copy link
Collaborator

@konradpabjan konradpabjan commented May 15, 2020

Overview

Fixes: #71

Testing

This is a relatively low risk change, considering the same bug was fixed in @actions/cache: actions/cache#305

Stress test uploading 9000+ small files and 1 large file: https://github.com/konradpabjan/artifact-test/runs/679266178?check_suite_focus=true

@@ -21,7 +21,7 @@ async function run(): Promise<void> {

const artifactClient = create()
const options: UploadOptions = {
continueOnError: true
continueOnError: false
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a behavior change?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should silently change behaviors. If this is really bothering people, consider exposing this option?

Copy link
Member

Choose a reason for hiding this comment

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

How did V1 behave? We should keep this consistent and expose an option if users request it

Copy link
Collaborator Author

@konradpabjan konradpabjan May 15, 2020

Choose a reason for hiding this comment

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

Yup, currently if an error is hit and a file can't get uploaded, the problematic files doesn't get uploaded but everything else continues. Users also have to dig into their logs to see that something didn't get uploaded. This will make the step with the upload action fail so users will immediately know that something bad happened during artifact upload. See the comments linked in the issue.

See this log for example: https://github.com/zhangyoufu/alpine/runs/629165891#step:6:110
The file upload fails, but there is no indication or error unless users dig into their logs. This change will mark this upload step as a failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I understand it's quite annoying that you can't trust the exit code, but this is the behavior since v1 right? v2 is just being consistent with v1?

Copy link
Member

Choose a reason for hiding this comment

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

I think V1 would still fail the step if an upload failed

Copy link
Collaborator Author

@konradpabjan konradpabjan May 15, 2020

Choose a reason for hiding this comment

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

Here is the design decision we came up with ADR

The upload step is failed (which causes the action to fail and turn red)

So this actually makes it consistent with what we planned out earlier. I missed this 😱

The artifact will still be available for download at the end and the reported size will only be that which was uploaded before the failure. V1 would generally fail fast if an error was encountered so this also makes it consistent with that.

Copy link
Contributor

@yacaovsnc yacaovsnc May 15, 2020

Choose a reason for hiding this comment

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

I think V1 would still fail the step if an upload failed

If this is the case, then we are good. I just read some users mentioned this is consistent with v1.

We had the window of introducing breaking changes when we add v2. Now we should be careful about making any breaking changes, even though it was in the design. We missed the window. However, if this change makes us consistent with v1, I feel better about changing the behavior now.

Copy link
Collaborator Author

@konradpabjan konradpabjan May 15, 2020

Choose a reason for hiding this comment

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

This behavior change only manifests itself if a really bad error is encountered (like the ECONNRESET users encountered with 4 retries doing nothing). Ideally there shouldn't be any errors like this :)

This should have been set to false for the initial v2 release

Copy link
Member

@joshmgross joshmgross left a comment

Choose a reason for hiding this comment

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

Should we bump the version in package.json to line up with the next release?

@konradpabjan
Copy link
Collaborator Author

Should we bump the version in package.json to line up with the next release?

I bumped it up to 2.0.1 (package-lock.json also got an update). I looked at some of our other actions and most of them are at 1.0.0. The exceptions are cache and checkout (outdated though...). I think this will be a good practice to follow.

It would be cool if in the future we had an action that bumps up the version numbers, updates the tags, and also creates a release automatically through a chatop or something😀

name || getDefaultArtifactName(),
searchResult.filesToUpload,
searchResult.rootDirectory,
options
)

core.info('Artifact upload has finished successfully!')
if (uploadResponse.failedItems.length > 0) {
core.setFailed(
Copy link
Collaborator Author

@konradpabjan konradpabjan May 15, 2020

Choose a reason for hiding this comment

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

I double checked my code in @actions/artifact and it's up to us to call core.setFailed if something doesn't get uploaded.

If an error is encountered with continueOnError set to false (true doesn't make a difference either), any remaining files are not attempted to be uploaded (aborts the upload) and it just calls core.error which doesn't actually fail the step

@konradpabjan konradpabjan merged commit 97b7dac into master May 18, 2020
@konradpabjan konradpabjan deleted the konradpabjan/v2-fix-retries branch May 18, 2020 13:43
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.

Connection errors with v2
3 participants