Skip to content

Commit 216c8ea

Browse files
GiteaBotlunny
andauthored
Fix missing migrate actions artifacts (#30874) (#30886)
Backport #30874 by @lunny The actions artifacts should be able to be migrate to the new storage place. Co-authored-by: Lunny Xiao <[email protected]>
1 parent d5563be commit 216c8ea

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

cmd/migrate_storage.go

+16-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var CmdMigrateStorage = &cli.Command{
3434
Name: "type",
3535
Aliases: []string{"t"},
3636
Value: "",
37-
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log'",
37+
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log', 'actions-artifacts",
3838
},
3939
&cli.StringFlag{
4040
Name: "storage",
@@ -160,6 +160,13 @@ func migrateActionsLog(ctx context.Context, dstStorage storage.ObjectStorage) er
160160
})
161161
}
162162

163+
func migrateActionsArtifacts(ctx context.Context, dstStorage storage.ObjectStorage) error {
164+
return db.Iterate(ctx, nil, func(ctx context.Context, artifact *actions_model.ActionArtifact) error {
165+
_, err := storage.Copy(dstStorage, artifact.ArtifactPath, storage.ActionsArtifacts, artifact.ArtifactPath)
166+
return err
167+
})
168+
}
169+
163170
func runMigrateStorage(ctx *cli.Context) error {
164171
stdCtx, cancel := installSignals()
165172
defer cancel()
@@ -223,13 +230,14 @@ func runMigrateStorage(ctx *cli.Context) error {
223230
}
224231

225232
migratedMethods := map[string]func(context.Context, storage.ObjectStorage) error{
226-
"attachments": migrateAttachments,
227-
"lfs": migrateLFS,
228-
"avatars": migrateAvatars,
229-
"repo-avatars": migrateRepoAvatars,
230-
"repo-archivers": migrateRepoArchivers,
231-
"packages": migratePackages,
232-
"actions-log": migrateActionsLog,
233+
"attachments": migrateAttachments,
234+
"lfs": migrateLFS,
235+
"avatars": migrateAvatars,
236+
"repo-avatars": migrateRepoAvatars,
237+
"repo-archivers": migrateRepoArchivers,
238+
"packages": migratePackages,
239+
"actions-log": migrateActionsLog,
240+
"actions-artifacts": migrateActionsArtifacts,
233241
}
234242

235243
tp := strings.ToLower(ctx.String("type"))

0 commit comments

Comments
 (0)