Skip to content

Commit

Permalink
Merge remote-tracking branch 'giteaofficial/main'
Browse files Browse the repository at this point in the history
* giteaofficial/main:
  Add fix incorrect can_create_org_repo for org owner team (go-gitea#26683)
  [skip ci] Updated translations via Crowdin
  Improve modal dialog UI (go-gitea#26764)
  Improve the "bug report" template and "support options" document (go-gitea#26753)
  Unify `border-radius` behavior (go-gitea#26770)
  Reduce some allocations in type conversion (go-gitea#26772)
  Refactor some CSS styles and simplify code (go-gitea#26771)
  Add auth-required to config.json for Cargo http registry (go-gitea#26729)
  refactor(API): refactor secret creation and update functionality (go-gitea#26751)
  • Loading branch information
zjjhot committed Aug 29, 2023
2 parents bc79ffa + 60ca3d0 commit 764a683
Show file tree
Hide file tree
Showing 41 changed files with 493 additions and 331 deletions.
9 changes: 3 additions & 6 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug Report
description: Found something you weren't expecting? Report it here!
labels: kind/bug
labels: ["kind/bug"]
body:
- type: markdown
attributes:
Expand All @@ -15,11 +15,8 @@ body:
3. Make sure you are using the latest release and
take a moment to check that your issue hasn't been reported before.
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
5. Please give all relevant information below for bug reports, because
5. It's really important to provide pertinent details and logs (https://docs.gitea.com/help/support),
incomplete details will be handled as an invalid report.
6. In particular it's really important to provide pertinent logs. You must give us DEBUG level logs.
Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
- type: textarea
id: description
attributes:
Expand Down Expand Up @@ -89,6 +86,6 @@ body:
description: What database system are you running?
options:
- PostgreSQL
- MySQL
- MySQL/MariaDB
- MSSQL
- SQLite
67 changes: 45 additions & 22 deletions docs/content/help/support.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,57 @@ menu:
- [Discourse Forum](https://discourse.gitea.io/)
- [Matrix](https://matrix.to/#/#gitea-space:matrix.org)
- NOTE: Most of the Matrix channels are bridged with their counterpart in Discord and may experience some degree of flakiness with the bridge process.
- Chinese Support
- [Discourse Chinese Category](https://discourse.gitea.io/c/5-category/5)
- QQ Group 328432459

# Bug Report

If you found a bug, please [create an issue on GitHub](https://github.com/go-gitea/gitea/issues).

**NOTE:** When asking for support, it may be a good idea to have the following available so that the person helping has all the info they need:

1. Your `app.ini` (with any sensitive data scrubbed as necessary).
2. The Gitea logs, and any other appropriate log files for the situation.
- When using systemd, use `journalctl --lines 1000 --unit gitea` to collect logs.
- When using docker, use `docker logs --tail 1000 <gitea-container>` to collect logs.
- By default, the logs are outputted to console. If you need to collect logs from files,
you could copy the following config into your `app.ini` (remove all other `[log]` sections),
then you can find the `*.log` files in Gitea's log directory (default: `%(GITEA_WORK_DIR)/log`).

```ini
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
[log]
LEVEL=debug
MODE=console,file
```

3. Any error messages you are seeing.
4. When possible, try to replicate the issue on [try.gitea.io](https://try.gitea.io) and include steps so that others can reproduce the issue.
- This will greatly improve the chance that the root of the issue can be quickly discovered and resolved.
5. If you encounter slow/hanging/deadlock problems, please report the stack trace when the problem occurs.
2. Any error messages you are seeing.
3. The Gitea logs, and all other related logs for the situation.
- It's more useful to collect `trace` / `debug` level logs (see the next section).
- When using systemd, use `journalctl --lines 1000 --unit gitea` to collect logs.
- When using docker, use `docker logs --tail 1000 <gitea-container>` to collect logs.
4. Reproducible steps so that others could reproduce and understand the problem more quickly and easily.
- [try.gitea.io](https://try.gitea.io) could be used to reproduce the problem.
5. If you encounter slow/hanging/deadlock problems, please report the stacktrace when the problem occurs.
Go to the "Site Admin" -> "Monitoring" -> "Stacktrace" -> "Download diagnosis report".

## Bugs
# Advanced Bug Report Tips

## More Config Options for Logs

By default, the logs are outputted to console with `info` level.
If you need to set log level and/or collect logs from files,
you could just copy the following config into your `app.ini` (remove all other `[log]` sections),
then you will find the `*.log` files in Gitea's log directory (default: `%(GITEA_WORK_DIR)/log`).

```ini
; To show all SQL logs, you can also set LOG_SQL=true in the [database] section
[log]
LEVEL=debug
MODE=console,file
```

If you found a bug, please create an [issue on GitHub](https://github.com/go-gitea/gitea/issues).
## Collecting Stacktrace by Command Line

Gitea could use Golang's pprof handler and toolchain to collect stacktrace and other runtime information.

If the web UI stops working, you could try to collect the stacktrace by command line:

1. Set `app.ini`:

```
[server]
ENABLE_PPROF = true
```

## Chinese Support
2. Restart Gitea

Support for the Chinese language is provided at [Our discourse](https://discourse.gitea.io/c/5-category/5) or QQ Group 328432459.
3. Try to trigger the bug, when the requests get stuck for a while,
use `curl` or browser to visit: `http://127.0.0.1:6060/debug/pprof/goroutine?debug=1` to get the stacktrace.
61 changes: 61 additions & 0 deletions modules/doctor/fix8312.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package doctor

import (
"context"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
org_model "code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/models/perm"
"code.gitea.io/gitea/modules/log"

"xorm.io/builder"
)

func fixOwnerTeamCreateOrgRepo(ctx context.Context, logger log.Logger, autofix bool) error {
count := 0

err := db.Iterate(
ctx,
builder.Eq{"authorize": perm.AccessModeOwner, "can_create_org_repo": false},
func(ctx context.Context, team *org_model.Team) error {
team.CanCreateOrgRepo = true
count++

if !autofix {
return nil
}

return models.UpdateTeam(team, false, false)
},
)
if err != nil {
logger.Critical("Unable to iterate across repounits to fix incorrect can_create_org_repo: Error %v", err)
return err
}

if !autofix {
if count == 0 {
logger.Info("Found no team with incorrect can_create_org_repo")
} else {
logger.Warn("Found %d teams with incorrect can_create_org_repo", count)
}
return nil
}
logger.Info("Fixed %d teams with incorrect can_create_org_repo", count)

return nil
}

func init() {
Register(&Check{
Title: "Check for incorrect can_create_org_repo for org owner teams",
Name: "fix-owner-team-create-org-repo",
IsDefault: false,
Run: fixOwnerTeamCreateOrgRepo,
Priority: 7,
})
}
2 changes: 1 addition & 1 deletion modules/log/event_writer_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (b *EventWriterBaseImpl) Run(ctx context.Context) {

if exprRegexp != nil {
fileLineCaller := fmt.Sprintf("%s:%d:%s", event.Origin.Filename, event.Origin.Line, event.Origin.Caller)
matched := exprRegexp.Match([]byte(fileLineCaller)) || exprRegexp.Match([]byte(event.Origin.MsgSimpleText))
matched := exprRegexp.MatchString(fileLineCaller) || exprRegexp.MatchString(event.Origin.MsgSimpleText)
if !matched {
continue
}
Expand Down
16 changes: 2 additions & 14 deletions modules/structs/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,9 @@ type Secret struct {
Created time.Time `json:"created_at"`
}

// CreateSecretOption options when creating secret
// CreateOrUpdateSecretOption options when creating or updating secret
// swagger:model
type CreateSecretOption struct {
// Name of the secret to create
//
// required: true
// unique: true
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
// Data of the secret to create
Data string `json:"data" binding:"Required"`
}

// UpdateSecretOption options when updating secret
// swagger:model
type UpdateSecretOption struct {
type CreateOrUpdateSecretOption struct {
// Data of the secret to update
//
// required: true
Expand Down
Loading

0 comments on commit 764a683

Please sign in to comment.