Skip to content

Commit de2c98c

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: (31 commits) Show OAuth2 errors to end users (go-gitea#25261) [skip ci] Updated translations via Crowdin Fix index generation parallelly failure (go-gitea#25235) Fix variable in template (go-gitea#25267) Add template linting via djlint (go-gitea#25212) Fix edit OAuth application width (go-gitea#25262) Use flex to align SVG and text (go-gitea#25163) GitHub Actions enhancements for frontend (go-gitea#25150) Add missing `v` in migrations.go (go-gitea#25252) Change form actions to fetch for submit review box (go-gitea#25219) Fix panic when migrating a repo from GitHub with issues (go-gitea#25246) Fix description of drop custom_labels migration (go-gitea#25243) Fix all possible setting error related storages and added some tests (go-gitea#23911) [skip ci] Updated translations via Crowdin Revert overflow: overlay (revert go-gitea#21850) (go-gitea#25231) Support changing labels of Actions runner without re-registration (go-gitea#24806) Improve AJAX link and modal confirm dialog (go-gitea#25210) Use inline SVG for built-in OAuth providers (go-gitea#25171) Disable `Create column` button while the column name is empty (go-gitea#25192) Fix profile render when the README.md size is larger than 1024 bytes (go-gitea#25131) ...
2 parents 1fa6c06 + 73ae718 commit de2c98c

File tree

225 files changed

+10426
-1390
lines changed

Some content is hidden

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

225 files changed

+10426
-1390
lines changed

.github/workflows/files-changed.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
actions:
1616
description: "whether actions files changed"
1717
value: ${{ jobs.detect.outputs.actions }}
18+
templates:
19+
description: "whether templates files changed"
20+
value: ${{ jobs.detect.outputs.templates }}
1821

1922
jobs:
2023
detect:
@@ -27,6 +30,7 @@ jobs:
2730
frontend: ${{ steps.changes.outputs.frontend }}
2831
docs: ${{ steps.changes.outputs.docs }}
2932
actions: ${{ steps.changes.outputs.actions }}
33+
templates: ${{ steps.changes.outputs.templates }}
3034
steps:
3135
- uses: actions/checkout@v3
3236
- uses: dorny/paths-filter@v2
@@ -35,7 +39,7 @@ jobs:
3539
filters: |
3640
backend:
3741
- "**/*.go"
38-
- "**/*.tmpl"
42+
- "templates/**/*.tmpl"
3943
- "go.mod"
4044
- "go.sum"
4145
@@ -51,3 +55,6 @@ jobs:
5155
5256
actions:
5357
- ".github/workflows/*"
58+
59+
templates:
60+
- "templates/**/*.tmpl"

.github/workflows/pull-compliance.yml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
uses: ./.github/workflows/files-changed.yml
1313

1414
lint-backend:
15-
if: needs.files-changed.outputs.backend == 'true'
15+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
1616
needs: files-changed
1717
runs-on: ubuntu-latest
1818
steps:
@@ -26,8 +26,21 @@ jobs:
2626
env:
2727
TAGS: bindata sqlite sqlite_unlock_notify
2828

29+
lint-templates:
30+
if: needs.files-changed.outputs.templates == 'true'
31+
needs: files-changed
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: actions/setup-python@v4
36+
with:
37+
python-version: "3.11"
38+
- run: pip install poetry
39+
- run: make deps-py
40+
- run: make lint-templates
41+
2942
lint-go-windows:
30-
if: needs.files-changed.outputs.backend == 'true'
43+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
3144
needs: files-changed
3245
runs-on: ubuntu-latest
3346
steps:
@@ -44,7 +57,7 @@ jobs:
4457
GOARCH: amd64
4558

4659
lint-go-gogit:
47-
if: needs.files-changed.outputs.backend == 'true'
60+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
4861
needs: files-changed
4962
runs-on: ubuntu-latest
5063
steps:
@@ -59,7 +72,7 @@ jobs:
5972
TAGS: bindata gogit sqlite sqlite_unlock_notify
6073

6174
checks-backend:
62-
if: needs.files-changed.outputs.backend == 'true'
75+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
6376
needs: files-changed
6477
runs-on: ubuntu-latest
6578
steps:
@@ -72,7 +85,7 @@ jobs:
7285
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs
7386

7487
frontend:
75-
if: needs.files-changed.outputs.frontend == 'true'
88+
if: needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
7689
needs: files-changed
7790
runs-on: ubuntu-latest
7891
steps:
@@ -83,9 +96,10 @@ jobs:
8396
- run: make deps-frontend
8497
- run: make lint-frontend
8598
- run: make checks-frontend
99+
- run: make frontend
86100

87101
backend:
88-
if: needs.files-changed.outputs.backend == 'true'
102+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
89103
needs: files-changed
90104
runs-on: ubuntu-latest
91105
steps:
@@ -94,12 +108,9 @@ jobs:
94108
with:
95109
go-version: ">=1.20"
96110
check-latest: true
97-
- uses: actions/setup-node@v3
98-
with:
99-
node-version: 20
111+
# no frontend build here as backend should be able to build
112+
# even without any frontend files
100113
- run: make deps-backend deps-tools
101-
- run: make deps-frontend
102-
- run: make frontend
103114
- run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
104115
- name: build-backend-arm64
105116
run: make backend # test cross compile
@@ -120,7 +131,7 @@ jobs:
120131
GOARCH: 386
121132

122133
docs:
123-
if: needs.files-changed.outputs.docs == 'true'
134+
if: needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.actions == 'true'
124135
needs: files-changed
125136
runs-on: ubuntu-latest
126137
steps:
@@ -133,7 +144,7 @@ jobs:
133144
- run: make docs # test if build could succeed
134145

135146
actions:
136-
if: needs.files-changed.outputs.actions == 'true'
147+
if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true'
137148
needs: files-changed
138149
runs-on: ubuntu-latest
139150
steps:

.github/workflows/pull-db-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
uses: ./.github/workflows/files-changed.yml
1313

1414
test-pgsql:
15-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
15+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
1616
needs: files-changed
1717
runs-on: ubuntu-latest
1818
services:
@@ -59,7 +59,7 @@ jobs:
5959
USE_REPO_TEST_DIR: 1
6060

6161
test-sqlite:
62-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
62+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
6363
needs: files-changed
6464
runs-on: ubuntu-latest
6565
steps:
@@ -81,7 +81,7 @@ jobs:
8181
USE_REPO_TEST_DIR: 1
8282

8383
test-unit:
84-
if: needs.files-changed.outputs.backend == 'true'
84+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
8585
needs: files-changed
8686
runs-on: ubuntu-latest
8787
services:
@@ -147,7 +147,7 @@ jobs:
147147
GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
148148

149149
test-mysql5:
150-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
150+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
151151
needs: files-changed
152152
runs-on: ubuntu-latest
153153
services:
@@ -192,7 +192,7 @@ jobs:
192192
TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
193193

194194
test-mysql8:
195-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
195+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
196196
needs: files-changed
197197
runs-on: ubuntu-latest
198198
services:
@@ -222,7 +222,7 @@ jobs:
222222
USE_REPO_TEST_DIR: 1
223223

224224
test-mssql:
225-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
225+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
226226
needs: files-changed
227227
runs-on: ubuntu-latest
228228
services:

.github/workflows/pull-docker-dryrun.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
uses: ./.github/workflows/files-changed.yml
1313

1414
docker-dryrun:
15-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
15+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
1616
needs: files-changed
1717
runs-on: ubuntu-latest
1818
steps:

.github/workflows/pull-e2e-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
uses: ./.github/workflows/files-changed.yml
1313

1414
test-e2e:
15-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true'
15+
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
1616
needs: files-changed
1717
runs-on: ubuntu-latest
1818
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ cpu.out
7070
/tests/*.ini
7171
/tests/**/*.git/**/*.sample
7272
/node_modules
73+
/.venv
7374
/yarn.lock
7475
/yarn-error.log
7576
/npm-debug.log*

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ help:
198198
@echo " - deps-frontend install frontend dependencies"
199199
@echo " - deps-backend install backend dependencies"
200200
@echo " - deps-tools install tool dependencies"
201+
@echo " - deps-py install python dependencies"
201202
@echo " - lint lint everything"
202203
@echo " - lint-fix lint everything and fix issues"
203204
@echo " - lint-actions lint action workflow files"
@@ -214,6 +215,7 @@ help:
214215
@echo " - lint-css-fix lint css files and fix issues"
215216
@echo " - lint-md lint markdown files"
216217
@echo " - lint-swagger lint swagger files"
218+
@echo " - lint-templates lint template files"
217219
@echo " - checks run various consistency checks"
218220
@echo " - checks-frontend check frontend files"
219221
@echo " - checks-backend check backend files"
@@ -417,6 +419,10 @@ lint-editorconfig:
417419
lint-actions:
418420
$(GO) run $(ACTIONLINT_PACKAGE)
419421

422+
.PHONY: lint-templates
423+
lint-templates: .venv
424+
@poetry run djlint $(shell find templates -type f -iname '*.tmpl')
425+
420426
.PHONY: watch
421427
watch:
422428
@bash build/watch.sh
@@ -893,7 +899,10 @@ deps-docs:
893899
fi
894900

895901
.PHONY: deps
896-
deps: deps-frontend deps-backend deps-tools deps-docs
902+
deps: deps-frontend deps-backend deps-tools deps-docs deps-py
903+
904+
.PHONY: deps-py
905+
deps-py: .venv
897906

898907
.PHONY: deps-frontend
899908
deps-frontend: node_modules
@@ -920,6 +929,10 @@ node_modules: package-lock.json
920929
npm install --no-save
921930
@touch node_modules
922931

932+
.venv: poetry.lock
933+
poetry install
934+
@touch .venv
935+
923936
.PHONY: npm-update
924937
npm-update: node-check | node_modules
925938
npx updates -cu

cmd/dump.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ func runDump(ctx *cli.Context) error {
353353
}
354354

355355
excludes = append(excludes, setting.RepoRootPath)
356-
excludes = append(excludes, setting.LFS.Path)
357-
excludes = append(excludes, setting.Attachment.Path)
358-
excludes = append(excludes, setting.Packages.Path)
356+
excludes = append(excludes, setting.LFS.Storage.Path)
357+
excludes = append(excludes, setting.Attachment.Storage.Path)
358+
excludes = append(excludes, setting.Packages.Storage.Path)
359359
excludes = append(excludes, setting.Log.RootPath)
360360
excludes = append(excludes, absFileName)
361361
if err := addRecursiveExclude(w, "data", setting.AppDataPath, excludes, verbose); err != nil {

cmd/migrate_storage.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,30 +179,32 @@ func runMigrateStorage(ctx *cli.Context) error {
179179
switch strings.ToLower(ctx.String("storage")) {
180180
case "":
181181
fallthrough
182-
case string(storage.LocalStorageType):
182+
case string(setting.LocalStorageType):
183183
p := ctx.String("path")
184184
if p == "" {
185185
log.Fatal("Path must be given when storage is loal")
186186
return nil
187187
}
188188
dstStorage, err = storage.NewLocalStorage(
189189
stdCtx,
190-
storage.LocalStorageConfig{
190+
&setting.Storage{
191191
Path: p,
192192
})
193-
case string(storage.MinioStorageType):
193+
case string(setting.MinioStorageType):
194194
dstStorage, err = storage.NewMinioStorage(
195195
stdCtx,
196-
storage.MinioStorageConfig{
197-
Endpoint: ctx.String("minio-endpoint"),
198-
AccessKeyID: ctx.String("minio-access-key-id"),
199-
SecretAccessKey: ctx.String("minio-secret-access-key"),
200-
Bucket: ctx.String("minio-bucket"),
201-
Location: ctx.String("minio-location"),
202-
BasePath: ctx.String("minio-base-path"),
203-
UseSSL: ctx.Bool("minio-use-ssl"),
204-
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
205-
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
196+
&setting.Storage{
197+
MinioConfig: setting.MinioStorageConfig{
198+
Endpoint: ctx.String("minio-endpoint"),
199+
AccessKeyID: ctx.String("minio-access-key-id"),
200+
SecretAccessKey: ctx.String("minio-secret-access-key"),
201+
Bucket: ctx.String("minio-bucket"),
202+
Location: ctx.String("minio-location"),
203+
BasePath: ctx.String("minio-base-path"),
204+
UseSSL: ctx.Bool("minio-use-ssl"),
205+
InsecureSkipVerify: ctx.Bool("minio-insecure-skip-verify"),
206+
ChecksumAlgorithm: ctx.String("minio-checksum-algorithm"),
207+
},
206208
})
207209
default:
208210
return fmt.Errorf("unsupported storage type: %s", ctx.String("storage"))

cmd/migrate_storage_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"code.gitea.io/gitea/models/unittest"
1414
user_model "code.gitea.io/gitea/models/user"
1515
packages_module "code.gitea.io/gitea/modules/packages"
16+
"code.gitea.io/gitea/modules/setting"
1617
"code.gitea.io/gitea/modules/storage"
1718
packages_service "code.gitea.io/gitea/services/packages"
1819

@@ -57,7 +58,7 @@ func TestMigratePackages(t *testing.T) {
5758

5859
dstStorage, err := storage.NewLocalStorage(
5960
ctx,
60-
storage.LocalStorageConfig{
61+
&setting.Storage{
6162
Path: p,
6263
})
6364
assert.NoError(t, err)

custom/conf/app.example.ini

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,6 +2392,10 @@ LEVEL = Info
23922392
;; Enable/Disable package registry capabilities
23932393
;ENABLED = true
23942394
;;
2395+
;STORAGE_TYPE = local
2396+
;; override the minio base path if storage type is minio
2397+
;MINIO_BASE_PATH = packages/
2398+
;;
23952399
;; Path for chunked uploads. Defaults to APP_DATA_PATH + `tmp/package-upload`
23962400
;CHUNKED_UPLOAD_PATH = tmp/package-upload
23972401
;;
@@ -2452,6 +2456,19 @@ LEVEL = Info
24522456
;; storage type
24532457
;STORAGE_TYPE = local
24542458

2459+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2460+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2461+
;; repo-archive storage will override storage
2462+
;;
2463+
;[repo-archive]
2464+
;STORAGE_TYPE = local
2465+
;;
2466+
;; Where your lfs files reside, default is data/lfs.
2467+
;PATH = data/repo-archive
2468+
;;
2469+
;; override the minio base path if storage type is minio
2470+
;MINIO_BASE_PATH = repo-archive/
2471+
24552472
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24562473
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24572474
;; settings for repository archives, will override storage setting
@@ -2471,6 +2488,9 @@ LEVEL = Info
24712488
;;
24722489
;; Where your lfs files reside, default is data/lfs.
24732490
;PATH = data/lfs
2491+
;;
2492+
;; override the minio base path if storage type is minio
2493+
;MINIO_BASE_PATH = lfs/
24742494

24752495
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24762496
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2520,6 +2540,7 @@ LEVEL = Info
25202540
; [actions]
25212541
;; Enable/Disable actions capabilities
25222542
;ENABLED = false
2543+
;;
25232544
;; Default address to get action plugins, e.g. the default value means downloading from "https://gitea.com/actions/checkout" for "uses: actions/checkout@v3"
25242545
;DEFAULT_ACTIONS_URL = https://gitea.com
25252546

0 commit comments

Comments
 (0)