Skip to content

Commit f9c05a9

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Fix the bug: deploy key with write access can not push (go-gitea#19010) Renamed ctx.User to ctx.Doer. (go-gitea#19161) [docs] Enhance container selection in docker dump (go-gitea#14292) Cleanup protected branches when deleting users & teams (go-gitea#19158) Reorder issue templates and automatically add labels (go-gitea#18875) Use IterateBufferSize whilst querying repositories during adoption check (go-gitea#19140)
2 parents aa07464 + 2b55422 commit f9c05a9

File tree

146 files changed

+1130
-1005
lines changed

Some content is hidden

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

146 files changed

+1130
-1005
lines changed

.github/ISSUE_TEMPLATE/bug-report.yaml

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Bug Report
22
description: Found something you weren't expecting? Report it here!
3+
labels: kind/bug
34
body:
45
- type: markdown
56
attributes:
@@ -19,13 +20,48 @@ body:
1920
6. In particular it's really important to provide pertinent logs. You must give us DEBUG level logs.
2021
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
2122
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
23+
- type: textarea
24+
id: description
25+
attributes:
26+
label: Description
27+
description: |
28+
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below)
29+
If you are using a proxy or a CDN (e.g. Cloudflare) in front of Gitea, please disable the proxy/CDN fully and access Gitea directly to confirm the issue still persists without those services.
2230
- type: input
2331
id: gitea-ver
2432
attributes:
2533
label: Gitea Version
2634
description: Gitea version (or commit reference) of your instance
2735
validations:
2836
required: true
37+
- type: dropdown
38+
id: can-reproduce
39+
attributes:
40+
label: Can you reproduce the bug on the Gitea demo site?
41+
description: |
42+
If so, please provide a URL in the Description field
43+
URL of Gitea demo: https://try.gitea.io
44+
options:
45+
- "Yes"
46+
- "No"
47+
validations:
48+
required: true
49+
- type: markdown
50+
attributes:
51+
value: |
52+
It's really important to provide pertinent logs
53+
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
54+
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
55+
- type: input
56+
id: logs
57+
attributes:
58+
label: Log Gist
59+
description: Please provide a gist URL of your logs, with any sensitive information (e.g. API keys) removed/hidden
60+
- type: textarea
61+
id: screenshots
62+
attributes:
63+
label: Screenshots
64+
description: If this issue involves the Web Interface, please provide one or more screenshots
2965
- type: input
3066
id: git-ver
3167
attributes:
@@ -56,38 +92,3 @@ body:
5692
- MySQL
5793
- MSSQL
5894
- SQLite
59-
- type: dropdown
60-
id: can-reproduce
61-
attributes:
62-
label: Can you reproduce the bug on the Gitea demo site?
63-
description: |
64-
If so, please provide a URL in the Description field
65-
URL of Gitea demo: https://try.gitea.io
66-
options:
67-
- "Yes"
68-
- "No"
69-
validations:
70-
required: true
71-
- type: markdown
72-
attributes:
73-
value: |
74-
It's really important to provide pertinent logs
75-
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
76-
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
77-
- type: input
78-
id: logs
79-
attributes:
80-
label: Log Gist
81-
description: Please provide a gist URL of your logs, with any sensitive information (e.g. API keys) removed/hidden
82-
- type: textarea
83-
id: description
84-
attributes:
85-
label: Description
86-
description: |
87-
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see above)
88-
If you are using a proxy or a CDN (e.g. Cloudflare) in front of Gitea, please disable the proxy/CDN fully and access Gitea directly to confirm the issue still persists without those services.
89-
- type: textarea
90-
id: screenshots
91-
attributes:
92-
label: Screenshots
93-
description: If this issue involves the Web Interface, please provide one or more screenshots

.github/ISSUE_TEMPLATE/feature-request.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Feature Request
22
description: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here!
3+
labels: ["kind/feature", "kind/proposal"]
34
body:
45
- type: markdown
56
attributes:
Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Web Interface Bug Report
22
description: Something doesn't look quite as it should? Report it here!
3+
labels: ["kind/bug", "kind/ui"]
34
body:
45
- type: markdown
56
attributes:
@@ -18,23 +19,25 @@ body:
1819
6. In particular it's really important to provide pertinent logs. If you are certain that this is a javascript
1920
error, show us the javascript console. If the error appears to relate to Gitea the server you must also give us
2021
DEBUG level logs. (See https://docs.gitea.io/en-us/logging-configuration/#debugging-problems)
21-
- type: input
22-
id: gitea-ver
22+
- type: textarea
23+
id: description
2324
attributes:
24-
label: Gitea Version
25-
description: Gitea version (or commit reference) your instance is running
25+
label: Description
26+
description: |
27+
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below)
28+
If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services.
29+
- type: textarea
30+
id: screenshots
31+
attributes:
32+
label: Screenshots
33+
description: Please provide at least 1 screenshot showing the issue.
2634
validations:
2735
required: true
2836
- type: input
29-
id: os-ver
30-
attributes:
31-
label: Operating System
32-
description: The operating system you are using to access Gitea
33-
- type: input
34-
id: browser-ver
37+
id: gitea-ver
3538
attributes:
36-
label: Browser Version
37-
description: The browser and version that you are using to access Gitea
39+
label: Gitea Version
40+
description: Gitea version (or commit reference) your instance is running
3841
validations:
3942
required: true
4043
- type: dropdown
@@ -49,17 +52,15 @@ body:
4952
- "No"
5053
validations:
5154
required: true
52-
- type: textarea
53-
id: description
55+
- type: input
56+
id: os-ver
5457
attributes:
55-
label: Description
56-
description: |
57-
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see above)
58-
If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services.
59-
- type: textarea
60-
id: screenshots
58+
label: Operating System
59+
description: The operating system you are using to access Gitea
60+
- type: input
61+
id: browser-ver
6162
attributes:
62-
label: Screenshots
63-
description: Please provide at least 1 screenshot showing the issue.
63+
label: Browser Version
64+
description: The browser and version that you are using to access Gitea
6465
validations:
6566
required: true

cmd/hook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Gitea or set your environment appropriately.`, "")
185185
reponame := os.Getenv(models.EnvRepoName)
186186
userID, _ := strconv.ParseInt(os.Getenv(models.EnvPusherID), 10, 64)
187187
prID, _ := strconv.ParseInt(os.Getenv(models.EnvPRID), 10, 64)
188-
isDeployKey, _ := strconv.ParseBool(os.Getenv(models.EnvIsDeployKey))
188+
deployKeyID, _ := strconv.ParseInt(os.Getenv(models.EnvDeployKeyID), 10, 64)
189189

190190
hookOptions := private.HookOptions{
191191
UserID: userID,
@@ -194,7 +194,7 @@ Gitea or set your environment appropriately.`, "")
194194
GitQuarantinePath: os.Getenv(private.GitQuarantinePath),
195195
GitPushOptions: pushOptions(),
196196
PullRequestID: prID,
197-
IsDeployKey: isDeployKey,
197+
DeployKeyID: deployKeyID,
198198
}
199199

200200
scanner := bufio.NewScanner(os.Stdin)

cmd/serv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func runServ(c *cli.Context) error {
243243
os.Setenv(models.EnvPusherID, strconv.FormatInt(results.UserID, 10))
244244
os.Setenv(models.EnvRepoID, strconv.FormatInt(results.RepoID, 10))
245245
os.Setenv(models.EnvPRID, fmt.Sprintf("%d", 0))
246-
os.Setenv(models.EnvIsDeployKey, fmt.Sprintf("%t", results.IsDeployKey))
246+
os.Setenv(models.EnvDeployKeyID, fmt.Sprintf("%d", results.DeployKeyID))
247247
os.Setenv(models.EnvKeyID, fmt.Sprintf("%d", results.KeyID))
248248
os.Setenv(models.EnvAppURL, setting.AppURL)
249249

docs/content/doc/usage/backup-and-restore.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The command has to be executed with the `RUN_USER = <OS_USERNAME>` specified in
5757
Example:
5858

5959
```none
60-
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf "name=<NAME_OF_DOCKER_CONTAINER>") bash -c '/app/gitea/gitea dump -c </path/to/app.ini>'
60+
docker exec -u <OS_USERNAME> -it -w <--tempdir> $(docker ps -qf 'name=^<NAME_OF_DOCKER_CONTAINER>$') bash -c '/app/gitea/gitea dump -c </path/to/app.ini>'
6161
```
6262

6363
\*Note: `--tempdir` refers to the temporary directory of the docker environment used by Gitea; if you have not specified a custom `--tempdir`, then Gitea uses `/tmp` or the `TMPDIR` environment variable of the docker container. For `--tempdir` adjust your `docker exec` command options accordingly.

integrations/api_private_serv_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestAPIPrivateServ(t *testing.T) {
4747
results, err := private.ServCommand(ctx, 1, "user2", "repo1", perm.AccessModeWrite, "git-upload-pack", "")
4848
assert.NoError(t, err)
4949
assert.False(t, results.IsWiki)
50-
assert.False(t, results.IsDeployKey)
50+
assert.Zero(t, results.DeployKeyID)
5151
assert.Equal(t, int64(1), results.KeyID)
5252
assert.Equal(t, "user2@localhost", results.KeyName)
5353
assert.Equal(t, "user2", results.UserName)
@@ -70,7 +70,7 @@ func TestAPIPrivateServ(t *testing.T) {
7070
results, err = private.ServCommand(ctx, 1, "user15", "big_test_public_1", perm.AccessModeRead, "git-upload-pack", "")
7171
assert.NoError(t, err)
7272
assert.False(t, results.IsWiki)
73-
assert.False(t, results.IsDeployKey)
73+
assert.Zero(t, results.DeployKeyID)
7474
assert.Equal(t, int64(1), results.KeyID)
7575
assert.Equal(t, "user2@localhost", results.KeyName)
7676
assert.Equal(t, "user2", results.UserName)
@@ -92,7 +92,7 @@ func TestAPIPrivateServ(t *testing.T) {
9292
results, err = private.ServCommand(ctx, deployKey.KeyID, "user15", "big_test_private_1", perm.AccessModeRead, "git-upload-pack", "")
9393
assert.NoError(t, err)
9494
assert.False(t, results.IsWiki)
95-
assert.True(t, results.IsDeployKey)
95+
assert.NotZero(t, results.DeployKeyID)
9696
assert.Equal(t, deployKey.KeyID, results.KeyID)
9797
assert.Equal(t, "test-deploy", results.KeyName)
9898
assert.Equal(t, "user15", results.UserName)
@@ -129,7 +129,7 @@ func TestAPIPrivateServ(t *testing.T) {
129129
results, err = private.ServCommand(ctx, deployKey.KeyID, "user15", "big_test_private_2", perm.AccessModeRead, "git-upload-pack", "")
130130
assert.NoError(t, err)
131131
assert.False(t, results.IsWiki)
132-
assert.True(t, results.IsDeployKey)
132+
assert.NotZero(t, results.DeployKeyID)
133133
assert.Equal(t, deployKey.KeyID, results.KeyID)
134134
assert.Equal(t, "test-deploy", results.KeyName)
135135
assert.Equal(t, "user15", results.UserName)
@@ -142,7 +142,7 @@ func TestAPIPrivateServ(t *testing.T) {
142142
results, err = private.ServCommand(ctx, deployKey.KeyID, "user15", "big_test_private_2", perm.AccessModeWrite, "git-upload-pack", "")
143143
assert.NoError(t, err)
144144
assert.False(t, results.IsWiki)
145-
assert.True(t, results.IsDeployKey)
145+
assert.NotZero(t, results.DeployKeyID)
146146
assert.Equal(t, deployKey.KeyID, results.KeyID)
147147
assert.Equal(t, "test-deploy", results.KeyName)
148148
assert.Equal(t, "user15", results.UserName)

integrations/repofiles_delete_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func testDeleteRepoFile(t *testing.T, u *url.URL) {
7777
test.LoadGitRepo(t, ctx)
7878
defer ctx.Repo.GitRepo.Close()
7979
repo := ctx.Repo.Repository
80-
doer := ctx.User
80+
doer := ctx.Doer
8181
opts := getDeleteRepoFileOptions(repo)
8282

8383
t.Run("Delete README.md file", func(t *testing.T) {
@@ -117,7 +117,7 @@ func testDeleteRepoFileWithoutBranchNames(t *testing.T, u *url.URL) {
117117
defer ctx.Repo.GitRepo.Close()
118118

119119
repo := ctx.Repo.Repository
120-
doer := ctx.User
120+
doer := ctx.Doer
121121
opts := getDeleteRepoFileOptions(repo)
122122
opts.OldBranch = ""
123123
opts.NewBranch = ""
@@ -147,7 +147,7 @@ func TestDeleteRepoFileErrors(t *testing.T) {
147147
defer ctx.Repo.GitRepo.Close()
148148

149149
repo := ctx.Repo.Repository
150-
doer := ctx.User
150+
doer := ctx.Doer
151151

152152
t.Run("Bad branch", func(t *testing.T) {
153153
opts := getDeleteRepoFileOptions(repo)

integrations/repofiles_update_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func TestCreateOrUpdateRepoFileForCreate(t *testing.T) {
194194
defer ctx.Repo.GitRepo.Close()
195195

196196
repo := ctx.Repo.Repository
197-
doer := ctx.User
197+
doer := ctx.Doer
198198
opts := getCreateRepoFileOptions(repo)
199199

200200
// test
@@ -230,7 +230,7 @@ func TestCreateOrUpdateRepoFileForUpdate(t *testing.T) {
230230
defer ctx.Repo.GitRepo.Close()
231231

232232
repo := ctx.Repo.Repository
233-
doer := ctx.User
233+
doer := ctx.Doer
234234
opts := getUpdateRepoFileOptions(repo)
235235

236236
// test
@@ -263,7 +263,7 @@ func TestCreateOrUpdateRepoFileForUpdateWithFileMove(t *testing.T) {
263263
defer ctx.Repo.GitRepo.Close()
264264

265265
repo := ctx.Repo.Repository
266-
doer := ctx.User
266+
doer := ctx.Doer
267267
opts := getUpdateRepoFileOptions(repo)
268268
opts.FromTreePath = "README.md"
269269
opts.TreePath = "README_new.md" // new file name, README_new.md
@@ -313,7 +313,7 @@ func TestCreateOrUpdateRepoFileWithoutBranchNames(t *testing.T) {
313313
defer ctx.Repo.GitRepo.Close()
314314

315315
repo := ctx.Repo.Repository
316-
doer := ctx.User
316+
doer := ctx.Doer
317317
opts := getUpdateRepoFileOptions(repo)
318318
opts.OldBranch = ""
319319
opts.NewBranch = ""
@@ -344,7 +344,7 @@ func TestCreateOrUpdateRepoFileErrors(t *testing.T) {
344344
defer ctx.Repo.GitRepo.Close()
345345

346346
repo := ctx.Repo.Repository
347-
doer := ctx.User
347+
doer := ctx.Doer
348348

349349
t.Run("bad branch", func(t *testing.T) {
350350
opts := getUpdateRepoFileOptions(repo)

models/asymkey/ssh_key_deploy.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (key *DeployKey) GetContent() error {
5858
return nil
5959
}
6060

61-
// IsReadOnly checks if the key can only be used for read operations
61+
// IsReadOnly checks if the key can only be used for read operations, used by template
6262
func (key *DeployKey) IsReadOnly() bool {
6363
return key.Mode == perm.AccessModeRead
6464
}
@@ -203,12 +203,6 @@ func UpdateDeployKeyCols(key *DeployKey, cols ...string) error {
203203
return err
204204
}
205205

206-
// UpdateDeployKey updates deploy key information.
207-
func UpdateDeployKey(key *DeployKey) error {
208-
_, err := db.GetEngine(db.DefaultContext).ID(key.ID).AllCols().Update(key)
209-
return err
210-
}
211-
212206
// ListDeployKeysOptions are options for ListDeployKeys
213207
type ListDeployKeysOptions struct {
214208
db.ListOptions

models/helper_environment.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const (
2323
EnvPusherName = "GITEA_PUSHER_NAME"
2424
EnvPusherEmail = "GITEA_PUSHER_EMAIL"
2525
EnvPusherID = "GITEA_PUSHER_ID"
26-
EnvKeyID = "GITEA_KEY_ID"
27-
EnvIsDeployKey = "GITEA_IS_DEPLOY_KEY"
26+
EnvKeyID = "GITEA_KEY_ID" // public key ID
27+
EnvDeployKeyID = "GITEA_DEPLOY_KEY_ID"
2828
EnvPRID = "GITEA_PR_ID"
2929
EnvIsInternal = "GITEA_INTERNAL_PUSH"
3030
EnvAppURL = "GITEA_ROOT_URL"

0 commit comments

Comments
 (0)