8
8
"fmt"
9
9
"strings"
10
10
11
+ actions_model "code.gitea.io/gitea/models/actions"
11
12
"code.gitea.io/gitea/models/db"
12
13
git_model "code.gitea.io/gitea/models/git"
13
14
"code.gitea.io/gitea/models/migrations"
@@ -32,7 +33,7 @@ var CmdMigrateStorage = cli.Command{
32
33
cli.StringFlag {
33
34
Name : "type, t" ,
34
35
Value : "" ,
35
- Usage : "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages'" ,
36
+ Usage : "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log' " ,
36
37
},
37
38
cli.StringFlag {
38
39
Name : "storage, s" ,
@@ -134,6 +135,22 @@ func migratePackages(ctx context.Context, dstStorage storage.ObjectStorage) erro
134
135
})
135
136
}
136
137
138
+ func migrateActionsLog (ctx context.Context , dstStorage storage.ObjectStorage ) error {
139
+ return db .Iterate (ctx , nil , func (ctx context.Context , task * actions_model.ActionTask ) error {
140
+ if task .LogExpired {
141
+ // the log has been cleared
142
+ return nil
143
+ }
144
+ if ! task .LogInStorage {
145
+ // running tasks store logs in DBFS
146
+ return nil
147
+ }
148
+ p := task .LogFilename
149
+ _ , err := storage .Copy (dstStorage , p , storage .Actions , p )
150
+ return err
151
+ })
152
+ }
153
+
137
154
func runMigrateStorage (ctx * cli.Context ) error {
138
155
stdCtx , cancel := installSignals ()
139
156
defer cancel ()
@@ -201,6 +218,7 @@ func runMigrateStorage(ctx *cli.Context) error {
201
218
"repo-avatars" : migrateRepoAvatars ,
202
219
"repo-archivers" : migrateRepoArchivers ,
203
220
"packages" : migratePackages ,
221
+ "actions-log" : migrateActionsLog ,
204
222
}
205
223
206
224
tp := strings .ToLower (ctx .String ("type" ))
0 commit comments