Skip to content

Commit 52d62fb

Browse files
committed
Merge branch 'main' into add-issue-planned-time
2 parents a71b457 + 68d5c18 commit 52d62fb

File tree

250 files changed

+5918
-2713
lines changed

Some content is hidden

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

250 files changed

+5918
-2713
lines changed

.eslintrc.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,21 @@ rules:
127127
"@stylistic/js/computed-property-spacing": [2, never]
128128
"@stylistic/js/dot-location": [2, property]
129129
"@stylistic/js/eol-last": [2]
130-
"@stylistic/js/function-call-spacing": [2, never]
131130
"@stylistic/js/function-call-argument-newline": [0]
131+
"@stylistic/js/function-call-spacing": [2, never]
132132
"@stylistic/js/function-paren-newline": [0]
133133
"@stylistic/js/generator-star-spacing": [0]
134134
"@stylistic/js/implicit-arrow-linebreak": [0]
135135
"@stylistic/js/indent": [2, 2, {ignoreComments: true, SwitchCase: 1}]
136136
"@stylistic/js/key-spacing": [2]
137137
"@stylistic/js/keyword-spacing": [2]
138+
"@stylistic/js/line-comment-position": [0]
138139
"@stylistic/js/linebreak-style": [2, unix]
139140
"@stylistic/js/lines-around-comment": [0]
140141
"@stylistic/js/lines-between-class-members": [0]
141142
"@stylistic/js/max-len": [0]
142143
"@stylistic/js/max-statements-per-line": [0]
144+
"@stylistic/js/multiline-comment-style": [0]
143145
"@stylistic/js/multiline-ternary": [0]
144146
"@stylistic/js/new-parens": [2]
145147
"@stylistic/js/newline-per-chained-call": [0]
@@ -705,6 +707,7 @@ rules:
705707
unicorn/better-regex: [0]
706708
unicorn/catch-error-name: [0]
707709
unicorn/consistent-destructuring: [2]
710+
unicorn/consistent-empty-array-spread: [2]
708711
unicorn/consistent-function-scoping: [2]
709712
unicorn/custom-error-definition: [0]
710713
unicorn/empty-brace-spaces: [2]
@@ -731,9 +734,11 @@ rules:
731734
unicorn/no-for-loop: [0]
732735
unicorn/no-hex-escape: [0]
733736
unicorn/no-instanceof-array: [0]
737+
unicorn/no-invalid-fetch-options: [2]
734738
unicorn/no-invalid-remove-event-listener: [2]
735739
unicorn/no-keyword-prefix: [0]
736740
unicorn/no-lonely-if: [2]
741+
unicorn/no-magic-array-flat-depth: [0]
737742
unicorn/no-negated-condition: [0]
738743
unicorn/no-nested-ternary: [0]
739744
unicorn/no-new-array: [0]
@@ -799,10 +804,12 @@ rules:
799804
unicorn/prefer-set-has: [0]
800805
unicorn/prefer-set-size: [2]
801806
unicorn/prefer-spread: [0]
807+
unicorn/prefer-string-raw: [0]
802808
unicorn/prefer-string-replace-all: [0]
803809
unicorn/prefer-string-slice: [0]
804810
unicorn/prefer-string-starts-ends-with: [2]
805811
unicorn/prefer-string-trim-start-end: [2]
812+
unicorn/prefer-structured-clone: [2]
806813
unicorn/prefer-switch: [0]
807814
unicorn/prefer-ternary: [0]
808815
unicorn/prefer-text-content: [2]

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ kerwin612 <[email protected]> (@kerwin612)
6161
Gary Wang <[email protected]> (@BLumia)
6262
Tim-Niclas Oelschläger <[email protected]> (@zokkis)
6363
Yu Liu <[email protected]> (@HEREYUA)
64+
Kemal Zebari <[email protected]> (@kemzeb)

cmd/hook.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,7 @@ Gitea or set your environment appropriately.`, "")
220220
}
221221
}
222222

223-
supportProcReceive := false
224-
if git.CheckGitVersionAtLeast("2.29") == nil {
225-
supportProcReceive = true
226-
}
223+
supportProcReceive := git.DefaultFeatures().SupportProcReceive
227224

228225
for scanner.Scan() {
229226
// TODO: support news feeds for wiki
@@ -341,6 +338,7 @@ Gitea or set your environment appropriately.`, "")
341338
isWiki, _ := strconv.ParseBool(os.Getenv(repo_module.EnvRepoIsWiki))
342339
repoName := os.Getenv(repo_module.EnvRepoName)
343340
pusherID, _ := strconv.ParseInt(os.Getenv(repo_module.EnvPusherID), 10, 64)
341+
prID, _ := strconv.ParseInt(os.Getenv(repo_module.EnvPRID), 10, 64)
344342
pusherName := os.Getenv(repo_module.EnvPusherName)
345343

346344
hookOptions := private.HookOptions{
@@ -350,6 +348,8 @@ Gitea or set your environment appropriately.`, "")
350348
GitObjectDirectory: os.Getenv(private.GitObjectDirectory),
351349
GitQuarantinePath: os.Getenv(private.GitQuarantinePath),
352350
GitPushOptions: pushOptions(),
351+
PullRequestID: prID,
352+
PushTrigger: repo_module.PushTrigger(os.Getenv(repo_module.EnvPushTrigger)),
353353
}
354354
oldCommitIDs := make([]string, hookBatchSize)
355355
newCommitIDs := make([]string, hookBatchSize)
@@ -497,7 +497,7 @@ Gitea or set your environment appropriately.`, "")
497497
return nil
498498
}
499499

500-
if git.CheckGitVersionAtLeast("2.29") != nil {
500+
if !git.DefaultFeatures().SupportProcReceive {
501501
return fail(ctx, "No proc-receive support", "current git version doesn't support proc-receive.")
502502
}
503503

cmd/migrate_storage.go

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var CmdMigrateStorage = &cli.Command{
3434
Name: "type",
3535
Aliases: []string{"t"},
3636
Value: "",
37-
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log'",
37+
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log', 'actions-artifacts",
3838
},
3939
&cli.StringFlag{
4040
Name: "storage",
@@ -91,6 +91,11 @@ var CmdMigrateStorage = &cli.Command{
9191
Value: "",
9292
Usage: "Minio checksum algorithm (default/md5)",
9393
},
94+
&cli.StringFlag{
95+
Name: "minio-bucket-lookup-type",
96+
Value: "",
97+
Usage: "Minio bucket lookup type",
98+
},
9499
},
95100
}
96101

@@ -160,6 +165,13 @@ func migrateActionsLog(ctx context.Context, dstStorage storage.ObjectStorage) er
160165
})
161166
}
162167

168+
func migrateActionsArtifacts(ctx context.Context, dstStorage storage.ObjectStorage) error {
169+
return db.Iterate(ctx, nil, func(ctx context.Context, artifact *actions_model.ActionArtifact) error {
170+
_, err := storage.Copy(dstStorage, artifact.ArtifactPath, storage.ActionsArtifacts, artifact.ArtifactPath)
171+
return err
172+
})
173+
}
174+
163175
func runMigrateStorage(ctx *cli.Context) error {
164176
stdCtx, cancel := installSignals()
165177
defer cancel()
@@ -213,6 +225,7 @@ func runMigrateStorage(ctx *cli.Context) error {
213225
UseSSL: ctx.Bool("minio-use-ssl"),
214226
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
215227
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
228+
BucketLookUpType: ctx.String("minio-bucket-lookup-type"),
216229
},
217230
})
218231
default:
@@ -223,13 +236,14 @@ func runMigrateStorage(ctx *cli.Context) error {
223236
}
224237

225238
migratedMethods := map[string]func(context.Context, storage.ObjectStorage) error{
226-
"attachments": migrateAttachments,
227-
"lfs": migrateLFS,
228-
"avatars": migrateAvatars,
229-
"repo-avatars": migrateRepoAvatars,
230-
"repo-archivers": migrateRepoArchivers,
231-
"packages": migratePackages,
232-
"actions-log": migrateActionsLog,
239+
"attachments": migrateAttachments,
240+
"lfs": migrateLFS,
241+
"avatars": migrateAvatars,
242+
"repo-avatars": migrateRepoAvatars,
243+
"repo-archivers": migrateRepoArchivers,
244+
"packages": migratePackages,
245+
"actions-log": migrateActionsLog,
246+
"actions-artifacts": migrateActionsArtifacts,
233247
}
234248

235249
tp := strings.ToLower(ctx.String("type"))

cmd/serv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func runServ(c *cli.Context) error {
178178
}
179179

180180
if len(words) < 2 {
181-
if git.CheckGitVersionAtLeast("2.29") == nil {
181+
if git.DefaultFeatures().SupportProcReceive {
182182
// for AGit Flow
183183
if cmd == "ssh_info" {
184184
fmt.Print(`{"type":"gitea","version":1}`)

custom/conf/app.example.ini

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ LEVEL = Info
14561456
;; Batch size to send for batched queues
14571457
;BATCH_LENGTH = 20
14581458
;;
1459-
;; Connection string for redis queues this will store the redis or redis-cluster connection string.
1459+
;; Connection string for redis queues this will store the redis (or Redis cluster) connection string.
14601460
;; When `TYPE` is `persistable-channel`, this provides a directory for the underlying leveldb
14611461
;; or additional options of the form `leveldb://path/to/db?option=value&....`, and will override `DATADIR`.
14621462
;CONN_STR = "redis://127.0.0.1:6379/0"
@@ -1740,9 +1740,8 @@ LEVEL = Info
17401740
;; For "memory" only, GC interval in seconds, default is 60
17411741
;INTERVAL = 60
17421742
;;
1743-
;; For "redis", "redis-cluster" and "memcache", connection host address
1744-
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
1745-
;; redis-cluster: `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
1743+
;; For "redis" and "memcache", connection host address
1744+
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` (or `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` for a Redis cluster)
17461745
;; memcache: `127.0.0.1:11211`
17471746
;; twoqueue: `{"size":50000,"recent_ratio":0.25,"ghost_ratio":0.5}` or `50000`
17481747
;HOST =
@@ -1772,15 +1771,14 @@ LEVEL = Info
17721771
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17731772
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17741773
;;
1775-
;; Either "memory", "file", "redis", "redis-cluster", "db", "mysql", "couchbase", "memcache" or "postgres"
1774+
;; Either "memory", "file", "redis", "db", "mysql", "couchbase", "memcache" or "postgres"
17761775
;; Default is "memory". "db" will reuse the configuration in [database]
17771776
;PROVIDER = memory
17781777
;;
17791778
;; Provider config options
17801779
;; memory: doesn't have any config yet
17811780
;; file: session file path, e.g. `data/sessions`
1782-
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
1783-
;; redis-cluster: `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s`
1781+
;; redis: `redis://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` (or `redis+cluster://127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` for a Redis cluster)
17841782
;; mysql: go-sql-driver/mysql dsn config string, e.g. `root:password@/session_table`
17851783
;PROVIDER_CONFIG = data/sessions ; Relative paths will be made absolute against _`AppWorkPath`_.
17861784
;;
@@ -1897,6 +1895,9 @@ LEVEL = Info
18971895
;;
18981896
;; Minio checksum algorithm: default (for MinIO or AWS S3) or md5 (for Cloudflare or Backblaze)
18991897
;MINIO_CHECKSUM_ALGORITHM = default
1898+
;;
1899+
;; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1900+
;MINIO_BUCKET_LOOKUP_TYPE = auto
19001901

19011902
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19021903
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2578,6 +2579,9 @@ LEVEL = Info
25782579
;;
25792580
;; Minio skip SSL verification available when STORAGE_TYPE is `minio`
25802581
;MINIO_INSECURE_SKIP_VERIFY = false
2582+
;;
2583+
;; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
2584+
;MINIO_BUCKET_LOOKUP_TYPE = auto
25812585

25822586
;[proxy]
25832587
;; Enable the proxy, all requests to external via HTTP will be affected

docker/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Gitea - Docker
22

3-
Dockerfile is found in root of repository.
3+
Dockerfile is found in the root of the repository.
44

5-
Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea)
5+
Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea).
66

7-
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.com/installation/install-with-docker-rootless)
7+
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.com/installation/install-with-docker-rootless).

docs/content/administration/config-cheat-sheet.en-us.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ Configuration at `[queue]` will set defaults for queues with overrides for indiv
492492
- `DATADIR`: **queues/common**: Base DataDir for storing level queues. `DATADIR` for individual queues can be set in `queue.name` sections. Relative paths will be made absolute against `%(APP_DATA_PATH)s`.
493493
- `LENGTH`: **100000**: Maximal queue size before channel queues block
494494
- `BATCH_LENGTH`: **20**: Batch data before passing to the handler
495-
- `CONN_STR`: **redis://127.0.0.1:6379/0**: Connection string for the redis queue type. For `redis-cluster` use `redis+cluster://127.0.0.1:6379/0`. Options can be set using query params. Similarly, LevelDB options can also be set using: **leveldb://relative/path?option=value** or **leveldb:///absolute/path?option=value**, and will override `DATADIR`
495+
- `CONN_STR`: **redis://127.0.0.1:6379/0**: Connection string for the redis queue type. If you're running a Redis cluster, use `redis+cluster://127.0.0.1:6379/0`. Options can be set using query params. Similarly, LevelDB options can also be set using: **leveldb://relative/path?option=value** or **leveldb:///absolute/path?option=value**, and will override `DATADIR`
496496
- `QUEUE_NAME`: **_queue**: The suffix for default redis and disk queue name. Individual queues will default to **`name`**`QUEUE_NAME` but can be overridden in the specific `queue.name` section.
497497
- `SET_NAME`: **_unique**: The suffix that will be added to the default redis and disk queue `set` name for unique queues. Individual queues will default to **`name`**`QUEUE_NAME`_`SET_NAME`_ but can be overridden in the specific `queue.name` section.
498498
- `MAX_WORKERS`: **(dynamic)**: Maximum number of worker go-routines for the queue. Default value is "CpuNum/2" clipped to between 1 and 10.
@@ -777,11 +777,11 @@ and
777777

778778
## Cache (`cache`)
779779

780-
- `ADAPTER`: **memory**: Cache engine adapter, either `memory`, `redis`, `redis-cluster`, `twoqueue` or `memcache`. (`twoqueue` represents a size limited LRU cache.)
780+
- `ADAPTER`: **memory**: Cache engine adapter, either `memory`, `redis`, `twoqueue` or `memcache`. (`twoqueue` represents a size limited LRU cache.)
781781
- `INTERVAL`: **60**: Garbage Collection interval (sec), for memory and twoqueue cache only.
782-
- `HOST`: **_empty_**: Connection string for `redis`, `redis-cluster` and `memcache`. For `twoqueue` sets configuration for the queue.
782+
- `HOST`: **_empty_**: Connection string for `redis` and `memcache`. For `twoqueue` sets configuration for the queue.
783783
- Redis: `redis://:[email protected]:6379/0?pool_size=100&idle_timeout=180s`
784-
- Redis-cluster `redis+cluster://:[email protected]:6379/0?pool_size=100&idle_timeout=180s`
784+
- For a Redis cluster: `redis+cluster://:[email protected]:6379/0?pool_size=100&idle_timeout=180s`
785785
- Memcache: `127.0.0.1:9090;127.0.0.1:9091`
786786
- TwoQueue LRU cache: `{"size":50000,"recent_ratio":0.25,"ghost_ratio":0.5}` or `50000` representing the maximum number of objects stored in the cache.
787787
- `ITEM_TTL`: **16h**: Time to keep items in cache if not used, Setting it to -1 disables caching.
@@ -793,7 +793,7 @@ and
793793

794794
## Session (`session`)
795795

796-
- `PROVIDER`: **memory**: Session engine provider \[memory, file, redis, redis-cluster, db, mysql, couchbase, memcache, postgres\]. Setting `db` will reuse the configuration in `[database]`
796+
- `PROVIDER`: **memory**: Session engine provider \[memory, file, redis, db, mysql, couchbase, memcache, postgres\]. Setting `db` will reuse the configuration in `[database]`
797797
- `PROVIDER_CONFIG`: **data/sessions**: For file, the root path; for db, empty (database config will be used); for others, the connection string. Relative paths will be made absolute against _`AppWorkPath`_.
798798
- `COOKIE_SECURE`:**_empty_**: `true` or `false`. Enable this to force using HTTPS for all session access. If not set, it defaults to `true` if the ROOT_URL is an HTTPS URL.
799799
- `COOKIE_NAME`: **i\_like\_gitea**: The name of the cookie used for the session ID.
@@ -851,6 +851,7 @@ Default templates for project boards:
851851
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when STORAGE_TYPE is `minio`
852852
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
853853
- `MINIO_CHECKSUM_ALGORITHM`: **default**: Minio checksum algorithm: `default` (for MinIO or AWS S3) or `md5` (for Cloudflare or Backblaze)
854+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
854855

855856
## Log (`log`)
856857

@@ -1272,6 +1273,7 @@ is `data/lfs` and the default of `MINIO_BASE_PATH` is `lfs/`.
12721273
- `MINIO_BASE_PATH`: **lfs/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
12731274
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
12741275
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1276+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
12751277

12761278
## Storage (`storage`)
12771279

@@ -1286,6 +1288,7 @@ Default storage configuration for attachments, lfs, avatars, repo-avatars, repo-
12861288
- `MINIO_LOCATION`: **us-east-1**: Minio location to create bucket only available when `STORAGE_TYPE` is `minio`
12871289
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
12881290
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1291+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
12891292

12901293
The recommended storage configuration for minio like below:
12911294

@@ -1307,6 +1310,8 @@ MINIO_USE_SSL = false
13071310
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
13081311
MINIO_INSECURE_SKIP_VERIFY = false
13091312
SERVE_DIRECT = true
1313+
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1314+
MINIO_BUCKET_LOOKUP_TYPE = auto
13101315
```
13111316

13121317
Defaultly every storage has their default base path like below
@@ -1353,6 +1358,8 @@ MINIO_LOCATION = us-east-1
13531358
MINIO_USE_SSL = false
13541359
; Minio skip SSL verification available when STORAGE_TYPE is `minio`
13551360
MINIO_INSECURE_SKIP_VERIFY = false
1361+
; Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
1362+
MINIO_BUCKET_LOOKUP_TYPE = auto
13561363
```
13571364

13581365
## Repository Archive Storage (`storage.repo-archive`)
@@ -1372,6 +1379,7 @@ is `data/repo-archive` and the default of `MINIO_BASE_PATH` is `repo-archive/`.
13721379
- `MINIO_BASE_PATH`: **repo-archive/**: Minio base path on the bucket only available when `STORAGE_TYPE` is `minio`
13731380
- `MINIO_USE_SSL`: **false**: Minio enabled ssl only available when `STORAGE_TYPE` is `minio`
13741381
- `MINIO_INSECURE_SKIP_VERIFY`: **false**: Minio skip SSL verification available when STORAGE_TYPE is `minio`
1382+
- `MINIO_BUCKET_LOOKUP_TYPE`: **auto**: Minio bucket lookup method defaults to auto mode; set it to `dns` for virtual host style or `path` for path style, only available when STORAGE_TYPE is `minio`
13751383

13761384
## Repository Archives (`repo-archive`)
13771385

0 commit comments

Comments
 (0)