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

Artifacts get lost, when re-running old workflows #32256

Closed
hakito opened this issue Oct 14, 2024 · 1 comment · Fixed by #32281
Closed

Artifacts get lost, when re-running old workflows #32256

hakito opened this issue Oct 14, 2024 · 1 comment · Fixed by #32281
Labels
topic/gitea-actions related to the actions of Gitea type/bug

Comments

@hakito
Copy link
Contributor

hakito commented Oct 14, 2024

Description

I just tried to re-run a job that was executed 2 weeks ago. We have set ARTIFACT_RETENTION_DAYS = 7 in the actions section.

The build job actually says that artifact upload is succesful. But the next job, that tries to fetch the artifact fails:

Total number of files that will be downloaded: 540
A 500 response code has been received while attempting to download an artifact
Exponential backoff for retry #1. Waiting for 5[4](https://HIDDEN/actions/runs/860/jobs/1#jobstep-1-4)75 milliseconds before continuing the download
A 500 response code has been received while attempting to download an artifact
Exponential backoff for retry #1. Waiting for [5](https://HIDDEN/actions/runs/860/jobs/1#jobstep-1-5)482 milliseconds before continuing the download

I also tried downloading the artifact manually and get the error:

artifact not found

I also tried to delete the artifact manually in the web interface. This also returns a 200 code for the DELETE request. However the artifact does not disappear.

Here a part of the response from the artifacts GET request after the deletion attempt:

{
    "artifacts": [
        {
            "name": "Bin.Unprotected",
            "size": 80032963,
            "status": "expired"
        }
    ]
}

Gitea Version

1.22.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

MySQL/MariaDB

@yp05327 yp05327 added the topic/gitea-actions related to the actions of Gitea label Oct 15, 2024
@Zettat123
Copy link
Contributor

We should improve the CreateArtifact function to support updating uploaded artifacts when re-running a job.

func CreateArtifact(ctx context.Context, t *ActionTask, artifactName, artifactPath string, expiredDays int64) (*ActionArtifact, error) {
if err := t.LoadJob(ctx); err != nil {
return nil, err
}
artifact, err := getArtifactByNameAndPath(ctx, t.Job.RunID, artifactName, artifactPath)
if errors.Is(err, util.ErrNotExist) {
artifact := &ActionArtifact{
ArtifactName: artifactName,
ArtifactPath: artifactPath,
RunID: t.Job.RunID,
RunnerID: t.RunnerID,
RepoID: t.RepoID,
OwnerID: t.OwnerID,
CommitSHA: t.CommitSHA,
Status: int64(ArtifactStatusUploadPending),
ExpiredUnix: timeutil.TimeStamp(time.Now().Unix() + 3600*24*expiredDays),
}
if _, err := db.GetEngine(ctx).Insert(artifact); err != nil {
return nil, err
}
return artifact, nil
} else if err != nil {
return nil, err
}
return artifact, nil
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants