Skip to content

Commit 951b133

Browse files
committed
Merge branch 'main' into lunny/fix_incomplete_commit_status
2 parents a9080fa + b8b690f commit 951b133

File tree

382 files changed

+6076
-6066
lines changed

Some content is hidden

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

382 files changed

+6076
-6066
lines changed

.eslintrc.cjs

Lines changed: 999 additions & 0 deletions
Large diffs are not rendered by default.

.eslintrc.yaml

Lines changed: 0 additions & 967 deletions
This file was deleted.

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build stage
2-
FROM docker.io/library/golang:1.23-alpine3.20 AS build-env
2+
FROM docker.io/library/golang:1.23-alpine3.21 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.20
44+
FROM docker.io/library/alpine:3.21
4545
LABEL maintainer="maintainers@gitea.io"
4646

4747
EXPOSE 22 3000
@@ -78,7 +78,7 @@ ENV GITEA_CUSTOM=/data/gitea
7878
VOLUME ["/data"]
7979

8080
ENTRYPOINT ["/usr/bin/entrypoint"]
81-
CMD ["/bin/s6-svscan", "/etc/s6"]
81+
CMD ["/usr/bin/s6-svscan", "/etc/s6"]
8282

8383
COPY --from=build-env /tmp/local /
8484
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea

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.23-alpine3.20 AS build-env
2+
FROM docker.io/library/golang:1.23-alpine3.21 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.20
42+
FROM docker.io/library/alpine:3.21
4343
LABEL maintainer="maintainers@gitea.io"
4444

4545
EXPOSE 2222 3000

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ COMMA := ,
2626
XGO_VERSION := go-1.23.x
2727

2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
29-
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.7.0
29+
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.0.3
3030
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.7.0
3131
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2
32-
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11
33-
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.5.1
32+
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.12
33+
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.6.0
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.31.0
3535
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3636
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1
3737
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1
3838
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1
39-
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.15.3
39+
GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.17.0
4040

4141
DOCKER_IMAGE ?= gitea/gitea
4242
DOCKER_TAG ?= latest

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ require (
123123
github.com/yuin/goldmark-meta v1.1.0
124124
golang.org/x/crypto v0.31.0
125125
golang.org/x/image v0.21.0
126-
golang.org/x/net v0.30.0
126+
golang.org/x/net v0.33.0
127127
golang.org/x/oauth2 v0.23.0
128128
golang.org/x/sync v0.10.0
129129
golang.org/x/sys v0.28.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
932932
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
933933
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
934934
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
935-
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
936-
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
935+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
936+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
937937
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
938938
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
939939
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

models/actions/runner_token.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"code.gitea.io/gitea/models/db"
1111
repo_model "code.gitea.io/gitea/models/repo"
1212
user_model "code.gitea.io/gitea/models/user"
13+
"code.gitea.io/gitea/modules/base"
1314
"code.gitea.io/gitea/modules/timeutil"
1415
"code.gitea.io/gitea/modules/util"
1516
)
@@ -51,7 +52,7 @@ func GetRunnerToken(ctx context.Context, token string) (*ActionRunnerToken, erro
5152
if err != nil {
5253
return nil, err
5354
} else if !has {
54-
return nil, fmt.Errorf("runner token %q: %w", token, util.ErrNotExist)
55+
return nil, fmt.Errorf(`runner token "%s...": %w`, base.TruncateString(token, 3), util.ErrNotExist)
5556
}
5657
return &runnerToken, nil
5758
}
@@ -68,19 +69,15 @@ func UpdateRunnerToken(ctx context.Context, r *ActionRunnerToken, cols ...string
6869
return err
6970
}
7071

71-
// NewRunnerToken creates a new active runner token and invalidate all old tokens
72+
// NewRunnerTokenWithValue creates a new active runner token and invalidate all old tokens
7273
// ownerID will be ignored and treated as 0 if repoID is non-zero.
73-
func NewRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error) {
74+
func NewRunnerTokenWithValue(ctx context.Context, ownerID, repoID int64, token string) (*ActionRunnerToken, error) {
7475
if ownerID != 0 && repoID != 0 {
7576
// It's trying to create a runner token that belongs to a repository, but OwnerID has been set accidentally.
7677
// Remove OwnerID to avoid confusion; it's not worth returning an error here.
7778
ownerID = 0
7879
}
7980

80-
token, err := util.CryptoRandomString(40)
81-
if err != nil {
82-
return nil, err
83-
}
8481
runnerToken := &ActionRunnerToken{
8582
OwnerID: ownerID,
8683
RepoID: repoID,
@@ -95,11 +92,19 @@ func NewRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerTo
9592
return err
9693
}
9794

98-
_, err = db.GetEngine(ctx).Insert(runnerToken)
95+
_, err := db.GetEngine(ctx).Insert(runnerToken)
9996
return err
10097
})
10198
}
10299

100+
func NewRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error) {
101+
token, err := util.CryptoRandomString(40)
102+
if err != nil {
103+
return nil, err
104+
}
105+
return NewRunnerTokenWithValue(ctx, ownerID, repoID, token)
106+
}
107+
103108
// GetLatestRunnerToken returns the latest runner token
104109
func GetLatestRunnerToken(ctx context.Context, ownerID, repoID int64) (*ActionRunnerToken, error) {
105110
if ownerID != 0 && repoID != 0 {

models/activities/action.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ func ActivityQueryCondition(ctx context.Context, opts GetFeedsOptions) (builder.
511511
}
512512

513513
if opts.RequestedTeam != nil {
514-
env := organization.OrgFromUser(opts.RequestedUser).AccessibleTeamReposEnv(ctx, opts.RequestedTeam)
514+
env := repo_model.AccessibleTeamReposEnv(ctx, organization.OrgFromUser(opts.RequestedUser), opts.RequestedTeam)
515515
teamRepoIDs, err := env.RepoIDs(1, opts.RequestedUser.NumRepos)
516516
if err != nil {
517517
return nil, fmt.Errorf("GetTeamRepositories: %w", err)

models/asymkey/error.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ func (err ErrGPGKeyAccessDenied) Unwrap() error {
217217
// ErrKeyAccessDenied represents a "KeyAccessDenied" kind of error.
218218
type ErrKeyAccessDenied struct {
219219
UserID int64
220+
RepoID int64
220221
KeyID int64
221222
Note string
222223
}
@@ -228,8 +229,8 @@ func IsErrKeyAccessDenied(err error) bool {
228229
}
229230

230231
func (err ErrKeyAccessDenied) Error() string {
231-
return fmt.Sprintf("user does not have access to the key [user_id: %d, key_id: %d, note: %s]",
232-
err.UserID, err.KeyID, err.Note)
232+
return fmt.Sprintf("user does not have access to the key [user_id: %d, repo_id: %d, key_id: %d, note: %s]",
233+
err.UserID, err.RepoID, err.KeyID, err.Note)
233234
}
234235

235236
func (err ErrKeyAccessDenied) Unwrap() error {

0 commit comments

Comments
 (0)