Skip to content

Commit 5b90bf0

Browse files
committed
Merge branch 'main' into deps-api
2 parents 8a586d0 + 7821370 commit 5b90bf0

File tree

541 files changed

+23183
-18312
lines changed

Some content is hidden

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

541 files changed

+23183
-18312
lines changed

.drone.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,6 @@ steps:
783783
from_secret: docker_password
784784
username:
785785
from_secret: docker_username
786-
environment:
787-
PLUGIN_MIRROR:
788-
from_secret: plugin_mirror
789786
when:
790787
event:
791788
exclude:
@@ -848,9 +845,6 @@ steps:
848845
from_secret: docker_password
849846
username:
850847
from_secret: docker_username
851-
environment:
852-
PLUGIN_MIRROR:
853-
from_secret: plugin_mirror
854848
when:
855849
event:
856850
exclude:
@@ -928,9 +922,6 @@ steps:
928922
from_secret: docker_password
929923
username:
930924
from_secret: docker_username
931-
environment:
932-
PLUGIN_MIRROR:
933-
from_secret: plugin_mirror
934925
when:
935926
event:
936927
exclude:
@@ -949,9 +940,6 @@ steps:
949940
from_secret: docker_password
950941
username:
951942
from_secret: docker_username
952-
environment:
953-
PLUGIN_MIRROR:
954-
from_secret: plugin_mirror
955943
when:
956944
event:
957945
exclude:
@@ -996,9 +984,6 @@ steps:
996984
from_secret: docker_password
997985
username:
998986
from_secret: docker_username
999-
environment:
1000-
PLUGIN_MIRROR:
1001-
from_secret: plugin_mirror
1002987
when:
1003988
event:
1004989
exclude:
@@ -1017,9 +1002,6 @@ steps:
10171002
from_secret: docker_password
10181003
username:
10191004
from_secret: docker_username
1020-
environment:
1021-
PLUGIN_MIRROR:
1022-
from_secret: plugin_mirror
10231005
when:
10241006
event:
10251007
exclude:

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/.eslintrc linguist-language=YAML
66
/.stylelintrc linguist-language=YAML
77
/web_src/fomantic/build/** linguist-generated
8+
Dockerfile.* linguist-language=Dockerfile

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.15.8](https://github.com/go-gitea/gitea/releases/tag/v1.15.8) - 2021-12-20
8+
9+
* BUGFIXES
10+
* Move POST /{username}/action/{action} to simply POST /{username} (#18045) (#18046)
11+
* Fix delete u2f keys bug (#18040) (#18042)
12+
* Reset Session ID on login (#18018) (#18041)
13+
* Prevent off-by-one error on comments on newly appended lines (#18029) (#18035)
14+
* Stop printing 03d after escaped characters in logs (#18030) (#18034)
15+
* Reset locale on login (#18023) (#18025)
16+
* Fix reset password email template (#17025) (#18022)
17+
* Fix outType on gitea dump (#18000) (#18016)
18+
* Ensure complexity, minlength and isPwned are checked on password setting (#18005) (#18015)
19+
* Fix rename notification bug (#18011)
20+
* Prevent double decoding of % in url params (#17997) (#18001)
21+
* Prevent hang in git cat-file if the repository is not a valid repository (Partial #17991) (#17992)
22+
* Prevent deadlock in create issue (#17970) (#17982)
23+
* TESTING
24+
* Use non-expiring key. (#17984) (#17985)
25+
726
## [1.15.7](https://github.com/go-gitea/gitea/releases/tag/v1.15.7) - 2021-12-01
827

928
* ENHANCEMENTS

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
###################################
3-
#Build stage
4-
FROM golang:1.17-alpine3.13 AS build-env
3+
#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image
4+
FROM techknowlogick/go:1.17-alpine3.13 AS build-env
55

66
ARG GOPROXY
77
ENV GOPROXY ${GOPROXY:-direct}

Dockerfile.rootless

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
###################################
3-
#Build stage
4-
FROM golang:1.17-alpine3.13 AS build-env
3+
#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image
4+
FROM techknowlogick/go:1.17-alpine3.13 AS build-env
55

66
ARG GOPROXY
77
ENV GOPROXY ${GOPROXY:-direct}

cmd/admin.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,36 @@ var (
299299
Name: "skip-local-2fa",
300300
Usage: "Set to true to skip local 2fa for users authenticated by this source",
301301
},
302+
cli.StringSliceFlag{
303+
Name: "scopes",
304+
Value: nil,
305+
Usage: "Scopes to request when to authenticate against this OAuth2 source",
306+
},
307+
cli.StringFlag{
308+
Name: "required-claim-name",
309+
Value: "",
310+
Usage: "Claim name that has to be set to allow users to login with this source",
311+
},
312+
cli.StringFlag{
313+
Name: "required-claim-value",
314+
Value: "",
315+
Usage: "Claim value that has to be set to allow users to login with this source",
316+
},
317+
cli.StringFlag{
318+
Name: "group-claim-name",
319+
Value: "",
320+
Usage: "Claim name providing group names for this source",
321+
},
322+
cli.StringFlag{
323+
Name: "admin-group",
324+
Value: "",
325+
Usage: "Group Claim value for administrator users",
326+
},
327+
cli.StringFlag{
328+
Name: "restricted-group",
329+
Value: "",
330+
Usage: "Group Claim value for restricted users",
331+
},
302332
}
303333

304334
microcmdAuthUpdateOauth = cli.Command{
@@ -349,6 +379,10 @@ func runChangePassword(c *cli.Context) error {
349379
if err := initDB(ctx); err != nil {
350380
return err
351381
}
382+
if len(c.String("password")) < setting.MinPasswordLength {
383+
return fmt.Errorf("Password is not long enough. Needs to be at least %d", setting.MinPasswordLength)
384+
}
385+
352386
if !pwd.IsComplexEnough(c.String("password")) {
353387
return errors.New("Password does not meet complexity requirements")
354388
}
@@ -649,6 +683,12 @@ func parseOAuth2Config(c *cli.Context) *oauth2.Source {
649683
CustomURLMapping: customURLMapping,
650684
IconURL: c.String("icon-url"),
651685
SkipLocalTwoFA: c.Bool("skip-local-2fa"),
686+
Scopes: c.StringSlice("scopes"),
687+
RequiredClaimName: c.String("required-claim-name"),
688+
RequiredClaimValue: c.String("required-claim-value"),
689+
GroupClaimName: c.String("group-claim-name"),
690+
AdminGroup: c.String("admin-group"),
691+
RestrictedGroup: c.String("restricted-group"),
652692
}
653693
}
654694

@@ -711,6 +751,28 @@ func runUpdateOauth(c *cli.Context) error {
711751
oAuth2Config.IconURL = c.String("icon-url")
712752
}
713753

754+
if c.IsSet("scopes") {
755+
oAuth2Config.Scopes = c.StringSlice("scopes")
756+
}
757+
758+
if c.IsSet("required-claim-name") {
759+
oAuth2Config.RequiredClaimName = c.String("required-claim-name")
760+
761+
}
762+
if c.IsSet("required-claim-value") {
763+
oAuth2Config.RequiredClaimValue = c.String("required-claim-value")
764+
}
765+
766+
if c.IsSet("group-claim-name") {
767+
oAuth2Config.GroupClaimName = c.String("group-claim-name")
768+
}
769+
if c.IsSet("admin-group") {
770+
oAuth2Config.AdminGroup = c.String("admin-group")
771+
}
772+
if c.IsSet("restricted-group") {
773+
oAuth2Config.RestrictedGroup = c.String("restricted-group")
774+
}
775+
714776
// update custom URL mapping
715777
var customURLMapping = &oauth2.CustomURLMapping{}
716778

cmd/dump.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/urfave/cli"
2626
)
2727

28-
func addFile(w archiver.Writer, filePath string, absPath string, verbose bool) error {
28+
func addFile(w archiver.Writer, filePath, absPath string, verbose bool) error {
2929
if verbose {
3030
log.Info("Adding file %s\n", filePath)
3131
}
@@ -48,7 +48,7 @@ func addFile(w archiver.Writer, filePath string, absPath string, verbose bool) e
4848
})
4949
}
5050

51-
func isSubdir(upper string, lower string) (bool, error) {
51+
func isSubdir(upper, lower string) (bool, error) {
5252
if relPath, err := filepath.Rel(upper, lower); err != nil {
5353
return false, err
5454
} else if relPath == "." || !strings.HasPrefix(relPath, ".") {
@@ -86,7 +86,7 @@ func (o outputType) String() string {
8686
}
8787

8888
var outputTypeEnum = &outputType{
89-
Enum: []string{"zip", "tar", "tar.gz", "tar.xz", "tar.bz2"},
89+
Enum: []string{"zip", "rar", "tar", "sz", "tar.gz", "tar.xz", "tar.bz2", "tar.br", "tar.lz4"},
9090
Default: "zip",
9191
}
9292

@@ -152,12 +152,16 @@ func fatal(format string, args ...interface{}) {
152152
func runDump(ctx *cli.Context) error {
153153
var file *os.File
154154
fileName := ctx.String("file")
155+
outType := ctx.String("type")
155156
if fileName == "-" {
156157
file = os.Stdout
157158
err := log.DelLogger("console")
158159
if err != nil {
159160
fatal("Deleting default logger failed. Can not write to stdout: %v", err)
160161
}
162+
} else {
163+
fileName = strings.TrimSuffix(fileName, path.Ext(fileName))
164+
fileName += "." + outType
161165
}
162166
setting.LoadFromExisting()
163167

@@ -200,7 +204,6 @@ func runDump(ctx *cli.Context) error {
200204
}
201205

202206
verbose := ctx.Bool("verbose")
203-
outType := ctx.String("type")
204207
var iface interface{}
205208
if fileName == "-" {
206209
iface, err = archiver.ByExtension(fmt.Sprintf(".%s", outType))

cmd/migrate_storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func migrateAvatars(dstStorage storage.ObjectStorage) error {
102102
}
103103

104104
func migrateRepoAvatars(dstStorage storage.ObjectStorage) error {
105-
return models.IterateRepository(func(repo *repo_model.Repository) error {
105+
return repo_model.IterateRepository(func(repo *repo_model.Repository) error {
106106
_, err := storage.Copy(dstStorage, repo.CustomAvatarRelativePath(), storage.RepoAvatars, repo.CustomAvatarRelativePath())
107107
return err
108108
})
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dashboards_out
2+
vendor
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
JSONNET_FMT := jsonnetfmt -n 2 --max-blank-lines 1 --string-style s --comment-style s
2+
3+
.PHONY: all
4+
all: build dashboards_out
5+
6+
vendor: jsonnetfile.json
7+
jb install
8+
9+
.PHONY: build
10+
build: vendor
11+
12+
.PHONY: fmt
13+
fmt:
14+
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
15+
xargs -n 1 -- $(JSONNET_FMT) -i
16+
17+
.PHONY: lint
18+
lint: build
19+
find . -name 'vendor' -prune -o -name '*.libsonnet' -print -o -name '*.jsonnet' -print | \
20+
while read f; do \
21+
$(JSONNET_FMT) "$$f" | diff -u "$$f" -; \
22+
done
23+
mixtool lint mixin.libsonnet
24+
25+
dashboards_out: mixin.libsonnet config.libsonnet $(wildcard dashboards/*)
26+
@mkdir -p dashboards_out
27+
jsonnet -J vendor -m dashboards_out lib/dashboards.jsonnet
28+
29+
.PHONY: clean
30+
clean:
31+
rm -rf dashboards_out
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Gitea Mixin
2+
3+
Gitea Mixin is a set of configurable Grafana dashboards based on the metrics exported by the Gitea built-in metrics endpoint.
4+
5+
## Generate config files
6+
7+
You can manually generate dashboards, but first you should install some tools:
8+
9+
```bash
10+
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
11+
go install github.com/google/go-jsonnet/cmd/jsonnet@latest
12+
# or in brew: brew install go-jsonnet
13+
```
14+
15+
For linting and formatting, you would also need `mixtool` and `jsonnetfmt` installed. If you
16+
have a working Go development environment, it's easiest to run the following:
17+
18+
```bash
19+
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest
20+
go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
21+
```
22+
23+
The files in `dashboards_out` need to be imported
24+
into your Grafana server. The exact details will be depending on your environment.
25+
26+
Edit `config.libsonnet` if required and then build JSON dashboard files for Grafana:
27+
28+
```bash
29+
make
30+
```
31+
32+
For more advanced uses of mixins, see
33+
https://github.com/monitoring-mixins/docs.

0 commit comments

Comments
 (0)