Skip to content

Commit 9a59699

Browse files
committed
Merge branch 'main' of https://github.com/go-gitea/gitea into refactoring-private
2 parents b82ac60 + f088dc4 commit 9a59699

File tree

355 files changed

+5053
-4363
lines changed

Some content is hidden

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

355 files changed

+5053
-4363
lines changed

.drone.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ services:
153153
MYSQL_DATABASE: test
154154

155155
- name: mysql8
156-
image: mysql:8.0
156+
image: mysql:8
157157
environment:
158158
MYSQL_ALLOW_EMPTY_PASSWORD: yes
159159
MYSQL_DATABASE: testgitea
@@ -319,7 +319,7 @@ trigger:
319319
services:
320320
- name: pgsql
321321
pull: default
322-
image: postgres:9.5
322+
image: postgres:10
323323
environment:
324324
POSTGRES_DB: test
325325
POSTGRES_PASSWORD: postgres
@@ -503,7 +503,7 @@ steps:
503503
pull: always
504504
image: techknowlogick/xgo:go-1.16.x
505505
commands:
506-
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
506+
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
507507
- export PATH=$PATH:$GOPATH/bin
508508
- make release
509509
environment:
@@ -599,7 +599,7 @@ steps:
599599
pull: always
600600
image: techknowlogick/xgo:go-1.16.x
601601
commands:
602-
- curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs
602+
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
603603
- export PATH=$PATH:$GOPATH/bin
604604
- make release
605605
environment:

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Please check the following:
22

3-
1. Make sure you are targeting the `master` branch, pull requests on release branches are only allowed for bug fixes.
3+
1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes.
44
2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/master/CONTRIBUTING.md
55
3. Describe what your pull request does and which issue you're targeting (if any)
66

.golangci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ issues:
7070
- path: modules/log/
7171
linters:
7272
- errcheck
73-
- path: routers/routes/web.go
74-
linters:
75-
- dupl
7673
- path: routers/api/v1/repo/issue_subscription.go
7774
linters:
7875
- dupl
@@ -114,3 +111,4 @@ issues:
114111
linters:
115112
- staticcheck
116113
text: "svc.IsAnInteractiveSession is deprecated: Use IsWindowsService instead."
114+

Dockerfile.rootless

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ RUN apk --no-cache add \
3535
ca-certificates \
3636
gettext \
3737
git \
38+
curl \
3839
gnupg
3940

4041
RUN addgroup \
@@ -59,6 +60,8 @@ USER git:git
5960
ENV GITEA_WORK_DIR /var/lib/gitea
6061
ENV GITEA_CUSTOM /var/lib/gitea/custom
6162
ENV GITEA_TEMP /tmp/gitea
63+
ENV TMPDIR /tmp/gitea
64+
6265
#TODO add to docs the ability to define the ini to load (usefull to test and revert a config)
6366
ENV GITEA_APP_INI /etc/gitea/app.ini
6467
ENV HOME "/var/lib/gitea/git"

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ endif
4343
ifeq ($(OS), Windows_NT)
4444
GOFLAGS := -v -buildmode=exe
4545
EXECUTABLE ?= gitea.exe
46+
else ifeq ($(OS), Windows)
47+
GOFLAGS := -v -buildmode=exe
48+
EXECUTABLE ?= gitea.exe
4649
else
4750
GOFLAGS := -v
4851
EXECUTABLE ?= gitea
@@ -61,8 +64,9 @@ EXTRA_GOFLAGS ?=
6164
MAKE_VERSION := $(shell $(MAKE) -v | head -n 1)
6265
MAKE_EVIDENCE_DIR := .make_evidence
6366

64-
ifneq ($(RACE_ENABLED),)
65-
GOTESTFLAGS ?= -race
67+
ifeq ($(RACE_ENABLED),true)
68+
GOFLAGS += -race
69+
GOTESTFLAGS += -race
6670
endif
6771

6872
STORED_VERSION_FILE := VERSION
@@ -377,7 +381,7 @@ test-check:
377381
.PHONY: test\#%
378382
test\#%:
379383
@echo "Running go test with -tags '$(TEST_TAGS)'..."
380-
@$(GO) test -mod=vendor -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_PACKAGES)
384+
@$(GO) test -mod=vendor $(GOTESTFLAGS) -tags='$(TEST_TAGS)' -run $(subst .,/,$*) $(GO_PACKAGES)
381385

382386
.PHONY: coverage
383387
coverage:

cmd/serv.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ func fail(userMessage, logMessage string, args ...interface{}) {
8181
}
8282
}
8383

84+
if len(logMessage) > 0 {
85+
_ = private.SSHLog(true, fmt.Sprintf(logMessage+": ", args...))
86+
}
87+
8488
os.Exit(1)
8589
}
8690

cmd/web.go

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ import (
1616
"code.gitea.io/gitea/modules/graceful"
1717
"code.gitea.io/gitea/modules/log"
1818
"code.gitea.io/gitea/modules/setting"
19-
"code.gitea.io/gitea/modules/util"
2019
"code.gitea.io/gitea/routers"
21-
"code.gitea.io/gitea/routers/routes"
20+
"code.gitea.io/gitea/routers/install"
2221

2322
context2 "github.com/gorilla/context"
2423
"github.com/urfave/cli"
@@ -89,7 +88,7 @@ func runWeb(ctx *cli.Context) error {
8988
}
9089

9190
// Perform pre-initialization
92-
needsInstall := routers.PreInstallInit(graceful.GetManager().HammerContext())
91+
needsInstall := install.PreloadSettings(graceful.GetManager().HammerContext())
9392
if needsInstall {
9493
// Flag for port number in case first time run conflict
9594
if ctx.IsSet("port") {
@@ -102,7 +101,7 @@ func runWeb(ctx *cli.Context) error {
102101
return err
103102
}
104103
}
105-
c := routes.InstallRoutes()
104+
c := install.Routes()
106105
err := listen(c, false)
107106
select {
108107
case <-graceful.GetManager().IsShutdown():
@@ -135,7 +134,7 @@ func runWeb(ctx *cli.Context) error {
135134
}
136135

137136
// Set up Chi routes
138-
c := routes.NormalRoutes()
137+
c := routers.NormalRoutes()
139138
err := listen(c, true)
140139
<-graceful.GetManager().Done()
141140
log.Info("PID: %d Gitea Web Finished", os.Getpid())
@@ -152,19 +151,6 @@ func setPort(port string) error {
152151
case setting.FCGI:
153152
case setting.FCGIUnix:
154153
default:
155-
// Save LOCAL_ROOT_URL if port changed
156-
cfg := ini.Empty()
157-
isFile, err := util.IsFile(setting.CustomConf)
158-
if err != nil {
159-
log.Fatal("Unable to check if %s is a file", err)
160-
}
161-
if isFile {
162-
// Keeps custom settings if there is already something.
163-
if err := cfg.Append(setting.CustomConf); err != nil {
164-
return fmt.Errorf("Failed to load custom conf '%s': %v", setting.CustomConf, err)
165-
}
166-
}
167-
168154
defaultLocalURL := string(setting.Protocol) + "://"
169155
if setting.HTTPAddr == "0.0.0.0" {
170156
defaultLocalURL += "localhost"
@@ -173,10 +159,10 @@ func setPort(port string) error {
173159
}
174160
defaultLocalURL += ":" + setting.HTTPPort + "/"
175161

176-
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
177-
if err := cfg.SaveTo(setting.CustomConf); err != nil {
178-
return fmt.Errorf("Error saving generated LOCAL_ROOT_URL to custom config: %v", err)
179-
}
162+
// Save LOCAL_ROOT_URL if port changed
163+
setting.CreateOrAppendToCustomConf(func(cfg *ini.File) {
164+
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
165+
})
180166
}
181167
return nil
182168
}

contrib/pr/checkout.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"code.gitea.io/gitea/modules/setting"
3232
"code.gitea.io/gitea/modules/util"
3333
"code.gitea.io/gitea/routers"
34-
"code.gitea.io/gitea/routers/routes"
3534

3635
"github.com/go-git/go-git/v5"
3736
"github.com/go-git/go-git/v5/config"
@@ -116,7 +115,7 @@ func runPR() {
116115
//routers.GlobalInit()
117116
external.RegisterRenderers()
118117
markup.Init()
119-
c := routes.NormalRoutes()
118+
c := routers.NormalRoutes()
120119

121120
log.Printf("[PR] Ready for testing !\n")
122121
log.Printf("[PR] Login with user1, user2, user3, ... with pass: password\n")

custom/conf/app.example.ini

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,11 @@ ROUTER = console
444444
;ACCESS_LOG_TEMPLATE = {{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.URL.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}"
445445
;;
446446
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
447+
;;
448+
;; SSH log (Creates log from ssh git request)
449+
;;
450+
;ENABLE_SSH_LOG = false
451+
;;
447452
;; Other Settings
448453
;;
449454
;; Print Stacktraces with logs. (Rarely helpful.) Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "None"
@@ -1140,8 +1145,8 @@ PATH =
11401145
;;
11411146
;; When ISSUE_INDEXER_QUEUE_TYPE is levelqueue, this will be the path where the queue will be saved.
11421147
;; This can be overridden by `ISSUE_INDEXER_QUEUE_CONN_STR`.
1143-
;; default is indexers/issues.queue
1144-
;ISSUE_INDEXER_QUEUE_DIR = indexers/issues.queue
1148+
;; default is queues/common
1149+
;ISSUE_INDEXER_QUEUE_DIR = queues/common
11451150
;;
11461151
;; When `ISSUE_INDEXER_QUEUE_TYPE` is `redis`, this will store the redis connection string.
11471152
;; When `ISSUE_INDEXER_QUEUE_TYPE` is `levelqueue`, this is a directory or additional options of
@@ -1196,7 +1201,7 @@ PATH =
11961201
;; default to persistable-channel
11971202
;TYPE = persistable-channel
11981203
;;
1199-
;; data-dir for storing persistable queues and level queues, individual queues will be named by their type
1204+
;; data-dir for storing persistable queues and level queues, individual queues will default to `queues/common` meaning the queue is shared.
12001205
;DATADIR = queues/
12011206
;;
12021207
;; Default queue length before a channel queue will block
@@ -1226,7 +1231,7 @@ PATH =
12261231
;TIMEOUT = 15m30s
12271232
;;
12281233
;; Create a pool with this many workers
1229-
;WORKERS = 1
1234+
;WORKERS = 0
12301235
;;
12311236
;; Dynamically scale the worker pool to at this many workers
12321237
;MAX_WORKERS = 10
@@ -1238,7 +1243,7 @@ PATH =
12381243
;BOOST_TIMEOUT = 5m
12391244
;;
12401245
;; During a boost add BOOST_WORKERS
1241-
;BOOST_WORKERS = 5
1246+
;BOOST_WORKERS = 1
12421247

12431248
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12441249
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docker/root/etc/s6/openssh/setup

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ if [ -d /etc/ssh ]; then
4747
SSH_RSA_CERT="${SSH_RSA_CERT:+"HostCertificate "}${SSH_RSA_CERT}" \
4848
SSH_ECDSA_CERT="${SSH_ECDSA_CERT:+"HostCertificate "}${SSH_ECDSA_CERT}" \
4949
SSH_DSA_CERT="${SSH_DSA_CERT:+"HostCertificate "}${SSH_DSA_CERT}" \
50+
SSH_MAX_STARTUPS="${SSH_MAX_STARTUPS:+"MaxStartups "}${SSH_MAX_STARTUPS}" \
51+
SSH_MAX_SESSIONS="${SSH_MAX_SESSIONS:+"MaxSessions "}${SSH_MAX_SESSIONS}" \
5052
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
5153

5254
chmod 0644 /etc/ssh/sshd_config

0 commit comments

Comments
 (0)