diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go index 1a8a37543d..69fdb90f33 100644 --- a/cmd/migrate_storage.go +++ b/cmd/migrate_storage.go @@ -5,7 +5,9 @@ package cmd import ( "context" + "errors" "fmt" + "io/fs" "strings" actions_model "code.gitea.io/gitea/models/actions" @@ -162,8 +164,20 @@ func migrateActionsLog(ctx context.Context, dstStorage storage.ObjectStorage) er func migrateActionsArtifacts(ctx context.Context, dstStorage storage.ObjectStorage) error { return db.Iterate(ctx, nil, func(ctx context.Context, artifact *actions_model.ActionArtifact) error { - _, err := storage.Copy(dstStorage, artifact.ArtifactPath, storage.ActionsArtifacts, artifact.ArtifactPath) - return err + if artifact.Status == int64(actions_model.ArtifactStatusExpired) { + return nil + } + + _, err := storage.Copy(dstStorage, artifact.StoragePath, storage.ActionsArtifacts, artifact.StoragePath) + if err != nil { + // ignore files that do not exist + if errors.Is(err, fs.ErrNotExist) { + return nil + } + return err + } + + return nil }) } diff --git a/release-notes/8.0.0/fix/4085.md b/release-notes/8.0.0/fix/4085.md new file mode 100644 index 0000000000..6112b2f920 --- /dev/null +++ b/release-notes/8.0.0/fix/4085.md @@ -0,0 +1 @@ +- `forgejo migrate-storage --type actions-artifacts` always fails because it picks the wrong path