Skip to content

Commit b723912

Browse files
Merge branch 'main' into main
2 parents cd5e9df + 3f7dbbd commit b723912

File tree

539 files changed

+10080
-5071
lines changed

Some content is hidden

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

539 files changed

+10080
-5071
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
services:
1919
pgsql:
20-
image: postgres:12
20+
image: postgres:14
2121
env:
2222
POSTGRES_DB: test
2323
POSTGRES_PASSWORD: postgres

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ 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' || needs.files-changed.outputs.actions == 'true'
15+
# the "test-e2e" won't pass, and it seems that there is no useful test, so skip
16+
# if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
17+
if: false
1618
needs: files-changed
1719
runs-on: ubuntu-latest
1820
steps:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ _test
2222
.vscode
2323
__debug_bin*
2424

25+
# Visual Studio
26+
/.vs/
27+
2528
*.cgo1.go
2629
*.cgo2.c
2730
_cgo_defun.c

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.24-alpine3.21 AS build-env
2+
FROM docker.io/library/golang:1.24-alpine3.22 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY=${GOPROXY:-direct}
@@ -41,7 +41,7 @@ RUN chmod 755 /tmp/local/usr/bin/entrypoint \
4141
/go/src/code.gitea.io/gitea/environment-to-ini
4242
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
4343

44-
FROM docker.io/library/alpine:3.21
44+
FROM docker.io/library/alpine:3.22
4545
LABEL maintainer="[email protected]"
4646

4747
EXPOSE 22 3000

Dockerfile.rootless

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.24-alpine3.21 AS build-env
2+
FROM docker.io/library/golang:1.24-alpine3.22 AS build-env
33

44
ARG GOPROXY
55
ENV GOPROXY=${GOPROXY:-direct}
@@ -39,7 +39,7 @@ RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
3939
/go/src/code.gitea.io/gitea/environment-to-ini
4040
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
4141

42-
FROM docker.io/library/alpine:3.21
42+
FROM docker.io/library/alpine:3.22
4343
LABEL maintainer="[email protected]"
4444

4545
EXPOSE 2222 3000

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ Rowan Bohde <[email protected]> (@bohde)
6464
hiifong <[email protected]> (@hiifong)
6565
metiftikci <[email protected]> (@metiftikci)
6666
Christopher Homberger <[email protected]> (@ChristopherHX)
67+
Tobias Balle-Petersen <[email protected]> (@tobiasbp)

assets/go-licenses.json

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

cmd/admin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
107107

108108
log.Trace("Synchronizing repository releases (this may take a while)")
109109
for page := 1; ; page++ {
110-
repos, count, err := repo_model.SearchRepositoryByName(ctx, &repo_model.SearchRepoOptions{
110+
repos, count, err := repo_model.SearchRepositoryByName(ctx, repo_model.SearchRepoOptions{
111111
ListOptions: db.ListOptions{
112112
PageSize: repo_model.RepositoryListDefaultPageSize,
113113
Page: page,

cmd/admin_auth_ldap.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010

1111
"code.gitea.io/gitea/models/auth"
12+
"code.gitea.io/gitea/modules/util"
1213
"code.gitea.io/gitea/services/auth/source/ldap"
1314

1415
"github.com/urfave/cli/v2"
@@ -210,8 +211,8 @@ func newAuthService() *authService {
210211
}
211212
}
212213

213-
// parseAuthSource assigns values on authSource according to command line flags.
214-
func parseAuthSource(c *cli.Context, authSource *auth.Source) {
214+
// parseAuthSourceLdap assigns values on authSource according to command line flags.
215+
func parseAuthSourceLdap(c *cli.Context, authSource *auth.Source) {
215216
if c.IsSet("name") {
216217
authSource.Name = c.String("name")
217218
}
@@ -227,6 +228,7 @@ func parseAuthSource(c *cli.Context, authSource *auth.Source) {
227228
if c.IsSet("disable-synchronize-users") {
228229
authSource.IsSyncEnabled = !c.Bool("disable-synchronize-users")
229230
}
231+
authSource.TwoFactorPolicy = util.Iif(c.Bool("skip-local-2fa"), "skip", "")
230232
}
231233

232234
// parseLdapConfig assigns values on config according to command line flags.
@@ -298,9 +300,6 @@ func parseLdapConfig(c *cli.Context, config *ldap.Source) error {
298300
if c.IsSet("allow-deactivate-all") {
299301
config.AllowDeactivateAll = c.Bool("allow-deactivate-all")
300302
}
301-
if c.IsSet("skip-local-2fa") {
302-
config.SkipLocalTwoFA = c.Bool("skip-local-2fa")
303-
}
304303
if c.IsSet("enable-groups") {
305304
config.GroupsEnabled = c.Bool("enable-groups")
306305
}
@@ -376,7 +375,7 @@ func (a *authService) addLdapBindDn(c *cli.Context) error {
376375
},
377376
}
378377

379-
parseAuthSource(c, authSource)
378+
parseAuthSourceLdap(c, authSource)
380379
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
381380
return err
382381
}
@@ -398,7 +397,7 @@ func (a *authService) updateLdapBindDn(c *cli.Context) error {
398397
return err
399398
}
400399

401-
parseAuthSource(c, authSource)
400+
parseAuthSourceLdap(c, authSource)
402401
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
403402
return err
404403
}
@@ -427,7 +426,7 @@ func (a *authService) addLdapSimpleAuth(c *cli.Context) error {
427426
},
428427
}
429428

430-
parseAuthSource(c, authSource)
429+
parseAuthSourceLdap(c, authSource)
431430
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
432431
return err
433432
}
@@ -449,7 +448,7 @@ func (a *authService) updateLdapSimpleAuth(c *cli.Context) error {
449448
return err
450449
}
451450

452-
parseAuthSource(c, authSource)
451+
parseAuthSourceLdap(c, authSource)
453452
if err := parseLdapConfig(c, authSource.Cfg.(*ldap.Source)); err != nil {
454453
return err
455454
}

cmd/admin_auth_ldap_test.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"testing"
99

1010
"code.gitea.io/gitea/models/auth"
11+
"code.gitea.io/gitea/modules/test"
1112
"code.gitea.io/gitea/services/auth/source/ldap"
1213

1314
"github.com/stretchr/testify/assert"
@@ -16,9 +17,7 @@ import (
1617

1718
func TestAddLdapBindDn(t *testing.T) {
1819
// Mock cli functions to do not exit on error
19-
osExiter := cli.OsExiter
20-
defer func() { cli.OsExiter = osExiter }()
21-
cli.OsExiter = func(code int) {}
20+
defer test.MockVariableValue(&cli.OsExiter, func(code int) {})()
2221

2322
// Test cases
2423
cases := []struct {
@@ -256,9 +255,7 @@ func TestAddLdapBindDn(t *testing.T) {
256255

257256
func TestAddLdapSimpleAuth(t *testing.T) {
258257
// Mock cli functions to do not exit on error
259-
osExiter := cli.OsExiter
260-
defer func() { cli.OsExiter = osExiter }()
261-
cli.OsExiter = func(code int) {}
258+
defer test.MockVariableValue(&cli.OsExiter, func(code int) {})()
262259

263260
// Test cases
264261
cases := []struct {
@@ -487,9 +484,7 @@ func TestAddLdapSimpleAuth(t *testing.T) {
487484

488485
func TestUpdateLdapBindDn(t *testing.T) {
489486
// Mock cli functions to do not exit on error
490-
osExiter := cli.OsExiter
491-
defer func() { cli.OsExiter = osExiter }()
492-
cli.OsExiter = func(code int) {}
487+
defer test.MockVariableValue(&cli.OsExiter, func(code int) {})()
493488

494489
// Test cases
495490
cases := []struct {
@@ -964,9 +959,7 @@ func TestUpdateLdapBindDn(t *testing.T) {
964959

965960
func TestUpdateLdapSimpleAuth(t *testing.T) {
966961
// Mock cli functions to do not exit on error
967-
osExiter := cli.OsExiter
968-
defer func() { cli.OsExiter = osExiter }()
969-
cli.OsExiter = func(code int) {}
962+
defer test.MockVariableValue(&cli.OsExiter, func(code int) {})()
970963

971964
// Test cases
972965
cases := []struct {

0 commit comments

Comments
 (0)