Skip to content

Commit a548fe7

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Added instance-level variables (go-gitea#28115) Revert "improve possible performance bottleneck (go-gitea#28547)" (go-gitea#28593) [skip ci] Updated licenses and gitignores Fix flex container width (go-gitea#28603) Fix the scroll behavior for emoji/mention list (go-gitea#28597) bump to use alpine3.19 (go-gitea#28594) Include heap pprof in diagnosis report to help debugging memory leaks (go-gitea#28596) Disable query token param in integration tests (go-gitea#28592) Fix wrong due date rendering in issue list page (go-gitea#28588) Fix `status_check_contexts` matching bug (go-gitea#28582) Fix 405 method not allowed CORS / OIDC (go-gitea#28583)
2 parents 9296ce0 + d0f24ff commit a548fe7

24 files changed

+137
-82
lines changed

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.21-alpine3.18 AS build-env
2+
FROM docker.io/library/golang:1.21-alpine3.19 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.18
44+
FROM docker.io/library/alpine:3.19
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.21-alpine3.18 AS build-env
2+
FROM docker.io/library/golang:1.21-alpine3.19 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.18
42+
FROM docker.io/library/alpine:3.19
4343
LABEL maintainer="[email protected]"
4444

4545
EXPOSE 2222 3000

models/actions/variable.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ func init() {
3131
}
3232

3333
func (v *ActionVariable) Validate() error {
34-
if v.OwnerID == 0 && v.RepoID == 0 {
35-
return errors.New("the variable is not bound to any scope")
34+
if v.OwnerID != 0 && v.RepoID != 0 {
35+
return errors.New("a variable should not be bound to an owner and a repository at the same time")
3636
}
3737
return nil
3838
}
@@ -58,12 +58,8 @@ type FindVariablesOpts struct {
5858

5959
func (opts FindVariablesOpts) ToConds() builder.Cond {
6060
cond := builder.NewCond()
61-
if opts.OwnerID > 0 {
62-
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
63-
}
64-
if opts.RepoID > 0 {
65-
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
66-
}
61+
cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
62+
cond = cond.And(builder.Eq{"repo_id": opts.RepoID})
6763
return cond
6864
}
6965

models/issues/comment.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,14 @@ func DeleteComment(ctx context.Context, comment *Comment) error {
11611161
// UpdateCommentsMigrationsByType updates comments' migrations information via given git service type and original id and poster id
11621162
func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error {
11631163
_, err := db.GetEngine(ctx).Table("comment").
1164-
Join("INNER", "issue", "issue.id = comment.issue_id").
1165-
Join("INNER", "repository", "issue.repo_id = repository.id").
1166-
Where("repository.original_service_type = ?", tp).
1164+
Where(builder.In("issue_id",
1165+
builder.Select("issue.id").
1166+
From("issue").
1167+
InnerJoin("repository", "issue.repo_id = repository.id").
1168+
Where(builder.Eq{
1169+
"repository.original_service_type": tp,
1170+
}),
1171+
)).
11671172
And("comment.original_author_id = ?", originalAuthorID).
11681173
Update(map[string]any{
11691174
"poster_id": posterID,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Copyright (C) 2008 Micah J. Cowan
2+
3+
Copying and distribution of this file, with or without modification,
4+
are permitted in any medium without royalty provided the copyright
5+
notice and this notice are preserved.

options/license/HPND-Kevlin-Henney

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved.
2+
3+
Permission to use, copy, modify, and distribute this software and its
4+
documentation for any purpose is hereby granted without fee, provided
5+
that this copyright and permissions notice appear in all copies and
6+
derivatives.
7+
8+
This software is supplied "as is" without express or implied warranty.
9+
10+
But that said, if there are any problems please get in touch.

package-lock.json

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

routers/api/actions/runner/utils.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ func getSecretsOfTask(ctx context.Context, task *actions_model.ActionTask) map[s
9494
func getVariablesOfTask(ctx context.Context, task *actions_model.ActionTask) map[string]string {
9595
variables := map[string]string{}
9696

97+
// Global
98+
globalVariables, err := db.Find[actions_model.ActionVariable](ctx, actions_model.FindVariablesOpts{})
99+
if err != nil {
100+
log.Error("find global variables: %v", err)
101+
}
102+
97103
// Org / User level
98104
ownerVariables, err := db.Find[actions_model.ActionVariable](ctx, actions_model.FindVariablesOpts{OwnerID: task.Job.Run.Repo.OwnerID})
99105
if err != nil {
@@ -106,8 +112,8 @@ func getVariablesOfTask(ctx context.Context, task *actions_model.ActionTask) map
106112
log.Error("find variables of repo: %d, error: %v", task.Job.Run.RepoID, err)
107113
}
108114

109-
// Level precedence: Repo > Org / User
110-
for _, v := range append(ownerVariables, repoVariables...) {
115+
// Level precedence: Repo > Org / User > Global
116+
for _, v := range append(globalVariables, append(ownerVariables, repoVariables...)...) {
111117
variables[v.Name] = v.Data
112118
}
113119

routers/web/admin/diagnosis.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,11 @@ func MonitorDiagnosis(ctx *context.Context) {
5858
return
5959
}
6060
_ = pprof.Lookup("goroutine").WriteTo(f, 1)
61+
62+
f, err = zipWriter.CreateHeader(&zip.FileHeader{Name: "heap.dat", Method: zip.Deflate, Modified: time.Now()})
63+
if err != nil {
64+
ctx.ServerError("Failed to create zip file", err)
65+
return
66+
}
67+
_ = pprof.Lookup("heap").WriteTo(f, 0)
6168
}

routers/web/repo/pull.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,15 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
653653
if pb != nil && pb.EnableStatusCheck {
654654
ctx.Data["is_context_required"] = func(context string) bool {
655655
for _, c := range pb.StatusCheckContexts {
656-
if gp, err := glob.Compile(c); err == nil && gp.Match(context) {
656+
if c == context {
657+
return true
658+
}
659+
if gp, err := glob.Compile(c); err != nil {
660+
// All newly created status_check_contexts are checked to ensure they are valid glob expressions before being stored in the database.
661+
// But some old status_check_context created before glob was introduced may be invalid glob expressions.
662+
// So log the error here for debugging.
663+
log.Error("compile glob %q: %v", c, err)
664+
} else if gp.Match(context) {
657665
return true
658666
}
659667
}

0 commit comments

Comments
 (0)