Skip to content

Commit 381162a

Browse files
authored
Merge branch 'main' into feature-user-webhooks
2 parents ebd031e + f8c1e14 commit 381162a

File tree

358 files changed

+6679
-1803
lines changed

Some content is hidden

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

358 files changed

+6679
-1803
lines changed

.drone.yml

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ steps:
2525
- make deps-frontend
2626

2727
- name: deps-backend
28-
image: golang:1.19
28+
image: golang:1.20
2929
pull: always
3030
commands:
3131
- make deps-backend
@@ -88,7 +88,7 @@ steps:
8888
depends_on: [deps-frontend]
8989

9090
- name: checks-backend
91-
image: golang:1.19
91+
image: golang:1.20
9292
commands:
9393
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
9494
depends_on: [deps-backend]
@@ -109,7 +109,7 @@ steps:
109109
depends_on: [deps-frontend]
110110

111111
- name: build-backend-no-gcc
112-
image: golang:1.18 # this step is kept as the lowest version of golang that we support
112+
image: golang:1.19 # this step is kept as the lowest version of golang that we support
113113
pull: always
114114
environment:
115115
GO111MODULE: on
@@ -122,7 +122,7 @@ steps:
122122
path: /go
123123

124124
- name: build-backend-arm64
125-
image: golang:1.19
125+
image: golang:1.20
126126
environment:
127127
GO111MODULE: on
128128
GOPROXY: https://goproxy.io
@@ -138,7 +138,7 @@ steps:
138138
path: /go
139139

140140
- name: build-backend-windows
141-
image: golang:1.19
141+
image: golang:1.20
142142
environment:
143143
GO111MODULE: on
144144
GOPROXY: https://goproxy.io
@@ -153,7 +153,7 @@ steps:
153153
path: /go
154154

155155
- name: build-backend-386
156-
image: golang:1.19
156+
image: golang:1.20
157157
environment:
158158
GO111MODULE: on
159159
GOPROXY: https://goproxy.io
@@ -247,7 +247,7 @@ steps:
247247
- pull_request
248248

249249
- name: deps-backend
250-
image: golang:1.19
250+
image: golang:1.20
251251
pull: always
252252
commands:
253253
- make deps-backend
@@ -364,7 +364,7 @@ steps:
364364
path: /go
365365

366366
- name: generate-coverage
367-
image: golang:1.19
367+
image: golang:1.20
368368
commands:
369369
- make coverage
370370
environment:
@@ -440,7 +440,7 @@ steps:
440440
- pull_request
441441

442442
- name: deps-backend
443-
image: golang:1.19
443+
image: golang:1.20
444444
pull: always
445445
commands:
446446
- make deps-backend
@@ -557,7 +557,7 @@ steps:
557557
- name: test-e2e
558558
image: mcr.microsoft.com/playwright:v1.29.2-focal
559559
commands:
560-
- curl -sLO https://go.dev/dl/go1.19.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
560+
- curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
561561
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea
562562
- apt-get -qq update && apt-get -qqy install build-essential
563563
- export TEST_PGSQL_SCHEMA=''
@@ -656,7 +656,7 @@ trigger:
656656

657657
steps:
658658
- name: download
659-
image: golang:1.19
659+
image: golang:1.20
660660
pull: always
661661
commands:
662662
- timeout -s ABRT 40m make generate-license generate-gitignore
@@ -720,7 +720,7 @@ steps:
720720
- make deps-frontend
721721

722722
- name: deps-backend
723-
image: golang:1.19
723+
image: golang:1.20
724724
pull: always
725725
commands:
726726
- make deps-backend
@@ -729,7 +729,7 @@ steps:
729729
path: /go
730730

731731
- name: static
732-
image: techknowlogick/xgo:go-1.19.x
732+
image: techknowlogick/xgo:go-1.20.x
733733
pull: always
734734
commands:
735735
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
@@ -763,10 +763,16 @@ steps:
763763
image: woodpeckerci/plugin-s3:latest
764764
pull: always
765765
settings:
766-
acl: public-read
767-
bucket: gitea-artifacts
768-
endpoint: https://ams3.digitaloceanspaces.com
769-
path_style: true
766+
acl:
767+
from_secret: aws_s3_acl
768+
region:
769+
from_secret: aws_s3_region
770+
bucket:
771+
from_secret: aws_s3_bucket
772+
endpoint:
773+
from_secret: aws_s3_endpoint
774+
path_style:
775+
from_secret: aws_s3_path_style
770776
source: "dist/release/*"
771777
strip_prefix: dist/release/
772778
target: "/gitea/${DRONE_BRANCH##release/v}"
@@ -784,10 +790,16 @@ steps:
784790
- name: release-main
785791
image: woodpeckerci/plugin-s3:latest
786792
settings:
787-
acl: public-read
788-
bucket: gitea-artifacts
789-
endpoint: https://ams3.digitaloceanspaces.com
790-
path_style: true
793+
acl:
794+
from_secret: aws_s3_acl
795+
region:
796+
from_secret: aws_s3_region
797+
bucket:
798+
from_secret: aws_s3_bucket
799+
endpoint:
800+
from_secret: aws_s3_endpoint
801+
path_style:
802+
from_secret: aws_s3_path_style
791803
source: "dist/release/*"
792804
strip_prefix: dist/release/
793805
target: /gitea/main
@@ -841,7 +853,7 @@ steps:
841853
- make deps-frontend
842854

843855
- name: deps-backend
844-
image: golang:1.19
856+
image: golang:1.20
845857
pull: always
846858
commands:
847859
- make deps-backend
@@ -850,7 +862,7 @@ steps:
850862
path: /go
851863

852864
- name: static
853-
image: techknowlogick/xgo:go-1.19.x
865+
image: techknowlogick/xgo:go-1.20.x
854866
pull: always
855867
commands:
856868
# Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved
@@ -886,10 +898,16 @@ steps:
886898
image: woodpeckerci/plugin-s3:latest
887899
pull: always
888900
settings:
889-
acl: public-read
890-
bucket: gitea-artifacts
891-
endpoint: https://ams3.digitaloceanspaces.com
892-
path_style: true
901+
acl:
902+
from_secret: aws_s3_acl
903+
region:
904+
from_secret: aws_s3_region
905+
bucket:
906+
from_secret: aws_s3_bucket
907+
endpoint:
908+
from_secret: aws_s3_endpoint
909+
path_style:
910+
from_secret: aws_s3_path_style
893911
source: "dist/release/*"
894912
strip_prefix: dist/release/
895913
target: "/gitea/${DRONE_TAG##v}"
@@ -932,7 +950,7 @@ trigger:
932950

933951
steps:
934952
- name: build-docs
935-
image: golang:1.19
953+
image: golang:1.20
936954
commands:
937955
- cd docs
938956
- make trans-copy clean build

.golangci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ linters:
2828
fast: false
2929

3030
run:
31-
go: 1.19
31+
go: 1.20
3232
timeout: 10m
3333
skip-dirs:
3434
- node_modules
@@ -74,7 +74,7 @@ linters-settings:
7474
- name: modifies-value-receiver
7575
gofumpt:
7676
extra-rules: true
77-
lang-version: "1.19"
77+
lang-version: "1.20"
7878
depguard:
7979
list-type: denylist
8080
# Check the list against standard lib.
@@ -84,6 +84,7 @@ linters-settings:
8484
- github.com/unknwon/com: "use gitea's util and replacements"
8585
- io/ioutil: "use os or io instead"
8686
- golang.org/x/exp: "it's experimental and unreliable."
87+
- code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead"
8788

8889
issues:
8990
max-issues-per-linter: 0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.19-alpine3.17 AS build-env
2+
FROM golang:1.20-alpine3.17 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}

Dockerfile.rootless

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Build stage
2-
FROM golang:1.19-alpine3.17 AS build-env
2+
FROM golang:1.20-alpine3.17 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY ${GOPROXY:-direct}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ SHASUM ?= shasum -a 256
2323
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
2424
COMMA := ,
2525

26-
XGO_VERSION := go-1.19.x
26+
XGO_VERSION := go-1.20.x
2727

2828
AIR_PACKAGE ?= github.com/cosmtrek/[email protected]
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected]
3030
ERRCHECK_PACKAGE ?= github.com/kisielk/[email protected]
3131
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
32-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
32+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
3333
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3434
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
3535
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]

assets/go-licenses.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/admin.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ var (
180180
Name: "raw",
181181
Usage: "Display only the token value",
182182
},
183+
cli.StringFlag{
184+
Name: "scopes",
185+
Value: "",
186+
Usage: "Comma separated list of scopes to apply to access token",
187+
},
183188
},
184189
Action: runGenerateAccessToken,
185190
}
@@ -303,6 +308,11 @@ var (
303308
Value: "false",
304309
Usage: "Use custom URLs for GitLab/GitHub OAuth endpoints",
305310
},
311+
cli.StringFlag{
312+
Name: "custom-tenant-id",
313+
Value: "",
314+
Usage: "Use custom Tenant ID for OAuth endpoints",
315+
},
306316
cli.StringFlag{
307317
Name: "custom-auth-url",
308318
Value: "",
@@ -573,12 +583,16 @@ func runCreateUser(c *cli.Context) error {
573583
restricted = util.OptionalBoolOf(c.Bool("restricted"))
574584
}
575585

586+
// default user visibility in app.ini
587+
visibility := setting.Service.DefaultUserVisibilityMode
588+
576589
u := &user_model.User{
577590
Name: username,
578591
Email: c.String("email"),
579592
Passwd: password,
580593
IsAdmin: c.Bool("admin"),
581594
MustChangePassword: changePassword,
595+
Visibility: visibility,
582596
}
583597

584598
overwriteDefault := &user_model.CreateUserOverwriteOptions{
@@ -698,9 +712,15 @@ func runGenerateAccessToken(c *cli.Context) error {
698712
return err
699713
}
700714

715+
accessTokenScope, err := auth_model.AccessTokenScope(c.String("scopes")).Normalize()
716+
if err != nil {
717+
return err
718+
}
719+
701720
t := &auth_model.AccessToken{
702-
Name: c.String("token-name"),
703-
UID: user.ID,
721+
Name: c.String("token-name"),
722+
UID: user.ID,
723+
Scope: accessTokenScope,
704724
}
705725

706726
if err := auth_model.NewAccessToken(t); err != nil {
@@ -814,6 +834,7 @@ func parseOAuth2Config(c *cli.Context) *oauth2.Source {
814834
AuthURL: c.String("custom-auth-url"),
815835
ProfileURL: c.String("custom-profile-url"),
816836
EmailURL: c.String("custom-email-url"),
837+
Tenant: c.String("custom-tenant-id"),
817838
}
818839
} else {
819840
customURLMapping = nil
@@ -923,6 +944,7 @@ func runUpdateOauth(c *cli.Context) error {
923944
customURLMapping.AuthURL = oAuth2Config.CustomURLMapping.AuthURL
924945
customURLMapping.ProfileURL = oAuth2Config.CustomURLMapping.ProfileURL
925946
customURLMapping.EmailURL = oAuth2Config.CustomURLMapping.EmailURL
947+
customURLMapping.Tenant = oAuth2Config.CustomURLMapping.Tenant
926948
}
927949
if c.IsSet("use-custom-urls") && c.IsSet("custom-token-url") {
928950
customURLMapping.TokenURL = c.String("custom-token-url")
@@ -940,6 +962,10 @@ func runUpdateOauth(c *cli.Context) error {
940962
customURLMapping.EmailURL = c.String("custom-email-url")
941963
}
942964

965+
if c.IsSet("use-custom-urls") && c.IsSet("custom-tenant-id") {
966+
customURLMapping.Tenant = c.String("custom-tenant-id")
967+
}
968+
943969
oAuth2Config.CustomURLMapping = customURLMapping
944970
source.Cfg = oAuth2Config
945971

0 commit comments

Comments
 (0)