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

Retry handling can lead to duplicated artifact uploads, which fails actions/deploy-pages #97

Open
Bo98 opened this issue Feb 24, 2024 · 2 comments

Comments

@Bo98
Copy link

Bo98 commented Feb 24, 2024

If the upload fails due to a timeout in the "finalizing artifact upload" stage, the uploader retries and creates another artifact with the same name. However, the server has actually received all the data if it has reached the "finalizing" stage so it's possible that the timeout is simply in receiving the confirmation from the server.

Take the following example output:

With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 8388608
Uploaded bytes 16777216
Uploaded bytes 25165824
Uploaded bytes 33554432
Uploaded bytes 41943040
Uploaded bytes 50331648
Uploaded bytes 52845291
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 581e085d8ee66e610a32e88c1e0e70205caaf6c4082dc4c23ccdd678e9def1cc
Finalizing artifact upload
Attempt 1 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/FinalizeArtifact. Retrying request in 3000 ms...
Artifact github-pages.zip successfully finalized. Artifact ID 1271248021
Artifact github-pages has been successfully uploaded! Final size is 52845291 bytes. Artifact ID is 1271248021

The end result was two artifacts with the same name:

image

This fails actions/deploy-pages:

Fetching artifact metadata for "github-pages" in this workflow run
Found 2 artifact(s)
Error: Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.
Error: Error: Multiple artifacts named "github-pages" were unexpectedly found for this workflow run. Artifact count is 2.
    at getArtifactMetadata (/home/runner/work/_actions/actions/deploy-pages/v4/src/internal/api-client.js:89:1)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Deployment.create (/home/runner/work/_actions/actions/deploy-pages/v4/src/internal/deployment.js:66:1)
    at main (/home/runner/work/_actions/actions/deploy-pages/v4/src/index.js:30:1)
Error: Error: Multiple artifacts named "github-pages" were unexpectedly found for this workflow run. Artifact count is 2.

Not sure what the best fix for this is. Retry handling perhaps could check if the list of artifacts changed before and after the artifact was finalized, though this feels hacky. Alternatively, and probably better, the backend could pair CreateArtifact and FinalizeArtifact more closely so that duplicated FinalizeArtifact on the same artifact can report the same ID.


An alternative workaround could be to make actions/deploy-pages accept an artifact_id rather than only accept artifact_name. It doesn't really fix the core issue, but is something I would be comfortable making a PR for if deemed nice to have.

@jcreedcmu
Copy link

Fwiw, I see this is also being tracked on upload-artifact: actions/upload-artifact#531

@mauritz-lovgren
Copy link

mauritz-lovgren commented Apr 24, 2024

As a workaround, we use the geekyeggo/delete-artifact action to remove the github-pages artifact just before deployment (and just after for cleanup).

Or, this might not really fix this issue at all?

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

No branches or pull requests

3 participants