Skip to content

Commit 6793e8d

Browse files
committed
Merge branch 'master' into protect-branch-signed-commits-only
2 parents 50cf492 + 1751d5f commit 6793e8d

Some content is hidden

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

42 files changed

+504
-217
lines changed

.drone.yml

Lines changed: 88 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
1+
---
2+
kind: pipeline
3+
name: compliance
4+
5+
platform:
6+
os: linux
7+
arch: arm64
8+
9+
workspace:
10+
base: /go
11+
path: src/code.gitea.io/gitea
12+
13+
steps:
14+
- name: pre-build
15+
pull: always
16+
image: node:10 # this step is kept at the lowest version of node that we support
17+
commands:
18+
- make css
19+
- make js
20+
21+
- name: build-without-gcc
22+
pull: always
23+
image: golang:1.11 # this step is kept as the lowest version of golang that we support
24+
environment:
25+
GO111MODULE: on
26+
GOPROXY: off
27+
commands:
28+
- go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag
29+
30+
- name: build-linux-386
31+
pull: always
32+
image: golang:1.13
33+
environment:
34+
GO111MODULE: on
35+
GOPROXY: off
36+
GOOS: linux
37+
GOARCH: 386
38+
commands:
39+
- go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit
40+
41+
- name: check
42+
pull: always
43+
image: golang:1.13
44+
commands:
45+
- make clean
46+
- make golangci-lint
47+
- make revive
48+
- make swagger-check
49+
- make swagger-validate
50+
- make test-vendor
51+
environment:
52+
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
53+
GOSUMDB: sum.golang.org
54+
TAGS: bindata sqlite sqlite_unlock_notify
55+
156
---
257
kind: pipeline
358
name: testing
@@ -54,46 +109,11 @@ steps:
54109
exclude:
55110
- pull_request
56111

57-
- name: pre-build
58-
pull: always
59-
image: node:10 # this step is kept at the lowest version of node that we support
60-
commands:
61-
- make css
62-
- make js
63-
64-
- name: build-without-gcc
65-
pull: always
66-
image: golang:1.11 # this step is kept as the lowest version of golang that we support
67-
environment:
68-
GO111MODULE: on
69-
GOPROXY: off
70-
commands:
71-
- curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
72-
- go build -mod=vendor -o gitea_no_gcc # test if build succeeds without the sqlite tag
73-
74-
- name: build-linux-386
75-
pull: always
76-
image: golang:1.13
77-
environment:
78-
GO111MODULE: on
79-
GOPROXY: off
80-
GOOS: linux
81-
GOARCH: 386
82-
commands:
83-
- curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
84-
- go build -mod=vendor -o gitea_linux_386 # test if compatible with 32 bit
85-
86112
- name: build
87113
pull: always
88114
image: golang:1.13
89115
commands:
90116
- curl -sL https://deb.nodesource.com/setup_12.x | bash - && apt -y install nodejs
91-
- make clean
92-
- make golangci-lint
93-
- make revive
94-
- make swagger-check
95-
- make swagger-validate
96-
- make test-vendor
97117
- make build
98118
environment:
99119
GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not
@@ -108,8 +128,6 @@ steps:
108128
environment:
109129
GOPROXY: off
110130
TAGS: bindata sqlite sqlite_unlock_notify
111-
depends_on:
112-
- build
113131
when:
114132
branch:
115133
- master
@@ -125,8 +143,6 @@ steps:
125143
environment:
126144
GOPROXY: off
127145
TAGS: bindata sqlite sqlite_unlock_notify
128-
depends_on:
129-
- build
130146
when:
131147
branch:
132148
- "release/*"
@@ -578,7 +594,7 @@ steps:
578594

579595
---
580596
kind: pipeline
581-
name: docker-linux-amd64
597+
name: docker-linux-amd64-release
582598

583599
platform:
584600
os: linux
@@ -595,31 +611,13 @@ trigger:
595611
ref:
596612
- refs/heads/master
597613
- "refs/tags/**"
598-
- "refs/pull/**"
599614

600615
steps:
601616
- name: fetch-tags
602617
pull: default
603618
image: docker:git
604619
commands:
605620
- git fetch --tags --force
606-
when:
607-
event:
608-
exclude:
609-
- pull_request
610-
611-
- name: dryrun
612-
pull: always
613-
image: plugins/docker:linux-amd64
614-
settings:
615-
dry_run: true
616-
repo: gitea/gitea
617-
tags: linux-amd64
618-
build_args:
619-
- GOPROXY=off
620-
when:
621-
event:
622-
- pull_request
623621

624622
- name: publish
625623
pull: always
@@ -641,7 +639,7 @@ steps:
641639

642640
---
643641
kind: pipeline
644-
name: docker-linux-arm64
642+
name: docker-linux-arm64-dry-run
645643

646644
platform:
647645
os: linux
@@ -652,25 +650,13 @@ workspace:
652650
path: src/code.gitea.io/gitea
653651

654652
depends_on:
655-
- testing
653+
- compliance
656654

657655
trigger:
658656
ref:
659-
- refs/heads/master
660-
- "refs/tags/**"
661657
- "refs/pull/**"
662658

663659
steps:
664-
- name: fetch-tags
665-
pull: default
666-
image: docker:git
667-
commands:
668-
- git fetch --tags --force
669-
when:
670-
event:
671-
exclude:
672-
- pull_request
673-
674660
- name: dryrun
675661
pull: always
676662
image: plugins/docker:linux-arm64
@@ -684,6 +670,32 @@ steps:
684670
event:
685671
- pull_request
686672

673+
---
674+
kind: pipeline
675+
name: docker-linux-arm64-release
676+
677+
platform:
678+
os: linux
679+
arch: arm64
680+
681+
workspace:
682+
base: /go
683+
path: src/code.gitea.io/gitea
684+
685+
depends_on:
686+
- testing
687+
688+
trigger:
689+
ref:
690+
- refs/heads/master
691+
- "refs/tags/**"
692+
steps:
693+
- name: fetch-tags
694+
pull: default
695+
image: docker:git
696+
commands:
697+
- git fetch --tags --force
698+
687699
- name: publish
688700
pull: always
689701
image: plugins/docker:linux-arm64
@@ -729,8 +741,8 @@ trigger:
729741
- "refs/tags/**"
730742

731743
depends_on:
732-
- docker-linux-amd64
733-
- docker-linux-arm64
744+
- docker-linux-amd64-release
745+
- docker-linux-arm64-release
734746

735747
---
736748
kind: pipeline
@@ -757,8 +769,8 @@ depends_on:
757769
- translations
758770
- release-version
759771
- release-master
760-
- docker-linux-amd64
761-
- docker-linux-arm64
772+
- docker-linux-amd64-release
773+
- docker-linux-arm64-release
762774
- docker-manifest
763775
- docs
764776

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
package-lock=true
12
save-exact=true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,6 @@ pr:
534534
golangci-lint:
535535
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
536536
export BINARY="golangci-lint"; \
537-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.22.2; \
537+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.20.0; \
538538
fi
539539
golangci-lint run --timeout 5m

docs/content/doc/help/faq.en-us.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Also see [Support Options]({{< relref "doc/help/seek-help.en-us.md" >}})
3131
* [Only allow certain email domains](#only-allow-certain-email-domains)
3232
* [Only allow/block certain OpenID providers](#only-allow-block-certain-openid-providers)
3333
* [Issue only users](#issue-only-users)
34+
* [Restricted users](#restricted-users)
3435
* [Enable Fail2ban](#enable-fail2ban)
3536
* [Adding custom themes](#how-to-add-use-custom-themes)
3637
* [SSHD vs built-in SSH](#sshd-vs-built-in-ssh)
@@ -147,6 +148,14 @@ You can configure `WHITELISTED_URIS` or `BLACKLISTED_URIS` under `[openid]` in y
147148
### Issue only users
148149
The current way to achieve this is to create/modify a user with a max repo creation limit of 0.
149150

151+
### Restricted users
152+
Restricted users are limited to a subset of the content based on their organization/team memberships and collaborations, ignoring the public flag on organizations/repos etc.__
153+
154+
Example use case: A company runs a Gitea instance that requires login. Most repos are public (accessible/browseable by all co-workers).
155+
156+
At some point, a customer or third party needs access to a specific repo and only that repo. Making such a customer account restricted and granting any needed access using team membership(s) and/or collaboration(s) is a simple way to achieve that without the need to make everything private.
157+
158+
150159
### Enable Fail2ban
151160

152161
Use [Fail2Ban]({{ relref "doc/usage/fail2ban-setup.md" >}}) to monitor and stop automated login attempts or other malicious behavior based on log patterns

integrations/api_comment_test.go

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package integrations
77
import (
88
"fmt"
99
"net/http"
10+
"net/url"
1011
"testing"
1112

1213
"code.gitea.io/gitea/models"
@@ -25,18 +26,40 @@ func TestAPIListRepoComments(t *testing.T) {
2526
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
2627

2728
session := loginUser(t, repoOwner.Name)
28-
req := NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues/comments",
29-
repoOwner.Name, repo.Name)
29+
link, _ := url.Parse(fmt.Sprintf("/api/v1/repos/%s/%s/issues/comments", repoOwner.Name, repo.Name))
30+
req := NewRequest(t, "GET", link.String())
3031
resp := session.MakeRequest(t, req, http.StatusOK)
3132

3233
var apiComments []*api.Comment
3334
DecodeJSON(t, resp, &apiComments)
35+
assert.Len(t, apiComments, 2)
3436
for _, apiComment := range apiComments {
3537
c := &models.Comment{ID: apiComment.ID}
3638
models.AssertExistsAndLoadBean(t, c,
3739
models.Cond("type = ?", models.CommentTypeComment))
3840
models.AssertExistsAndLoadBean(t, &models.Issue{ID: c.IssueID, RepoID: repo.ID})
3941
}
42+
43+
//test before and since filters
44+
query := url.Values{}
45+
before := "2000-01-01T00:00:11+00:00" //unix: 946684811
46+
since := "2000-01-01T00:00:12+00:00" //unix: 946684812
47+
query.Add("before", before)
48+
link.RawQuery = query.Encode()
49+
req = NewRequest(t, "GET", link.String())
50+
resp = session.MakeRequest(t, req, http.StatusOK)
51+
DecodeJSON(t, resp, &apiComments)
52+
assert.Len(t, apiComments, 1)
53+
assert.EqualValues(t, 2, apiComments[0].ID)
54+
55+
query.Del("before")
56+
query.Add("since", since)
57+
link.RawQuery = query.Encode()
58+
req = NewRequest(t, "GET", link.String())
59+
resp = session.MakeRequest(t, req, http.StatusOK)
60+
DecodeJSON(t, resp, &apiComments)
61+
assert.Len(t, apiComments, 1)
62+
assert.EqualValues(t, 3, apiComments[0].ID)
4063
}
4164

4265
func TestAPIListIssueComments(t *testing.T) {

0 commit comments

Comments
 (0)