diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-05-07 08:45:30 +0200 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-05-12 20:03:10 +0200 |
commit | 7028fe0b4d89c045b64ae891d2716e89965bc012 (patch) | |
tree | 8a9ff019dc120f2d6135d699dc6a2cfaecb74405 /cmd | |
parent | Make "sync branch" also sync object format and add tests (#30878) (diff) | |
download | forgejo-7028fe0b4d89c045b64ae891d2716e89965bc012.tar.xz forgejo-7028fe0b4d89c045b64ae891d2716e89965bc012.zip |
Fix missing migrate actions artifacts (#30874)
The actions artifacts should be able to be migrate to the new storage
place.
(cherry picked from commit 6ad77125cabe53a943d46b50e8cb79cfcea5491f)
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/migrate_storage.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go index aa49445a89..357416fc33 100644 --- a/cmd/migrate_storage.go +++ b/cmd/migrate_storage.go @@ -34,7 +34,7 @@ var CmdMigrateStorage = &cli.Command{ Name: "type", Aliases: []string{"t"}, Value: "", - Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log'", + Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log', 'actions-artifacts", }, &cli.StringFlag{ Name: "storage", @@ -160,6 +160,13 @@ 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 + }) +} + func runMigrateStorage(ctx *cli.Context) error { stdCtx, cancel := installSignals() defer cancel() @@ -223,13 +230,14 @@ func runMigrateStorage(ctx *cli.Context) error { } migratedMethods := map[string]func(context.Context, storage.ObjectStorage) error{ - "attachments": migrateAttachments, - "lfs": migrateLFS, - "avatars": migrateAvatars, - "repo-avatars": migrateRepoAvatars, - "repo-archivers": migrateRepoArchivers, - "packages": migratePackages, - "actions-log": migrateActionsLog, + "attachments": migrateAttachments, + "lfs": migrateLFS, + "avatars": migrateAvatars, + "repo-avatars": migrateRepoAvatars, + "repo-archivers": migrateRepoArchivers, + "packages": migratePackages, + "actions-log": migrateActionsLog, + "actions-artifacts": migrateActionsArtifacts, } tp := strings.ToLower(ctx.String("type")) |