Skip to content

Commit 890377e

Browse files
authored
Merge branch 'main' into remove-menu-hide
2 parents 2b1dba4 + 65fc2d1 commit 890377e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1886
-1465
lines changed

.drone.yml

+136-2
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,10 @@ depends_on:
985985

986986
trigger:
987987
ref:
988-
- "refs/tags/**"
988+
include:
989+
- "refs/tags/**"
990+
exclude:
991+
- "refs/tags/**-rc*"
989992
event:
990993
exclude:
991994
- cron
@@ -1033,6 +1036,68 @@ steps:
10331036
event:
10341037
exclude:
10351038
- pull_request
1039+
---
1040+
1041+
kind: pipeline
1042+
type: docker
1043+
name: docker-linux-amd64-release-candidate-version
1044+
1045+
platform:
1046+
os: linux
1047+
arch: amd64
1048+
1049+
depends_on:
1050+
- testing-amd64
1051+
- testing-arm64
1052+
1053+
trigger:
1054+
ref:
1055+
- "refs/tags/**-rc*"
1056+
event:
1057+
exclude:
1058+
- cron
1059+
1060+
steps:
1061+
- name: fetch-tags
1062+
image: docker:git
1063+
pull: always
1064+
commands:
1065+
- git config --global --add safe.directory /drone/src
1066+
- git fetch --tags --force
1067+
1068+
- name: publish
1069+
image: techknowlogick/drone-docker:latest
1070+
pull: always
1071+
settings:
1072+
tags: ${DRONE_TAG##v}-linux-amd64
1073+
repo: gitea/gitea
1074+
build_args:
1075+
- GOPROXY=https://goproxy.io
1076+
password:
1077+
from_secret: docker_password
1078+
username:
1079+
from_secret: docker_username
1080+
when:
1081+
event:
1082+
exclude:
1083+
- pull_request
1084+
1085+
- name: publish-rootless
1086+
image: techknowlogick/drone-docker:latest
1087+
settings:
1088+
dockerfile: Dockerfile.rootless
1089+
tags: ${DRONE_TAG##v}-linux-amd64-rootless
1090+
repo: gitea/gitea
1091+
build_args:
1092+
- GOPROXY=https://goproxy.io
1093+
password:
1094+
from_secret: docker_password
1095+
username:
1096+
from_secret: docker_username
1097+
when:
1098+
event:
1099+
exclude:
1100+
- pull_request
10361101

10371102
---
10381103
kind: pipeline
@@ -1209,7 +1274,10 @@ depends_on:
12091274

12101275
trigger:
12111276
ref:
1212-
- "refs/tags/**"
1277+
include:
1278+
- "refs/tags/**"
1279+
exclude:
1280+
- "refs/tags/**-rc*"
12131281
event:
12141282
exclude:
12151283
- cron
@@ -1258,6 +1326,68 @@ steps:
12581326
exclude:
12591327
- pull_request
12601328

1329+
---
1330+
kind: pipeline
1331+
type: docker
1332+
name: docker-linux-arm64-release-candidate-version
1333+
1334+
platform:
1335+
os: linux
1336+
arch: arm64
1337+
1338+
depends_on:
1339+
- testing-amd64
1340+
- testing-arm64
1341+
1342+
trigger:
1343+
ref:
1344+
- "refs/tags/**-rc*"
1345+
event:
1346+
exclude:
1347+
- cron
1348+
1349+
steps:
1350+
- name: fetch-tags
1351+
image: docker:git
1352+
pull: always
1353+
commands:
1354+
- git config --global --add safe.directory /drone/src
1355+
- git fetch --tags --force
1356+
1357+
- name: publish
1358+
image: techknowlogick/drone-docker:latest
1359+
pull: always
1360+
settings:
1361+
tags: ${DRONE_TAG##v}-linux-arm64
1362+
repo: gitea/gitea
1363+
build_args:
1364+
- GOPROXY=https://goproxy.io
1365+
password:
1366+
from_secret: docker_password
1367+
username:
1368+
from_secret: docker_username
1369+
when:
1370+
event:
1371+
exclude:
1372+
- pull_request
1373+
1374+
- name: publish-rootless
1375+
image: techknowlogick/drone-docker:latest
1376+
settings:
1377+
dockerfile: Dockerfile.rootless
1378+
tags: ${DRONE_TAG##v}-linux-arm64-rootless
1379+
repo: gitea/gitea
1380+
build_args:
1381+
- GOPROXY=https://goproxy.io
1382+
password:
1383+
from_secret: docker_password
1384+
username:
1385+
from_secret: docker_username
1386+
when:
1387+
event:
1388+
exclude:
1389+
- pull_request
1390+
12611391
---
12621392
kind: pipeline
12631393
type: docker
@@ -1427,7 +1557,9 @@ trigger:
14271557

14281558
depends_on:
14291559
- docker-linux-amd64-release-version
1560+
- docker-linux-amd64-release-candidate-version
14301561
- docker-linux-arm64-release-version
1562+
- docker-linux-arm64-release-candidate-version
14311563

14321564
---
14331565
kind: pipeline
@@ -1509,6 +1641,8 @@ depends_on:
15091641
- docker-linux-arm64-release
15101642
- docker-linux-amd64-release-version
15111643
- docker-linux-arm64-release-version
1644+
- docker-linux-amd64-release-candidate-version
1645+
- docker-linux-arm64-release-candidate-version
15121646
- docker-linux-amd64-release-branch
15131647
- docker-linux-arm64-release-branch
15141648
- docker-manifest

cmd/cmd.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ func confirm() (bool, error) {
5757
}
5858

5959
func initDB(ctx context.Context) error {
60-
setting.LoadFromExisting()
61-
setting.InitDBConfig()
62-
setting.NewXORMLogService(false)
60+
setting.InitProviderFromExistingFile()
61+
setting.LoadCommonSettings()
62+
setting.LoadDBSetting()
63+
setting.InitSQLLog(false)
6364

6465
if setting.Database.Type == "" {
6566
log.Fatal(`Database settings are missing from the configuration file: %q.

cmd/convert.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func runConvert(ctx *cli.Context) error {
3232
log.Info("AppPath: %s", setting.AppPath)
3333
log.Info("AppWorkPath: %s", setting.AppWorkPath)
3434
log.Info("Custom path: %s", setting.CustomPath)
35-
log.Info("Log path: %s", setting.LogRootPath)
35+
log.Info("Log path: %s", setting.Log.RootPath)
3636
log.Info("Configuration file: %s", setting.CustomConf)
3737

3838
if !setting.Database.UseMySQL {

cmd/doctor.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,16 @@ func runRecreateTable(ctx *cli.Context) error {
8787
golog.SetPrefix("")
8888
golog.SetOutput(log.NewLoggerAsWriter("INFO", log.GetLogger(log.DEFAULT)))
8989

90-
setting.LoadFromExisting()
91-
setting.InitDBConfig()
90+
setting.InitProviderFromExistingFile()
91+
setting.LoadCommonSettings()
92+
setting.LoadDBSetting()
9293

93-
setting.EnableXORMLog = ctx.Bool("debug")
94+
setting.Log.EnableXORMLog = ctx.Bool("debug")
9495
setting.Database.LogSQL = ctx.Bool("debug")
95-
setting.Cfg.Section("log").Key("XORM").SetValue(",")
96+
// FIXME: don't use CfgProvider directly
97+
setting.CfgProvider.Section("log").Key("XORM").SetValue(",")
9698

97-
setting.NewXORMLogService(!ctx.Bool("debug"))
99+
setting.InitSQLLog(!ctx.Bool("debug"))
98100
stdCtx, cancel := installSignals()
99101
defer cancel()
100102

cmd/dump.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -181,20 +181,22 @@ func runDump(ctx *cli.Context) error {
181181
}
182182
fileName += "." + outType
183183
}
184-
setting.LoadFromExisting()
184+
setting.InitProviderFromExistingFile()
185+
setting.LoadCommonSettings()
185186

186187
// make sure we are logging to the console no matter what the configuration tells us do to
187-
if _, err := setting.Cfg.Section("log").NewKey("MODE", "console"); err != nil {
188+
// FIXME: don't use CfgProvider directly
189+
if _, err := setting.CfgProvider.Section("log").NewKey("MODE", "console"); err != nil {
188190
fatal("Setting logging mode to console failed: %v", err)
189191
}
190-
if _, err := setting.Cfg.Section("log.console").NewKey("STDERR", "true"); err != nil {
192+
if _, err := setting.CfgProvider.Section("log.console").NewKey("STDERR", "true"); err != nil {
191193
fatal("Setting console logger to stderr failed: %v", err)
192194
}
193195
if !setting.InstallLock {
194196
log.Error("Is '%s' really the right config path?\n", setting.CustomConf)
195197
return fmt.Errorf("gitea is not initialized")
196198
}
197-
setting.NewServices() // cannot access session settings otherwise
199+
setting.LoadSettings() // cannot access session settings otherwise
198200

199201
stdCtx, cancel := installSignals()
200202
defer cancel()
@@ -322,7 +324,7 @@ func runDump(ctx *cli.Context) error {
322324
log.Info("Packing data directory...%s", setting.AppDataPath)
323325

324326
var excludes []string
325-
if setting.Cfg.Section("session").Key("PROVIDER").Value() == "file" {
327+
if setting.SessionConfig.OriginalProvider == "file" {
326328
var opts session.Options
327329
if err = json.Unmarshal([]byte(setting.SessionConfig.ProviderConfig), &opts); err != nil {
328330
return err
@@ -339,7 +341,7 @@ func runDump(ctx *cli.Context) error {
339341
excludes = append(excludes, setting.LFS.Path)
340342
excludes = append(excludes, setting.Attachment.Path)
341343
excludes = append(excludes, setting.Packages.Path)
342-
excludes = append(excludes, setting.LogRootPath)
344+
excludes = append(excludes, setting.Log.RootPath)
343345
excludes = append(excludes, absFileName)
344346
if err := addRecursiveExclude(w, "data", setting.AppDataPath, excludes, verbose); err != nil {
345347
fatal("Failed to include data directory: %v", err)
@@ -378,12 +380,12 @@ func runDump(ctx *cli.Context) error {
378380
if ctx.IsSet("skip-log") && ctx.Bool("skip-log") {
379381
log.Info("Skip dumping log files")
380382
} else {
381-
isExist, err := util.IsExist(setting.LogRootPath)
383+
isExist, err := util.IsExist(setting.Log.RootPath)
382384
if err != nil {
383-
log.Error("Unable to check if %s exists. Error: %v", setting.LogRootPath, err)
385+
log.Error("Unable to check if %s exists. Error: %v", setting.Log.RootPath, err)
384386
}
385387
if isExist {
386-
if err := addRecursiveExclude(w, "log", setting.LogRootPath, []string{absFileName}, verbose); err != nil {
388+
if err := addRecursiveExclude(w, "log", setting.Log.RootPath, []string{absFileName}, verbose); err != nil {
387389
fatal("Failed to include log: %v", err)
388390
}
389391
}

cmd/dump_repo.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func runDumpRepository(ctx *cli.Context) error {
9494
log.Info("AppPath: %s", setting.AppPath)
9595
log.Info("AppWorkPath: %s", setting.AppWorkPath)
9696
log.Info("Custom path: %s", setting.CustomPath)
97-
log.Info("Log path: %s", setting.LogRootPath)
97+
log.Info("Log path: %s", setting.Log.RootPath)
9898
log.Info("Configuration file: %s", setting.CustomConf)
9999

100100
var (

cmd/embedded.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ func initEmbeddedExtractor(c *cli.Context) error {
112112
log.DelNamedLogger(log.DEFAULT)
113113

114114
// Read configuration file
115-
setting.LoadAllowEmpty()
115+
setting.InitProviderAllowEmpty()
116+
setting.LoadCommonSettings()
116117

117118
pats, err := getPatterns(c.Args())
118119
if err != nil {

cmd/mailer.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ func runSendMail(c *cli.Context) error {
1717
ctx, cancel := installSignals()
1818
defer cancel()
1919

20-
setting.LoadFromExisting()
20+
setting.InitProviderFromExistingFile()
21+
setting.LoadCommonSettings()
2122

2223
if err := argsSet(c, "title"); err != nil {
2324
return err

cmd/main_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
func init() {
1414
setting.SetCustomPathAndConf("", "", "")
15-
setting.LoadForTest()
15+
setting.InitProviderAndLoadCommonSettingsForTest()
1616
}
1717

1818
func TestMain(m *testing.M) {

cmd/migrate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func runMigrate(ctx *cli.Context) error {
3333
log.Info("AppPath: %s", setting.AppPath)
3434
log.Info("AppWorkPath: %s", setting.AppWorkPath)
3535
log.Info("Custom path: %s", setting.CustomPath)
36-
log.Info("Log path: %s", setting.LogRootPath)
36+
log.Info("Log path: %s", setting.Log.RootPath)
3737
log.Info("Configuration file: %s", setting.CustomConf)
3838

3939
if err := db.InitEngineWithMigration(context.Background(), migrations.Migrate); err != nil {

cmd/migrate_storage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func runMigrateStorage(ctx *cli.Context) error {
136136
log.Info("AppPath: %s", setting.AppPath)
137137
log.Info("AppWorkPath: %s", setting.AppWorkPath)
138138
log.Info("Custom path: %s", setting.CustomPath)
139-
log.Info("Log path: %s", setting.LogRootPath)
139+
log.Info("Log path: %s", setting.Log.RootPath)
140140
log.Info("Configuration file: %s", setting.CustomConf)
141141

142142
if err := db.InitEngineWithMigration(context.Background(), migrations.Migrate); err != nil {

cmd/restore_repo.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ func runRestoreRepository(c *cli.Context) error {
5454
ctx, cancel := installSignals()
5555
defer cancel()
5656

57-
setting.LoadFromExisting()
57+
setting.InitProviderFromExistingFile()
58+
setting.LoadCommonSettings()
5859
var units []string
5960
if s := c.String("units"); s != "" {
6061
units = strings.Split(s, ",")

cmd/serv.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ func setup(logPath string, debug bool) {
6161
} else {
6262
_ = log.NewLogger(1000, "console", "console", `{"level":"fatal","stacktracelevel":"NONE","stderr":true}`)
6363
}
64-
setting.LoadFromExisting()
64+
setting.InitProviderFromExistingFile()
65+
setting.LoadCommonSettings()
6566
if debug {
6667
setting.RunMode = "dev"
6768
}

cmd/web.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ func runWeb(ctx *cli.Context) error {
158158

159159
log.Info("Global init")
160160
// Perform global initialization
161-
setting.LoadFromExisting()
161+
setting.InitProviderFromExistingFile()
162+
setting.LoadCommonSettings()
162163
routers.GlobalInitInstalled(graceful.GetManager().HammerContext())
163164

164165
// We check that AppDataPath exists here (it should have been created during installation)

contrib/pr/checkout.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ func runPR() {
4949
log.Fatal(err)
5050
}
5151
setting.SetCustomPathAndConf("", "", "")
52-
setting.LoadAllowEmpty()
52+
setting.InitProviderAllowEmpty()
53+
setting.LoadCommonSettings()
5354

5455
setting.RepoRootPath, err = os.MkdirTemp(os.TempDir(), "repos")
5556
if err != nil {
@@ -82,7 +83,7 @@ func runPR() {
8283
setting.Database.Path = ":memory:"
8384
setting.Database.Timeout = 500
8485
*/
85-
dbCfg := setting.Cfg.Section("database")
86+
dbCfg := setting.CfgProvider.Section("database")
8687
dbCfg.NewKey("DB_TYPE", "sqlite3")
8788
dbCfg.NewKey("PATH", ":memory:")
8889

0 commit comments

Comments
 (0)