mirror of
https://github.com/go-gitea/gitea.git
synced 2026-12-04 15:54:57 +00:00
refactor: remove support for obsolete "repo archiver" (#40284)
Since #35487 (1.25) the repo archive download is served by streaming mode. Leftover archives in `data/repo-archive` or the `repo-archive/` storage prefix can be deleted. Docs: https://gitea.com/gitea/docs/pulls/654 --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
1 parent
4116cd60fc
commit
12ad626c22
33 files changed
+129
-971
No files matched your search
@@ -260,7 +260,6 @@ func runDump(ctx context.Context, cmd *cli.Command) error {
|
||||
excludes = append(excludes, setting.LFS.Storage.Path)
|
||||
excludes = append(excludes, setting.Attachment.Storage.Path)
|
||||
excludes = append(excludes, setting.Packages.Storage.Path)
|
||||
excludes = append(excludes, setting.RepoArchive.Storage.Path)
|
||||
excludes = append(excludes, setting.Log.RootPath)
|
||||
if err := dumper.AddRecursiveExclude("data", setting.AppDataPath, excludes); err != nil {
|
||||
fatal("Failed to include data directory: %v", err)
|
||||
|
||||
+1
-10
@@ -36,7 +36,7 @@ func newMigrateStorageCommand() *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', 'actions-artifacts'",
|
||||
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'packages', 'actions-log', 'actions-artifacts'",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "storage",
|
||||
@@ -173,14 +173,6 @@ func migrateRepoAvatars(ctx context.Context, dstStorage storage.ObjectStorage) e
|
||||
})
|
||||
}
|
||||
|
||||
func migrateRepoArchivers(ctx context.Context, dstStorage storage.ObjectStorage) error {
|
||||
return db.Iterate(ctx, nil, func(ctx context.Context, archiver *repo_model.RepoArchiver) error {
|
||||
p := archiver.RelativePath()
|
||||
_, err := storage.Copy(dstStorage, p, storage.RepoArchives, p)
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func migratePackages(ctx context.Context, dstStorage storage.ObjectStorage) error {
|
||||
return db.Iterate(ctx, nil, func(ctx context.Context, pb *packages_model.PackageBlob) error {
|
||||
p := packages_module.KeyToRelativePath(packages_module.BlobHash256Key(pb.HashSHA256))
|
||||
@@ -304,7 +296,6 @@ func runMigrateStorage(ctx context.Context, cmd *cli.Command) error {
|
||||
"lfs": migrateLFS,
|
||||
"avatars": migrateAvatars,
|
||||
"repo-avatars": migrateRepoAvatars,
|
||||
"repo-archivers": migrateRepoArchivers,
|
||||
"packages": migratePackages,
|
||||
"actions-log": migrateActionsLog,
|
||||
"actions-artifacts": migrateActionsArtifacts,
|
||||
|
||||
@@ -2180,22 +2180,6 @@ LEVEL = Info
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Clean up old repository archives
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;[cron.archive_cleanup]
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Whether to enable the job
|
||||
;ENABLED = true
|
||||
;; Whether to always run at least once at start up time (if ENABLED)
|
||||
;RUN_AT_START = true
|
||||
;; Whether to emit notice on successful execution too
|
||||
;NOTICE_ON_SUCCESS = false
|
||||
;; Time interval for job to run
|
||||
;SCHEDULE = @midnight
|
||||
;; Archives created more than OLDER_THAN ago are subject to deletion
|
||||
;OLDER_THAN = 24h
|
||||
|
||||
;; Enforce merge queue check timeouts and minimum group wait times
|
||||
;[cron.check_merge_queues]
|
||||
;ENABLED = true
|
||||
@@ -2409,18 +2393,6 @@ LEVEL = Info
|
||||
;SCHEDULE = @annually
|
||||
;OLDER_THAN = 168h
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Delete all repository archives
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;[cron.delete_repo_archives]
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;ENABLED = false
|
||||
;RUN_AT_START = false
|
||||
;NOTICE_ON_SUCCESS = false
|
||||
;SCHEDULE = @annually;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Garbage collect all repositories
|
||||
@@ -2923,31 +2895,6 @@ LEVEL = Info
|
||||
;; storage type
|
||||
;STORAGE_TYPE = local
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; repo-archive storage will override storage
|
||||
;;
|
||||
;[repo-archive]
|
||||
;STORAGE_TYPE = local
|
||||
;;
|
||||
;; Where your lfs files reside, default is data/lfs.
|
||||
;PATH = data/repo-archive
|
||||
;;
|
||||
;; override the S3 base path if storage type is s3
|
||||
;S3_BASE_PATH = repo-archive/
|
||||
;; override the azure blob base path if storage type is azureblob
|
||||
;AZURE_BLOB_BASE_PATH = repo-archive/
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; settings for repository archives, will override storage setting
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;[storage.repo-archive]
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; storage type
|
||||
;STORAGE_TYPE = local
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; lfs storage will override storage
|
||||
|
||||
@@ -452,6 +452,7 @@ func prepareMigrationTasks() []*migration {
|
||||
newMigration(373, "Repair Debian and RPM signing keys rejected by Sequoia", v29.RepairPackageSigningKeys),
|
||||
newMigration(374, "Add pull_merge_queue_entry table", v29.AddPullMergeQueueEntryTable),
|
||||
newMigration(375, "Update OwnerID as zero for repository level runner tokens", v29.UpdateOwnerIDOfRepoLevelRunnerTokens),
|
||||
newMigration(376, "Drop repo_archiver table", v29.DropRepoArchiverTable),
|
||||
}
|
||||
return preparedMigrations
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright 2026 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v29
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.dev/modelmigration/base"
|
||||
)
|
||||
|
||||
func DropRepoArchiverTable(_ context.Context, x base.EngineMigration) error {
|
||||
return x.DropTables("repo_archiver")
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
[] # empty
|
||||
|
||||
# DO NOT add more test data in the fixtures, test case should prepare their own test data separately and clearly
|
||||
@@ -5,25 +5,10 @@ package repo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/modules/timeutil"
|
||||
"gitea.dev/modules/util"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
// ArchiverStatus represents repo archive status
|
||||
type ArchiverStatus int
|
||||
|
||||
// enumerate all repo archive statuses
|
||||
const (
|
||||
ArchiverGenerating = iota // the archiver is generating
|
||||
ArchiverReady // it's ready
|
||||
)
|
||||
|
||||
// ArchiveType archive types
|
||||
@@ -61,97 +46,6 @@ func SplitArchiveNameType(s string) (string, ArchiveType) {
|
||||
return s, ArchiveUnknown
|
||||
}
|
||||
|
||||
// RepoArchiver represents all archivers
|
||||
type RepoArchiver struct { //revive:disable-line:exported
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
RepoID int64 `xorm:"index unique(s)"`
|
||||
Type ArchiveType `xorm:"unique(s)"`
|
||||
Status ArchiverStatus
|
||||
CommitID string `xorm:"VARCHAR(64) unique(s)"`
|
||||
CreatedUnix timeutil.TimeStamp `xorm:"INDEX NOT NULL created"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
db.RegisterModel(new(RepoArchiver))
|
||||
}
|
||||
|
||||
// RelativePath returns the archive path relative to the archive storage root.
|
||||
func (archiver *RepoArchiver) RelativePath() string {
|
||||
return fmt.Sprintf("%d/%s/%s.%s", archiver.RepoID, archiver.CommitID[:2], archiver.CommitID, archiver.Type.String())
|
||||
}
|
||||
|
||||
// repoArchiverForRelativePath takes a relativePath created from RepoArchiver.RelativePath() and creates a shell repoArchiver struct representing it
|
||||
func repoArchiverForRelativePath(relativePath string) (*RepoArchiver, error) {
|
||||
parts := strings.SplitN(relativePath, "/", 3)
|
||||
if len(parts) != 3 {
|
||||
return nil, util.NewInvalidArgumentErrorf("invalid storage path: must have 3 parts")
|
||||
}
|
||||
repoID, err := strconv.ParseInt(parts[0], 10, 64)
|
||||
if err != nil {
|
||||
return nil, util.NewInvalidArgumentErrorf("invalid storage path: invalid repo id")
|
||||
}
|
||||
commitID, archiveType := SplitArchiveNameType(parts[2])
|
||||
if archiveType == ArchiveUnknown {
|
||||
return nil, util.NewInvalidArgumentErrorf("invalid storage path: invalid archive type")
|
||||
}
|
||||
return &RepoArchiver{RepoID: repoID, CommitID: commitID, Type: archiveType}, nil
|
||||
}
|
||||
|
||||
// GetRepoArchiver get an archiver
|
||||
func GetRepoArchiver(ctx context.Context, repoID int64, tp ArchiveType, commitID string) (*RepoArchiver, error) {
|
||||
var archiver RepoArchiver
|
||||
has, err := db.GetEngine(ctx).Where("repo_id=?", repoID).And("`type`=?", tp).And("commit_id=?", commitID).Get(&archiver)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if has {
|
||||
return &archiver, nil
|
||||
}
|
||||
return nil, nil //nolint:nilnil // return nil to indicate that the object does not exist
|
||||
}
|
||||
|
||||
// ExistsRepoArchiverWithStoragePath checks if there is a RepoArchiver for a given storage path
|
||||
func ExistsRepoArchiverWithStoragePath(ctx context.Context, storagePath string) (bool, error) {
|
||||
// We need to invert the path provided func (archiver *RepoArchiver) RelativePath() above
|
||||
archiver, err := repoArchiverForRelativePath(storagePath)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return db.GetEngine(ctx).Exist(archiver)
|
||||
}
|
||||
|
||||
// UpdateRepoArchiverStatus updates archiver's status
|
||||
func UpdateRepoArchiverStatus(ctx context.Context, archiver *RepoArchiver) error {
|
||||
_, err := db.GetEngine(ctx).ID(archiver.ID).Cols("status").Update(archiver)
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteAllRepoArchives deletes all repo archives records
|
||||
func DeleteAllRepoArchives(ctx context.Context) error {
|
||||
// 1=1 to enforce delete all data, otherwise it will delete nothing
|
||||
_, err := db.GetEngine(ctx).Where("1=1").Delete(new(RepoArchiver))
|
||||
return err
|
||||
}
|
||||
|
||||
// FindRepoArchiversOption represents an archiver options
|
||||
type FindRepoArchiversOption struct {
|
||||
db.ListOptions
|
||||
OlderThan time.Duration
|
||||
}
|
||||
|
||||
func (opts FindRepoArchiversOption) ToConds() builder.Cond {
|
||||
cond := builder.NewCond()
|
||||
if opts.OlderThan > 0 {
|
||||
cond = cond.And(builder.Lt{"created_unix": time.Now().Add(-opts.OlderThan).Unix()})
|
||||
}
|
||||
return cond
|
||||
}
|
||||
|
||||
func (opts FindRepoArchiversOption) ToOrders() string {
|
||||
return "created_unix ASC"
|
||||
}
|
||||
|
||||
// SetArchiveRepoState sets if a repo is archived
|
||||
func SetArchiveRepoState(ctx context.Context, repo *Repository, isArchived bool) (err error) {
|
||||
repo.IsArchived = isArchived
|
||||
|
||||
@@ -63,12 +63,6 @@ var (
|
||||
AllowForkWithoutMaximumLimit bool
|
||||
AllowForkIntoSameOwner bool
|
||||
|
||||
// StreamArchives makes Gitea stream git archive files to the client directly instead of creating an archive first.
|
||||
// Ideally all users should use this streaming method. However, at the moment we don't know whether there are
|
||||
// any users who still need the old behavior, so we introduce this option, intentionally not documenting it.
|
||||
// After one or two releases, if no one complains, we will remove this option and always use streaming.
|
||||
StreamArchives bool
|
||||
|
||||
// Repository editor settings
|
||||
Editor struct {
|
||||
LineWrapExtensions []string
|
||||
@@ -155,7 +149,6 @@ var (
|
||||
DefaultBranch: "main",
|
||||
DefaultObjectFormat: "sha1",
|
||||
AllowForkWithoutMaximumLimit: true,
|
||||
StreamArchives: true,
|
||||
|
||||
// Repository editor settings
|
||||
Editor: struct {
|
||||
@@ -393,8 +386,4 @@ func loadRepositoryFrom(rootCfg ConfigProvider) {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
||||
if err := loadRepoArchiveFrom(rootCfg); err != nil {
|
||||
log.Fatal("loadRepoArchiveFrom: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// Copyright 2023 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package setting
|
||||
|
||||
import "fmt"
|
||||
|
||||
var RepoArchive = struct {
|
||||
Storage *Storage
|
||||
}{}
|
||||
|
||||
func loadRepoArchiveFrom(rootCfg ConfigProvider) (err error) {
|
||||
sec, _ := rootCfg.GetSection("repo-archive")
|
||||
if sec == nil {
|
||||
RepoArchive.Storage, err = getStorage(rootCfg, "repo-archive", "", nil)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := sec.MapTo(&RepoArchive); err != nil {
|
||||
return fmt.Errorf("mapto repoarchive failed: %v", err)
|
||||
}
|
||||
|
||||
RepoArchive.Storage, err = getStorage(rootCfg, "repo-archive", "", sec)
|
||||
return err
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
// Copyright 2023 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package setting
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_getStorageInheritNameSectionTypeForRepoArchive(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
ini, basePath string
|
||||
}{
|
||||
// packages storage inherits from storage if nothing configured
|
||||
{`
|
||||
[storage]
|
||||
STORAGE_TYPE = s3
|
||||
`, "repo-archive/"},
|
||||
// we can also configure packages storage directly
|
||||
{`
|
||||
[storage.repo-archive]
|
||||
STORAGE_TYPE = s3
|
||||
`, "repo-archive/"},
|
||||
// or we can indicate the storage type in the packages section
|
||||
{`
|
||||
[repo-archive]
|
||||
STORAGE_TYPE = my_s3
|
||||
|
||||
[storage.my_s3]
|
||||
STORAGE_TYPE = s3
|
||||
`, "repo-archive/"},
|
||||
// or we can indicate the storage type and S3 base path in the packages section
|
||||
{`
|
||||
[repo-archive]
|
||||
STORAGE_TYPE = my_s3
|
||||
S3_BASE_PATH = my_archive/
|
||||
|
||||
[storage.my_s3]
|
||||
STORAGE_TYPE = s3
|
||||
`, "my_archive/"},
|
||||
} {
|
||||
cfg, err := NewConfigProviderFromData(tc.ini)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
|
||||
assert.EqualValues(t, "s3", RepoArchive.Storage.Type)
|
||||
assert.Equal(t, tc.basePath, RepoArchive.Storage.S3Config.BasePath)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_RepoArchiveStorage(t *testing.T) {
|
||||
for _, ini := range []string{
|
||||
`
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[storage]
|
||||
STORAGE_TYPE = s3
|
||||
S3_ENDPOINT = s3.my-domain.net
|
||||
S3_BUCKET = gitea
|
||||
S3_LOCATION = homenet
|
||||
S3_USE_SSL = true
|
||||
S3_ACCESS_KEY_ID = correct_key
|
||||
S3_SECRET_ACCESS_KEY = correct_key
|
||||
`,
|
||||
`
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
[storage.repo-archive]
|
||||
STORAGE_TYPE = s3
|
||||
[storage.s3]
|
||||
STORAGE_TYPE = s3
|
||||
S3_ENDPOINT = s3.my-domain.net
|
||||
S3_BUCKET = gitea
|
||||
S3_LOCATION = homenet
|
||||
S3_USE_SSL = true
|
||||
S3_ACCESS_KEY_ID = correct_key
|
||||
S3_SECRET_ACCESS_KEY = correct_key
|
||||
`,
|
||||
} {
|
||||
cfg, err := NewConfigProviderFromData(ini)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
storage := RepoArchive.Storage
|
||||
|
||||
assert.EqualValues(t, "s3", storage.Type)
|
||||
assert.Equal(t, "gitea", storage.S3Config.Bucket)
|
||||
}
|
||||
}
|
||||
@@ -73,10 +73,10 @@ STORAGE_TYPE = s3
|
||||
assert.Equal(t, "gitea", Packages.Storage.S3Config.Bucket)
|
||||
assert.Equal(t, "packages/", Packages.Storage.S3Config.BasePath)
|
||||
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.EqualValues(t, "s3", RepoArchive.Storage.Type)
|
||||
assert.Equal(t, "gitea", RepoArchive.Storage.S3Config.Bucket)
|
||||
assert.Equal(t, "repo-archive/", RepoArchive.Storage.S3Config.BasePath)
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
assert.EqualValues(t, "s3", LFS.Storage.Type)
|
||||
assert.Equal(t, "gitea", LFS.Storage.S3Config.Bucket)
|
||||
assert.Equal(t, "lfs/", LFS.Storage.S3Config.BasePath)
|
||||
|
||||
assert.NoError(t, loadActionsFrom(cfg))
|
||||
assert.EqualValues(t, "s3", Actions.LogStorage.Type)
|
||||
@@ -111,10 +111,10 @@ STORAGE_TYPE = azureblob
|
||||
assert.Equal(t, "gitea", Packages.Storage.AzureBlobConfig.Container)
|
||||
assert.Equal(t, "packages/", Packages.Storage.AzureBlobConfig.BasePath)
|
||||
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.EqualValues(t, "azureblob", RepoArchive.Storage.Type)
|
||||
assert.Equal(t, "gitea", RepoArchive.Storage.AzureBlobConfig.Container)
|
||||
assert.Equal(t, "repo-archive/", RepoArchive.Storage.AzureBlobConfig.BasePath)
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
assert.EqualValues(t, "azureblob", LFS.Storage.Type)
|
||||
assert.Equal(t, "gitea", LFS.Storage.AzureBlobConfig.Container)
|
||||
assert.Equal(t, "lfs/", LFS.Storage.AzureBlobConfig.BasePath)
|
||||
|
||||
assert.NoError(t, loadActionsFrom(cfg))
|
||||
assert.EqualValues(t, "azureblob", Actions.LogStorage.Type)
|
||||
@@ -158,28 +158,28 @@ func testLocalStoragePath(t *testing.T, appDataPath, iniStr string, cases []test
|
||||
|
||||
func Test_getStorageInheritStorageTypeLocal(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name, ini, basePath, archivePath string
|
||||
name, ini, basePath, lfsPath string
|
||||
}{
|
||||
{"Default", `
|
||||
[storage]
|
||||
STORAGE_TYPE = local
|
||||
`, "/appdata", "/appdata/repo-archive"},
|
||||
`, "/appdata", "/appdata/lfs"},
|
||||
{"Path", `
|
||||
[storage]
|
||||
STORAGE_TYPE = local
|
||||
PATH = /data/gitea
|
||||
`, "/data/gitea", "/data/gitea/repo-archive"},
|
||||
`, "/data/gitea", "/data/gitea/lfs"},
|
||||
{"RelativePath", `
|
||||
[storage]
|
||||
STORAGE_TYPE = local
|
||||
PATH = storages
|
||||
`, "/appdata/storages", "/appdata/storages/repo-archive"},
|
||||
`, "/appdata/storages", "/appdata/storages/lfs"},
|
||||
{"PathOverride", `
|
||||
[storage]
|
||||
STORAGE_TYPE = local
|
||||
PATH = /data/gitea
|
||||
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
PATH = /data/gitea/the-archives-dir
|
||||
`, "/data/gitea", "/data/gitea/the-archives-dir"},
|
||||
{"PathOverrideEmpty", `
|
||||
@@ -187,49 +187,48 @@ PATH = /data/gitea/the-archives-dir
|
||||
STORAGE_TYPE = local
|
||||
PATH = /data/gitea
|
||||
|
||||
[repo-archive]
|
||||
`, "/data/gitea", "/data/gitea/repo-archive"},
|
||||
[lfs]
|
||||
`, "/data/gitea", "/data/gitea/lfs"},
|
||||
{"RelativePathOverride", `
|
||||
[storage]
|
||||
STORAGE_TYPE = local
|
||||
PATH = /data/gitea
|
||||
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
PATH = the-archives-dir
|
||||
`, "/data/gitea", "/data/gitea/the-archives-dir"},
|
||||
{"PathOverride3", `
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
STORAGE_TYPE = local
|
||||
PATH = /data/gitea/archives
|
||||
`, "/appdata", "/data/gitea/archives"},
|
||||
{"PathOverride3_5", `
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
STORAGE_TYPE = local
|
||||
PATH = a-relative-path
|
||||
`, "/appdata", "/appdata/a-relative-path"},
|
||||
{"PathOverride4", `
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
STORAGE_TYPE = local
|
||||
PATH = /data/gitea/archives
|
||||
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
PATH = /tmp/gitea/archives
|
||||
`, "/appdata", "/tmp/gitea/archives"},
|
||||
{"PathOverride5", `
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
STORAGE_TYPE = local
|
||||
PATH = /data/gitea/archives
|
||||
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
`, "/appdata", "/data/gitea/archives"},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
testLocalStoragePath(t, "/appdata", tc.ini, []testLocalStoragePathCase{
|
||||
{loadAttachmentFrom, &Attachment.Storage, tc.basePath + "/attachments"},
|
||||
{loadLFSFrom, &LFS.Storage, tc.basePath + "/lfs"},
|
||||
{loadActionsFrom, &Actions.ArtifactStorage, tc.basePath + "/actions_artifacts"},
|
||||
{loadPackagesFrom, &Packages.Storage, tc.basePath + "/packages"},
|
||||
{loadRepoArchiveFrom, &RepoArchive.Storage, tc.archivePath},
|
||||
{loadLFSFrom, &LFS.Storage, tc.lfsPath},
|
||||
{loadActionsFrom, &Actions.LogStorage, tc.basePath + "/actions_log"},
|
||||
{loadAvatarsFrom, &Avatar.Storage, tc.basePath + "/avatars"},
|
||||
{loadRepoAvatarFrom, &RepoAvatar.Storage, tc.basePath + "/repo-avatars"},
|
||||
@@ -240,45 +239,45 @@ PATH = /data/gitea/archives
|
||||
|
||||
func Test_getStorageInheritStorageTypeLocalPathOverride72(t *testing.T) {
|
||||
testLocalStoragePath(t, "/appdata", `
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
STORAGE_TYPE = local
|
||||
PATH = archives
|
||||
`, []testLocalStoragePathCase{
|
||||
{loadRepoArchiveFrom, &RepoArchive.Storage, "/appdata/archives"},
|
||||
{loadLFSFrom, &LFS.Storage, "/appdata/archives"},
|
||||
})
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration20(t *testing.T) {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
STORAGE_TYPE = my_storage
|
||||
PATH = archives
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Error(t, loadRepoArchiveFrom(cfg))
|
||||
assert.Error(t, loadLFSFrom(cfg))
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration21(t *testing.T) {
|
||||
testLocalStoragePath(t, "/appdata", `
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
`, []testLocalStoragePathCase{
|
||||
{loadRepoArchiveFrom, &RepoArchive.Storage, "/appdata/repo-archive"},
|
||||
{loadLFSFrom, &LFS.Storage, "/appdata/lfs"},
|
||||
})
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration22(t *testing.T) {
|
||||
testLocalStoragePath(t, "/appdata", `
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
PATH = archives
|
||||
`, []testLocalStoragePathCase{
|
||||
{loadRepoArchiveFrom, &RepoArchive.Storage, "/appdata/archives"},
|
||||
{loadLFSFrom, &LFS.Storage, "/appdata/archives"},
|
||||
})
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration23(t *testing.T) {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
STORAGE_TYPE = s3
|
||||
S3_ACCESS_KEY_ID = my_access_key
|
||||
S3_SECRET_ACCESS_KEY = my_secret_key
|
||||
@@ -288,15 +287,15 @@ S3_SECRET_ACCESS_KEY = my_secret_key
|
||||
_, err = getStorage(cfg, "", "", nil)
|
||||
assert.Error(t, err)
|
||||
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
cp := RepoArchive.Storage.ToShadowCopy()
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
cp := LFS.Storage.ToShadowCopy()
|
||||
assert.Equal(t, "******", cp.S3Config.AccessKeyID)
|
||||
assert.Equal(t, "******", cp.S3Config.SecretAccessKey)
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration24(t *testing.T) {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
STORAGE_TYPE = my_archive
|
||||
|
||||
[storage.my_archive]
|
||||
@@ -304,13 +303,13 @@ STORAGE_TYPE = my_archive
|
||||
PATH = archives
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.Error(t, loadRepoArchiveFrom(cfg))
|
||||
assert.Error(t, loadLFSFrom(cfg))
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration25(t *testing.T) {
|
||||
for _, storageType := range []string{"my_archive", "local"} {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
STORAGE_TYPE = ` + storageType + `
|
||||
|
||||
[storage.` + storageType + `]
|
||||
@@ -318,13 +317,13 @@ STORAGE_TYPE = unknown
|
||||
PATH = archives
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.Error(t, loadRepoArchiveFrom(cfg), storageType)
|
||||
assert.Error(t, loadLFSFrom(cfg), storageType)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration26(t *testing.T) {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
STORAGE_TYPE = s3
|
||||
S3_ACCESS_KEY_ID = my_access_key
|
||||
S3_SECRET_ACCESS_KEY = my_secret_key
|
||||
@@ -332,25 +331,25 @@ S3_SECRET_ACCESS_KEY = my_secret_key
|
||||
S3_USE_SSL = abc
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
// assert.Error(t, loadRepoArchiveFrom(cfg))
|
||||
// assert.Error(t, loadLFSFrom(cfg))
|
||||
// FIXME: this should return error but now ini package's MapTo() doesn't check type
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration27(t *testing.T) {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
STORAGE_TYPE = s3
|
||||
S3_ACCESS_KEY_ID = my_access_key
|
||||
S3_SECRET_ACCESS_KEY = my_secret_key
|
||||
S3_USE_SSL = true
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.Equal(t, "my_access_key", RepoArchive.Storage.S3Config.AccessKeyID)
|
||||
assert.Equal(t, "my_secret_key", RepoArchive.Storage.S3Config.SecretAccessKey)
|
||||
assert.True(t, RepoArchive.Storage.S3Config.UseSSL)
|
||||
assert.Equal(t, "repo-archive/", RepoArchive.Storage.S3Config.BasePath)
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
assert.Equal(t, "my_access_key", LFS.Storage.S3Config.AccessKeyID)
|
||||
assert.Equal(t, "my_secret_key", LFS.Storage.S3Config.SecretAccessKey)
|
||||
assert.True(t, LFS.Storage.S3Config.UseSSL)
|
||||
assert.Equal(t, "lfs/", LFS.Storage.S3Config.BasePath)
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration28(t *testing.T) {
|
||||
@@ -363,11 +362,11 @@ S3_USE_SSL = true
|
||||
S3_BASE_PATH = /prefix
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.Equal(t, "my_access_key", RepoArchive.Storage.S3Config.AccessKeyID)
|
||||
assert.Equal(t, "my_secret_key", RepoArchive.Storage.S3Config.SecretAccessKey)
|
||||
assert.True(t, RepoArchive.Storage.S3Config.UseSSL)
|
||||
assert.Equal(t, "/prefix/repo-archive/", RepoArchive.Storage.S3Config.BasePath)
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
assert.Equal(t, "my_access_key", LFS.Storage.S3Config.AccessKeyID)
|
||||
assert.Equal(t, "my_secret_key", LFS.Storage.S3Config.SecretAccessKey)
|
||||
assert.True(t, LFS.Storage.S3Config.UseSSL)
|
||||
assert.Equal(t, "/prefix/lfs/", LFS.Storage.S3Config.BasePath)
|
||||
|
||||
cfg, err = NewConfigProviderFromData(`
|
||||
[storage]
|
||||
@@ -377,10 +376,10 @@ S3_USE_SSL = true
|
||||
S3_BASE_PATH = /prefix
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.Equal(t, "127.0.0.1", RepoArchive.Storage.S3Config.IamEndpoint)
|
||||
assert.True(t, RepoArchive.Storage.S3Config.UseSSL)
|
||||
assert.Equal(t, "/prefix/repo-archive/", RepoArchive.Storage.S3Config.BasePath)
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
assert.Equal(t, "127.0.0.1", LFS.Storage.S3Config.IamEndpoint)
|
||||
assert.True(t, LFS.Storage.S3Config.UseSSL)
|
||||
assert.Equal(t, "/prefix/lfs/", LFS.Storage.S3Config.BasePath)
|
||||
|
||||
cfg, err = NewConfigProviderFromData(`
|
||||
[storage]
|
||||
@@ -421,29 +420,29 @@ S3_BASE_PATH = /lfs
|
||||
|
||||
func Test_getStorageConfiguration29(t *testing.T) {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[repo-archive]
|
||||
[lfs]
|
||||
STORAGE_TYPE = azureblob
|
||||
AZURE_BLOB_ACCOUNT_NAME = my_account_name
|
||||
AZURE_BLOB_ACCOUNT_KEY = my_account_key
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
// assert.Error(t, loadRepoArchiveFrom(cfg))
|
||||
// assert.Error(t, loadLFSFrom(cfg))
|
||||
// FIXME: this should return error but now ini package's MapTo() doesn't check type
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration30(t *testing.T) {
|
||||
cfg, err := NewConfigProviderFromData(`
|
||||
[storage.repo-archive]
|
||||
[storage.lfs]
|
||||
STORAGE_TYPE = azureblob
|
||||
AZURE_BLOB_ACCOUNT_NAME = my_account_name
|
||||
AZURE_BLOB_ACCOUNT_KEY = my_account_key
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.Equal(t, "my_account_name", RepoArchive.Storage.AzureBlobConfig.AccountName)
|
||||
assert.Equal(t, "my_account_key", RepoArchive.Storage.AzureBlobConfig.AccountKey)
|
||||
assert.Equal(t, "repo-archive/", RepoArchive.Storage.AzureBlobConfig.BasePath)
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
assert.Equal(t, "my_account_name", LFS.Storage.AzureBlobConfig.AccountName)
|
||||
assert.Equal(t, "my_account_key", LFS.Storage.AzureBlobConfig.AccountKey)
|
||||
assert.Equal(t, "lfs/", LFS.Storage.AzureBlobConfig.BasePath)
|
||||
}
|
||||
|
||||
func Test_getStorageConfiguration31(t *testing.T) {
|
||||
@@ -455,10 +454,10 @@ AZURE_BLOB_ACCOUNT_KEY = my_account_key
|
||||
AZURE_BLOB_BASE_PATH = /prefix
|
||||
`)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, loadRepoArchiveFrom(cfg))
|
||||
assert.Equal(t, "my_account_name", RepoArchive.Storage.AzureBlobConfig.AccountName)
|
||||
assert.Equal(t, "my_account_key", RepoArchive.Storage.AzureBlobConfig.AccountKey)
|
||||
assert.Equal(t, "/prefix/repo-archive/", RepoArchive.Storage.AzureBlobConfig.BasePath)
|
||||
assert.NoError(t, loadLFSFrom(cfg))
|
||||
assert.Equal(t, "my_account_name", LFS.Storage.AzureBlobConfig.AccountName)
|
||||
assert.Equal(t, "my_account_key", LFS.Storage.AzureBlobConfig.AccountKey)
|
||||
assert.Equal(t, "/prefix/lfs/", LFS.Storage.AzureBlobConfig.BasePath)
|
||||
|
||||
cfg, err = NewConfigProviderFromData(`
|
||||
[storage]
|
||||
|
||||
@@ -184,9 +184,6 @@ var (
|
||||
// RepoAvatars represents repository avatars storage
|
||||
RepoAvatars ObjectStorage = uninitializedStorage
|
||||
|
||||
// RepoArchives represents repository archives storage
|
||||
RepoArchives ObjectStorage = uninitializedStorage
|
||||
|
||||
// Packages represents packages storage
|
||||
Packages ObjectStorage = uninitializedStorage
|
||||
|
||||
@@ -203,7 +200,6 @@ func Init() error {
|
||||
initAvatars,
|
||||
initRepoAvatars,
|
||||
initLFS,
|
||||
initRepoArchives,
|
||||
initPackages,
|
||||
initActions,
|
||||
} {
|
||||
@@ -259,12 +255,6 @@ func initRepoAvatars() (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func initRepoArchives() (err error) {
|
||||
log.Info("Initialising Repository Archive storage with type: %s", setting.RepoArchive.Storage.Type)
|
||||
RepoArchives, err = NewStorage(setting.RepoArchive.Storage.Type, setting.RepoArchive.Storage)
|
||||
return err
|
||||
}
|
||||
|
||||
func initPackages() (err error) {
|
||||
if !setting.Packages.Enabled {
|
||||
Packages = discardStorage("Packages isn't enabled")
|
||||
|
||||
@@ -3102,8 +3102,6 @@
|
||||
"admin.dashboard.cron.finished": "Cron: %[1]s has finished",
|
||||
"admin.dashboard.delete_inactive_accounts": "Delete all unactivated accounts",
|
||||
"admin.dashboard.delete_inactive_accounts.started": "Task to delete all unactivated accounts started",
|
||||
"admin.dashboard.delete_repo_archives": "Delete all repositories' archives (ZIP, TAR.GZ, etc..)",
|
||||
"admin.dashboard.delete_repo_archives.started": "Task to delete all repository archives started",
|
||||
"admin.dashboard.delete_missing_repos": "Delete all repositories missing their Git files",
|
||||
"admin.dashboard.delete_missing_repos.started": "Task to delete all repositories missing their Git files started",
|
||||
"admin.dashboard.delete_generated_repository_avatars": "Delete generated repository avatars",
|
||||
@@ -3112,7 +3110,6 @@
|
||||
"admin.dashboard.update_mirrors": "Update Mirrors",
|
||||
"admin.dashboard.repo_health_check": "Health check all repositories",
|
||||
"admin.dashboard.check_repo_stats": "Check all repository statistics",
|
||||
"admin.dashboard.archive_cleanup": "Delete old repository archives",
|
||||
"admin.dashboard.deleted_branches_cleanup": "Clean up deleted branches",
|
||||
"admin.dashboard.update_migration_poster_id": "Update migration poster IDs",
|
||||
"admin.dashboard.git_gc_repos": "Garbage-collect all repositories",
|
||||
|
||||
@@ -50,7 +50,6 @@ import (
|
||||
pull_service "gitea.dev/services/pull"
|
||||
release_service "gitea.dev/services/release"
|
||||
repo_service "gitea.dev/services/repository"
|
||||
"gitea.dev/services/repository/archiver"
|
||||
"gitea.dev/services/task"
|
||||
"gitea.dev/services/uinotification"
|
||||
user_service "gitea.dev/services/user"
|
||||
@@ -130,7 +129,6 @@ func InitWebInstalled(ctx context.Context) {
|
||||
mustInit(cache.Init)
|
||||
mustInit(feed_service.Init)
|
||||
mustInit(uinotification.Init)
|
||||
mustInitCtx(ctx, archiver.Init)
|
||||
|
||||
external.RegisterRenderers()
|
||||
markup.Init(markup_service.FormalRenderHelperFuncs())
|
||||
|
||||
@@ -349,53 +349,6 @@ func Download(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// InitiateDownload will enqueue an archival request, as needed. It may submit
|
||||
// a request that's already in-progress, but the archiver service will just
|
||||
// kind of drop it on the floor if this is the case.
|
||||
func InitiateDownload(ctx *context.Context) {
|
||||
if !checkDownloadTokenScope(ctx) {
|
||||
return
|
||||
}
|
||||
|
||||
paths := ctx.FormStrings("path")
|
||||
if setting.Repository.StreamArchives || len(paths) > 0 {
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"complete": true,
|
||||
})
|
||||
return
|
||||
}
|
||||
aReq, err := archiver_service.NewRequest(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.PathParam("*"), paths)
|
||||
if err != nil {
|
||||
ctx.HTTPError(http.StatusBadRequest, "invalid archive request")
|
||||
return
|
||||
}
|
||||
if aReq == nil {
|
||||
ctx.HTTPError(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
archiver, err := repo_model.GetRepoArchiver(ctx, aReq.Repo.ID, aReq.Type, aReq.CommitID)
|
||||
if err != nil {
|
||||
ctx.ServerErrorAuto(err)
|
||||
return
|
||||
}
|
||||
if archiver == nil || archiver.Status != repo_model.ArchiverReady {
|
||||
if err := archiver_service.StartArchive(aReq); err != nil {
|
||||
ctx.ServerErrorAuto(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var completed bool
|
||||
if archiver != nil && archiver.Status == repo_model.ArchiverReady {
|
||||
completed = true
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"complete": completed,
|
||||
})
|
||||
}
|
||||
|
||||
// SearchRepo repositories via options
|
||||
func SearchRepo(ctx *context.Context) {
|
||||
page := ctx.FormInt("page")
|
||||
|
||||
@@ -1654,7 +1654,6 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) {
|
||||
|
||||
m.Group("/archive", func() {
|
||||
m.Get("/*", repo.Download)
|
||||
m.Post("/*", repo.InitiateDownload)
|
||||
}, webAuth.AllowBasic, webAuth.AllowOAuth2, repo.MustBeNotEmpty, dlSourceEnabled)
|
||||
|
||||
m.Group("/branches", func() {
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
mirror_service "gitea.dev/services/mirror"
|
||||
packages_cleanup_service "gitea.dev/services/packages/cleanup"
|
||||
repo_service "gitea.dev/services/repository"
|
||||
archiver_service "gitea.dev/services/repository/archiver"
|
||||
)
|
||||
|
||||
func registerUpdateMirrorTask() {
|
||||
@@ -72,19 +71,6 @@ func registerCheckRepoStats() {
|
||||
})
|
||||
}
|
||||
|
||||
func registerArchiveCleanup() {
|
||||
RegisterTaskFatal("archive_cleanup", &OlderThanConfig{
|
||||
BaseConfig: BaseConfig{
|
||||
Enabled: true,
|
||||
RunAtStart: true,
|
||||
Schedule: "@midnight",
|
||||
},
|
||||
OlderThan: 24 * time.Hour,
|
||||
}, func(ctx context.Context, _ *user_model.User, config *OlderThanConfig) error {
|
||||
return archiver_service.DeleteOldRepositoryArchives(ctx, config.OlderThan)
|
||||
})
|
||||
}
|
||||
|
||||
func registerSyncExternalUsers() {
|
||||
RegisterTaskFatal("sync_external_users", &UpdateExistingConfig{
|
||||
BaseConfig: BaseConfig{
|
||||
@@ -166,7 +152,6 @@ func initBasicTasks() {
|
||||
}
|
||||
registerRepoHealthCheck()
|
||||
registerCheckRepoStats()
|
||||
registerArchiveCleanup()
|
||||
registerSyncExternalUsers()
|
||||
registerDeletedBranchesCleanup()
|
||||
if !setting.Repository.DisableMigrations {
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
asymkey_service "gitea.dev/services/asymkey"
|
||||
"gitea.dev/services/audit"
|
||||
repo_service "gitea.dev/services/repository"
|
||||
archiver_service "gitea.dev/services/repository/archiver"
|
||||
user_service "gitea.dev/services/user"
|
||||
)
|
||||
|
||||
@@ -35,16 +34,6 @@ func registerDeleteInactiveUsers() {
|
||||
})
|
||||
}
|
||||
|
||||
func registerDeleteRepositoryArchives() {
|
||||
RegisterTaskFatal("delete_repo_archives", &BaseConfig{
|
||||
Enabled: false,
|
||||
RunAtStart: false,
|
||||
Schedule: "@annually",
|
||||
}, func(ctx context.Context, _ *user_model.User, _ *BaseConfig) error {
|
||||
return archiver_service.DeleteRepositoryArchives(ctx)
|
||||
})
|
||||
}
|
||||
|
||||
func registerGarbageCollectRepositories() {
|
||||
type RepoHealthCheckConfig struct {
|
||||
BaseConfig
|
||||
@@ -239,7 +228,6 @@ func registerRebuildIssueIndexer() {
|
||||
|
||||
func initExtendedTasks() {
|
||||
registerDeleteInactiveUsers()
|
||||
registerDeleteRepositoryArchives()
|
||||
registerGarbageCollectRepositories()
|
||||
registerRewriteAllPublicKeys()
|
||||
registerRewriteAllPrincipalKeys()
|
||||
|
||||
@@ -5,7 +5,6 @@ package doctor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io/fs"
|
||||
"strings"
|
||||
|
||||
@@ -79,13 +78,12 @@ func commonCheckStorage(logger log.Logger, autofix bool, opts *commonStorageChec
|
||||
}
|
||||
|
||||
type checkStorageOptions struct {
|
||||
All bool
|
||||
Attachments bool
|
||||
LFS bool
|
||||
Avatars bool
|
||||
RepoAvatars bool
|
||||
RepoArchives bool
|
||||
Packages bool
|
||||
All bool
|
||||
Attachments bool
|
||||
LFS bool
|
||||
Avatars bool
|
||||
RepoAvatars bool
|
||||
Packages bool
|
||||
}
|
||||
|
||||
// checkStorage will return a doctor check function to check the requested storage types for "orphaned" stored object/files and optionally delete them
|
||||
@@ -159,24 +157,6 @@ func checkStorage(opts *checkStorageOptions) func(ctx context.Context, logger lo
|
||||
}
|
||||
}
|
||||
|
||||
if opts.RepoArchives || opts.All {
|
||||
if err := commonCheckStorage(logger, autofix,
|
||||
&commonStorageCheckOptions{
|
||||
storer: storage.RepoArchives,
|
||||
isOrphaned: func(path string, obj storage.Object, stat fs.FileInfo) (bool, error) {
|
||||
exists, err := repo.ExistsRepoArchiverWithStoragePath(ctx, path)
|
||||
if err == nil || errors.Is(err, util.ErrInvalidArgument) {
|
||||
// invalid arguments mean that the object is not a valid repo archiver and it should be removed
|
||||
return !exists, nil
|
||||
}
|
||||
return !exists, err
|
||||
},
|
||||
name: "repo archive",
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if opts.Packages || opts.All {
|
||||
if !setting.Packages.Enabled {
|
||||
logger.Info("Packages isn't enabled (skipped)")
|
||||
@@ -248,16 +228,6 @@ func init() {
|
||||
Priority: 1,
|
||||
})
|
||||
|
||||
Register(&Check{
|
||||
Title: "Check if there are orphaned archives in storage",
|
||||
Name: "storage-archives",
|
||||
IsDefault: false,
|
||||
Run: checkStorage(&checkStorageOptions{RepoArchives: true}),
|
||||
AbortIfFailed: false,
|
||||
SkipDatabaseInitialization: false,
|
||||
Priority: 1,
|
||||
})
|
||||
|
||||
Register(&Check{
|
||||
Title: "Check if there are orphaned package blobs in storage",
|
||||
Name: "storage-packages",
|
||||
|
||||
@@ -5,25 +5,16 @@ package archiver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
"gitea.dev/modules/git"
|
||||
"gitea.dev/modules/git/gitcmd"
|
||||
"gitea.dev/modules/graceful"
|
||||
"gitea.dev/modules/httpcache"
|
||||
"gitea.dev/modules/httplib"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/process"
|
||||
"gitea.dev/modules/queue"
|
||||
"gitea.dev/modules/setting"
|
||||
"gitea.dev/modules/storage"
|
||||
"gitea.dev/modules/util"
|
||||
gitea_context "gitea.dev/services/context"
|
||||
)
|
||||
@@ -42,41 +33,7 @@ type ArchiveRequest struct {
|
||||
archiveRefShortName string // the ref short name to download the archive, for example: "master", "v1.0.0", "commit id"
|
||||
}
|
||||
|
||||
type archiveQueueItem struct {
|
||||
RepoID int64 `json:"RepoID"`
|
||||
Type repo_model.ArchiveType `json:"Type"`
|
||||
CommitID string `json:"CommitID"`
|
||||
Paths []string `json:"Paths,omitempty"`
|
||||
ArchiveRefShortName string `json:"ArchiveRefShortName,omitempty"`
|
||||
}
|
||||
|
||||
func (aReq *ArchiveRequest) toQueueItem() *archiveQueueItem {
|
||||
return &archiveQueueItem{
|
||||
RepoID: aReq.Repo.ID,
|
||||
Type: aReq.Type,
|
||||
CommitID: aReq.CommitID,
|
||||
Paths: aReq.Paths,
|
||||
ArchiveRefShortName: aReq.archiveRefShortName,
|
||||
}
|
||||
}
|
||||
|
||||
func (item *archiveQueueItem) toArchiveRequest(ctx context.Context) (*ArchiveRequest, error) {
|
||||
repo, err := repo_model.GetRepositoryByID(ctx, item.RepoID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ArchiveRequest{
|
||||
Repo: repo,
|
||||
Type: item.Type,
|
||||
CommitID: item.CommitID,
|
||||
Paths: item.Paths,
|
||||
archiveRefShortName: item.ArchiveRefShortName,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewRequest creates an archival request, based on the URI. The
|
||||
// resulting ArchiveRequest is suitable for being passed to Await()
|
||||
// if it's determined that the request still needs to be satisfied.
|
||||
// NewRequest creates an archival request, based on the URI.
|
||||
func NewRequest(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, archiveRefExt string, paths []string) (*ArchiveRequest, error) {
|
||||
// here the archiveRefShortName is not a clear ref, it could be a tag, branch or commit id
|
||||
archiveRefShortName, archiveType := repo_model.SplitArchiveNameType(archiveRefExt)
|
||||
@@ -104,49 +61,6 @@ func (aReq *ArchiveRequest) GetArchiveName() string {
|
||||
return strings.ReplaceAll(aReq.archiveRefShortName, "/", "-") + "." + aReq.Type.String()
|
||||
}
|
||||
|
||||
// Await awaits the completion of an ArchiveRequest. If the archive has
|
||||
// already been prepared the method returns immediately. Otherwise, an archiver
|
||||
// process will be started and its completion awaited. On success the returned
|
||||
// RepoArchiver may be used to download the archive. Note that even if the
|
||||
// context is cancelled/times out a started archiver will still continue to run
|
||||
// in the background.
|
||||
func (aReq *ArchiveRequest) Await(ctx context.Context) (*repo_model.RepoArchiver, error) {
|
||||
archiver, err := repo_model.GetRepoArchiver(ctx, aReq.Repo.ID, aReq.Type, aReq.CommitID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("models.GetRepoArchiver: %w", err)
|
||||
}
|
||||
|
||||
if archiver != nil && archiver.Status == repo_model.ArchiverReady {
|
||||
// Archive already generated, we're done.
|
||||
return archiver, nil
|
||||
}
|
||||
|
||||
if err := StartArchive(aReq); err != nil {
|
||||
return nil, fmt.Errorf("archiver.StartArchive: %w", err)
|
||||
}
|
||||
|
||||
poll := time.NewTicker(time.Second * 1)
|
||||
defer poll.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-graceful.GetManager().HammerContext().Done():
|
||||
// System stopped.
|
||||
return nil, graceful.GetManager().HammerContext().Err()
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
case <-poll.C:
|
||||
archiver, err = repo_model.GetRepoArchiver(ctx, aReq.Repo.ID, aReq.Type, aReq.CommitID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("repo_model.GetRepoArchiver: %w", err)
|
||||
}
|
||||
if archiver != nil && archiver.Status == repo_model.ArchiverReady {
|
||||
return archiver, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stream satisfies the ArchiveRequest being passed in. Processing
|
||||
// will occur directly in this routine.
|
||||
func (aReq *ArchiveRequest) Stream(ctx context.Context, w io.Writer) error {
|
||||
@@ -169,189 +83,6 @@ func (aReq *ArchiveRequest) Stream(ctx context.Context, w io.Writer) error {
|
||||
)
|
||||
}
|
||||
|
||||
// doArchive satisfies the ArchiveRequest being passed in. Processing
|
||||
// will occur in a separate goroutine, as this phase may take a while to
|
||||
// complete. If the archive already exists, doArchive will not do
|
||||
// anything. In all cases, the caller should be examining the *ArchiveRequest
|
||||
// being returned for completion, as it may be different than the one they passed
|
||||
// in.
|
||||
func doArchive(ctx context.Context, r *ArchiveRequest) (*repo_model.RepoArchiver, error) {
|
||||
ctx, _, finished := process.GetManager().AddContext(ctx, fmt.Sprintf("ArchiveRequest[%s]: %s", r.Repo.FullName(), r.GetArchiveName()))
|
||||
defer finished()
|
||||
|
||||
archiver, err := repo_model.GetRepoArchiver(ctx, r.Repo.ID, r.Type, r.CommitID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if archiver != nil {
|
||||
// FIXME: If another process are generating it, we think it's not ready and just return
|
||||
// Or we should wait until the archive generated.
|
||||
if archiver.Status == repo_model.ArchiverGenerating {
|
||||
return nil, nil //nolint:nilnil // return nil because the archive is still being generated
|
||||
}
|
||||
} else {
|
||||
archiver = &repo_model.RepoArchiver{
|
||||
RepoID: r.Repo.ID,
|
||||
Type: r.Type,
|
||||
CommitID: r.CommitID,
|
||||
Status: repo_model.ArchiverGenerating,
|
||||
}
|
||||
if err := db.Insert(ctx, archiver); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
rPath := archiver.RelativePath()
|
||||
_, err = storage.RepoArchives.Stat(rPath)
|
||||
if err == nil {
|
||||
if archiver.Status == repo_model.ArchiverGenerating {
|
||||
archiver.Status = repo_model.ArchiverReady
|
||||
if err = repo_model.UpdateRepoArchiverStatus(ctx, archiver); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return archiver, nil
|
||||
}
|
||||
|
||||
if !errors.Is(err, os.ErrNotExist) {
|
||||
return nil, fmt.Errorf("unable to stat archive: %w", err)
|
||||
}
|
||||
|
||||
rd, w := io.Pipe()
|
||||
defer func() {
|
||||
_ = w.Close()
|
||||
_ = rd.Close()
|
||||
}()
|
||||
done := make(chan error, 1) // Ensure that there is some capacity which will ensure that the goroutine below can always finish
|
||||
|
||||
go func(done chan error, w *io.PipeWriter, archiveReq *ArchiveRequest) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
done <- fmt.Errorf("%v", r)
|
||||
}
|
||||
}()
|
||||
|
||||
err := archiveReq.Stream(ctx, w)
|
||||
_ = w.CloseWithError(err)
|
||||
done <- err
|
||||
}(done, w, r)
|
||||
|
||||
// TODO: add lfs data to zip
|
||||
// TODO: add submodule data to zip
|
||||
|
||||
if _, err := storage.RepoArchives.Save(rPath, rd, -1); err != nil {
|
||||
return nil, fmt.Errorf("unable to write archive: %w", err)
|
||||
}
|
||||
|
||||
err = <-done
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if archiver.Status == repo_model.ArchiverGenerating {
|
||||
archiver.Status = repo_model.ArchiverReady
|
||||
if err = repo_model.UpdateRepoArchiverStatus(ctx, archiver); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return archiver, nil
|
||||
}
|
||||
|
||||
var archiverQueue *queue.WorkerPoolQueue[*archiveQueueItem]
|
||||
|
||||
// Init initializes archiver
|
||||
func Init(ctx context.Context) error {
|
||||
handler := func(items ...*archiveQueueItem) []*archiveQueueItem {
|
||||
for _, item := range items {
|
||||
log.Trace("ArchiverData Process: %#v", item)
|
||||
archiveReq, err := item.toArchiveRequest(ctx)
|
||||
if err != nil {
|
||||
log.Error("Archive repo %d: %v", item.RepoID, err)
|
||||
continue
|
||||
}
|
||||
if archiver, err := doArchive(ctx, archiveReq); err != nil {
|
||||
log.Error("Archive %v failed: %v", archiveReq, err)
|
||||
} else {
|
||||
log.Trace("ArchiverData Success: %#v", archiver)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
archiverQueue = queue.CreateUniqueQueue(graceful.GetManager().ShutdownContext(), "repo-archive", handler)
|
||||
if archiverQueue == nil {
|
||||
return errors.New("unable to create repo-archive queue")
|
||||
}
|
||||
go graceful.GetManager().RunWithCancel(archiverQueue)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartArchive push the archive request to the queue
|
||||
func StartArchive(request *ArchiveRequest) error {
|
||||
item := request.toQueueItem()
|
||||
has, err := archiverQueue.Has(item)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if has {
|
||||
return nil
|
||||
}
|
||||
return archiverQueue.Push(item)
|
||||
}
|
||||
|
||||
func deleteOldRepoArchiver(ctx context.Context, archiver *repo_model.RepoArchiver) error {
|
||||
if _, err := db.DeleteByID[repo_model.RepoArchiver](ctx, archiver.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
p := archiver.RelativePath()
|
||||
if err := storage.RepoArchives.Delete(p); err != nil {
|
||||
log.Error("delete repo archive file failed: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteOldRepositoryArchives deletes old repository archives.
|
||||
func DeleteOldRepositoryArchives(ctx context.Context, olderThan time.Duration) error {
|
||||
log.Trace("Doing: ArchiveCleanup")
|
||||
|
||||
for {
|
||||
archivers, err := db.Find[repo_model.RepoArchiver](ctx, repo_model.FindRepoArchiversOption{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: 100,
|
||||
Page: 1,
|
||||
},
|
||||
OlderThan: olderThan,
|
||||
})
|
||||
if err != nil {
|
||||
log.Trace("Error: ArchiveClean: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
for _, archiver := range archivers {
|
||||
if err := deleteOldRepoArchiver(ctx, archiver); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if len(archivers) < 100 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
log.Trace("Finished: ArchiveCleanup")
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteRepositoryArchives deletes all repositories' archives.
|
||||
func DeleteRepositoryArchives(ctx context.Context) error {
|
||||
if err := repo_model.DeleteAllRepoArchives(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
return storage.Clean(storage.RepoArchives)
|
||||
}
|
||||
|
||||
func ServeRepoArchive(ctx *gitea_context.Base, archiveReq *ArchiveRequest) error {
|
||||
// Add nix format link header so tarballs lock correctly:
|
||||
// https://github.com/nixos/nix/blob/56763ff918eb308db23080e560ed2ea3e00c80a7/doc/manual/src/protocols/tarball-fetcher.md
|
||||
@@ -363,48 +94,19 @@ func ServeRepoArchive(ctx *gitea_context.Base, archiveReq *ArchiveRequest) error
|
||||
))
|
||||
downloadName := archiveReq.Repo.Name + "-" + archiveReq.GetArchiveName()
|
||||
|
||||
if setting.Repository.StreamArchives || len(archiveReq.Paths) > 0 {
|
||||
// Use weak ETag because the bytes also depend on the git version, compression level and repo config
|
||||
etag := fmt.Sprintf(`W/"%s-%s-%t"`, archiveReq.CommitID, archiveReq.Type.String(), setting.Repository.PrefixArchiveFiles)
|
||||
if len(archiveReq.Paths) == 0 && httpcache.HandleGenericETagPrivateCache(ctx.Req, ctx.Resp, etag, nil) {
|
||||
return nil
|
||||
}
|
||||
// the header must be set before starting streaming even an error would occur,
|
||||
// because errors may happen in git command and such cases aren't in our control.
|
||||
httplib.ServeSetHeaders(ctx.Resp, httplib.ServeHeaderOptions{Filename: downloadName})
|
||||
if err := archiveReq.Stream(ctx, ctx.Resp); err != nil && !ctx.Written() {
|
||||
if gitcmd.IsStderr(err, gitcmd.StderrPathSpec) || gitcmd.IsStderr(err, gitcmd.StderrNotTreeObject) {
|
||||
return util.NewInvalidArgumentErrorf("path doesn't exist or is invalid")
|
||||
}
|
||||
return fmt.Errorf("archive repo %s: failed to stream: %w", archiveReq.Repo.FullName(), err)
|
||||
}
|
||||
// Use weak ETag because the bytes also depend on the git version, compression level and repo config
|
||||
etag := fmt.Sprintf(`W/"%s-%s-%t"`, archiveReq.CommitID, archiveReq.Type.String(), setting.Repository.PrefixArchiveFiles)
|
||||
if len(archiveReq.Paths) == 0 && httpcache.HandleGenericETagPrivateCache(ctx.Req, ctx.Resp, etag, nil) {
|
||||
return nil
|
||||
}
|
||||
|
||||
archiver, err := archiveReq.Await(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("archive repo %s: failed to await: %w", archiveReq.Repo.FullName(), err)
|
||||
}
|
||||
|
||||
rPath := archiver.RelativePath()
|
||||
if setting.RepoArchive.Storage.ServeDirect() {
|
||||
// If we have a signed url (S3, object storage), redirect to this directly.
|
||||
u, err := storage.RepoArchives.ServeDirectURL(rPath, downloadName, ctx.Req.Method, nil)
|
||||
if u != nil && err == nil {
|
||||
ctx.Redirect(u.String())
|
||||
return nil
|
||||
// the header must be set before starting streaming even an error would occur,
|
||||
// because errors may happen in git command and such cases aren't in our control.
|
||||
httplib.ServeSetHeaders(ctx.Resp, httplib.ServeHeaderOptions{Filename: downloadName})
|
||||
if err := archiveReq.Stream(ctx, ctx.Resp); err != nil && !ctx.Written() {
|
||||
if gitcmd.IsStderr(err, gitcmd.StderrPathSpec) || gitcmd.IsStderr(err, gitcmd.StderrNotTreeObject) {
|
||||
return util.NewInvalidArgumentErrorf("path doesn't exist or is invalid")
|
||||
}
|
||||
return fmt.Errorf("ServeRepoArchive: archive repo %s: failed to stream: %w", archiveReq.Repo.FullName(), err)
|
||||
}
|
||||
|
||||
fr, err := storage.RepoArchives.Open(rPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("archive repo %s: failed to open archive file: %w", archiveReq.Repo.FullName(), err)
|
||||
}
|
||||
defer fr.Close()
|
||||
|
||||
ctx.ServeContent(fr, gitea_context.ServeHeaderOptions{
|
||||
Filename: downloadName,
|
||||
LastModified: archiver.CreatedUnix.AsLocalTime(),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@@ -4,11 +4,10 @@
|
||||
package archiver
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
repo_model "gitea.dev/models/repo"
|
||||
"gitea.dev/models/unittest"
|
||||
"gitea.dev/modules/json"
|
||||
"gitea.dev/modules/util"
|
||||
"gitea.dev/services/contexttest"
|
||||
|
||||
@@ -22,22 +21,6 @@ func TestMain(m *testing.M) {
|
||||
unittest.MainTest(m)
|
||||
}
|
||||
|
||||
func TestArchiveQueueItemJSON(t *testing.T) {
|
||||
orig := &archiveQueueItem{
|
||||
RepoID: 7,
|
||||
Type: repo_model.ArchiveZip,
|
||||
CommitID: "abc123",
|
||||
Paths: []string{"agents"},
|
||||
ArchiveRefShortName: "main",
|
||||
}
|
||||
bs, err := json.Marshal(orig)
|
||||
require.NoError(t, err)
|
||||
|
||||
var decoded archiveQueueItem
|
||||
require.NoError(t, json.Unmarshal(bs, &decoded))
|
||||
assert.Equal(t, *orig, decoded)
|
||||
}
|
||||
|
||||
func TestArchive_Basic(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
@@ -92,49 +75,11 @@ func TestArchive_Basic(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, secondReq)
|
||||
|
||||
inFlight := make([]*ArchiveRequest, 3)
|
||||
inFlight[0] = zipReq
|
||||
inFlight[1] = tgzReq
|
||||
inFlight[2] = secondReq
|
||||
|
||||
doArchive(t.Context(), zipReq)
|
||||
doArchive(t.Context(), tgzReq)
|
||||
doArchive(t.Context(), secondReq)
|
||||
|
||||
// Make sure sending an unprocessed request through doesn't affect the queue
|
||||
// count.
|
||||
doArchive(t.Context(), zipReq)
|
||||
|
||||
zipReq2, err := NewRequest(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, firstCommit+".zip", nil)
|
||||
assert.NoError(t, err)
|
||||
// This zipReq should match what's sitting in the queue, as we haven't
|
||||
// let it release yet. From the consumer's point of view, this looks like
|
||||
// a long-running archive task.
|
||||
assert.Equal(t, zipReq, zipReq2)
|
||||
|
||||
// We still have the other three stalled at completion, waiting to remove
|
||||
// from archiveInProgress. Try to submit this new one before its
|
||||
// predecessor has cleared out of the queue.
|
||||
doArchive(t.Context(), zipReq2)
|
||||
|
||||
// Now we'll submit a request and TimedWaitForCompletion twice, before and
|
||||
// after we release it. We should trigger both the timeout and non-timeout
|
||||
// cases.
|
||||
timedReq, err := NewRequest(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, secondCommit+".tar.gz", nil)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, timedReq)
|
||||
doArchive(t.Context(), timedReq)
|
||||
|
||||
zipReq2, err = NewRequest(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, firstCommit+".zip", nil)
|
||||
assert.NoError(t, err)
|
||||
// Now, we're guaranteed to have released the original zipReq from the queue.
|
||||
// Ensure that we don't get handed back the released entry somehow, but they
|
||||
// should remain functionally equivalent in all fields. The exception here
|
||||
// is zipReq.cchan, which will be non-nil because it's a completed request.
|
||||
// It's fine to go ahead and set it to nil now.
|
||||
|
||||
assert.Equal(t, zipReq, zipReq2)
|
||||
assert.NotSame(t, zipReq, zipReq2)
|
||||
for _, request := range []*ArchiveRequest{zipReq, tgzReq, secondReq} {
|
||||
var archive bytes.Buffer
|
||||
require.NoError(t, request.Stream(ctx, &archive))
|
||||
assert.Positive(t, archive.Len())
|
||||
}
|
||||
|
||||
// Same commit, different compression formats should have different names.
|
||||
// Ideally, the extension would match what we originally requested.
|
||||
|
||||
@@ -268,21 +268,6 @@ func DeleteRepositoryDirectly(ctx context.Context, repoID int64, ignoreOrgTeams
|
||||
return err
|
||||
}
|
||||
|
||||
// Remove archives
|
||||
var archives []*repo_model.RepoArchiver
|
||||
if err = sess.Where("repo_id=?", repoID).Find(&archives); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
archivePaths := make([]string, 0, len(archives))
|
||||
for _, v := range archives {
|
||||
archivePaths = append(archivePaths, v.RelativePath())
|
||||
}
|
||||
|
||||
if _, err := db.DeleteByBean(ctx, &repo_model.RepoArchiver{RepoID: repoID}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if repo.NumForks > 0 {
|
||||
if _, err = sess.Exec("UPDATE `repository` SET fork_id=0,is_fork=? WHERE fork_id=?", false, repo.ID); err != nil {
|
||||
log.Error("reset 'fork_id' and 'is_fork': %v", err)
|
||||
@@ -345,11 +330,6 @@ func DeleteRepositoryDirectly(ctx context.Context, repoID int64, ignoreOrgTeams
|
||||
}
|
||||
}
|
||||
|
||||
// Remove archives
|
||||
for _, archive := range archivePaths {
|
||||
system_model.RemoveStorageWithNotice(ctx, storage.RepoArchives, "Delete repo archive file", archive)
|
||||
}
|
||||
|
||||
// Remove lfs objects
|
||||
for _, lfsObj := range lfsPaths {
|
||||
system_model.RemoveStorageWithNotice(ctx, storage.LFS, "Delete orphaned LFS file", lfsObj)
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
<td>{{ctx.Locale.Tr "admin.dashboard.delete_inactive_accounts"}}</td>
|
||||
<td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="delete_inactive_accounts">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ctx.Locale.Tr "admin.dashboard.delete_repo_archives"}}</td>
|
||||
<td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="delete_repo_archives">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ctx.Locale.Tr "admin.dashboard.delete_missing_repos"}}</td>
|
||||
<td class="tw-text-right"><button type="submit" class="ui primary button" name="op" value="delete_missing_repos">{{svg "octicon-play"}} {{ctx.Locale.Tr "admin.dashboard.operation_run"}}</button></td>
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
<div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" ($.DefaultBranchBranch.DBBranch.Name)}}">
|
||||
{{svg "octicon-download"}}
|
||||
<div class="menu">
|
||||
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} ZIP</a>
|
||||
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} TAR.GZ</a>
|
||||
<a download class="item" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} ZIP</a>
|
||||
<a download class="item" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.DefaultBranchBranch.DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} TAR.GZ</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -179,8 +179,8 @@
|
||||
<div class="ui dropdown btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.branch.download" (.DBBranch.Name)}}">
|
||||
{{svg "octicon-download"}}
|
||||
<div class="menu">
|
||||
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} ZIP</a>
|
||||
<a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} TAR.GZ</a>
|
||||
<a download class="item" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} ZIP</a>
|
||||
<a download class="item" href="{{$.RepoLink}}/archive/{{PathEscapeSegments .DBBranch.Name}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} TAR.GZ</a>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
@@ -47,9 +47,9 @@
|
||||
{{if $downloadArchiveLinkPrefix}}
|
||||
{{if $showOpenWithEditorApps}}<div class="divider"></div>{{end}}
|
||||
<div class="flex-items-block clone-panel-list">
|
||||
<a class="item muted archive-link" href="{{$downloadArchiveLinkPrefix}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a>
|
||||
<a class="item muted archive-link" href="{{$downloadArchiveLinkPrefix}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a>
|
||||
<a class="item muted archive-link" href="{{$downloadArchiveLinkPrefix}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a>
|
||||
<a download class="item muted" href="{{$downloadArchiveLinkPrefix}}.zip" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_zip"}}</a>
|
||||
<a download class="item muted" href="{{$downloadArchiveLinkPrefix}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}} {{ctx.Locale.Tr "repo.download_tar"}}</a>
|
||||
<a download class="item muted" href="{{$downloadArchiveLinkPrefix}}.bundle" rel="nofollow">{{svg "octicon-package"}} {{ctx.Locale.Tr "repo.download_bundle"}}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
@@ -108,12 +108,12 @@
|
||||
{{end}}
|
||||
{{if $showArchives}}
|
||||
<div class="item">
|
||||
<a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow">
|
||||
<a download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.zip" rel="nofollow">
|
||||
<strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "tw-text-text-light-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (ZIP)</strong>
|
||||
</a>
|
||||
</div>
|
||||
<div class="item">
|
||||
<a class="archive-link" download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">
|
||||
<a download href="{{$.RepoLink}}/archive/{{$release.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">
|
||||
<strong class="flex-text-inline">{{svg "octicon-file-zip" 16 "tw-text-text-light-1"}}{{ctx.Locale.Tr "repo.release.source_code"}} (TAR.GZ)</strong>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
<a class="flex-text-inline tw-font-mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit"}}{{ShortSha .Sha1}}</a>
|
||||
|
||||
{{if not $.DisableDownloadSourceArchives}}
|
||||
<a class="archive-link flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}ZIP</a>
|
||||
<a class="archive-link flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}TAR.GZ</a>
|
||||
<a download class="flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}ZIP</a>
|
||||
<a download class="flex-text-inline" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}TAR.GZ</a>
|
||||
{{end}}
|
||||
|
||||
{{if (and $canReadReleases $.CanCreateRelease $release.IsTag)}}
|
||||
|
||||
@@ -97,8 +97,8 @@
|
||||
</a>
|
||||
{{if and (not $.DisableDownloadSourceArchives) $.RefFullName}}
|
||||
<div class="divider"></div>
|
||||
<a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.zip?path={{.TreePath}}" rel="nofollow">{{svg "octicon-file-zip"}}{{ctx.Locale.Tr "repo.download_directory_as" "ZIP"}}</a>
|
||||
<a class="item muted archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.tar.gz?path={{.TreePath}}" rel="nofollow">{{svg "octicon-file-zip"}}{{ctx.Locale.Tr "repo.download_directory_as" "TAR.GZ"}}</a>
|
||||
<a download class="item muted" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.zip?path={{.TreePath}}" rel="nofollow">{{svg "octicon-file-zip"}}{{ctx.Locale.Tr "repo.download_directory_as" "ZIP"}}</a>
|
||||
<a download class="item muted" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefFullName.ShortName}}.tar.gz?path={{.TreePath}}" rel="nofollow">{{svg "octicon-file-zip"}}{{ctx.Locale.Tr "repo.download_directory_as" "TAR.GZ"}}</a>
|
||||
{{end}}
|
||||
{{if and .Repository.CanContentChange (not $isTreePathRoot)}}
|
||||
<div class="divider"></div>
|
||||
|
||||
@@ -148,10 +148,10 @@ func TestAPIAdminAccessAndSSHKeys(t *testing.T) {
|
||||
AddTokenAuth(token)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
assert.Equal(t, "31", resp.Header().Get("X-Total-Count"))
|
||||
assert.Equal(t, "29", resp.Header().Get("X-Total-Count"))
|
||||
|
||||
crons := DecodeJSON(t, resp, []api.Cron{})
|
||||
assert.Len(t, crons, 30)
|
||||
assert.Len(t, crons, 29)
|
||||
})
|
||||
|
||||
t.Run("Execute", func(t *testing.T) {
|
||||
@@ -159,10 +159,7 @@ func TestAPIAdminAccessAndSSHKeys(t *testing.T) {
|
||||
|
||||
now := time.Now()
|
||||
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteAdmin)
|
||||
// Archive cleanup is harmless, because in the test environment there are none
|
||||
// and is thus an NOOP operation and therefore doesn't interfere with any other
|
||||
// tests.
|
||||
req := NewRequest(t, "POST", "/api/v1/admin/cron/archive_cleanup").
|
||||
req := NewRequest(t, "POST", "/api/v1/admin/cron/deleted_branches_cleanup").
|
||||
AddTokenAuth(token)
|
||||
MakeRequest(t, req, http.StatusNoContent)
|
||||
|
||||
@@ -174,7 +171,7 @@ func TestAPIAdminAccessAndSSHKeys(t *testing.T) {
|
||||
crons := DecodeJSON(t, resp, []api.Cron{})
|
||||
|
||||
for _, cron := range crons {
|
||||
if cron.Name == "archive_cleanup" {
|
||||
if cron.Name == "deleted_branches_cleanup" {
|
||||
assert.True(t, now.Before(cron.Prev))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
|
||||
type downloadScopeCase struct {
|
||||
name string
|
||||
method string
|
||||
url string
|
||||
publicOnlyOK bool
|
||||
}
|
||||
@@ -78,25 +77,11 @@ func TestDownloadRepoContent(t *testing.T) {
|
||||
cases := []downloadScopeCase{
|
||||
{
|
||||
name: "PublicArchiveDownload",
|
||||
method: http.MethodGet,
|
||||
url: "/user2/repo1/archive/master.tar.gz",
|
||||
publicOnlyOK: true,
|
||||
},
|
||||
{
|
||||
name: "PrivateArchiveDownload",
|
||||
method: http.MethodGet,
|
||||
url: "/user2/repo2/archive/master.tar.gz",
|
||||
publicOnlyOK: false,
|
||||
},
|
||||
{
|
||||
name: "PublicArchiveInitiate",
|
||||
method: http.MethodPost,
|
||||
url: "/user2/repo1/archive/master.tar.gz",
|
||||
publicOnlyOK: true,
|
||||
},
|
||||
{
|
||||
name: "PrivateArchiveInitiate",
|
||||
method: http.MethodPost,
|
||||
url: "/user2/repo2/archive/master.tar.gz",
|
||||
publicOnlyOK: false,
|
||||
},
|
||||
@@ -110,7 +95,6 @@ func TestDownloadRepoContent(t *testing.T) {
|
||||
} {
|
||||
cases = append(cases, downloadScopeCase{
|
||||
name: "Public" + route + ref.name,
|
||||
method: http.MethodGet,
|
||||
url: "/user2/repo1/" + strings.ToLower(route) + "/" + ref.path,
|
||||
publicOnlyOK: true,
|
||||
})
|
||||
@@ -119,19 +103,16 @@ func TestDownloadRepoContent(t *testing.T) {
|
||||
cases = append(cases,
|
||||
downloadScopeCase{
|
||||
name: "PrivateRawBranch",
|
||||
method: http.MethodGet,
|
||||
url: "/user2/repo2/raw/branch/master/test.xml",
|
||||
publicOnlyOK: false,
|
||||
},
|
||||
downloadScopeCase{
|
||||
name: "PrivateRawBlob",
|
||||
method: http.MethodGet,
|
||||
url: "/user2/repo2/raw/blob/6395b68e1feebb1e4c657b4f9f6ba2676a283c0b",
|
||||
publicOnlyOK: false,
|
||||
},
|
||||
downloadScopeCase{
|
||||
name: "PrivateMediaBranch",
|
||||
method: http.MethodGet,
|
||||
url: "/user2/repo2/media/branch/master/test.xml",
|
||||
publicOnlyOK: false,
|
||||
},
|
||||
@@ -139,14 +120,14 @@ func TestDownloadRepoContent(t *testing.T) {
|
||||
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
MakeRequest(t, NewRequest(t, tc.method, tc.url).AddTokenAuth(miscToken), http.StatusForbidden)
|
||||
MakeRequest(t, NewRequest(t, tc.method, tc.url).AddTokenAuth(ownerReadToken), http.StatusOK)
|
||||
MakeRequest(t, NewRequest(t, http.MethodGet, tc.url).AddTokenAuth(miscToken), http.StatusForbidden)
|
||||
MakeRequest(t, NewRequest(t, http.MethodGet, tc.url).AddTokenAuth(ownerReadToken), http.StatusOK)
|
||||
|
||||
publicOnlyStatus := http.StatusNotFound
|
||||
if tc.publicOnlyOK {
|
||||
publicOnlyStatus = http.StatusOK
|
||||
}
|
||||
MakeRequest(t, NewRequest(t, tc.method, tc.url).AddTokenAuth(publicOnlyToken), publicOnlyStatus)
|
||||
MakeRequest(t, NewRequest(t, http.MethodGet, tc.url).AddTokenAuth(publicOnlyToken), publicOnlyStatus)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -50,7 +50,6 @@ func TestRepoDownloadArchive(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Conditional", func(t *testing.T) {
|
||||
defer test.MockVariableValue(&setting.Repository.StreamArchives, true)()
|
||||
archiveURL := "/user2/repo1/archive/archive-test.tar.gz"
|
||||
etag := MakeRequest(t, NewRequest(t, "GET", archiveURL), http.StatusOK).Header().Get("ETag")
|
||||
assert.True(t, strings.HasPrefix(etag, `W/"`))
|
||||
@@ -58,17 +57,11 @@ func TestRepoDownloadArchive(t *testing.T) {
|
||||
MakeRequest(t, NewRequest(t, "GET", archiveURL+"?path=aaa.doc").SetHeader("If-None-Match", etag), http.StatusOK)
|
||||
assert.NotEqual(t, etag, MakeRequest(t, NewRequest(t, "GET", "/user2/repo1/archive/master.tar.gz"), http.StatusOK).Header().Get("ETag"))
|
||||
|
||||
restoreStreaming := test.MockVariableValue(&setting.Repository.StreamArchives, false)
|
||||
MakeRequest(t, NewRequest(t, "GET", archiveURL).SetHeader("If-None-Match", etag), http.StatusOK)
|
||||
restoreStreaming()
|
||||
|
||||
defer test.MockVariableValue(&setting.Repository.PrefixArchiveFiles, !setting.Repository.PrefixArchiveFiles)()
|
||||
MakeRequest(t, NewRequest(t, "GET", archiveURL).SetHeader("If-None-Match", etag), http.StatusOK)
|
||||
})
|
||||
|
||||
t.Run("SubPath", func(t *testing.T) {
|
||||
// When using "archiving and caching" approach, archiving with paths will always use streaming and never be cached
|
||||
defer test.MockVariableValue(&setting.Repository.StreamArchives, false)() // this can be removed if there is always streaming mode
|
||||
req := NewRequest(t, "GET", "/user2/repo1/archive/archive-test.tar.gz?path=aaa.doc&path=x/y")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
content, err := test.ReadAllTarGzContent(resp.Body)
|
||||
|
||||
@@ -1,42 +1,10 @@
|
||||
import {queryElems, toggleElem} from '../utils/dom.ts';
|
||||
import {errorMessage} from '../modules/errors.ts';
|
||||
import {POST} from '../modules/fetch.ts';
|
||||
import {showErrorToast} from '../modules/toast.ts';
|
||||
import {sleep} from '../utils.ts';
|
||||
import {toggleElem} from '../utils/dom.ts';
|
||||
import RepoActivityTopAuthors from '../components/RepoActivityTopAuthors.vue';
|
||||
import {createApp} from 'vue';
|
||||
import {createTippy} from '../modules/tippy.ts';
|
||||
import {localUserSettings} from '../modules/user-settings.ts';
|
||||
import {registerGlobalInitFunc} from '../modules/observer.ts';
|
||||
|
||||
async function onDownloadArchive(e: Event) {
|
||||
e.preventDefault();
|
||||
// there are many places using the "archive-link", eg: the dropdown on the repo code page, the release list
|
||||
const el = (e.target as HTMLElement).closest<HTMLAnchorElement>('a.archive-link[href]')!;
|
||||
const targetLoading = el.closest('.ui.dropdown') ?? el;
|
||||
targetLoading.classList.add('is-loading', 'loading-icon-2px');
|
||||
try {
|
||||
for (let tryCount = 0; ;tryCount++) {
|
||||
const response = await POST(el.href);
|
||||
if (!response.ok) throw new Error(`Invalid server response: ${response.status}`);
|
||||
|
||||
const data = await response.json();
|
||||
if (data.complete) break;
|
||||
await sleep(Math.min((tryCount + 1) * 750, 2000));
|
||||
}
|
||||
window.location.assign(el.href); // the archive is ready, start real downloading
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showErrorToast(`Failed to download the archive: ${errorMessage(e)}`, {duration: 2500});
|
||||
} finally {
|
||||
targetLoading.classList.remove('is-loading', 'loading-icon-2px');
|
||||
}
|
||||
}
|
||||
|
||||
export function initRepoArchiveLinks() {
|
||||
queryElems(document, 'a.archive-link[href]', (el) => el.addEventListener('click', onDownloadArchive));
|
||||
}
|
||||
|
||||
export function initRepoActivityTopAuthorsChart() {
|
||||
const el = document.querySelector('#repo-activity-top-authors-chart');
|
||||
if (el) {
|
||||
|
||||
+1
-2
@@ -26,7 +26,7 @@ import {initAdminCommon} from './features/admin/common.ts';
|
||||
import {initRepoCodeView} from './features/repo-code.ts';
|
||||
import {initSshKeyFormParser} from './features/sshkey-helper.ts';
|
||||
import {initUserSettings} from './features/user-settings.ts';
|
||||
import {initRepoActivityTopAuthorsChart, initRepoArchiveLinks} from './features/repo-common.ts';
|
||||
import {initRepoActivityTopAuthorsChart} from './features/repo-common.ts';
|
||||
import {initRepoMigrationStatusChecker} from './features/repo-migrate.ts';
|
||||
import {initRepoDiffView} from './features/repo-diff.ts';
|
||||
import {initOrgTeam} from './features/org-team.ts';
|
||||
@@ -123,7 +123,6 @@ const initPerformanceTracer = callInitFunctions([
|
||||
initOrgTeam,
|
||||
|
||||
initRepoActivityTopAuthorsChart,
|
||||
initRepoArchiveLinks,
|
||||
initRepoBranchButton,
|
||||
initRepoCodeView,
|
||||
initBranchSelectorTabs,
|
||||
|
||||
Reference in new issue
Block a user