mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-21 17:41:16 +02:00
Compare commits
328 Commits
v1.7.6
...
v1.8.0-rc2
Author | SHA1 | Date | |
---|---|---|---|
|
73ce02400c | ||
|
197cbd674d | ||
|
4a0f7c1eb4 | ||
|
e54f7a708c | ||
|
63f6764dce | ||
|
0bf7ed55be | ||
|
93e8174e4e | ||
|
c5ec66a8a3 | ||
|
b6fb082b78 | ||
|
3ce195115b | ||
|
00619a04f7 | ||
|
16815306ad | ||
|
3934d9cd2f | ||
|
6a6656ae44 | ||
|
ca46385637 | ||
|
c151682fae | ||
|
82fbc82b63 | ||
|
d78bb1d564 | ||
|
cd8cdbd9d2 | ||
|
1155f1b02d | ||
|
4a6b011b15 | ||
|
b3ad5eb414 | ||
|
379289639e | ||
|
faf446b372 | ||
|
e558f83407 | ||
|
4f74bad783 | ||
|
c55bdca562 | ||
|
583968f274 | ||
|
7780ea8890 | ||
|
d7542bfde3 | ||
|
91775c1125 | ||
|
202a8f6ed9 | ||
|
b2e9894988 | ||
|
663874e8be | ||
|
50631b5ac3 | ||
|
7c205607b5 | ||
|
f9627ede3c | ||
|
4334fe754e | ||
|
2315019fef | ||
|
e0eb6514d2 | ||
|
dbab98c8e0 | ||
|
e836b8869b | ||
|
f5cf9a8355 | ||
|
8fffb06168 | ||
|
8211e01d9e | ||
|
f7ffb190c6 | ||
|
96f1720d69 | ||
|
5c69e31c22 | ||
|
062de8e86f | ||
|
bd4be434ff | ||
|
489419c330 | ||
|
e777c6bdc6 | ||
|
9d3732dfd5 | ||
|
9fd8b2621f | ||
|
f2de5dc8c8 | ||
|
01bd1fcd33 | ||
|
020075e12f | ||
|
ad86b843e1 | ||
|
608781f880 | ||
|
6460cff222 | ||
|
f80caa5a8c | ||
|
b257e0456b | ||
|
4512634604 | ||
|
f066bd2b3f | ||
|
19862699cd | ||
|
141c58f5a6 | ||
|
8e202e28ad | ||
|
a5604b1611 | ||
|
b28e527a2b | ||
|
afdc0ca41d | ||
|
c01fb4d09e | ||
|
8e266c3193 | ||
|
4a2e92bcd1 | ||
|
4b7237b63e | ||
|
1cf3fc3bc5 | ||
|
c812ba7f87 | ||
|
48c101affe | ||
|
525f03306f | ||
|
25b6496f48 | ||
|
7548037a64 | ||
|
b1ffe7e47b | ||
|
a1214978b3 | ||
|
6cc11eccac | ||
|
b03d780ccb | ||
|
1142632f1a | ||
|
7afe81f28e | ||
|
594f591691 | ||
|
795f6e04ad | ||
|
d8d24a5619 | ||
|
28fcbf33dc | ||
|
15ecc08475 | ||
|
05143768d0 | ||
|
035c82aec4 | ||
|
4a2fbbeb10 | ||
|
134e55510e | ||
|
df30010dbd | ||
|
3b61ff1895 | ||
|
994b1be9d1 | ||
|
477ef46251 | ||
|
0751153613 | ||
|
eaf9ded182 | ||
|
eea1155afe | ||
|
d26d249748 | ||
|
2982413f8d | ||
|
fc14344acb | ||
|
41fbaaba78 | ||
|
ba0749b7db | ||
|
987a521e2f | ||
|
830ae61456 | ||
|
094263db4d | ||
|
ff2be17e3f | ||
|
f5fa22a499 | ||
|
538a26d56f | ||
|
b79820f610 | ||
|
44114b38e6 | ||
|
64ce159a6e | ||
|
ae3a913122 | ||
|
22770c324d | ||
|
a380cfd8e0 | ||
|
11e316654e | ||
|
8d3bb86e20 | ||
|
5e7dee0db5 | ||
|
0b72c00fad | ||
|
8c8ac1a162 | ||
|
e456fc0110 | ||
|
ec540294a1 | ||
|
7ae59567a2 | ||
|
18d0662bdd | ||
|
7a72aa623e | ||
|
f2256d9881 | ||
|
23414ac2a1 | ||
|
7f38e2d0de | ||
|
2a03e96bce | ||
|
296814e887 | ||
|
fc038caa69 | ||
|
48a9025346 | ||
|
7884353a04 | ||
|
baffea1ddb | ||
|
9eb00fed13 | ||
|
353282e658 | ||
|
d0cb5aa9f9 | ||
|
c71c28eab8 | ||
|
9d8178b3ac | ||
|
c0adb5ea8b | ||
|
820e28c904 | ||
|
9e8cc3b18d | ||
|
681345dc99 | ||
|
3a33742e38 | ||
|
d252d4eb8c | ||
|
8c865f3ce8 | ||
|
11a9ce6a2b | ||
|
c3d8fb73dc | ||
|
db58dbabfc | ||
|
ba91214633 | ||
|
7fb09f035a | ||
|
2e85e70e38 | ||
|
f60b1d8fe2 | ||
|
4c5b585a6f | ||
|
6606d650fa | ||
|
f51e7ed18e | ||
|
01bbf5ea69 | ||
|
2d213b64d1 | ||
|
06a1739553 | ||
|
9dfdf80af0 | ||
|
cc48c12d8f | ||
|
44d6a904d3 | ||
|
da1edbfb79 | ||
|
0c840a924a | ||
|
ad059fdbbc | ||
|
0c721fe016 | ||
|
f286a5abb4 | ||
|
3b7f41f9f7 | ||
|
4a747aef7b | ||
|
acaf5c96fe | ||
|
c20034be31 | ||
|
2ec9bf9048 | ||
|
1772893505 | ||
|
9de871a0f8 | ||
|
bf4badad1d | ||
|
680a57ce92 | ||
|
5390791224 | ||
|
5bd594c858 | ||
|
024871ade6 | ||
|
f21ae12abb | ||
|
24a36e84cc | ||
|
01c10a951b | ||
|
634cbaad2b | ||
|
746cf22d8a | ||
|
13c0f7dfff | ||
|
2902b3a68c | ||
|
f81c6cc2a9 | ||
|
ecefa9e724 | ||
|
3d91bb2f2d | ||
|
67567eff0e | ||
|
12ee544411 | ||
|
af22df8314 | ||
|
f9d4bd53e6 | ||
|
1219d46b02 | ||
|
3a7306945c | ||
|
98feb0ef4d | ||
|
bbad9b6178 | ||
|
0823791d17 | ||
|
ca00ca8ee4 | ||
|
0f295ababa | ||
|
80098bd752 | ||
|
57a69ef277 | ||
|
6dc2f401c9 | ||
|
7933a950d0 | ||
|
fada6968a8 | ||
|
8b5f6ced22 | ||
|
a967cf9e99 | ||
|
16678f5255 | ||
|
c62c0b669a | ||
|
2569363204 | ||
|
002e898bcf | ||
|
036964b4a7 | ||
|
8917d66571 | ||
|
bc748f205a | ||
|
573650877c | ||
|
3568d426fe | ||
|
7461c5a75f | ||
|
56415fa2fc | ||
|
bf47f70c3b | ||
|
5f4a40c4a3 | ||
|
182a6d6885 | ||
|
34a1c4c514 | ||
|
7e8242ddb1 | ||
|
2d8520d039 | ||
|
84076211b3 | ||
|
b8a81cb1b8 | ||
|
a757920f4e | ||
|
8510ac2687 | ||
|
ac766fe3de | ||
|
8656a3c62d | ||
|
d663930023 | ||
|
6b0c2e9e35 | ||
|
892bfd0b19 | ||
|
9a137faaaf | ||
|
62da3bee1a | ||
|
d6c229cdbe | ||
|
4aa2f4f45f | ||
|
44371b96f5 | ||
|
cd83c2ca05 | ||
|
ec31ee1c1c | ||
|
88aa70bab9 | ||
|
386e5312a4 | ||
|
3b364029f7 | ||
|
331c9120e8 | ||
|
1b90692844 | ||
|
b9f87376a2 | ||
|
904188ce9c | ||
|
0b510725c9 | ||
|
6ad834e236 | ||
|
7d434376f1 | ||
|
075649572d | ||
|
6a949af8ca | ||
|
4de2bd06da | ||
|
2d9456137e | ||
|
832bf218ec | ||
|
e1fcd6b742 | ||
|
8a92544a3e | ||
|
b80d6490f3 | ||
|
f631702299 | ||
|
dbb4aeead9 | ||
|
b0fbefc76b | ||
|
71c832e043 | ||
|
fba1f14779 | ||
|
1bb22b2b47 | ||
|
f54e0d2f16 | ||
|
6f194b83c6 | ||
|
6822a8993b | ||
|
c212c98463 | ||
|
905e63f5b5 | ||
|
ac0d5517f4 | ||
|
65b6ebf243 | ||
|
af45648e26 | ||
|
41f19e1a38 | ||
|
47ca1060dd | ||
|
b0478f1c42 | ||
|
ec9331510c | ||
|
7d65ddf5e1 | ||
|
07802a2bc5 | ||
|
9edc829c17 | ||
|
82e08a3364 | ||
|
477a80f658 | ||
|
5ac6da3c41 | ||
|
734834a676 | ||
|
c2dcb35148 | ||
|
19e651c0dd | ||
|
5d384c943f | ||
|
44759fd66c | ||
|
ca3b9aa6a3 | ||
|
1ac8f6fb83 | ||
|
270fa6d63b | ||
|
5a081c7a80 | ||
|
bd75965296 | ||
|
6868378673 | ||
|
656456441c | ||
|
5c44f751a3 | ||
|
beab2df122 | ||
|
e5228b8369 | ||
|
9e9d1b8f95 | ||
|
2b36bdd490 | ||
|
bf7a11254d | ||
|
f59bfe893a | ||
|
abb364f442 | ||
|
6630a33ec1 | ||
|
915278f237 | ||
|
31aa00fa4b | ||
|
dd13327382 | ||
|
0b84b5ee49 | ||
|
530c2b8ad8 | ||
|
c04fc677b5 | ||
|
8d2c24f7f9 | ||
|
ea518681d9 | ||
|
d3dc07f282 | ||
|
dd006db5a7 | ||
|
c42bde719e | ||
|
97dafdc057 | ||
|
0236856924 | ||
|
cbc14df16a | ||
|
6311e4ce6a | ||
|
9e901039e7 | ||
|
405414d14e | ||
|
fd1e8563f8 | ||
|
5a1ea37f57 | ||
|
9f476b8d1e | ||
|
0de57fd57c |
115
.drone.yml
115
.drone.yml
@@ -56,7 +56,7 @@ pipeline:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
build-without-gcc:
|
||||
image: golang:1.9
|
||||
image: golang:1.10 # this step is kept as the lowest version of golang that we support
|
||||
pull: true
|
||||
commands:
|
||||
- go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
|
||||
@@ -64,7 +64,7 @@ pipeline:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
build:
|
||||
image: golang:1.11
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
environment:
|
||||
TAGS: bindata sqlite sqlite_unlock_notify
|
||||
@@ -82,8 +82,8 @@ pipeline:
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
test:
|
||||
image: golang:1.11
|
||||
unit-test:
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
@@ -94,8 +94,8 @@ pipeline:
|
||||
event: [ push, pull_request ]
|
||||
branch: [ master ]
|
||||
|
||||
test:
|
||||
image: golang:1.11
|
||||
release-test:
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
@@ -106,8 +106,8 @@ pipeline:
|
||||
event: [ push, pull_request ]
|
||||
branch: [ release/* ]
|
||||
|
||||
test:
|
||||
image: golang:1.11
|
||||
tag-test:
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
@@ -118,7 +118,7 @@ pipeline:
|
||||
event: [ tag ]
|
||||
|
||||
test-sqlite:
|
||||
image: golang:1.11
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
@@ -127,12 +127,13 @@ pipeline:
|
||||
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
||||
- apt-get install -y git-lfs
|
||||
- (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.sqlite.test)' | sh)) &
|
||||
- make test-sqlite-migration
|
||||
- make test-sqlite
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
test-mysql:
|
||||
image: golang:1.11
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
@@ -141,13 +142,14 @@ pipeline:
|
||||
commands:
|
||||
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
||||
- apt-get install -y git-lfs
|
||||
- make test-mysql-migration
|
||||
- make integration-test-coverage
|
||||
when:
|
||||
event: [ push, pull_request ]
|
||||
branch: [ master ]
|
||||
|
||||
test-mysql:
|
||||
image: golang:1.11
|
||||
tag-test-mysql:
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
@@ -157,11 +159,12 @@ pipeline:
|
||||
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
||||
- apt-get install -y git-lfs
|
||||
- (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
|
||||
- make test-mysql-migration
|
||||
- make test-mysql
|
||||
when:
|
||||
event: [ tag ]
|
||||
|
||||
test-pgsql:
|
||||
test-mysql8:
|
||||
image: golang:1.11
|
||||
pull: true
|
||||
group: test
|
||||
@@ -172,12 +175,29 @@ pipeline:
|
||||
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
||||
- apt-get install -y git-lfs
|
||||
- (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
|
||||
- make test-mysql8-migration
|
||||
- make test-mysql8
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
test-pgsql:
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
TAGS: bindata
|
||||
TEST_LDAP: "1"
|
||||
commands:
|
||||
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
||||
- apt-get install -y git-lfs
|
||||
- (sleep 1200 && (echo 'kill -ABRT $(pidof gitea) $(pidof integrations.test)' | sh)) &
|
||||
- make test-pgsql-migration
|
||||
- make test-pgsql
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
test-mssql:
|
||||
image: golang:1.11
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
group: test
|
||||
environment:
|
||||
@@ -186,12 +206,49 @@ pipeline:
|
||||
commands:
|
||||
- curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
||||
- apt-get install -y git-lfs
|
||||
- make test-mssql-migration
|
||||
- make test-mssql
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
# bench-sqlite:
|
||||
# image: golang:1.12
|
||||
# pull: true
|
||||
# group: bench
|
||||
# commands:
|
||||
# - make bench-sqlite
|
||||
# when:
|
||||
# event: [ tag ]
|
||||
|
||||
# bench-mysql:
|
||||
# image: golang:1.12
|
||||
# pull: true
|
||||
# group: bench
|
||||
# commands:
|
||||
# - make bench-mysql
|
||||
# when:
|
||||
# event: [ tag ]
|
||||
|
||||
# bench-mssql:
|
||||
# image: golang:1.12
|
||||
# pull: true
|
||||
# group: bench
|
||||
# commands:
|
||||
# - make bench-mssql
|
||||
# when:
|
||||
# event: [ tag ]
|
||||
|
||||
# bench-pgsql:
|
||||
# image: golang:1.12
|
||||
# pull: true
|
||||
# group: bench
|
||||
# commands:
|
||||
# - make bench-pgsql
|
||||
# when:
|
||||
# event: [ tag ]
|
||||
|
||||
generate-coverage:
|
||||
image: golang:1.11
|
||||
image: golang:1.12
|
||||
pull: true
|
||||
environment:
|
||||
TAGS: bindata
|
||||
@@ -211,7 +268,7 @@ pipeline:
|
||||
branch: [ master ]
|
||||
|
||||
static:
|
||||
image: karalabe/xgo-latest:latest
|
||||
image: techknowlogick/xgo:latest
|
||||
pull: true
|
||||
environment:
|
||||
TAGS: bindata sqlite sqlite_unlock_notify
|
||||
@@ -240,12 +297,22 @@ pipeline:
|
||||
event: [ push ]
|
||||
branch: [ master ]
|
||||
|
||||
docker:
|
||||
docker-dryrun:
|
||||
image: plugins/docker:17.12
|
||||
pull: true
|
||||
repo: gitea/gitea
|
||||
cache_from: gitea/gitea
|
||||
dry_run: true
|
||||
when:
|
||||
event: [ pull_request ]
|
||||
|
||||
release-docker:
|
||||
image: plugins/docker:17.12
|
||||
pull: true
|
||||
secrets: [ docker_username, docker_password ]
|
||||
repo: gitea/gitea
|
||||
tags: [ '${DRONE_BRANCH##release/v}' ]
|
||||
cache_from: gitea/gitea
|
||||
when:
|
||||
event: [ push ]
|
||||
branch: [ release/* ]
|
||||
@@ -255,6 +322,7 @@ pipeline:
|
||||
secrets: [ docker_username, docker_password ]
|
||||
pull: true
|
||||
repo: gitea/gitea
|
||||
cache_from: gitea/gitea
|
||||
default_tags: true
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
@@ -271,7 +339,7 @@ pipeline:
|
||||
when:
|
||||
event: [ push, tag ]
|
||||
|
||||
release:
|
||||
tag-release:
|
||||
image: plugins/s3:1
|
||||
pull: true
|
||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
||||
@@ -285,7 +353,7 @@ pipeline:
|
||||
when:
|
||||
event: [ tag ]
|
||||
|
||||
release:
|
||||
release-branch-release:
|
||||
image: plugins/s3:1
|
||||
pull: true
|
||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
||||
@@ -354,6 +422,15 @@ services:
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
mysql8:
|
||||
image: mysql:8.0
|
||||
environment:
|
||||
- MYSQL_DATABASE=test
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
||||
- MYSQL_DATABASE=testgitea
|
||||
when:
|
||||
event: [ push, tag, pull_request ]
|
||||
|
||||
pgsql:
|
||||
image: postgres:9.5
|
||||
environment:
|
||||
|
@@ -1,5 +1,4 @@
|
||||
# http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
@@ -15,11 +14,11 @@ indent_size = 8
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.{less}]
|
||||
[*.less]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{yml}]
|
||||
[*.{yml,json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
6
.github/issue_template.md
vendored
6
.github/issue_template.md
vendored
@@ -1,7 +1,9 @@
|
||||
<!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue -->
|
||||
|
||||
<!--
|
||||
1. Please speak English, this is the language all of us can speak and write.
|
||||
1. Please speak English, this is the language all maintainers can speak and write.
|
||||
2. Please ask questions or configuration/deploy problems on our Discord
|
||||
server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io).
|
||||
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
|
||||
3. Please take a moment to check that your issue doesn't already exist.
|
||||
4. Please give all relevant information below for bug reports, because
|
||||
incomplete details will be handled as an invalid report.
|
||||
|
1
.github/stale.yml
vendored
1
.github/stale.yml
vendored
@@ -42,6 +42,7 @@ limitPerRun: 1
|
||||
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
|
||||
pulls:
|
||||
daysUntilStale: 60
|
||||
daysUntilClose: 60
|
||||
markComment: >
|
||||
This pull request has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -51,17 +51,21 @@ coverage.all
|
||||
/log
|
||||
/public/img/avatar
|
||||
/integrations/gitea-integration-mysql
|
||||
/integrations/gitea-integration-mysql8
|
||||
/integrations/gitea-integration-pgsql
|
||||
/integrations/gitea-integration-sqlite
|
||||
/integrations/gitea-integration-mssql
|
||||
/integrations/indexers-mysql
|
||||
/integrations/indexers-mysql8
|
||||
/integrations/indexers-pgsql
|
||||
/integrations/indexers-sqlite
|
||||
/integrations/indexers-mssql
|
||||
/integrations/mysql.ini
|
||||
/integrations/mysql8.ini
|
||||
/integrations/pgsql.ini
|
||||
/integrations/mssql.ini
|
||||
/node_modules
|
||||
/modules/indexer/issues/indexers
|
||||
|
||||
|
||||
# Snapcraft
|
||||
|
309
CHANGELOG.md
309
CHANGELOG.md
@@ -4,7 +4,295 @@ This changelog goes through all the changes that have been made in each release
|
||||
without substantial changes to our git log; to see the highlights of what has
|
||||
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
|
||||
## [1.7.0-rc1](https://github.com/go-gitea/gitea/releases/tag/v1.7.0) - 2019-01-02
|
||||
## [1.8.0-rc2](https://github.com/go-gitea/gitea/releases/tag/v1.8.0-rc2) - 2019-03-27
|
||||
* BUGFIXES
|
||||
* Disable benchmarking during tag events on DroneIO (#6365) (#6366)
|
||||
* Make sure units of a team are returned (#6379) (#6381)
|
||||
* Don't Unescape redirect_to cookie value (#6399) (#6401)
|
||||
* Fix dump table name error and add some test for dump database (#6394) (#6402)
|
||||
* Fix migration v82 to ignore unsynced tags between database and git data; Add missing is_archived column on repository table (#6387) (#6403)
|
||||
* Display correct error for invalid mirror interval (#6414) (#6429)
|
||||
* Clean up ref name rules (#6437) (#6439)
|
||||
* Fix Hook & HookList in Swagger (#6432) (#6440)
|
||||
* Change order that PostProcess Processors are run (#6445) (#6447)
|
||||
|
||||
## [1.8.0-rc1](https://github.com/go-gitea/gitea/releases/tag/v1.8.0-rc1) - 2019-03-18
|
||||
* BREAKING
|
||||
* Add "ghost" and "notifications" to list of reserved user names. (#6208)
|
||||
* Change sqlite DB path default to data directory (#6198)
|
||||
* Adds MustChangePassword to user create/edit API (#6193)
|
||||
* Disable redirect for i18n (#5910)
|
||||
* Releases API paging (#5831)
|
||||
* Allow Macaron to be set to log through to gitea.log (#5667)
|
||||
* Don't close issues via commits on non-default branch (#5622)
|
||||
* FEATURE
|
||||
* Add regenerate secret feature for oauth2 (#6291)
|
||||
* Expose issue stopwatch toggling via API (#5970)
|
||||
* Add other session providers (#5963)
|
||||
* Pull request conflict files detection (#5951)
|
||||
* Integrate OAuth2 Provider (#5378)
|
||||
* Implement "conversation lock" for issue comments (#5073)
|
||||
* Feature: Archive repos (#5009)
|
||||
* Discord Oauth2 support (#4476)
|
||||
* Allow to set organization visibility (public, internal, private) (#1763)
|
||||
* Added URL mapping for Release attachments like on github.com (#1707)
|
||||
* ENHANCEMENT
|
||||
* Add support for client basic auth for exchanging access tokens (#6293)
|
||||
* Add ability to sort issues by due date (#6206) (#6244)
|
||||
* Style tweaks to issue selection (#6196)
|
||||
* Increase Username and Orgname MaxSize 35 -> 40 (#6178)
|
||||
* Coverage profile with multiple packages (#6167)
|
||||
* Split setting.go to multiple files (#6154)
|
||||
* Allow labels to contain emoji (#6063)
|
||||
* Disable git fsck for mirrored repos by default (#6018)
|
||||
* Add default time out for git operations (#6015)
|
||||
* Split setting.go as multiple files (#6014)
|
||||
* Make dashboard navbar and footer full-width (#6013)
|
||||
* Add lang specific font stacks for CJK (#6007)
|
||||
* Fix header menu misalignment (#6002)
|
||||
* Enhance closed PR and Issue status in the list (#6000)
|
||||
* Make navbar full width (#5998)
|
||||
* Add option to close issues via commit on a non master branch (#5992)
|
||||
* Support n as a line highlight prefix (#5987)
|
||||
* Search for org repos (#3031) (#5986)
|
||||
* Minor UI tweaks (#5980)
|
||||
* Use native golang SSH library but ssh-keygen when enable built-in SSH server to remove dependent on that command lines (#5976)
|
||||
* Dashboard tweaks (#5974)
|
||||
* Fixes for repo topic editor (#5971)
|
||||
* Display the branch name in the commit view (#5950)
|
||||
* handle milestone events for issues and PR (#5947)
|
||||
* Add label names as filter in issue search api (#5946)
|
||||
* Repo header tweaks (#5945)
|
||||
* Better support for long repo names (#5932)
|
||||
* Fix wrapping long code lines (#5927)
|
||||
* Change GPG Validation colors and remove inline CSS (#5404) (#5896)
|
||||
* Fix "pulls.blocked_by_approvals" text (#5879)
|
||||
* Rename reject to 'request changes' (#5858)
|
||||
* Move input fields to add members to a team and repos to a team (#5853)
|
||||
* Config option to disable automatic repo watching (#5852)
|
||||
* New Issue ?body= query (#5851)
|
||||
* Add API to list tags (#5850)
|
||||
* Pagination for git tree API (#5838)
|
||||
* Add InternalTokenURI to load InternalToken from an external file (#5812)
|
||||
* Allow markdown files to read from the LFS (#5787)
|
||||
* Add the ability to use multiple labels as filters (#5786)
|
||||
* Adjust log settings when a user is not found. (#5771)
|
||||
* Log IP of failed ssh connection (#5766)
|
||||
* Moved defaults in defaults.go to setting.go (#5764)
|
||||
* Make DB connect more robust (#5738)
|
||||
* Add Default Pull Request Title (#5735)
|
||||
* Refactor repo.isBare to repo.isEmpty #5629 (#5714)
|
||||
* Add flag to skip repository dumping (#5695)
|
||||
* Prioritize "readme.md" (#5691)
|
||||
* Improve "Fork button" for guests by showing a pop up asking them to log in before forking (#5690)
|
||||
* Allow for user specific themes (#5668)
|
||||
* Display branch name in delete branch confirmation modal. (#5654)
|
||||
* New API routes added (#5594)
|
||||
* Refactor notification for indexer (#5111)
|
||||
* Refactor mail notification (#5110)
|
||||
* Show email if the authenticated user owns the profile page being requested for (#4981)
|
||||
* Optimize pulls merging (#4921)
|
||||
* Sort Repositories widget by most recently updated (#3963) (#4599)
|
||||
* Allow markdown table to scroll (#4401)
|
||||
* Automatically clear stopwatch on merging a PR (#4327)
|
||||
* Add the Owner Name to differentiate when merging (#3807)
|
||||
* BUGFIXES
|
||||
* Clean up various use of escape/unescape functions for URL generation (#6334)
|
||||
* Return 409 when creating repo if it already exists. (#6330)
|
||||
* Add same changes from issues page to milestone->issues page (#6328)
|
||||
* Fix ParsePatch function to work with quoted diff --git strings (#6323)
|
||||
* Fix reported issue in repo description (#6306)
|
||||
* Use url.PathEscape to escape the branchname (#6304)
|
||||
* Add robots.txt as reserved username (#6272)
|
||||
* Replace linkRegex with xurls library (#6261)
|
||||
* Remove visitLinksForShortLinks features (#6257)
|
||||
* Add unit types to repo action URL to correctly show 404 when archived (#6247)
|
||||
* Check organization visibility before everything else (#6234) (#6235)
|
||||
* Prevent double-close of issues (#6233)
|
||||
* Override xorm type mapping for U2F counter (#6232)
|
||||
* Add isAdmin to user API response (#6231)
|
||||
* Update git vendor to fix wrong release commit id and add migrations (#6224)
|
||||
* Fix fork button (#6223)
|
||||
* Fix renames over redirects (#6216)
|
||||
* Fix display dashboard even if require to change password (#6214)
|
||||
* Create a repo redirect when transferring ownership (#6210) (#6211)
|
||||
* Fix issue update race condition (#6194)
|
||||
* Fix bug when migrate repository 500 when repo is existed (#6188)
|
||||
* Fix scrollbar always present on page body (#6177)
|
||||
* Fix bug when set indexer as db and add tests (#6173)
|
||||
* Modify linkRegex to require http|https (#6171)
|
||||
* Fix bug user could change private repository to public when force private enabled. (#6156)
|
||||
* Fix admin list user/org API (#6143)
|
||||
* Make repo creation for API similar to UI (#6142)
|
||||
* Make document body a flexbox (#6139)
|
||||
* Refactor issue indexer, add some testing and fix a bug (#6131)
|
||||
* Load Issue attributes for API call (#6122)
|
||||
* Fix bug when update owner team then visit team's repo return 404 (#6119)
|
||||
* Fix heatmap and repository menu display in Internet Explorer 9+ (#6117)
|
||||
* Show private organization for admin, fix #6111 (#6112)
|
||||
* Fix prohibit login check on authorization (#6106)
|
||||
* Move to ldap.v3 to fix #5928 (#6105)
|
||||
* Remove use MakeAssigneeList in webhooks to fix deadlock (#6102)
|
||||
* Allow display of LFS stored Readme.md on directory page (#6073) (#6099)
|
||||
* Make sure labels are actually returned (#6053)
|
||||
* Fix panic: template: repo/issue/list:210: unexpected "=" in operand (#6041)
|
||||
* After deleting a repo on admin panel, UI should remember the last sort type (#6033)
|
||||
* Default create repository on organisation on its dashboard (#6026)
|
||||
* Swagger: Remove spaces in MergePullRequestOption enum (#6016)
|
||||
* Fix metrics auth token detection (#6006)
|
||||
* Fix repo header issues (#5995)
|
||||
* Fix bug when deleting a linked account will removed all (#5989)
|
||||
* Make organization dropdown scrollable when using mouse wheel (#5988)
|
||||
* Fix empty ssh key importing in ldap (#5984)
|
||||
* Admin config page mailertype setting option update (#5973)
|
||||
* Fix redirect loop during forced password change (#5965)
|
||||
* Show user who created the repository instead of the organisation in action feed (#5948)
|
||||
* Remove all CommitStatus when a repo is deleted (#5940)
|
||||
* Fix ssh deploy and user key constraints (#1357) (#5939)
|
||||
* Fix log output (#5938)
|
||||
* Set PusherName and PusherID to owner on deploy key to fix pushing with deploy keys (#5935)
|
||||
* Fix compare button (#5929)
|
||||
* Fix bug when read public repo lfs file (#5912)
|
||||
* Only allow local login if password is non-empty (#5906)
|
||||
* Recover panic in orgmode.Render if bad orgfile (#4982) (#5903)
|
||||
* Provide better panic handling (#5902)
|
||||
* Respect value of REQUIRE_SIGNIN_VIEW (#5901)
|
||||
* Show a 404 not a 500 if a repo does not exist (#5900)
|
||||
* Ensure repo is loaded in mailer (Completely fix #5891) (#5895)
|
||||
* Ensure issue.Poster is loaded in mailIssueCommentToParticipants (#5891)
|
||||
* Correct footer height if screen-width is to small (fixes #5878) (#5889)
|
||||
* In gitea serv switch off console logger to fix #5866 (#5887)
|
||||
* Don't allow pull requests to be created on an archived repository (#5883)
|
||||
* Support reviews on a deleted file path (#5880)
|
||||
* Fix compare button on upstream repo leading to 404 (#5877)
|
||||
* Fix null pointer on not logged in attempt to Sudo (#5872)
|
||||
* Fix new release creation API to allow empty target (#5870)
|
||||
* Fix an error while adding a dependency via UI. (#5862)
|
||||
* Fix failing migration v67 (#5849)
|
||||
* Fix delete correct temp directory (#5839)
|
||||
* Make sure .git/info is created before generating .git/info/sparse-che… (#5825)
|
||||
* Fix topics saving internal error and disable for archived repos (#5821)
|
||||
* Fix TLS errors when using acme/autocert for local connections (#5820)
|
||||
* When creating new repository fsck option should be enabled (#5817)
|
||||
* Request for public keys only if LDAP attribute is set (#5816)
|
||||
* Fix serving of raw wiki files other than .md (#5814)
|
||||
* Fix migration 78 error mssql (#5791)
|
||||
* Disallow empty titles (#5785)
|
||||
* Fix the v78 migration script (#5776)
|
||||
* Ensure valid git author names passed in signatures (#5774)
|
||||
* Fix wrong assumption where a user is always said to have unassigned (her)himself (#5769)
|
||||
* Upgrade go-sql-driver/mysql to fix invalid connection error (#5748)
|
||||
* Fixing PostgreSQL dump creation (#5747)
|
||||
* Add proper CORS preflight origin validation (#5740)
|
||||
* Disable auto-migrate in docker container (#5730)
|
||||
* In basic auth check for tokens before call UserSignIn (#5725)
|
||||
* Pooled and buffered gzip implementation (#5722)
|
||||
* Ensure that sessions are passed into queries that could use the database to prevent deadlocks (#5718)
|
||||
* Keep file permissions during database migration (#5707)
|
||||
* Use correct value for "MSpan Structures Obtained" #4742 (#5706)
|
||||
* Refactor editor upload, update and delete to use git plumbing and add LFS support (#5702)
|
||||
* Update xorm to fix issue #5659 and #5651 (#5680)
|
||||
* Fix public will not be reused as public key after deleting as deploy key (#5671)
|
||||
* When redirecting, clean the path (#5669)
|
||||
* Don't list an issue on its own dependency list UI. (#5658)
|
||||
* Fix commit page showing status for current default branch (#5649) (#5650)
|
||||
* Only count users own actions for heatmap contributions (#5647)
|
||||
* Fix sqlite deadlock when assigning to a PR (#5640)
|
||||
* Refactor issue indexer (#5363)
|
||||
* TESTING
|
||||
* Run benchmark at tag to track performances (#6035)
|
||||
* Add test environment for MySQL8 (#5234)
|
||||
* BUILD
|
||||
* Use go 1.12 for tests and deprecate go 1.9 (#6186)
|
||||
* Makefile changes for Windows and easier development (#6103)
|
||||
* Update bleve dependency to latest master revision (#6100)
|
||||
* Switch to more recent build of xgo (#6070)
|
||||
* Add autoprefixer to css build (#6029)
|
||||
* Update the version of less (#6010)
|
||||
* Make log mailer for testing (#5893)
|
||||
* DOCS
|
||||
* Add more tests and docs for issue indexer, add db indexer type for searching from database (#6144)
|
||||
* update default value of `--must-change-password` cli flag (#6032)
|
||||
* Update and expand information about building Gitea (#6019)
|
||||
* Update U2F Section of app.ini.sample (#5994)
|
||||
* Update swagger for release API pagination (#5841)
|
||||
* Added docs for the tree api (#5834)
|
||||
* MISC
|
||||
* Add single commit API support (#5843)
|
||||
* Add missing GET teams endpoints (#5382)
|
||||
* Migrate database if app.ini found (#5290)
|
||||
|
||||
## [1.7.5](https://github.com/go-gitea/gitea/releases/tag/v1.7.5) - 2019-03-27
|
||||
* BUGFIXES
|
||||
* Fix unitTypeCode not being used in accessLevelUnit (#6419) (#6423)
|
||||
* Fix bug where manifest.json was being requested without cookies and continuously creating new sessions (#6372) (#6383)
|
||||
* Fix ParsePatch function to work with quoted diff --git strings (#6323) (#6332)
|
||||
|
||||
## [1.7.4](https://github.com/go-gitea/gitea/releases/tag/v1.7.4) - 2019-03-12
|
||||
* SECURITY
|
||||
* Fix potential XSS vulnerability in repository description. (#6306) (#6308)
|
||||
* BUGFIXES
|
||||
* Fix wrong release commit id (#6224) (#6300)
|
||||
* Fix panic on empty signed commits (#6292) (#6300)
|
||||
* Fix organization dropdown not being scrollable when using mouse wheel (#5988) (#6246)
|
||||
* Fix displaying dashboard even if required to change password (#6214) (#6215)
|
||||
|
||||
## [1.7.3](https://github.com/go-gitea/gitea/releases/tag/v1.7.3) - 2019-02-27
|
||||
* BUGFIXES
|
||||
* Fix server 500 when trying to migrate to an already existing repository (#6188) (#6197)
|
||||
* Load Issue attributes for API /repos/{owner}/{repo}/issues/{index} (#6122) (#6185)
|
||||
* Fix bug whereby user could change private repository to public when force private enabled. (#6156) (#6165)
|
||||
* Fix bug when update owner team then visit team's repo return 404 (#6119) (#6166)
|
||||
* Fix heatmap and repository menu display in Internet Explorer 9+ (#6117) (#6137)
|
||||
* Fix prohibit login check on authorization (#6106) (#6115)
|
||||
* Fix LDAP protocol error regression by moving to ldap.v3 (#6105) (#6107)
|
||||
* Fix deadlock in webhook PullRequest (#6102) (#6104)
|
||||
* Fix redirect loop when password change is required and Gitea is installed as a suburl (#5965) (#6101)
|
||||
* Fix compare button regression (#5929) (#6098)
|
||||
* Recover panic in orgmode.Render if bad orgfile (#4982) (#5903) (#6097)
|
||||
|
||||
## [1.7.2](https://github.com/go-gitea/gitea/releases/tag/v1.7.2) - 2019-02-14
|
||||
* BUGFIXES
|
||||
* Remove all CommitStatus when a repo is deleted (#5940) (#5941)
|
||||
* Fix notifications on pushing with deploy keys by setting hook environment variables (#5935) (#5944)
|
||||
* Silence console logger in gitea serv (#5887) (#5943)
|
||||
* Handle milestone webhook events for issues and PR (#5947) (#5955)
|
||||
* Show user who created the repository instead of the organization in action feed (#5948) (#5956)
|
||||
* Fix ssh deploy and user key constraints (#1357) (#5939) (#5966)
|
||||
* Fix bug when deleting a linked account will removed all (#5989) (#5990)
|
||||
* Fix empty ssh key importing in ldap (#5984) (#6009)
|
||||
* Fix metrics auth token detection (#6006) (#6017)
|
||||
* Create repository on organisation by default on its dashboard (#6026) (#6048)
|
||||
* Make sure labels are actually returned in API (#6053) (#6059)
|
||||
* Switch to more recent build of xgo (#6070) (#6072)
|
||||
* In basic auth check for tokens before call UserSignIn (#5725) (#6083)
|
||||
|
||||
## [1.7.1](https://github.com/go-gitea/gitea/releases/tag/v1.7.1) - 2019-01-31
|
||||
* SECURITY
|
||||
* Disable redirect for i18n (#5910) (#5916)
|
||||
* Only allow local login if password is non-empty (#5906) (#5908)
|
||||
* Fix go-get URL generation (#5905) (#5907)
|
||||
* BUGFIXES
|
||||
* Fix TLS errors when using acme/autocert for local connections (#5820) (#5826)
|
||||
* Request for public keys only if LDAP attribute is set (#5816) (#5819)
|
||||
* Fix delete correct temp directory (#5840) (#5839)
|
||||
* Fix an error while adding a dependency via UI (#5862) (#5876)
|
||||
* Fix null pointer in attempt to Sudo if not logged in (#5872) (#5884)
|
||||
* When creating new repository fsck option should be enabled (#5817) (#5885)
|
||||
* Prevent nil dereference in mailIssueCommentToParticipants (#5891) (#5895) (#5894)
|
||||
* Fix bug when read public repo lfs file (#5913) (#5912)
|
||||
* Respect value of REQUIRE_SIGNIN_VIEW (#5901) (#5915)
|
||||
* Fix compare button on upstream repo leading to 404 (#5877) (#5914)
|
||||
* DOCS
|
||||
* Added docs for the tree api (#5835)
|
||||
* MISC
|
||||
* Include Go toolchain to --version (#5832) (#5830)
|
||||
|
||||
## [1.7.0](https://github.com/go-gitea/gitea/releases/tag/v1.7.0) - 2019-01-22
|
||||
* SECURITY
|
||||
* Do not display the raw OpenID error in the UI (#5705) (#5712)
|
||||
* When redirecting clean the path to avoid redirecting to external site (#5669) (#5679)
|
||||
* Prevent DeleteFilePost doing arbitrary deletion (#5631)
|
||||
* BREAKING
|
||||
* Restrict permission check on repositories and fix some problems (#5314)
|
||||
* Show only opened milestones on issues page milestone filter (#5051)
|
||||
@@ -23,6 +311,13 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
* Give user a link to create PR after push (#4716)
|
||||
* Add rebase with merge commit merge style (#3844) (#4052)
|
||||
* BUGFIXES
|
||||
* Disallow empty titles (#5785) (#5794)
|
||||
* Fix sqlite deadlock when assigning to a PR (#5640) (#5642)
|
||||
* Don't close issues via commits on non-default branch. (#5622) (#5643)
|
||||
* Fix commit page showing status for current default branch (#5650) (#5653)
|
||||
* Only count users own actions for heatmap contributions (#5647) (#5655)
|
||||
* Update xorm to fix issue postgresql dumping issues (#5680) (#5692)
|
||||
* Use correct value for "MSpan Structures Obtained" (#5706) (#5716)
|
||||
* Fix bug on modifying sshd username (#5624)
|
||||
* Delete tags in mirror which are removed for original repo. (#5609)
|
||||
* Fix wrong text getting saved on editing second comment on an issue. (#5608)
|
||||
@@ -149,6 +444,18 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
* Git-Trees API (#5403)
|
||||
* Only chown directories during docker setup if necessary. Fix #4425 (#5064)
|
||||
|
||||
## [1.6.4](https://github.com/go-gitea/gitea/releases/tag/v1.6.4) - 2019-01-15
|
||||
* BUGFIX
|
||||
* Fix SSH key now can be reused as public key after deleting as deploy key (#5671) (#5685)
|
||||
* When redirecting clean the path to avoid redirecting to external site (#5669) (#5703)
|
||||
* Fix to use correct value for "MSpan Structures Obtained" (#5706) (#5715)
|
||||
|
||||
## [1.6.3](https://github.com/go-gitea/gitea/releases/tag/v1.6.3) - 2019-01-04
|
||||
* SECURITY
|
||||
* Prevent DeleteFilePost doing arbitrary deletion (#5631)
|
||||
* BUGFIX
|
||||
* Fix wrong text getting saved on editing second comment on an issue (#5608)
|
||||
|
||||
## [1.6.2](https://github.com/go-gitea/gitea/releases/tag/v1.6.2) - 2018-12-21
|
||||
* SECURITY
|
||||
* Sanitize uploaded file names (#5571) (#5573)
|
||||
|
@@ -64,15 +64,26 @@ high-level discussions.
|
||||
|
||||
## Testing redux
|
||||
|
||||
Before sending code out for review, run all the tests for the
|
||||
whole tree to make sure the changes don't break other usage
|
||||
and keep the compatibility on upgrade. To make sure you are
|
||||
running the test suite exactly like we do, you should install
|
||||
the CLI for [Drone CI](https://github.com/drone/drone), as
|
||||
we are using the server for continuous testing, following [these
|
||||
instructions](http://docs.drone.io/cli-installation/). After that,
|
||||
you can simply call `drone exec --local --build-event "pull_request"` within
|
||||
your working directory and it will try to run the test suite locally.
|
||||
Before submitting a pull request, run all the tests for the whole tree
|
||||
to make sure your changes don't cause regression elsewhere.
|
||||
|
||||
Here's how to run the test suite:
|
||||
|
||||
- Install the correct version of the drone-cli package. As of this
|
||||
writing, the correct drone-cli version is
|
||||
[0.8.6](https://0-8-0.docs.drone.io/cli-installation/).
|
||||
- Ensure you have enough free disk space. You will need at least
|
||||
15-20 Gb of free disk space to hold all of the containers drone
|
||||
creates (a default AWS or GCE disk size won't work -- see
|
||||
[#6243](https://github.com/go-gitea/gitea/issues/6243)).
|
||||
- Change into the base directory of your copy of the gitea repository,
|
||||
and run `drone exec --local --build-event pull_request`.
|
||||
|
||||
The drone version, command line, and disk requirements do change over
|
||||
time (see [#4053](https://github.com/go-gitea/gitea/issues/4053) and
|
||||
[#6243](https://github.com/go-gitea/gitea/issues/6243)); if you
|
||||
discover any issues, please feel free to send us a pull request to
|
||||
update these instructions.
|
||||
|
||||
## Vendoring
|
||||
|
||||
@@ -102,7 +113,7 @@ included in the next released version.
|
||||
Generally, the go build tools are installed as-needed in the `Makefile`.
|
||||
An exception are the tools to build the CSS and images.
|
||||
|
||||
- To build CSS: Install [Node.js](https://nodejs.org/en/download/package-manager)
|
||||
- To build CSS: Install [Node.js](https://nodejs.org/en/download/package-manager) at version 8.0 or above
|
||||
with `npm` and then run `npm install` and `make generate-stylesheets`.
|
||||
- To build Images: ImageMagick, inkscape and zopflipng binaries must be
|
||||
available in your `PATH` to run `make generate-images`.
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
###################################
|
||||
#Build stage
|
||||
FROM golang:1.11-alpine3.8 AS build-env
|
||||
FROM golang:1.12-alpine3.9 AS build-env
|
||||
|
||||
ARG GITEA_VERSION
|
||||
ARG TAGS="sqlite sqlite_unlock_notify"
|
||||
@@ -18,7 +18,7 @@ WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
||||
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
||||
&& make clean generate build
|
||||
|
||||
FROM alpine:3.8
|
||||
FROM alpine:3.9
|
||||
LABEL maintainer="maintainers@gitea.io"
|
||||
|
||||
EXPOSE 22 3000
|
||||
|
222
Gopkg.lock
generated
222
Gopkg.lock
generated
@@ -3,19 +3,27 @@
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:ab875622908a804a327a95a1701002b150806a3c5406df51ec231eac16d3a1ca"
|
||||
digest = "1:e1fa64238b0a2dbf1edf98c4af8d1b8cb65179e286d7f28006b50fa9f508ee9d"
|
||||
name = "code.gitea.io/git"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "389d3c803e12a30dffcbb54a15c2242521bc4333"
|
||||
revision = "74d7c14dd4a3ed9c5def0dc3c1aeede399ddc5c5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:aed2bc1c4026233af8ad43cab9d9464a0e3b906d3d058d2d6e814f3e1ddfa528"
|
||||
digest = "1:dbf849e6552740945ac1c6c6acba590fbc594e4efa80cf05568dec8579ae0dab"
|
||||
name = "code.gitea.io/sdk"
|
||||
packages = ["gitea"]
|
||||
pruneopts = "NUT"
|
||||
revision = "d95a6e0392218961d1bdd18020290a20bd61b063"
|
||||
revision = "e4effe4df2b895ca51482d24edb8748704326f1a"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5d72bbcc9c8667b11c3dc3cbe681c5a6f71e5096744c0bf7726ab5c6425d5dc4"
|
||||
name = "github.com/BurntSushi/toml"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005"
|
||||
version = "v0.3.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:3fcef06a1a6561955c94af6c7757a6fa37605eb653f0d06ab960e5bb80092195"
|
||||
@@ -32,14 +40,6 @@
|
||||
revision = "1a28a7fa985680f9f4e1644c0a857ec359a444b0"
|
||||
version = "v0.4.7"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:93367b6d47a8ccc7d14f9f493ccf103ccf5afb698559ff8e8f1999427ce27ace"
|
||||
name = "github.com/Smerity/govarint"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "7265e41f48f15fd61751e16da866af3c704bb3ab"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d290f4b25abbf574f80f60c8a5603ddada784f13f436b91a9a927bc7ce5a0146"
|
||||
@@ -90,7 +90,7 @@
|
||||
revision = "3a771d992973f24aa725d07868b467d1ddfceafb"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c10f35be6200b09e26da267ca80f837315093ecaba27e7a223071380efb9dd32"
|
||||
digest = "1:b17287a86f6cac923a5d886e10618df994eeb54b6724eac2e3b8dde89cfbe3a2"
|
||||
name = "github.com/blevesearch/bleve"
|
||||
packages = [
|
||||
".",
|
||||
@@ -113,7 +113,6 @@
|
||||
"index/scorch",
|
||||
"index/scorch/mergeplan",
|
||||
"index/scorch/segment",
|
||||
"index/scorch/segment/mem",
|
||||
"index/scorch/segment/zap",
|
||||
"index/store",
|
||||
"index/store/boltdb",
|
||||
@@ -133,9 +132,10 @@
|
||||
"search/query",
|
||||
"search/scorer",
|
||||
"search/searcher",
|
||||
"size",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "c74e08f039e56cef576e4336382b2a2d12d9e026"
|
||||
revision = "05d86ea8f6e30456949f612cf68cf4a27ce8c9c5"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -152,14 +152,6 @@
|
||||
pruneopts = "NUT"
|
||||
revision = "db70c57796cc8c310613541dfade3dce627d09c7"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c7e0968c05659f3973148cd5c5387d6ee960a6ae1b2eaaec0b1d435d806458bb"
|
||||
name = "github.com/boltdb/bolt"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "ccd680d8c1a0179ac3d68f692b01e1a1589cbfc7"
|
||||
source = "github.com/go-gitea/bolt"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:7c96cf7bf7f52af67f7a8222185813b9b665f5172ec2ac5f7d49ed96e5fcf3e5"
|
||||
name = "github.com/boombuler/barcode"
|
||||
@@ -187,15 +179,46 @@
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:82e1ad11d777f7bff9a1fc678a8a534a318f85e5026a8a4d6f4a94a6b0678bb6"
|
||||
digest = "1:eb205556fe75307c6d2b58d4159e7c2da23e2666481d352c66d4055bebf45a3c"
|
||||
name = "github.com/couchbase/gomemcached"
|
||||
packages = [
|
||||
".",
|
||||
"client",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "5125a94a666c83cb9b7a60907833cd320b84c20f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:ea03e12e246f7708a7b7ab3ad04e96d21ce73f48bb56258bc2bffeed474212e6"
|
||||
name = "github.com/couchbase/goutils"
|
||||
packages = [
|
||||
"logging",
|
||||
"scramsha",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "e865a1461c8ac0032bd37e2d4dab3289faea3873"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:6a658ac7d23204dc743c7155557c45273747d78e05ae0579742bd6b744bce215"
|
||||
name = "github.com/couchbase/vellum"
|
||||
packages = [
|
||||
".",
|
||||
"levenshtein2",
|
||||
"regexp",
|
||||
"utf8",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "eb6ae3743b3f300f2136f83ca78c08cc071edbd4"
|
||||
revision = "e91b68ff3efe3cc11723aa25dd315cbc9276cd65"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:df592f4b82b993fcac270862376c34210776b8b0334a0f59f4d9d80467713ffa"
|
||||
name = "github.com/couchbaselabs/go-couchbase"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "d904413d884d1fb849e2ad8834619f661761ef57"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2c1d0e43bd3baaa071d1b9ed72c27d78169b2b269f71c105ac4ba34b1be4a39"
|
||||
@@ -249,6 +272,14 @@
|
||||
revision = "1615341f118ae12f353cc8a983f35b584342c9b3"
|
||||
version = "v1.12.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:ae8eea1a24ae43a46c2e96631b6303fcc4210ca0ac9d643e4da965029d1b511d"
|
||||
name = "github.com/etcd-io/bbolt"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "63597a96ec0ad9e6d43c3fc81e809909e0237461"
|
||||
version = "v1.3.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8603f74d35c93b37c615a02ba297be2cf2efc9ff6f1ff2b458a903990b568e48"
|
||||
name = "github.com/ethantkoenig/rupture"
|
||||
@@ -340,14 +371,6 @@
|
||||
pruneopts = "NUT"
|
||||
revision = "503617c6b37257a55dff6293ec28556506c3a9a8"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:6326b27f8e0c8e135c8674ddbc619fae879664ac832e8e6fa6a23ce0d279ed4d"
|
||||
name = "github.com/go-macaron/gzip"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "cad1c6580a07c56f5f6bc52d66002a05985c5854"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d09d3c94e1bd444464c221be961ba4005e119308f1bcd57aa5f49046fb6affd2"
|
||||
@@ -366,14 +389,19 @@
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:8fea5718d84af17762195beb6fe92a0d6c1048452a1dbc464d227f12e0cff0cc"
|
||||
digest = "1:a26b7b56aece087165b8db87afb05db8495252449553ca20d15f5a24202f36bc"
|
||||
name = "github.com/go-macaron/session"
|
||||
packages = [
|
||||
".",
|
||||
"couchbase",
|
||||
"memcache",
|
||||
"mysql",
|
||||
"nodb",
|
||||
"postgres",
|
||||
"redis",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "330e4e4d8beb7b00111ac34539561f46f94c4458"
|
||||
revision = "0a0a789bf1934e55fde19629869caa015a40c525"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:758d2371fcdee6d02565901b348729053c636055e67ef6e17aa466c7ff6cc57c"
|
||||
@@ -383,11 +411,11 @@
|
||||
revision = "a77f45a7ce909c0ff14b28279fa1a2b674acb70f"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:747c1fcb10f8f6734551465ab73c6ed9c551aa6e66250fb6683d1624f554546a"
|
||||
digest = "1:dce58f88343bd78f4d32dd9601aab4fa5d9994fd2cafa185c51bbd858851cdf9"
|
||||
name = "github.com/go-sql-driver/mysql"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "d523deb1b23d913de5bdada721a6071e71283618"
|
||||
revision = "c45f530f8e7fe40f4687eaa50d0c8c5f1b66f9e0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:06d21295033f211588d0ad7ff391cc1b27e72b60cb6d4b7db0d70cffae4cf228"
|
||||
@@ -406,11 +434,11 @@
|
||||
version = "v0.6.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:931a62a1aacc37a5e4c309a111642ec4da47b4dc453cd4ba5481b12eedb04a5d"
|
||||
digest = "1:f3015325cb2a17a6ff838358574921a343a0295059b7eb5bec07187131befc0b"
|
||||
name = "github.com/go-xorm/xorm"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "401f4ee8ff8cbc40a4754cb12192fbe4f02f3979"
|
||||
revision = "a6300f2a45e05a8f75f00a1d6188049fe7851915"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@@ -588,12 +616,43 @@
|
||||
revision = "e3534c89ef969912856dfa39e56b09e58c5f5daf"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4b992ec853d0ea9bac3dcf09a64af61de1a392e6cb0eef2204c0c92f4ae6b911"
|
||||
branch = "master"
|
||||
digest = "1:3ea59a5ada4bbac04da58e6177ca63da8c377a3143b48fca584408bf415fdafb"
|
||||
name = "github.com/lunny/levelqueue"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "02b525a4418e684a7786215296984e364746806f"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:1e6a29ed1f189354030e3371f63ec58aacbc2bf232fd104c6e0d41174ac5af48"
|
||||
name = "github.com/lunny/log"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "7887c61bf0de75586961948b286be6f7d05d9f58"
|
||||
version = "v0.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:683d835728cb95d176d423b522420eb5e4ec859b276bca18466476b82b3ebc4c"
|
||||
name = "github.com/lunny/nodb"
|
||||
packages = [
|
||||
".",
|
||||
"config",
|
||||
"store",
|
||||
"store/driver",
|
||||
"store/goleveldb",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "fc1ef06ad4af0da31cdb87e3fa5ec084c67e6597"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:aa7dcd6a0db70d514821f8739d0a22e7df33b499d8d399cf15b2858d44f8319e"
|
||||
name = "github.com/markbates/goth"
|
||||
packages = [
|
||||
".",
|
||||
"gothic",
|
||||
"providers/bitbucket",
|
||||
"providers/discord",
|
||||
"providers/dropbox",
|
||||
"providers/facebook",
|
||||
"providers/github",
|
||||
@@ -603,8 +662,8 @@
|
||||
"providers/twitter",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "bc6d8ddf751a745f37ca5567dbbfc4157bbf5da9"
|
||||
version = "v1.47.2"
|
||||
revision = "157987f620ff2fc5e1f6a1427a3685219fbf6ff4"
|
||||
version = "v1.49.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c9724c929d27a14475a45b17a267dbc60671c0bc2c5c05ed21f011f7b5bc9fb5"
|
||||
@@ -666,6 +725,14 @@
|
||||
pruneopts = "NUT"
|
||||
revision = "02ccfbfaf0cc627aa3aec8ef7ed5cfeec5b43f63"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:63953ffb90bbc880c612d576fcfd973a5904277d25ec9e2d8d5719bf67969662"
|
||||
name = "github.com/mvdan/xurls"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "e52e821cbfe8fe163ff6f8628ab5869b11fc05af"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2be1d891535ce3d6d2a3db9087f07415e909744e9eff1a30f8f0b2519df60ae6"
|
||||
name = "github.com/nfnt/resize"
|
||||
@@ -689,6 +756,14 @@
|
||||
revision = "bb6d471dc95d4fe11e432687f8b70ff496cf3136"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:14715f705ff5dfe0ffd6571d7d201dd8e921030f8070321a79380d8ca4ec1a24"
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4"
|
||||
version = "v0.8.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
@@ -782,6 +857,14 @@
|
||||
pruneopts = "NUT"
|
||||
revision = "1dba4b3954bc059efc3991ec364f9f9a35f597d2"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:dbda803f21e60c38de7d9f884390f2ebbe234ce0c3d139b65bbb36b03a99d266"
|
||||
name = "github.com/siddontang/go-snappy"
|
||||
packages = ["snappy"]
|
||||
pruneopts = "NUT"
|
||||
revision = "d8f7bb82a96d89c1254e5a6c967134e1433c9ee2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:89fd77d603a74a6540d60067debad9397865bf040955d907362c95d364baeba6"
|
||||
name = "github.com/src-d/gcfg"
|
||||
@@ -811,6 +894,27 @@
|
||||
revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
|
||||
version = "v1.2.1"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:685fdfea42d825ebd39ee0994354b46c374cf2c2b2d97a41a8dee1807c6a9b62"
|
||||
name = "github.com/syndtr/goleveldb"
|
||||
packages = [
|
||||
"leveldb",
|
||||
"leveldb/cache",
|
||||
"leveldb/comparer",
|
||||
"leveldb/errors",
|
||||
"leveldb/filter",
|
||||
"leveldb/iterator",
|
||||
"leveldb/journal",
|
||||
"leveldb/memdb",
|
||||
"leveldb/opt",
|
||||
"leveldb/storage",
|
||||
"leveldb/table",
|
||||
"leveldb/util",
|
||||
]
|
||||
pruneopts = "NUT"
|
||||
revision = "2f17a3356c6616cbfc4ae4c38147dc062a68fb0e"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3cb6dfe7cdece5716b1c3c3c0b5faf7fce2e83e2758e2baad2e9986d101980b8"
|
||||
@@ -858,11 +962,13 @@
|
||||
revision = "2c050d2dae5345c417db301f11fda6fbf5ad0f0a"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c3d6b9e2cf3936ba9927da2e8858651aad69890b9dd3349f1316b4003b25d7a3"
|
||||
digest = "1:590035a7bbea1c037c2e6d51f81ee09857480c3c21f1f77397d9802f10507c06"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = [
|
||||
"acme",
|
||||
"acme/autocert",
|
||||
"bcrypt",
|
||||
"blowfish",
|
||||
"cast5",
|
||||
"curve25519",
|
||||
"ed25519",
|
||||
@@ -1005,20 +1111,20 @@
|
||||
version = "v1.31.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:01f4ac37c52bda6f7e1bd73680a99f88733c0408aaa159ecb1ba53a1ade9423c"
|
||||
name = "gopkg.in/ldap.v2"
|
||||
digest = "1:8a502dedecf5b6d56e36f0d0e6196392baf616634af2c23108b6e8bb89ec57fc"
|
||||
name = "gopkg.in/ldap.v3"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "d0a5ced67b4dc310b9158d63a2c6f9c5ec13f105"
|
||||
version = "v2.4.1"
|
||||
revision = "214f299a0ecb2a6c6f6d2b0f13977032b207dc58"
|
||||
version = "v3.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:cfe1730a152ff033ad7d9c115d22e36b19eec6d5928c06146b9119be45d39dc0"
|
||||
digest = "1:de2e7294c9bd0b7d07ada8e98ad02cbbaabacff90eedebe7454ebdbab50d0d19"
|
||||
name = "gopkg.in/macaron.v1"
|
||||
packages = ["."]
|
||||
pruneopts = "NUT"
|
||||
revision = "75f2e9b42e99652f0d82b28ccb73648f44615faa"
|
||||
version = "v1.2.4"
|
||||
revision = "dfcb80ca86e8534962c62812efd93209c7e600e7"
|
||||
version = "v1.3.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:00126f697efdcab42f07c89ac8bf0095fb2328aef6464e070055154088cea859"
|
||||
@@ -1154,10 +1260,14 @@
|
||||
"github.com/go-macaron/cache/redis",
|
||||
"github.com/go-macaron/captcha",
|
||||
"github.com/go-macaron/csrf",
|
||||
"github.com/go-macaron/gzip",
|
||||
"github.com/go-macaron/i18n",
|
||||
"github.com/go-macaron/inject",
|
||||
"github.com/go-macaron/session",
|
||||
"github.com/go-macaron/session/couchbase",
|
||||
"github.com/go-macaron/session/memcache",
|
||||
"github.com/go-macaron/session/mysql",
|
||||
"github.com/go-macaron/session/nodb",
|
||||
"github.com/go-macaron/session/postgres",
|
||||
"github.com/go-macaron/session/redis",
|
||||
"github.com/go-macaron/toolbox",
|
||||
"github.com/go-sql-driver/mysql",
|
||||
@@ -1173,12 +1283,15 @@
|
||||
"github.com/keybase/go-crypto/openpgp",
|
||||
"github.com/keybase/go-crypto/openpgp/armor",
|
||||
"github.com/keybase/go-crypto/openpgp/packet",
|
||||
"github.com/klauspost/compress/gzip",
|
||||
"github.com/lafriks/xormstore",
|
||||
"github.com/lib/pq",
|
||||
"github.com/lunny/dingtalk_webhook",
|
||||
"github.com/lunny/levelqueue",
|
||||
"github.com/markbates/goth",
|
||||
"github.com/markbates/goth/gothic",
|
||||
"github.com/markbates/goth/providers/bitbucket",
|
||||
"github.com/markbates/goth/providers/discord",
|
||||
"github.com/markbates/goth/providers/dropbox",
|
||||
"github.com/markbates/goth/providers/facebook",
|
||||
"github.com/markbates/goth/providers/github",
|
||||
@@ -1190,6 +1303,7 @@
|
||||
"github.com/mcuadros/go-version",
|
||||
"github.com/microcosm-cc/bluemonday",
|
||||
"github.com/msteinert/pam",
|
||||
"github.com/mvdan/xurls",
|
||||
"github.com/nfnt/resize",
|
||||
"github.com/pquerna/otp",
|
||||
"github.com/pquerna/otp/totp",
|
||||
@@ -1203,6 +1317,7 @@
|
||||
"github.com/urfave/cli",
|
||||
"github.com/yohcop/openid-go",
|
||||
"golang.org/x/crypto/acme/autocert",
|
||||
"golang.org/x/crypto/bcrypt",
|
||||
"golang.org/x/crypto/pbkdf2",
|
||||
"golang.org/x/crypto/ssh",
|
||||
"golang.org/x/net/html",
|
||||
@@ -1214,8 +1329,11 @@
|
||||
"gopkg.in/editorconfig/editorconfig-core-go.v1",
|
||||
"gopkg.in/gomail.v2",
|
||||
"gopkg.in/ini.v1",
|
||||
"gopkg.in/ldap.v2",
|
||||
"gopkg.in/ldap.v3",
|
||||
"gopkg.in/macaron.v1",
|
||||
"gopkg.in/src-d/go-git.v4",
|
||||
"gopkg.in/src-d/go-git.v4/config",
|
||||
"gopkg.in/src-d/go-git.v4/plumbing",
|
||||
"gopkg.in/testfixtures.v2",
|
||||
"strk.kbt.io/projects/go/libravatar",
|
||||
]
|
||||
|
21
Gopkg.toml
21
Gopkg.toml
@@ -15,10 +15,8 @@ ignored = ["google.golang.org/appengine*"]
|
||||
name = "code.gitea.io/sdk"
|
||||
|
||||
[[constraint]]
|
||||
# branch = "master"
|
||||
revision = "c74e08f039e56cef576e4336382b2a2d12d9e026"
|
||||
revision = "05d86ea8f6e30456949f612cf68cf4a27ce8c9c5"
|
||||
name = "github.com/blevesearch/bleve"
|
||||
#Not targetting v0.7.0 since standard where use only just after this tag
|
||||
|
||||
[[constraint]]
|
||||
revision = "12dd70caea0268ac0d6c2707d0611ef601e7c64e"
|
||||
@@ -38,7 +36,7 @@ ignored = ["google.golang.org/appengine*"]
|
||||
|
||||
[[override]]
|
||||
name = "github.com/go-xorm/xorm"
|
||||
revision = "401f4ee8ff8cbc40a4754cb12192fbe4f02f3979"
|
||||
revision = "a6300f2a45e05a8f75f00a1d6188049fe7851915"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/go-xorm/builder"
|
||||
@@ -46,7 +44,7 @@ ignored = ["google.golang.org/appengine*"]
|
||||
|
||||
[[override]]
|
||||
name = "github.com/go-sql-driver/mysql"
|
||||
revision = "d523deb1b23d913de5bdada721a6071e71283618"
|
||||
revision = "c45f530f8e7fe40f4687eaa50d0c8c5f1b66f9e0"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/mattn/go-sqlite3"
|
||||
@@ -97,8 +95,8 @@ ignored = ["google.golang.org/appengine*"]
|
||||
version = "1.31.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "gopkg.in/ldap.v2"
|
||||
version = "2.4.1"
|
||||
name = "gopkg.in/ldap.v3"
|
||||
version = "3.0.1"
|
||||
|
||||
[[constraint]]
|
||||
name = "gopkg.in/macaron.v1"
|
||||
@@ -108,11 +106,6 @@ ignored = ["google.golang.org/appengine*"]
|
||||
name = "gopkg.in/testfixtures.v2"
|
||||
version = "2.0.0"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/boltdb/bolt"
|
||||
revision = "ccd680d8c1a0179ac3d68f692b01e1a1589cbfc7"
|
||||
source = "github.com/go-gitea/bolt"
|
||||
|
||||
[[override]]
|
||||
branch = "master"
|
||||
name = "golang.org/x/oauth2"
|
||||
@@ -120,3 +113,7 @@ ignored = ["google.golang.org/appengine*"]
|
||||
[[constraint]]
|
||||
name = "github.com/prometheus/client_golang"
|
||||
version = "0.9.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/mvdan/xurls"
|
||||
version = "2.0.0"
|
||||
|
@@ -26,3 +26,5 @@ Lanre Adelowo <yo@lanre.wtf> (@adelowo)
|
||||
Konrad Langenberg <k@knt.li> (@kolaente)
|
||||
He-Long Zhang <outman99@hotmail.com> (@BetaCat0)
|
||||
Andrew Thornton <art27@cantab.net> (@zeripath)
|
||||
John Olheiser <john.olheiser@gmail.com> (@jolheiser)
|
||||
Richard Mahn <rich.mahn@unfoldingword.org> (@richmahn)
|
||||
|
78
Makefile
78
Makefile
@@ -4,6 +4,8 @@ IMPORT := code.gitea.io/gitea
|
||||
GO ?= go
|
||||
SED_INPLACE := sed -i
|
||||
|
||||
export PATH := $($(GO) env GOPATH)/bin:$(PATH)
|
||||
|
||||
ifeq ($(OS), Windows_NT)
|
||||
EXECUTABLE := gitea.exe
|
||||
else
|
||||
@@ -35,7 +37,7 @@ endif
|
||||
|
||||
LDFLAGS := -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
|
||||
|
||||
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/))
|
||||
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/)))
|
||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||
|
||||
TAGS ?=
|
||||
@@ -50,6 +52,10 @@ TEST_MYSQL_HOST ?= mysql:3306
|
||||
TEST_MYSQL_DBNAME ?= testgitea
|
||||
TEST_MYSQL_USERNAME ?= root
|
||||
TEST_MYSQL_PASSWORD ?=
|
||||
TEST_MYSQL8_HOST ?= mysql8:3306
|
||||
TEST_MYSQL8_DBNAME ?= testgitea
|
||||
TEST_MYSQL8_USERNAME ?= root
|
||||
TEST_MYSQL8_PASSWORD ?=
|
||||
TEST_PGSQL_HOST ?= pgsql:5432
|
||||
TEST_PGSQL_DBNAME ?= testgitea
|
||||
TEST_PGSQL_USERNAME ?= postgres
|
||||
@@ -78,9 +84,9 @@ clean:
|
||||
$(GO) clean -i ./...
|
||||
rm -rf $(EXECUTABLE) $(DIST) $(BINDATA) \
|
||||
integrations*.test \
|
||||
integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-sqlite/ integrations/gitea-integration-mssql/ \
|
||||
integrations/indexers-mysql/ integrations/indexers-pgsql integrations/indexers-sqlite integrations/indexers-mssql \
|
||||
integrations/mysql.ini integrations/pgsql.ini integrations/mssql.ini
|
||||
integrations/gitea-integration-pgsql/ integrations/gitea-integration-mysql/ integrations/gitea-integration-mysql8/ integrations/gitea-integration-sqlite/ \
|
||||
integrations/gitea-integration-mssql/ integrations/indexers-mysql/ integrations/indexers-mysql8/ integrations/indexers-pgsql integrations/indexers-sqlite \
|
||||
integrations/indexers-mssql integrations/mysql.ini integrations/mysql8.ini integrations/pgsql.ini integrations/mssql.ini
|
||||
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
@@ -174,7 +180,7 @@ coverage:
|
||||
|
||||
.PHONY: unit-test-coverage
|
||||
unit-test-coverage:
|
||||
for PKG in $(PACKAGES); do $(GO) test -tags='sqlite sqlite_unlock_notify' -cover -coverprofile $$GOPATH/src/$$PKG/coverage.out $$PKG || exit 1; done;
|
||||
$(GO) test -tags='sqlite sqlite_unlock_notify' -cover -coverprofile coverage.out $(PACKAGES) && echo "\n==>\033[32m Ok\033[m\n" || exit 1
|
||||
|
||||
.PHONY: vendor
|
||||
vendor:
|
||||
@@ -197,12 +203,21 @@ test-vendor: vendor
|
||||
test-sqlite: integrations.sqlite.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test
|
||||
|
||||
.PHONY: test-sqlite-migration
|
||||
test-sqlite-migration: migrations.sqlite.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./migrations.sqlite.test
|
||||
|
||||
generate-ini:
|
||||
sed -e 's|{{TEST_MYSQL_HOST}}|${TEST_MYSQL_HOST}|g' \
|
||||
-e 's|{{TEST_MYSQL_DBNAME}}|${TEST_MYSQL_DBNAME}|g' \
|
||||
-e 's|{{TEST_MYSQL_USERNAME}}|${TEST_MYSQL_USERNAME}|g' \
|
||||
-e 's|{{TEST_MYSQL_PASSWORD}}|${TEST_MYSQL_PASSWORD}|g' \
|
||||
integrations/mysql.ini.tmpl > integrations/mysql.ini
|
||||
sed -e 's|{{TEST_MYSQL8_HOST}}|${TEST_MYSQL8_HOST}|g' \
|
||||
-e 's|{{TEST_MYSQL8_DBNAME}}|${TEST_MYSQL8_DBNAME}|g' \
|
||||
-e 's|{{TEST_MYSQL8_USERNAME}}|${TEST_MYSQL8_USERNAME}|g' \
|
||||
-e 's|{{TEST_MYSQL8_PASSWORD}}|${TEST_MYSQL8_PASSWORD}|g' \
|
||||
integrations/mysql8.ini.tmpl > integrations/mysql8.ini
|
||||
sed -e 's|{{TEST_PGSQL_HOST}}|${TEST_PGSQL_HOST}|g' \
|
||||
-e 's|{{TEST_PGSQL_DBNAME}}|${TEST_PGSQL_DBNAME}|g' \
|
||||
-e 's|{{TEST_PGSQL_USERNAME}}|${TEST_PGSQL_USERNAME}|g' \
|
||||
@@ -218,14 +233,35 @@ generate-ini:
|
||||
test-mysql: integrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test
|
||||
|
||||
.PHONY: test-mysql-migration
|
||||
test-mysql-migration: migrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./migrations.test
|
||||
|
||||
.PHONY: test-mysql8
|
||||
test-mysql8: integrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./integrations.test
|
||||
|
||||
.PHONY: test-mysql8-migration
|
||||
test-mysql8-migration: migrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql8.ini ./migrations.test
|
||||
|
||||
.PHONY: test-pgsql
|
||||
test-pgsql: integrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test
|
||||
|
||||
.PHONY: test-pgsql-migration
|
||||
test-pgsql-migration: migrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./migrations.test
|
||||
|
||||
.PHONY: test-mssql
|
||||
test-mssql: integrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test
|
||||
|
||||
.PHONY: test-mssql-migration
|
||||
test-mssql-migration: migrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./migrations.test
|
||||
|
||||
|
||||
.PHONY: bench-sqlite
|
||||
bench-sqlite: integrations.sqlite.test
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
|
||||
@@ -234,6 +270,10 @@ bench-sqlite: integrations.sqlite.test
|
||||
bench-mysql: integrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mysql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
|
||||
|
||||
.PHONY: bench-mssql
|
||||
bench-mssql: integrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/mssql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
|
||||
|
||||
.PHONY: bench-pgsql
|
||||
bench-pgsql: integrations.test generate-ini
|
||||
GITEA_ROOT=${CURDIR} GITEA_CONF=integrations/pgsql.ini ./integrations.test -test.cpuprofile=cpu.out -test.run DontRunTests -test.bench .
|
||||
@@ -252,6 +292,14 @@ integrations.sqlite.test: $(SOURCES)
|
||||
integrations.cover.test: $(SOURCES)
|
||||
$(GO) test -c code.gitea.io/gitea/integrations -coverpkg $(shell echo $(PACKAGES) | tr ' ' ',') -o integrations.cover.test
|
||||
|
||||
.PHONY: migrations.test
|
||||
migrations.test: $(SOURCES)
|
||||
$(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.test
|
||||
|
||||
.PHONY: migrations.sqlite.test
|
||||
migrations.sqlite.test: $(SOURCES)
|
||||
$(GO) test -c code.gitea.io/gitea/integrations/migration-test -o migrations.sqlite.test -tags 'sqlite sqlite_unlock_notify'
|
||||
|
||||
.PHONY: check
|
||||
check: test
|
||||
|
||||
@@ -275,7 +323,7 @@ release-dirs:
|
||||
.PHONY: release-windows
|
||||
release-windows:
|
||||
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/karalabe/xgo; \
|
||||
$(GO) get -u src.techknowlogick.com/xgo; \
|
||||
fi
|
||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION) .
|
||||
ifeq ($(CI),drone)
|
||||
@@ -285,7 +333,7 @@ endif
|
||||
.PHONY: release-linux
|
||||
release-linux:
|
||||
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/karalabe/xgo; \
|
||||
$(GO) get -u src.techknowlogick.com/xgo; \
|
||||
fi
|
||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out gitea-$(VERSION) .
|
||||
ifeq ($(CI),drone)
|
||||
@@ -295,7 +343,7 @@ endif
|
||||
.PHONY: release-darwin
|
||||
release-darwin:
|
||||
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
$(GO) get -u github.com/karalabe/xgo; \
|
||||
$(GO) get -u src.techknowlogick.com/xgo; \
|
||||
fi
|
||||
xgo -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out gitea-$(VERSION) .
|
||||
ifeq ($(CI),drone)
|
||||
@@ -335,8 +383,14 @@ stylesheets-check: generate-stylesheets
|
||||
|
||||
.PHONY: generate-stylesheets
|
||||
generate-stylesheets:
|
||||
node_modules/.bin/lessc --clean-css public/less/index.less public/css/index.css
|
||||
$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),node_modules/.bin/lessc --clean-css public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)
|
||||
@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||
echo "Please install npm version 5.2+"; \
|
||||
exit 1; \
|
||||
fi;
|
||||
$(eval BROWSERS := "> 1%, last 2 firefox versions, last 2 safari versions, ie 11")
|
||||
npx lessc --clean-css public/less/index.less public/css/index.css
|
||||
$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)
|
||||
$(foreach file, $(wildcard public/css/*),npx postcss --use autoprefixer --autoprefixer.browsers $(BROWSERS) -o $(file) $(file);)
|
||||
|
||||
.PHONY: swagger-ui
|
||||
swagger-ui:
|
||||
@@ -382,3 +436,7 @@ generate-images:
|
||||
$(TMPDIR)/images/64.png $(TMPDIR)/images/128.png \
|
||||
$(PWD)/public/img/favicon.ico
|
||||
rm -rf $(TMPDIR)/images
|
||||
|
||||
.PHONY: pr
|
||||
pr:
|
||||
$(GO) run contrib/pr/checkout.go $(PR)
|
||||
|
@@ -340,6 +340,7 @@ func runCreateUser(c *cli.Context) error {
|
||||
IsActive: true,
|
||||
IsAdmin: c.Bool("admin"),
|
||||
MustChangePassword: changePassword,
|
||||
Theme: setting.UI.DefaultTheme,
|
||||
}); err != nil {
|
||||
return fmt.Errorf("CreateUser: %v", err)
|
||||
}
|
||||
|
@@ -9,10 +9,11 @@ package cmd
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
@@ -24,7 +25,7 @@ func argsSet(c *cli.Context, args ...string) error {
|
||||
return errors.New(a + " is not set")
|
||||
}
|
||||
|
||||
if len(strings.TrimSpace(c.String(a))) == 0 {
|
||||
if util.IsEmptyString(a) {
|
||||
return errors.New(a + " is required")
|
||||
}
|
||||
}
|
||||
|
36
cmd/dump.go
36
cmd/dump.go
@@ -48,6 +48,10 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
|
||||
Name: "database, d",
|
||||
Usage: "Specify the database SQL syntax",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "skip-repository, R",
|
||||
Usage: "Skip the repository dumping",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -79,13 +83,27 @@ func runDump(ctx *cli.Context) error {
|
||||
os.Setenv("TMPDIR", tmpWorkDir)
|
||||
}
|
||||
|
||||
reposDump := path.Join(tmpWorkDir, "gitea-repo.zip")
|
||||
dbDump := path.Join(tmpWorkDir, "gitea-db.sql")
|
||||
|
||||
log.Printf("Dumping local repositories...%s", setting.RepoRootPath)
|
||||
fileName := fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix())
|
||||
log.Printf("Packing dump files...")
|
||||
z, err := zip.Create(fileName)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create %s: %v", fileName, err)
|
||||
}
|
||||
zip.Verbose = ctx.Bool("verbose")
|
||||
if err := zip.PackTo(setting.RepoRootPath, reposDump, true); err != nil {
|
||||
log.Fatalf("Failed to dump local repositories: %v", err)
|
||||
|
||||
if ctx.IsSet("skip-repository") {
|
||||
log.Printf("Skip dumping local repositories")
|
||||
} else {
|
||||
log.Printf("Dumping local repositories...%s", setting.RepoRootPath)
|
||||
reposDump := path.Join(tmpWorkDir, "gitea-repo.zip")
|
||||
if err := zip.PackTo(setting.RepoRootPath, reposDump, true); err != nil {
|
||||
log.Fatalf("Failed to dump local repositories: %v", err)
|
||||
}
|
||||
if err := z.AddFile("gitea-repo.zip", reposDump); err != nil {
|
||||
log.Fatalf("Failed to include gitea-repo.zip: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
targetDBType := ctx.String("database")
|
||||
@@ -99,16 +117,6 @@ func runDump(ctx *cli.Context) error {
|
||||
log.Fatalf("Failed to dump database: %v", err)
|
||||
}
|
||||
|
||||
fileName := fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix())
|
||||
log.Printf("Packing dump files...")
|
||||
z, err := zip.Create(fileName)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create %s: %v", fileName, err)
|
||||
}
|
||||
|
||||
if err := z.AddFile("gitea-repo.zip", reposDump); err != nil {
|
||||
log.Fatalf("Failed to include gitea-repo.zip: %v", err)
|
||||
}
|
||||
if err := z.AddFile("gitea-db.sql", dbDump); err != nil {
|
||||
log.Fatalf("Failed to include gitea-db.sql: %v", err)
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ func runGenerateInternalToken(c *cli.Context) error {
|
||||
}
|
||||
|
||||
func runGenerateLfsJwtSecret(c *cli.Context) error {
|
||||
JWTSecretBase64, err := generate.NewLfsJwtSecret()
|
||||
JWTSecretBase64, err := generate.NewJwtSecret()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -18,6 +17,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@@ -239,7 +239,7 @@ func runHookPostReceive(c *cli.Context) error {
|
||||
branch = fmt.Sprintf("%s:%s", repo.OwnerName, branch)
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "Create a new pull request for '%s':\n", branch)
|
||||
fmt.Fprintf(os.Stderr, " %s/compare/%s...%s\n", baseRepo.HTMLURL(), url.QueryEscape(baseRepo.DefaultBranch), url.QueryEscape(branch))
|
||||
fmt.Fprintf(os.Stderr, " %s/compare/%s...%s\n", baseRepo.HTMLURL(), util.PathEscapeSegments(baseRepo.DefaultBranch), util.PathEscapeSegments(branch))
|
||||
} else {
|
||||
fmt.Fprint(os.Stderr, "Visit the existing pull request:\n")
|
||||
fmt.Fprintf(os.Stderr, " %s/pulls/%d\n", baseRepo.HTMLURL(), pr.Index)
|
||||
|
22
cmd/serv.go
22
cmd/serv.go
@@ -70,6 +70,7 @@ func checkLFSVersion() {
|
||||
}
|
||||
|
||||
func setup(logPath string) {
|
||||
log.DelLogger("console")
|
||||
setting.NewContext()
|
||||
checkLFSVersion()
|
||||
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath))
|
||||
@@ -233,23 +234,30 @@ func runServ(c *cli.Context) error {
|
||||
|
||||
// Check deploy key or user key.
|
||||
if key.Type == models.KeyTypeDeploy {
|
||||
if key.Mode < requestedMode {
|
||||
fail("Key permission denied", "Cannot push with deployment key: %d", key.ID)
|
||||
}
|
||||
|
||||
// Check if this deploy key belongs to current repository.
|
||||
has, err := private.HasDeployKey(key.ID, repo.ID)
|
||||
// Now we have to get the deploy key for this repo
|
||||
deployKey, err := private.GetDeployKey(key.ID, repo.ID)
|
||||
if err != nil {
|
||||
fail("Key access denied", "Failed to access internal api: [key_id: %d, repo_id: %d]", key.ID, repo.ID)
|
||||
}
|
||||
if !has {
|
||||
|
||||
if deployKey == nil {
|
||||
fail("Key access denied", "Deploy key access denied: [key_id: %d, repo_id: %d]", key.ID, repo.ID)
|
||||
}
|
||||
|
||||
if deployKey.Mode < requestedMode {
|
||||
fail("Key permission denied", "Cannot push with read-only deployment key: %d to repo_id: %d", key.ID, repo.ID)
|
||||
}
|
||||
|
||||
// Update deploy key activity.
|
||||
if err = private.UpdateDeployKeyUpdated(key.ID, repo.ID); err != nil {
|
||||
fail("Internal error", "UpdateDeployKey: %v", err)
|
||||
}
|
||||
|
||||
// FIXME: Deploy keys aren't really the owner of the repo pushing changes
|
||||
// however we don't have good way of representing deploy keys in hook.go
|
||||
// so for now use the owner
|
||||
os.Setenv(models.EnvPusherName, username)
|
||||
os.Setenv(models.EnvPusherID, fmt.Sprintf("%d", repo.OwnerID))
|
||||
} else {
|
||||
user, err = private.GetUserByKeyID(key.ID)
|
||||
if err != nil {
|
||||
|
263
contrib/pr/checkout.go
Normal file
263
contrib/pr/checkout.go
Normal file
@@ -0,0 +1,263 @@
|
||||
package main
|
||||
|
||||
/*
|
||||
Checkout a PR and load the tests data into sqlite database
|
||||
*/
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/markup/external"
|
||||
"code.gitea.io/gitea/routers"
|
||||
"code.gitea.io/gitea/routers/routes"
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/go-xorm/xorm"
|
||||
context2 "github.com/gorilla/context"
|
||||
"gopkg.in/src-d/go-git.v4"
|
||||
"gopkg.in/src-d/go-git.v4/config"
|
||||
"gopkg.in/src-d/go-git.v4/plumbing"
|
||||
"gopkg.in/testfixtures.v2"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
||||
var codeFilePath = "contrib/pr/checkout.go"
|
||||
|
||||
func runPR() {
|
||||
log.Printf("[PR] Starting gitea ...\n")
|
||||
curDir, err := os.Getwd()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
setting.NewContext()
|
||||
|
||||
setting.RepoRootPath, err = ioutil.TempDir(os.TempDir(), "repos")
|
||||
if err != nil {
|
||||
log.Fatalf("TempDir: %v\n", err)
|
||||
}
|
||||
setting.AppDataPath, err = ioutil.TempDir(os.TempDir(), "appdata")
|
||||
if err != nil {
|
||||
log.Fatalf("TempDir: %v\n", err)
|
||||
}
|
||||
setting.AppWorkPath = curDir
|
||||
setting.StaticRootPath = curDir
|
||||
setting.GravatarSourceURL, err = url.Parse("https://secure.gravatar.com/avatar/")
|
||||
if err != nil {
|
||||
log.Fatalf("url.Parse: %v\n", err)
|
||||
}
|
||||
|
||||
setting.AppURL = "http://localhost:8080/"
|
||||
setting.HTTPPort = "8080"
|
||||
setting.SSH.Domain = "localhost"
|
||||
setting.SSH.Port = 3000
|
||||
setting.InstallLock = true
|
||||
setting.SecretKey = "9pCviYTWSb"
|
||||
setting.InternalToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTI3OTU5ODN9.OQkH5UmzID2XBdwQ9TAI6Jj2t1X-wElVTjbE7aoN4I8"
|
||||
curUser, err := user.Current()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
setting.RunUser = curUser.Username
|
||||
|
||||
log.Printf("[PR] Loading fixtures data ...\n")
|
||||
setting.CheckLFSVersion()
|
||||
//models.LoadConfigs()
|
||||
/*
|
||||
models.DbCfg.Type = "sqlite3"
|
||||
models.DbCfg.Path = ":memory:"
|
||||
models.DbCfg.Timeout = 500
|
||||
*/
|
||||
db := setting.Cfg.Section("database")
|
||||
db.NewKey("DB_TYPE", "sqlite3")
|
||||
db.NewKey("PATH", ":memory:")
|
||||
setting.LogSQL = true
|
||||
models.LoadConfigs()
|
||||
routers.NewServices()
|
||||
//x, err = xorm.NewEngine("sqlite3", "file::memory:?cache=shared")
|
||||
|
||||
var helper testfixtures.Helper
|
||||
helper = &testfixtures.SQLite{}
|
||||
models.NewEngine(func(_ *xorm.Engine) error {
|
||||
return nil
|
||||
})
|
||||
models.HasEngine = true
|
||||
//x.ShowSQL(true)
|
||||
err = models.InitFixtures(
|
||||
helper,
|
||||
path.Join(curDir, "models/fixtures/"),
|
||||
)
|
||||
if err != nil {
|
||||
fmt.Printf("Error initializing test database: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
models.LoadFixtures()
|
||||
os.RemoveAll(setting.RepoRootPath)
|
||||
os.RemoveAll(models.LocalCopyPath())
|
||||
os.RemoveAll(models.LocalWikiPath())
|
||||
com.CopyDir(path.Join(curDir, "integrations/gitea-repositories-meta"), setting.RepoRootPath)
|
||||
|
||||
log.Printf("[PR] Setting up router\n")
|
||||
//routers.GlobalInit()
|
||||
external.RegisterParsers()
|
||||
m := routes.NewMacaron()
|
||||
routes.RegisterRoutes(m)
|
||||
|
||||
log.Printf("[PR] Ready for testing !\n")
|
||||
log.Printf("[PR] Login with user1, user2, user3, ... with pass: password\n")
|
||||
/*
|
||||
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
|
||||
|
||||
if setting.LFS.StartServer {
|
||||
log.Info("LFS server enabled")
|
||||
}
|
||||
|
||||
if setting.EnablePprof {
|
||||
go func() {
|
||||
log.Info("Starting pprof server on localhost:6060")
|
||||
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
|
||||
}()
|
||||
}
|
||||
*/
|
||||
|
||||
//Start the server
|
||||
http.ListenAndServe(":8080", context2.ClearHandler(m))
|
||||
|
||||
log.Printf("[PR] Cleaning up ...\n")
|
||||
/*
|
||||
if err = os.RemoveAll(setting.Indexer.IssuePath); err != nil {
|
||||
fmt.Printf("os.RemoveAll: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if err = os.RemoveAll(setting.Indexer.RepoPath); err != nil {
|
||||
fmt.Printf("Unable to remove repo indexer: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
*/
|
||||
if err = os.RemoveAll(setting.RepoRootPath); err != nil {
|
||||
log.Fatalf("os.RemoveAll: %v\n", err)
|
||||
}
|
||||
if err = os.RemoveAll(setting.AppDataPath); err != nil {
|
||||
log.Fatalf("os.RemoveAll: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
var runPRFlag = flag.Bool("run", false, "Run the PR code")
|
||||
flag.Parse()
|
||||
if *runPRFlag {
|
||||
runPR()
|
||||
return
|
||||
}
|
||||
|
||||
// To force checkout (e.g. Windows complains about unclean work tree) set env variable FORCE=true
|
||||
force, err := strconv.ParseBool(os.Getenv("FORCE"))
|
||||
if err != nil {
|
||||
force = false
|
||||
}
|
||||
|
||||
//Otherwise checkout PR
|
||||
if len(os.Args) != 2 {
|
||||
log.Fatal("Need only one arg: the PR number")
|
||||
}
|
||||
pr := os.Args[1]
|
||||
|
||||
codeFilePath = filepath.FromSlash(codeFilePath) //Convert to running OS
|
||||
|
||||
//Copy this file if it will not exist in the PR branch
|
||||
dat, err := ioutil.ReadFile(codeFilePath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to cache this code file : %v", err)
|
||||
}
|
||||
|
||||
repo, err := git.PlainOpen(".")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to open the repo : %v", err)
|
||||
}
|
||||
|
||||
//Find remote upstream
|
||||
remotes, err := repo.Remotes()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to list remotes of repo : %v", err)
|
||||
}
|
||||
remoteUpstream := "origin" //Default
|
||||
for _, r := range remotes {
|
||||
if r.Config().URLs[0] == "https://github.com/go-gitea/gitea" || r.Config().URLs[0] == "git@github.com:go-gitea/gitea.git" { //fetch at index 0
|
||||
remoteUpstream = r.Config().Name
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
branch := fmt.Sprintf("pr-%s-%d", pr, time.Now().Unix())
|
||||
branchRef := plumbing.NewBranchReferenceName(branch)
|
||||
|
||||
log.Printf("Fetching PR #%s in %s\n", pr, branch)
|
||||
if runtime.GOOS == "windows" {
|
||||
//Use git cli command for windows
|
||||
runCmd("git", "fetch", remoteUpstream, fmt.Sprintf("pull/%s/head:%s", pr, branch))
|
||||
} else {
|
||||
ref := fmt.Sprintf("refs/pull/%s/head:%s", pr, branchRef)
|
||||
err = repo.Fetch(&git.FetchOptions{
|
||||
RemoteName: remoteUpstream,
|
||||
RefSpecs: []config.RefSpec{
|
||||
config.RefSpec(ref),
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to fetch %s from %s : %v", ref, remoteUpstream, err)
|
||||
}
|
||||
}
|
||||
|
||||
tree, err := repo.Worktree()
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to parse git tree : %v", err)
|
||||
}
|
||||
log.Printf("Checkout PR #%s in %s\n", pr, branch)
|
||||
err = tree.Checkout(&git.CheckoutOptions{
|
||||
Branch: branchRef,
|
||||
Force: force,
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to checkout %s : %v", branch, err)
|
||||
}
|
||||
|
||||
//Copy this file if not exist
|
||||
if _, err := os.Stat(codeFilePath); os.IsNotExist(err) {
|
||||
err = os.MkdirAll(filepath.Dir(codeFilePath), 0755)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to duplicate this code file in PR : %v", err)
|
||||
}
|
||||
err = ioutil.WriteFile(codeFilePath, dat, 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to duplicate this code file in PR : %v", err)
|
||||
}
|
||||
}
|
||||
time.Sleep(5 * time.Second)
|
||||
//Start with integration test
|
||||
runCmd("go", "run", "-tags", "sqlite sqlite_unlock_notify", codeFilePath, "-run")
|
||||
}
|
||||
func runCmd(cmd ...string) {
|
||||
log.Printf("Executing : %s ...\n", cmd)
|
||||
c := exec.Command(cmd[0], cmd[1:]...)
|
||||
c.Stdout = os.Stdout
|
||||
c.Stderr = os.Stderr
|
||||
if err := c.Start(); err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
if err := c.Wait(); err != nil {
|
||||
log.Panicln(err)
|
||||
}
|
||||
}
|
@@ -2,10 +2,11 @@
|
||||
Description=Gitea (Git with a cup of tea)
|
||||
After=syslog.target
|
||||
After=network.target
|
||||
#After=mysqld.service
|
||||
#After=postgresql.service
|
||||
#After=memcached.service
|
||||
#After=redis.service
|
||||
#Requires=mysql.service
|
||||
#Requires=mariadb.service
|
||||
#Requires=postgresql.service
|
||||
#Requires=memcached.service
|
||||
#Requires=redis.service
|
||||
|
||||
[Service]
|
||||
# Modify these two values and uncomment them if you have
|
||||
|
@@ -31,8 +31,13 @@ PULL_REQUEST_QUEUE_LENGTH = 1000
|
||||
PREFERRED_LICENSES = Apache License 2.0,MIT License
|
||||
; Disable the ability to interact with repositories using the HTTP protocol
|
||||
DISABLE_HTTP_GIT = false
|
||||
; Value for Access-Control-Allow-Origin header, default is not to present
|
||||
; WARNING: This maybe harmful to you website if you do not give it a right value.
|
||||
ACCESS_CONTROL_ALLOW_ORIGIN =
|
||||
; Force ssh:// clone url instead of scp-style uri when default SSH port is used
|
||||
USE_COMPAT_SSH_URI = false
|
||||
; Close issues as long as a commit on any branch marks it as fixed
|
||||
DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH = false
|
||||
|
||||
[repository.editor]
|
||||
; List of file extensions for which lines should be wrapped in the CodeMirror editor
|
||||
@@ -64,6 +69,10 @@ MAX_FILES = 5
|
||||
; List of prefixes used in Pull Request title to mark them as Work In Progress
|
||||
WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]
|
||||
|
||||
[repository.issue]
|
||||
; List of reasons why a Pull Request or Issue can be locked
|
||||
LOCK_REASONS=Too heated,Off-topic,Resolved,Spam
|
||||
|
||||
[ui]
|
||||
; Number of repositories that are displayed on one explore page
|
||||
EXPLORE_PAGING_NUM = 20
|
||||
@@ -85,6 +94,8 @@ MAX_DISPLAY_FILE_SIZE = 8388608
|
||||
SHOW_USER_EMAIL = true
|
||||
; Set the default theme for the Gitea install
|
||||
DEFAULT_THEME = gitea
|
||||
; All available themes. Allow users select personalized themes regardless of the value of `DEFAULT_THEME`.
|
||||
THEMES = gitea,arc-green
|
||||
|
||||
[ui.admin]
|
||||
; Number of users that are displayed on one page
|
||||
@@ -237,9 +248,24 @@ SQLITE_TIMEOUT = 500
|
||||
ITERATE_BUFFER_SIZE = 50
|
||||
; Show the database generated SQL
|
||||
LOG_SQL = true
|
||||
; Maximum number of DB Connect retries
|
||||
DB_RETRIES = 10
|
||||
; Backoff time per DB retry (time.Duration)
|
||||
DB_RETRY_BACKOFF = 3s
|
||||
|
||||
[indexer]
|
||||
; Issue indexer type, currently support: bleve or db, default is bleve
|
||||
ISSUE_INDEXER_TYPE = bleve
|
||||
; Issue indexer storage path, available when ISSUE_INDEXER_TYPE is bleve
|
||||
ISSUE_INDEXER_PATH = indexers/issues.bleve
|
||||
; Issue indexer queue, currently support: channel or levelqueue, default is levelqueue
|
||||
ISSUE_INDEXER_QUEUE_TYPE = levelqueue
|
||||
; When ISSUE_INDEXER_QUEUE_TYPE is levelqueue, this will be the queue will be saved path,
|
||||
; default is indexers/issues.queue
|
||||
ISSUE_INDEXER_QUEUE_DIR = indexers/issues.queue
|
||||
; Batch queue number, default is 20
|
||||
ISSUE_INDEXER_QUEUE_BATCH_NUMBER = 20
|
||||
|
||||
; repo indexer by default disabled, since it uses a lot of disk space
|
||||
REPO_INDEXER_ENABLED = false
|
||||
REPO_INDEXER_PATH = indexers/repos.bleve
|
||||
@@ -339,6 +365,11 @@ DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
; Default value for AllowCreateOrganization
|
||||
; Every new user will have rights set to create organizations depending on this setting
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
; Either "public", "limited" or "private", default is "public"
|
||||
; Limited is for signed user only
|
||||
; Private is only for member of the organization
|
||||
; Public is for everyone
|
||||
DEFAULT_ORG_VISIBILITY = public
|
||||
; Default value for EnableDependencies
|
||||
; Repositories will use dependencies by default depending on this setting
|
||||
DEFAULT_ENABLE_DEPENDENCIES = true
|
||||
@@ -356,6 +387,12 @@ DEFAULT_ALLOW_ONLY_CONTRIBUTORS_TO_TRACK_TIME = true
|
||||
; if he has set KeepEmailPrivate to true. The user's email will be replaced with a
|
||||
; concatenation of the user name in lower case, "@" and NO_REPLY_ADDRESS.
|
||||
NO_REPLY_ADDRESS = noreply.example.org
|
||||
; Show Registration button
|
||||
SHOW_REGISTRATION_BUTTON = true
|
||||
; Default value for AutoWatchNewRepos
|
||||
; When adding a repo to a team or creating a new repo all team members will watch the
|
||||
; repo automatically if enabled
|
||||
AUTO_WATCH_NEW_REPOS = true
|
||||
|
||||
[webhook]
|
||||
; Hook task queue length, increase if webhook shooting starts hanging
|
||||
@@ -398,8 +435,8 @@ USER =
|
||||
PASSWD =
|
||||
; Send mails as plain text
|
||||
SEND_AS_PLAIN_TEXT = false
|
||||
; Enable sendmail (override SMTP)
|
||||
USE_SENDMAIL = false
|
||||
; Set Mailer Type (either SMTP, sendmail or dummy to just send to the log)
|
||||
MAILER_TYPE = smtp
|
||||
; Specify an alternative sendmail binary
|
||||
SENDMAIL_PATH = sendmail
|
||||
; Specify any extra sendmail arguments
|
||||
@@ -481,6 +518,7 @@ MODE = console
|
||||
BUFFER_LEN = 10000
|
||||
; Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Trace"
|
||||
LEVEL = Trace
|
||||
REDIRECT_MACARON_LOG = false
|
||||
|
||||
; For "console" mode only
|
||||
[log.console]
|
||||
@@ -593,6 +631,7 @@ GC_ARGS =
|
||||
|
||||
; Operation timeout in seconds
|
||||
[git.timeout]
|
||||
DEFAULT = 360
|
||||
MIGRATE = 600
|
||||
MIRROR = 300
|
||||
CLONE = 300
|
||||
@@ -610,6 +649,20 @@ MIN_INTERVAL = 10m
|
||||
ENABLE_SWAGGER = true
|
||||
; Max number of items in a page
|
||||
MAX_RESPONSE_ITEMS = 50
|
||||
; Default paging number of api
|
||||
DEFAULT_PAGING_NUM = 30
|
||||
; Default and maximum number of items per page for git trees api
|
||||
DEFAULT_GIT_TREES_PER_PAGE = 1000
|
||||
|
||||
[oauth2]
|
||||
; Enables OAuth2 provider
|
||||
ENABLED = true
|
||||
; Lifetime of an OAuth2 access token in seconds
|
||||
ACCESS_TOKEN_EXPIRATION_TIME=3600
|
||||
; Lifetime of an OAuth2 access token in hours
|
||||
REFRESH_TOKEN_EXPIRATION_TIME=730
|
||||
; OAuth2 authentication secret for access and refresh tokens, change this a unique string.
|
||||
JWT_SECRET=Bk0yK7Y9g_p56v86KaHqjSbxvNvu3SbKoOdOt2ZcXvU
|
||||
|
||||
[i18n]
|
||||
LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,uk-UA,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR
|
||||
@@ -641,11 +694,12 @@ sv-SE = sv
|
||||
ko-KR = ko
|
||||
|
||||
[U2F]
|
||||
; NOTE: THE DEFAULT VALUES HERE WILL NEED TO BE CHANGED
|
||||
; Two Factor authentication with security keys
|
||||
; https://developers.yubico.com/U2F/App_ID.html
|
||||
APP_ID = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
|
||||
; Comma seperated list of truisted facets
|
||||
TRUSTED_FACETS = %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/
|
||||
;APP_ID = http://localhost:3000/
|
||||
; Comma seperated list of trusted facets
|
||||
;TRUSTED_FACETS = http://localhost:3000/
|
||||
|
||||
; Extension mapping to highlight class
|
||||
; e.g. .toml=ini
|
||||
|
@@ -7,6 +7,14 @@ if [ "${USER}" != "git" ]; then
|
||||
sed -i -e "s/AllowUsers git$/AllowUsers ${USER}/g" /etc/ssh/sshd_config
|
||||
fi
|
||||
|
||||
if [ -z "${USER_GID}" ]; then
|
||||
USER_GID="`id -g ${USER}`"
|
||||
fi
|
||||
|
||||
if [ -z "${USER_UID}" ]; then
|
||||
USER_UID="`id -u ${USER}`"
|
||||
fi
|
||||
|
||||
## Change GID for USER?
|
||||
if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
|
||||
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
|
||||
|
@@ -1,20 +1,16 @@
|
||||
# Gitea: Docs
|
||||
|
||||
[](http://drone.gitea.io/go-gitea/docs)
|
||||
[](https://discord.gg/NsatcWJ)
|
||||
[](https://discord.gg/Gitea)
|
||||
[](http://microbadger.com/images/gitea/docs "Get your own image badge on microbadger.com")
|
||||
|
||||
## Hosting
|
||||
|
||||
This page is hosted on our infrastructure within Docker containers, it gets
|
||||
These pages are hosted using [netlifycms](https://www.netlifycms.org/) and get
|
||||
automatically updated on every push to the `master` branch.
|
||||
|
||||
If you want to host this page on your own you can take our docker image
|
||||
[gitea/docs](https://hub.docker.com/r/gitea/docs/).
|
||||
|
||||
## Install
|
||||
|
||||
This pages uses the [Hugo](https://github.com/spf13/hugo) static site generator.
|
||||
These pages use the [Hugo](https://gohugo.io/) static site generator.
|
||||
If you are planning to contribute you'll want to download and install Hugo on
|
||||
your local machine.
|
||||
|
||||
|
@@ -17,7 +17,7 @@ menu:
|
||||
|
||||
## Enabling/configuring API access
|
||||
|
||||
By default, `ENABLE_SWAGGER_ENDPOINT` is true, and
|
||||
By default, `ENABLE_SWAGGER` is true, and
|
||||
`MAX_RESPONSE_ITEMS` is set to 50. See [Config Cheat
|
||||
Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) for more
|
||||
information.
|
||||
@@ -31,18 +31,18 @@ Gitea supports these methods of API authentication:
|
||||
- `access_token=...` parameter in URL query string
|
||||
- `Authorization: token ...` header in HTTP headers
|
||||
|
||||
All of these methods accept the same apiKey token type. You can
|
||||
All of these methods accept the same API key token type. You can
|
||||
better understand this by looking at the code -- as of this writing,
|
||||
Gitea parses queries and headers to find the token in
|
||||
[modules/auth/auth.go](https://github.com/go-gitea/gitea/blob/6efdcaed86565c91a3dc77631372a9cc45a58e89/modules/auth/auth.go#L47).
|
||||
|
||||
You can create an apiKey token via your gitea install's web interface:
|
||||
You can create an API key token via your Gitea installation's web interface:
|
||||
`Settings | Applications | Generate New Token`.
|
||||
|
||||
### More on the `Authorization:` header
|
||||
|
||||
For historical reasons, Gitea needs the word `token` included before
|
||||
the apiKey token in an authorization header, like this:
|
||||
the API key token in an authorization header, like this:
|
||||
|
||||
```
|
||||
Authorization: token 65eaa9c8ef52460d22a93307fe0aee76289dc675
|
||||
|
@@ -17,7 +17,7 @@ menu:
|
||||
|
||||
## 开启/配置 API 访问
|
||||
|
||||
通常情况下, `ENABLE_SWAGGER_ENDPOINT` 默认开启并且参数 `MAX_RESPONSE_ITEMS` 默认为 50。您可以从 [Config Cheat
|
||||
通常情况下, `ENABLE_SWAGGER` 默认开启并且参数 `MAX_RESPONSE_ITEMS` 默认为 50。您可以从 [Config Cheat
|
||||
Sheet](https://docs.gitea.io/en-us/config-cheat-sheet/) 中获取更多配置相关信息。
|
||||
|
||||
## 通过 API 认证
|
||||
|
@@ -44,7 +44,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
|
||||
- `ROOT`: **~/gitea-repositories/**: Root path for storing all repository data. It must be
|
||||
an absolute path.
|
||||
- `SCRIPT_TYPE`: **bash**: The script type this server supports, usually this is `bash`,
|
||||
- `SCRIPT_TYPE`: **bash**: The script type this server supports. Usually this is `bash`,
|
||||
but some users report that only `sh` is available.
|
||||
- `ANSI_CHARSET`: **\<empty\>**: The default charset for an unrecognized charset.
|
||||
- `FORCE_PRIVATE`: **false**: Force every new repository to be private.
|
||||
@@ -62,11 +62,18 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
HTTP protocol.
|
||||
- `USE_COMPAT_SSH_URI`: **false**: Force ssh:// clone url instead of scp-style uri when
|
||||
default SSH port is used.
|
||||
- `ACCESS_CONTROL_ALLOW_ORIGIN`: **\<empty\>**: Value for Access-Control-Allow-Origin header,
|
||||
default is not to present. **WARNING**: This maybe harmful to you website if you do not
|
||||
give it a right value.
|
||||
- `DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH`: **false**: Close an issue if a commit on a non default branch marks it as closed.
|
||||
|
||||
### Repository - Pull Request (`repository.pull-request`)
|
||||
- `WORK_IN_PROGRESS_PREFIXES`: **WIP:,\[WIP\]**: List of prefixes used in Pull Request
|
||||
title to mark them as Work In Progress
|
||||
|
||||
### Repository - Issue (`repository.issue`)
|
||||
- `LOCK_REASONS`: **Too heated,Off-topic,Resolved,Spam**: A list of reasons why a Pull Request or Issue can be locked
|
||||
|
||||
## UI (`ui`)
|
||||
|
||||
- `EXPLORE_PAGING_NUM`: **20**: Number of repositories that are shown in one explore page.
|
||||
@@ -74,6 +81,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
- `FEED_MAX_COMMIT_NUM`: **5**: Number of maximum commits shown in one activity feed.
|
||||
- `GRAPH_MAX_COMMIT_NUM`: **100**: Number of maximum commits shown in the commit graph.
|
||||
- `DEFAULT_THEME`: **gitea**: \[gitea, arc-green\]: Set the default theme for the Gitea install.
|
||||
- `THEMES`: **gitea,arc-green**: All available themes. Allow users select personalized themes
|
||||
regardless of the value of `DEFAULT_THEME`.
|
||||
|
||||
### UI - Admin (`ui.admin`)
|
||||
|
||||
@@ -122,9 +131,8 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
- `LFS_CONTENT_PATH`: **./data/lfs**: Where to store LFS files.
|
||||
- `LFS_JWT_SECRET`: **\<empty\>**: LFS authentication secret, change this a unique string.
|
||||
- `LFS_HTTP_AUTH_EXPIRY`: **20m**: LFS authentication validity period in time.Duration, pushes taking longer than this may fail.
|
||||
- `REDIRECT_OTHER_PORT`: **false**: If true and `PROTOCOL` is https, redirects http requests
|
||||
on another (https) port.
|
||||
- `PORT_TO_REDIRECT`: **80**: Port used when `REDIRECT_OTHER_PORT` is true.
|
||||
- `REDIRECT_OTHER_PORT`: **false**: If true and `PROTOCOL` is https, allows redirecting http requests on `PORT_TO_REDIRECT` to the https port Gitea listens on.
|
||||
- `PORT_TO_REDIRECT`: **80**: Port for the http redirection service to listen on. Used when `REDIRECT_OTHER_PORT` is true.
|
||||
- `ENABLE_LETSENCRYPT`: **false**: If enabled you must set `DOMAIN` to valid internet facing domain (ensure DNS is set and port 80 is accessible by letsencrypt validation server).
|
||||
By using Lets Encrypt **you must consent** to their [terms of service](https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf).
|
||||
- `LETSENCRYPT_ACCEPTTOS`: **false**: This is an explicit check that you accept the terms of service for Let's Encrypt.
|
||||
@@ -141,11 +149,18 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
- `SSL_MODE`: **disable**: For PostgreSQL and MySQL only.
|
||||
- `PATH`: **data/gitea.db**: For SQLite3 only, the database file path.
|
||||
- `LOG_SQL`: **true**: Log the executed SQL.
|
||||
- `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed.
|
||||
- `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured.
|
||||
|
||||
## Indexer (`indexer`)
|
||||
|
||||
- `ISSUE_INDEXER_TYPE`: **bleve**: Issue indexer type, currently support: bleve or db, if it's db, below issue indexer item will be invalid.
|
||||
- `ISSUE_INDEXER_PATH`: **indexers/issues.bleve**: Index file used for issue search.
|
||||
- `REPO_INDEXER_ENABLED`: **false**: Enables code search (uses a lot of disk space).
|
||||
- `ISSUE_INDEXER_QUEUE_TYPE`: **levelqueue**: Issue indexer queue, currently support: channel or levelqueue
|
||||
- `ISSUE_INDEXER_QUEUE_DIR`: **indexers/issues.queue**: When ISSUE_INDEXER_QUEUE_TYPE is levelqueue, this will be the queue will be saved path
|
||||
- `ISSUE_INDEXER_QUEUE_BATCH_NUMBER`: **20**: Batch queue number
|
||||
|
||||
- `REPO_INDEXER_ENABLED`: **false**: Enables code search (uses a lot of disk space, about 6 times more than the repository size).
|
||||
- `REPO_INDEXER_PATH`: **indexers/repos.bleve**: Index file used for code search.
|
||||
- `UPDATE_BUFFER_LEN`: **20**: Buffer length of index request.
|
||||
- `MAX_FILE_SIZE`: **1048576**: Maximum size in bytes of files to be indexed.
|
||||
@@ -196,10 +211,13 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
- `CAPTCHA_TYPE`: **image**: \[image, recaptcha\]
|
||||
- `RECAPTCHA_SECRET`: **""**: Go to https://www.google.com/recaptcha/admin to get a secret for recaptcha.
|
||||
- `RECAPTCHA_SITEKEY`: **""**: Go to https://www.google.com/recaptcha/admin to get a sitekey for recaptcha.
|
||||
- `DEFAULT_ENABLE_DEPENDENCIES`: **true** Enable this to have dependencies enabled by default.
|
||||
- `ENABLE_USER_HEATMAP`: **true** Enable this to display the heatmap on users profiles.
|
||||
- `DEFAULT_ENABLE_DEPENDENCIES`: **true**: Enable this to have dependencies enabled by default.
|
||||
- `ENABLE_USER_HEATMAP`: **true**: Enable this to display the heatmap on users profiles.
|
||||
- `EMAIL_DOMAIN_WHITELIST`: **\<empty\>**: If non-empty, list of domain names that can only be used to register
|
||||
on this instance.
|
||||
- `SHOW_REGISTRATION_BUTTON`: **! DISABLE\_REGISTRATION**: Show Registration Button
|
||||
- `AUTO_WATCH_NEW_REPOS`: **true**: Enable this to let all organisation users watch new repos when they are created
|
||||
- `DEFAULT_ORG_VISIBILITY`: **public**: Set default visibility mode for organisations, either "public", "limited" or "private".
|
||||
|
||||
## Webhook (`webhook`)
|
||||
|
||||
@@ -220,10 +238,14 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
- `PASSWD`: **\<empty\>**: Password of mailing user. Use \`your password\` for quoting if you use special characters in the password.
|
||||
- `SKIP_VERIFY`: **\<empty\>**: Do not verify the self-signed certificates.
|
||||
- **Note:** Gitea only supports SMTP with STARTTLS.
|
||||
- `USE_SENDMAIL`: **false** Use the operating system's `sendmail` command instead of SMTP.
|
||||
- `MAILER_TYPE`: **smtp**: \[smtp, sendmail, dummy\]
|
||||
- **smtp** Use SMTP to send mail
|
||||
- **sendmail** Use the operating system's `sendmail` command instead of SMTP.
|
||||
This is common on linux systems.
|
||||
- **dummy** Send email messages to the log as a testing phase.
|
||||
- Note that enabling sendmail will ignore all other `mailer` settings except `ENABLED`,
|
||||
`FROM` and `SENDMAIL_PATH`.
|
||||
- Enabling dummy will ignore all settings except `ENABLED` and `FROM`.
|
||||
- `SENDMAIL_PATH`: **sendmail**: The location of sendmail on the operating system (can be
|
||||
command or full path).
|
||||
- ``IS_TLS_ENABLED`` : **false** : Decide if SMTP connections should use TLS.
|
||||
@@ -238,7 +260,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
|
||||
## Session (`session`)
|
||||
|
||||
- `PROVIDER`: **memory**: Session engine provider \[memory, file, redis, mysql\].
|
||||
- `PROVIDER`: **memory**: Session engine provider \[memory, file, redis, mysql, couchbase, memcache, nodb, postgres\].
|
||||
- `PROVIDER_CONFIG`: **data/sessions**: For file, the root path; for others, the connection string.
|
||||
- `COOKIE_SECURE`: **false**: Enable this to force using HTTPS for all session access.
|
||||
- `COOKIE_NAME`: **i\_like\_gitea**: The name of the cookie used for the session ID.
|
||||
@@ -267,6 +289,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
- `ROOT_PATH`: **\<empty\>**: Root path for log files.
|
||||
- `MODE`: **console**: Logging mode. For multiple modes, use a comma to separate values.
|
||||
- `LEVEL`: **Trace**: General log level. \[Trace, Debug, Info, Warn, Error, Critical\]
|
||||
- `REDIRECT_MACARON_LOG`: **false**: Redirects the Macaron log to the Gitea logger.
|
||||
|
||||
## Cron (`cron`)
|
||||
|
||||
@@ -303,6 +326,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
- `GC_ARGS`: **\<empty\>**: Arguments for command `git gc`, e.g. `--aggressive --auto`. See more on http://git-scm.com/docs/git-gc/
|
||||
|
||||
## Git - Timeout settings (`git.timeout`)
|
||||
- `DEFAUlT`: **360**: Git operations default timeout seconds.
|
||||
- `MIGRATE`: **600**: Migrate external repositories timeout seconds.
|
||||
- `MIRROR`: **300**: Mirror external repositories timeout seconds.
|
||||
- `CLONE`: **300**: Git clone from internal repositories timeout seconds.
|
||||
@@ -316,8 +340,17 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
|
||||
|
||||
## API (`api`)
|
||||
|
||||
- `ENABLE_SWAGGER_ENDPOINT`: **true**: Enables /api/swagger, /api/v1/swagger etc. endpoints. True or false; default is true.
|
||||
- `ENABLE_SWAGGER`: **true**: Enables /api/swagger, /api/v1/swagger etc. endpoints. True or false; default is true.
|
||||
- `MAX_RESPONSE_ITEMS`: **50**: Max number of items in a page.
|
||||
- `DEFAULT_PAGING_NUM`: **30**: Default paging number of api.
|
||||
- `DEFAULT_GIT_TREES_PER_PAGE`: **1000**: Default and maximum number of items per page for git trees api.
|
||||
|
||||
## OAuth2 (`oauth2`)
|
||||
|
||||
- `ENABLED`: **true**: Enables OAuth2 provider.
|
||||
- `ACCESS_TOKEN_EXPIRATION_TIME`: **3600**: Lifetime of an OAuth2 access token in seconds
|
||||
- `REFRESH_TOKEN_EXPIRATION_TIME`: **730**: Lifetime of an OAuth2 access token in hours
|
||||
- `JWT_SECRET`: **\<empty\>**: OAuth2 authentication secret for access and refresh tokens, change this a unique string.
|
||||
|
||||
## i18n (`i18n`)
|
||||
|
||||
|
@@ -82,6 +82,20 @@ menu:
|
||||
- `PATH`: Tidb 或者 SQLite3 数据文件存放路径。
|
||||
- `LOG_SQL`: **true**: 显示生成的SQL,默认为真。
|
||||
|
||||
|
||||
## Indexer (`indexer`)
|
||||
|
||||
- `ISSUE_INDEXER_TYPE`: **bleve**: 工单索引类型,当前支持 `bleve` 或 `db`,当为 `db` 时其它工单索引项可不用设置。
|
||||
- `ISSUE_INDEXER_PATH`: **indexers/issues.bleve**: 工单索引文件存放路径,当索引类型为 `bleve` 时有效。
|
||||
- `ISSUE_INDEXER_QUEUE_TYPE`: **levelqueue**: 工单索引队列类型,当前支持 `channel` 或 `levelqueue`。
|
||||
- `ISSUE_INDEXER_QUEUE_DIR`: **indexers/issues.queue**: 当 `ISSUE_INDEXER_QUEUE_TYPE` 为 `levelqueue` 时,保存索引队列的磁盘路径。
|
||||
- `ISSUE_INDEXER_QUEUE_BATCH_NUMBER`: **20**: 队列处理中批量提交数量。
|
||||
|
||||
- `REPO_INDEXER_ENABLED`: **false**: 是否启用代码搜索(启用后会占用比较大的磁盘空间)。
|
||||
- `REPO_INDEXER_PATH`: **indexers/repos.bleve**: 用于代码搜索的索引文件路径。
|
||||
- `UPDATE_BUFFER_LEN`: **20**: 代码索引请求的缓冲区长度。
|
||||
- `MAX_FILE_SIZE`: **1048576**: 进行解析的源代码文件的最大长度,小于该值时才会索引。
|
||||
|
||||
## Security (`security`)
|
||||
|
||||
- `INSTALL_LOCK`: 是否允许运行安装向导,(跟管理员账号有关,十分重要)。
|
||||
@@ -188,13 +202,22 @@ menu:
|
||||
- `GC_ARGS`: 执行 `git gc` 命令的参数, 比如: `--aggressive --auto`。
|
||||
|
||||
## Git - 超时设置 (`git.timeout`)
|
||||
|
||||
- `DEFAUlT`: **360**: Git操作默认超时时间,单位秒
|
||||
- `MIGRATE`: **600**: 迁移外部仓库时的超时时间,单位秒
|
||||
- `MIRROR`: **300**: 镜像外部仓库的超时时间,单位秒
|
||||
- `CLONE`: **300**: 内部仓库间克隆的超时时间,单位秒
|
||||
- `PULL`: **300**: 内部仓库间拉取的超时时间,单位秒
|
||||
- `GC`: **60**: git仓库GC的超时时间,单位秒
|
||||
|
||||
## markup (`markup`)
|
||||
## API (`api`)
|
||||
|
||||
- `ENABLE_SWAGGER`: **true**: 是否启用swagger路由 /api/swagger, /api/v1/swagger etc. endpoints. True 或 false; 默认是 true.
|
||||
- `MAX_RESPONSE_ITEMS`: **50**: 一个页面最大的项目数。
|
||||
- `DEFAULT_PAGING_NUM`: **30**: API中默认分页条数。
|
||||
- `DEFAULT_GIT_TREES_PER_PAGE`: **1000**: GIT TREES API每页的默认和最大项数.
|
||||
|
||||
## Markup (`markup`)
|
||||
|
||||
外部渲染工具支持,你可以用你熟悉的文档渲染工具. 比如一下将新增一个名字为 `asciidoc` 的渲染工具which is followed `markup.` ini section. And there are some config items below.
|
||||
|
||||
|
@@ -18,7 +18,7 @@ menu:
|
||||
Customizing Gitea is typically done using the `custom` folder. This is the central
|
||||
place to override configuration settings, templates, etc.
|
||||
|
||||
If Gitea is deployed from binary, all default paths will be relative to the gitea
|
||||
If Gitea is deployed from binary, all default paths will be relative to the Gitea
|
||||
binary. If installed from a distribution, these paths will likely be modified to
|
||||
the Linux Filesystem Standard. Gitea will create required folders, including `custom/`.
|
||||
Application settings are configured in `custom/conf/app.ini`. Distributions may
|
||||
@@ -55,7 +55,7 @@ Place the png image at the following path: `custom/public/img/avatar\_default.pn
|
||||
## Customizing Gitea pages
|
||||
|
||||
The `custom/templates` folder allows changing every single page of Gitea. Templates
|
||||
to override can be found in the `templates` directory of Gitea source. Override by
|
||||
to override can be found in the [`templates`](https://github.com/go-gitea/gitea/tree/master/templates) directory of Gitea source. Override by
|
||||
making a copy of the file under `custom/templates` using a full path structure
|
||||
matching source.
|
||||
|
||||
@@ -96,6 +96,42 @@ Google Analytics, Matomo (previously Piwik), and other analytics services can be
|
||||
|
||||
Place custom files in corresponding sub-folder under `custom/options`.
|
||||
|
||||
**NOTE:** The files should not have a file extension, e.g. `Labels` rather than `Labels.txt`
|
||||
|
||||
### gitignores
|
||||
|
||||
To add custom .gitignore, add a file with existing [.gitignore rules](https://git-scm.com/docs/gitignore) in it to `custom/options/gitignore`
|
||||
|
||||
### Labels
|
||||
|
||||
To add a custom label set, add a file that follows the [label format](https://github.com/go-gitea/gitea/blob/master/options/label/Default) to `custom/options/label`
|
||||
`#hex-color label name ; label description`
|
||||
|
||||
### Licenses
|
||||
|
||||
To add a custom license, add a file with the license text to `custom/options/license`
|
||||
|
||||
### Locales
|
||||
|
||||
Locales are managed via our [crowdin](https://crowdin.com/project/gitea).
|
||||
You can override a locale by placing an altered locale file in `custom/options/locale`.
|
||||
Gitea's default locale files can be found in the [`options/locale`](https://github.com/go-gitea/gitea/tree/master/options/locale) source folder and these should be used as examples for your changes.
|
||||
|
||||
To add a completely new locale, as well as placing the file in the above location, you will need to add the new lang and name to the `[i18n]` section in your `app.ini`. Keep in mind that Gitea will use those settings as **overrides**, so if you want to keep the other languages as well you will need to copy/paste the default values and add your own to them.
|
||||
|
||||
```
|
||||
[i18n]
|
||||
LANGS = en-US,foo-BAR
|
||||
NAMES = English,FooBar
|
||||
```
|
||||
|
||||
Locales may change between versions, so keeping track of your customized locales is highly encouraged.
|
||||
|
||||
### Readmes
|
||||
|
||||
To add a custom Readme, add a markdown formatted file (without an `.md` extension) to `custom/options/readme`
|
||||
|
||||
## Customizing the look of Gitea
|
||||
|
||||
As of version 1.6.0 Gitea has built-in themes. The two built-in themes are, the default theme `gitea`, and a dark theme `arc-green`. To change the look of your Gitea install change the value of `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` to another one of the available options.
|
||||
As of version 1.6.0 Gitea has built-in themes. The two built-in themes are, the default theme `gitea`, and a dark theme `arc-green`. To change the look of your Gitea install change the value of `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` to another one of the available options.
|
||||
As of version 1.8.0 Gitea also has per-user themes. The list of themes a user can choose from can be configured with the `THEMES` value in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` (defaults to `gitea` and `arc-green`, light and dark respectively)
|
||||
|
@@ -16,10 +16,10 @@ menu:
|
||||
# Custom files rendering configuration
|
||||
|
||||
Gitea supports custom file renderings (i.e., Jupyter notebooks, asciidoc, etc.) through external binaries,
|
||||
it is just matter of:
|
||||
it is just a matter of:
|
||||
* installing external binaries
|
||||
* add some configuration to your `app.ini` file
|
||||
* restart your gitea instance
|
||||
* restart your Gitea instance
|
||||
|
||||
## Installing external binaries
|
||||
|
||||
|
@@ -15,41 +15,282 @@ menu:
|
||||
|
||||
# Hacking on Gitea
|
||||
|
||||
Familiarity with the existing [installation instructions](https://golang.org/doc/install)
|
||||
is required for this section.
|
||||
## Installing go and setting the GOPATH
|
||||
|
||||
To contribute to Gitea, fork the project and work on the `master` branch.
|
||||
You should [install go](https://golang.org/doc/install) and set up your go
|
||||
environment correctly. In particular, it is recommended to set the `$GOPATH`
|
||||
environment variable and to add the go bin directory or directories
|
||||
`${GOPATH//://bin:}/bin` to the `$PATH`. See the Go wiki entry for
|
||||
[GOPATH](https://github.com/golang/go/wiki/GOPATH).
|
||||
|
||||
Some internal packages are referenced using their respective Github URL. This can
|
||||
become problematic. To "trick" the Go tool into thinking this is a clone from the
|
||||
official repository, download the source code using "go get" and follow these instructions.
|
||||
You will also need make.
|
||||
<a href='{{< relref "doc/advanced/make.en-us.md" >}}'>(See here how to get Make)</a>
|
||||
|
||||
```
|
||||
**Note**: When executing make tasks that require external tools, like
|
||||
`make misspell-check`, Gitea will automatically download and build these as
|
||||
necessary. To be able to use these you must have the `"$GOPATH"/bin` directory
|
||||
on the executable path. If you don't add the go bin directory to the
|
||||
executable path you will have to manage this yourself.
|
||||
|
||||
**Note 2**: Go version 1.9 or higher is required; however, it is important
|
||||
to note that our continuous integration will check that the formatting of the
|
||||
source code is not changed by `gofmt` using `make fmt-check`. Unfortunately,
|
||||
the results of `gofmt` can differ by the version of `go`. It is therefore
|
||||
recommended to install the version of go that our continuous integration is
|
||||
running. At the time of writing this is Go version 1.12; however, this can be
|
||||
checked by looking at the
|
||||
[master `.drone.yml`](https://github.com/go-gitea/gitea/blob/master/.drone.yml)
|
||||
(At the time of writing
|
||||
[line 67](https://github.com/go-gitea/gitea/blob/8917d66571a95f3da232a0c27bc1300210d10fde/.drone.yml#L67)
|
||||
is the relevant line - but this may change.)
|
||||
|
||||
## Downloading and cloning the Gitea source code
|
||||
|
||||
Go is quite opinionated about where it expects its source code, and simply
|
||||
cloning the Gitea repository to an arbitrary path is likely to lead to
|
||||
problems - the fixing of which is out of scope for this document. Further, some
|
||||
internal packages are referenced using their respective GitHub URL and at
|
||||
present we use `vendor/` directories.
|
||||
|
||||
The recommended method of obtaining the source code is by using the `go get` command:
|
||||
|
||||
```bash
|
||||
go get -d code.gitea.io/gitea
|
||||
cd "$GOPATH/src/code.gitea.io/gitea"
|
||||
```
|
||||
|
||||
Fork the [Gitea repository](https://github.com/go-gitea/gitea) on GitHub, it should
|
||||
then be possible to switch the source directory on the command line.
|
||||
This will clone the Gitea source code to: `"$GOPATH/src/code.gitea.io/gitea"`, or if `$GOPATH`
|
||||
is not set `"$HOME/go/src/code.gitea.io/gitea"`.
|
||||
|
||||
```
|
||||
cd $GOPATH/src/code.gitea.io/gitea
|
||||
```
|
||||
## Forking Gitea
|
||||
|
||||
To be able to create pull requests, the forked repository should be added as a remote
|
||||
to the Gitea sources, otherwise changes can't be pushed.
|
||||
As stated above, you cannot clone Gitea to an arbitrary path. Download the master Gitea source
|
||||
code as above. Then, fork the [Gitea repository](https://github.com/go-gitea/gitea) on GitHub,
|
||||
and either switch the git remote origin for your fork or add your fork as another remote:
|
||||
|
||||
```
|
||||
```bash
|
||||
# Rename original Gitea origin to upstream
|
||||
cd "$GOPATH/src/code.gitea.io/gitea"
|
||||
git remote rename origin upstream
|
||||
git remote add origin git@github.com:<USERNAME>/gitea.git
|
||||
git remote add origin "git@github.com:$GITHUB_USERNAME/gitea.git"
|
||||
git fetch --all --prune
|
||||
```
|
||||
|
||||
This should provide a working development environment for Gitea. Take a look at
|
||||
the `Makefile` to get an overview about the available tasks. The most common tasks
|
||||
should be `make test` which will start our test environment and `make build` which
|
||||
will build a `gitea` binary into the working directory. Writing test cases is not
|
||||
mandatory to contribute, but it is highly encouraged and helps developers sleep
|
||||
at night.
|
||||
or:
|
||||
|
||||
That's it! You are ready to hack on Gitea. Test changes, push them to the repository,
|
||||
and open a pull request.
|
||||
```bash
|
||||
# Add new remote for our fork
|
||||
cd "$GOPATH/src/code.gitea.io/gitea"
|
||||
git remote add "$FORK_NAME" "git@github.com:$GITHUB_USERNAME/gitea.git"
|
||||
git fetch --all --prune
|
||||
```
|
||||
|
||||
To be able to create pull requests, the forked repository should be added as a remote
|
||||
to the Gitea sources. Otherwise, changes can't be pushed.
|
||||
|
||||
## Building Gitea (Basic)
|
||||
|
||||
Take a look at our
|
||||
<a href='{{< relref "doc/installation/from-source.en-us.md" >}}'>instructions</a>
|
||||
for <a href='{{< relref "doc/installation/from-source.en-us.md" >}}'>building
|
||||
from source</a>.
|
||||
|
||||
The simplest recommended way to build from source is:
|
||||
|
||||
```bash
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" make generate build
|
||||
```
|
||||
|
||||
However, there are a number of additional make tasks you should be aware of.
|
||||
These are documented below but you can look at our
|
||||
[`Makefile`](https://github.com/go-gitea/gitea/blob/master/Makefile) for more,
|
||||
and look at our
|
||||
[`.drone.yml`](https://github.com/go-gitea/gitea/blob/master/.drone.yml) to see
|
||||
how our continuous integration works.
|
||||
|
||||
### Formatting, linting, vetting and spell-check
|
||||
|
||||
Our continous integration will reject PRs that are not properly formatted, fail
|
||||
linting, vet or spell-check.
|
||||
|
||||
You should format your code with `go fmt` using:
|
||||
|
||||
```bash
|
||||
make fmt
|
||||
```
|
||||
|
||||
and can test whether your changes would match the results with:
|
||||
|
||||
```bash
|
||||
make fmt-check # which runs make fmt internally
|
||||
```
|
||||
|
||||
**Note**: The results of `go fmt` are dependent on the version of `go` present.
|
||||
You should run the same version of go that is on the continuous integration
|
||||
server as mentioned above. `make fmt-check` will only check if your `go` would
|
||||
format differently - this may be different from the CI server version.
|
||||
|
||||
You should lint, vet and spell-check with:
|
||||
|
||||
```bash
|
||||
make vet lint misspell-check
|
||||
```
|
||||
|
||||
### Updating the stylesheets
|
||||
|
||||
To generate the stylsheets, you will need [Node.js](https://nodejs.org/) at version 8.0 or above.
|
||||
|
||||
At present we use [less](http://lesscss.org/) and [postcss](https://postcss.org) to generate our stylesheets. Do
|
||||
**not** edit the files in `public/css/` directly, as they are generated from
|
||||
`lessc` from the files in `public/less/`.
|
||||
|
||||
If you wish to work on the stylesheets, you will need to install `lessc` the
|
||||
less compiler and `postcss`. The recommended way to do this is using `npm install`:
|
||||
|
||||
```bash
|
||||
cd "$GOPATH/src/code.gitea.io/gitea"
|
||||
npm install
|
||||
```
|
||||
|
||||
You can then edit the less stylesheets and regenerate the stylesheets using:
|
||||
|
||||
```bash
|
||||
make generate-stylesheets
|
||||
```
|
||||
|
||||
You should commit both the changes to the css and the less files when making
|
||||
PRs.
|
||||
|
||||
### Updating the API
|
||||
|
||||
When creating new API routes or modifying existing API routes, you **MUST**
|
||||
update and/or create [Swagger](https://swagger.io/docs/specification/2-0/what-is-swagger/)
|
||||
documentation for these using [go-swagger](https://goswagger.io/) comments.
|
||||
The structure of these comments is described in the [specification](https://goswagger.io/use/spec.html#annotation-syntax).
|
||||
If you want more information about the Swagger structure, you can look at the
|
||||
[Swagger 2.0 Documentation](https://swagger.io/docs/specification/2-0/basic-structure/)
|
||||
or compare with a previous PR adding a new API endpoint, e.g. [PR #5483](https://github.com/go-gitea/gitea/pull/5843/files#diff-2e0a7b644cf31e1c8ef7d76b444fe3aaR20)
|
||||
|
||||
You should be careful not to break the API for downstream users which depend
|
||||
on a stable API. In general, this means additions are acceptable, but deletions
|
||||
or fundamental changes to the API will be rejected.
|
||||
|
||||
Once you have created or changed an API endpoint, please regenerate the Swagger
|
||||
documentation using:
|
||||
|
||||
```bash
|
||||
make generate-swagger
|
||||
```
|
||||
|
||||
You should validate your generated Swagger file and spell-check it with:
|
||||
|
||||
```bash
|
||||
make swagger-validate mispell-check
|
||||
```
|
||||
|
||||
You should commit the changed swagger JSON file. The continous integration
|
||||
server will check that this has been done using:
|
||||
|
||||
```bash
|
||||
make swagger-check
|
||||
```
|
||||
|
||||
**Note**: Please note you should use the Swagger 2.0 documentation, not the
|
||||
OpenAPI 3 documentation.
|
||||
|
||||
### Creating new configuration options
|
||||
|
||||
When creating new configuration options, it is not enough to add them to the
|
||||
`modules/setting` files. You should add information to `custom/conf/app.ini`
|
||||
and to the
|
||||
<a href='{{ relref "doc/advanced/config-cheat-sheet.en-us.md"}}'>configuration cheat sheet</a>
|
||||
found in `docs/content/doc/advanced/config-cheat-sheet.en-us.md`
|
||||
|
||||
### Changing the logo
|
||||
|
||||
When changing the Gitea logo SVG, you will need to run and commit the results
|
||||
of:
|
||||
|
||||
```bash
|
||||
make generate-images
|
||||
```
|
||||
|
||||
This will create the necessary Gitea favicon and others.
|
||||
|
||||
### Database Migrations
|
||||
|
||||
If you make breaking changes to any of the database persisted structs in the
|
||||
`models/` directory, you will need to make a new migration. These can be found
|
||||
in `models/migrations/`. You can ensure that your migrations work for the main
|
||||
database types using:
|
||||
|
||||
```bash
|
||||
make test-sqlite-migration # with sqlite switched for the appropriate database
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
There are two types of test run by Gitea: Unit tests and Integration Tests.
|
||||
|
||||
```bash
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" make test # Runs the unit tests
|
||||
```
|
||||
|
||||
Unit tests will not and cannot completely test Gitea alone. Therefore, we
|
||||
have written integration tests; however, these are database dependent.
|
||||
|
||||
```bash
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" make generate build test-sqlite
|
||||
```
|
||||
|
||||
will run the integration tests in an sqlite environment. Other database tests
|
||||
are available but may need adjustment to the local environment.
|
||||
|
||||
Look at
|
||||
[`integrations/README.md`](https://github.com/go-gitea/gitea/blob/master/integrations/README.md)
|
||||
for more information and how to run a single test.
|
||||
|
||||
Our continuous integration will test the code passes its unit tests and that
|
||||
all supported databases will pass integration test in a Docker environment.
|
||||
Migration from several recent versions of Gitea will also be tested.
|
||||
|
||||
Please submit your PR with additional tests and integration tests as
|
||||
appropriate.
|
||||
|
||||
## Documentation for the website
|
||||
|
||||
Documentation for the website is found in `docs/`. If you change this you
|
||||
can test your changes to ensure that they pass continuous integration using:
|
||||
|
||||
```bash
|
||||
cd "$GOPATH/src/code.gitea.io/gitea/docs"
|
||||
make trans-copy clean build
|
||||
```
|
||||
|
||||
You will require a copy of [Hugo](https://gohugo.io/) to run this task. Please
|
||||
note: this may generate a number of untracked git objects, which will need to
|
||||
be cleaned up.
|
||||
|
||||
## Visual Studio Code
|
||||
|
||||
A `launch.json` and `tasks.json` are provided within `contrib/ide/vscode` for
|
||||
Visual Studio Code. Look at
|
||||
[`contrib/ide/README.md`](https://github.com/go-gitea/gitea/blob/master/contrib/ide/README.md)
|
||||
for more information.
|
||||
|
||||
## Submitting PRs
|
||||
|
||||
Once you're happy with your changes, push them up and open a pull request. It
|
||||
is recommended that you allow Gitea Managers and Owners to modify your PR
|
||||
branches as we will need to update it to master before merging and/or may be
|
||||
able to help fix issues directly.
|
||||
|
||||
Any PR requires two approvals from the Gitea maintainers and needs to pass the
|
||||
continous integration. Take a look at our
|
||||
[`CONTRIBUTING.md`](https://github.com/go-gitea/gitea/blob/master/CONTRIBUTING.md)
|
||||
document.
|
||||
|
||||
If you need more help pop on to [Discord](https://discord.gg/gitea) #Develop
|
||||
and chat there.
|
||||
|
||||
That's it! You are ready to hack on Gitea.
|
||||
|
@@ -59,7 +59,7 @@ For documentation about each of the variables available, refer to the
|
||||
* `HOST`: Host Macaron will listen on
|
||||
* `PORT`: Port Macaron will listen on
|
||||
* `MACARON_ENV`: global variable to provide special functionality for development environments
|
||||
vs. production environments. If MACARON_ENV is set to "" or "development" then templates will
|
||||
vs. production environments. If MACARON_ENV is set to "" or "development", then templates will
|
||||
be recompiled on every request. For more performance, set the MACARON_ENV environment variable
|
||||
to "production".
|
||||
|
||||
|
36
docs/content/doc/advanced/third-party-tools.en-us.md
Normal file
36
docs/content/doc/advanced/third-party-tools.en-us.md
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
date: "2018-05-22T11:00:00+00:00"
|
||||
title: "Advanced: Third Party Tools"
|
||||
slug: "third-party-tools"
|
||||
weight: 50
|
||||
toc: true
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "advanced"
|
||||
name: "Third Party Tools"
|
||||
weight: 50
|
||||
identifier: "third-party-tools"
|
||||
---
|
||||
|
||||
# List of third-party tools
|
||||
**NOTE:** These tools are not endorsed by Gitea. They are listed here for convenience only.
|
||||
|
||||
*This is by no means a complete list, so feel free to ask about adding more!*
|
||||
|
||||
### Continuous Integration
|
||||
[BuildKite Connector](https://github.com/techknowlogick/gitea-buildkite-connector)
|
||||
[Jenkins Plugin](https://github.com/jenkinsci/gitea-plugin)
|
||||
[Using Gitea with Drone](https://docs.drone.io/installation/gitea/)
|
||||
|
||||
|
||||
### Migrating
|
||||
[Installation script for Gitea](https://git.coolaj86.com/coolaj86/gitea-installer.sh)
|
||||
[GitHub Migrator](https://gitea.com/gitea/migrator)
|
||||
|
||||
|
||||
### Mobile
|
||||
[GitNex for Android](https://gitlab.com/mmarif4u/gitnex)
|
||||
|
||||
### Editor Extensions
|
||||
- [Gitea Extension for Visual Studio](https://github.com/maikebing/Gitea.VisualStudio) Download from [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=MysticBoy.GiteaExtensionforVisualStudio)
|
@@ -91,7 +91,7 @@ Both the LDAP via BindDN and the simple auth LDAP share the following fields:
|
||||
name given on sign-in form.
|
||||
- Example: `(&(objectClass=posixAccount)(uid=%s))`
|
||||
- Example for Microsoft Active Directory (AD): `(&(objectCategory=Person)(memberOf=CN=user-group,OU=example,DC=example,DC=org)(sAMAccountName=%s)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))`
|
||||
- To substitute more than once `%[1]s` should be used instead, e.g. when
|
||||
- To substitute more than once, `%[1]s` should be used instead, e.g. when
|
||||
matching supplied login name against multiple attributes such as user
|
||||
identifier, email or even phone number.
|
||||
- Example: `(&(objectClass=Person)(|(uid=%[1]s)(mail=%[1]s)(mobile=%[1]s)))`
|
||||
@@ -181,7 +181,7 @@ configure this, set the fields below:
|
||||
|
||||
## FreeIPA
|
||||
|
||||
- In order to log in to Gitea using FreeIPA credentials,a bind account needs to
|
||||
- In order to log in to Gitea using FreeIPA credentials, a bind account needs to
|
||||
be created for Gitea:
|
||||
|
||||
- On the FreeIPA server, create a `gitea.ldif` file, replacing `dc=example,dc=com`
|
||||
|
@@ -15,9 +15,9 @@ menu:
|
||||
|
||||
# Gitea compared to other Git hosting options
|
||||
|
||||
To help decide if Gitea is suited for your needs here is how it compares to other Git self hosted options.
|
||||
To help decide if Gitea is suited for your needs, here is how it compares to other Git self hosted options.
|
||||
|
||||
Be warned that we don't regularly check for feature changes in other products so this list can be outdated. If you find anything that needs to be updated in table below please report [issue on Github](https://github.com/go-gitea/gitea/issues).
|
||||
Be warned that we don't regularly check for feature changes in other products, so this list may be outdated. If you find anything that needs to be updated in the table below, please report it in an [issue on GitHub](https://github.com/go-gitea/gitea/issues).
|
||||
|
||||
_Symbols used in table:_
|
||||
|
||||
@@ -81,13 +81,15 @@ _Symbols used in table:_
|
||||
| Related issues | ✘ | ✘ | ⁄ | ✘ | ✓ | ✘ | ✘ |
|
||||
| Confidential issues | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Comment reactions | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Lock Discussion | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Lock Discussion | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Batch issue handling | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Issue Boards | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Create new branches from issues | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Issue search | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Global issue search | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Issue dependency | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
|
||||
| Create issue via email | [✘](https://github.com/go-gitea/gitea/issues/6226) | [✘](https://github.com/gogs/gogs/issues/2602) | ✘ | ✘ | ✓ | ✓ | ✘ |
|
||||
| Service Desk | [✘](https://github.com/go-gitea/gitea/issues/6219) | ✘ | ✘ | ✘ | ✓ | ✘ | ✘ |
|
||||
|
||||
#### Pull/Merge requests
|
||||
|
||||
@@ -116,7 +118,7 @@ _Symbols used in table:_
|
||||
| LDAP user synchronization | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| OpenId Connect support | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ |
|
||||
| OAuth 2.0 integration (external authorization) | ✓ | ✘ | ⁄ | ✓ | ✓ | ? | ✓ |
|
||||
| Act as OAuth 2.0 provider | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Act as OAuth 2.0 provider | [✓](https://github.com/go-gitea/gitea/pull/5378) | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Two factor authentication (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Mattermost/Slack integration | ✓ | ✓ | ⁄ | ✓ | ✓ | ⁄ | ✓ |
|
||||
| Discord integration | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
|
125
docs/content/doc/features/comparison.zh-cn.md
Normal file
125
docs/content/doc/features/comparison.zh-cn.md
Normal file
@@ -0,0 +1,125 @@
|
||||
---
|
||||
date: "2019-02-14T11:51:04+08:00"
|
||||
title: "横向对比 Gitea 与其它 Git 托管工具"
|
||||
slug: "comparison"
|
||||
weight: 5
|
||||
toc: true
|
||||
draft: false
|
||||
menu:
|
||||
sidebar:
|
||||
parent: "features"
|
||||
name: "横向对比"
|
||||
weight: 5
|
||||
identifier: "comparison"
|
||||
---
|
||||
|
||||
# 横向对比 Gitea 与其它 Git 托管工具
|
||||
|
||||
这里列出了 Gitea 与其它一些 Git 托管工具之间的异同,以便确认 Gitea 是否能够满足您的需求。
|
||||
|
||||
请注意,此列表中的某些表项可能已经过时,因为我们并没有定期检查其它产品的功能是否有所更改。你可以前往 [Github issue](https://github.com/go-gitea/gitea/issues) 来帮助我们更新过时的内容,感谢!
|
||||
|
||||
_表格中的符号含义:_
|
||||
|
||||
* _✓ - 支持_
|
||||
|
||||
* _⁄ - 部分支持_
|
||||
|
||||
* _✘ - 不支持_
|
||||
|
||||
* _? - 不确定_
|
||||
|
||||
#### 主要特性
|
||||
|
||||
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|
||||
|-----------------------|-------|------|-----------|-----------|-----------|-----------|--------------|
|
||||
| 开源免费 | ✓ | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ |
|
||||
| 低资源开销 (RAM/CPU) | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ |
|
||||
| 支持多种数据库 | ✓ | ✓ | ✘ | ⁄ | ⁄ | ✓ | ✓ |
|
||||
| 支持多种操作系统 | ✓ | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ |
|
||||
| 升级简便 | ✓ | ✓ | ✘ | ✓ | ✓ | ✘ | ✓ |
|
||||
| 支持 Markdown | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 支持 Orgmode | ✓ | ✘ | ✓ | ✘ | ✘ | ✘ | ? |
|
||||
| 支持 CSV | ✓ | ✘ | ✓ | ✘ | ✘ | ✓ | ? |
|
||||
| 支持第三方渲染工具 | ✓ | ✘ | ✘ | ✘ | ✘ | ✓ | ? |
|
||||
| Git 驱动的静态 pages | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Git 驱动的集成化 wiki | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| 部署令牌 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 仓库写权限令牌 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ |
|
||||
| 内置容器 Registry | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 外部 Git 镜像 | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ |
|
||||
| FIDO U2F (2FA) | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| 内置 CI/CD | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 子组织:组织内的组织 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✓ |
|
||||
|
||||
#### 代码管理
|
||||
|
||||
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|
||||
|------------------------------------------|-------|------|-----------|-----------|-----------|-----------|--------------|
|
||||
| 仓库主题描述 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 仓库内代码搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 全局代码搜索 | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ |
|
||||
| Git LFS 2.0 | ✓ | ✘ | ✓ | ✓ | ✓ | ⁄ | ✓ |
|
||||
| 组织里程碑 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 细粒度用户角色 (例如 Code, Issues, Wiki) | ✓ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 提交人的身份验证 | ✘ | ✘ | ? | ✓ | ✓ | ✓ | ✘ |
|
||||
| GPG 签名的提交 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 拒绝未用通过验证的提交 | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✓ |
|
||||
| 仓库活跃度页面 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 分支管理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 建立新分支 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 在线代码编辑 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 提交的统计图表 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
|
||||
#### Issue 管理
|
||||
|
||||
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|
||||
|----------------------|-------|------|-----------|-----------|-----------|-----------|--------------|
|
||||
| 跟踪 Issue | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Issue 模板 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 标签 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 跟踪时间 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Issue 可有多个负责人 | ✓ | ✘ | ✓ | ✘ | ✓ | ✘ | ✘ |
|
||||
| 关联的 issues | ✘ | ✘ | ⁄ | ✘ | ✓ | ✘ | ✘ |
|
||||
| 私密 issues | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 评论反馈 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 锁定讨论 | ✘ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Issue 批量处理 | ✓ | ✘ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Issue 看板 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 从 issues 创建分支 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
| Issue 搜索 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| 全局 Issue 搜索 | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Issue 依赖 | ✓ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
|
||||
|
||||
#### Pull/Merge requests
|
||||
|
||||
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|
||||
|--------------------------------------|-------|------|-----------|-----------|-----------|-----------|--------------|
|
||||
| Pull/Merge requests | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| Squash merging | ✓ | ✘ | ✓ | ✘ | ✓ | ✓ | ✓ |
|
||||
| Rebase merging | ✓ | ✓ | ✓ | ✘ | ⁄ | ✘ | ✓ |
|
||||
| 评论 Pull/Merge request 中的某行代码 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 指定 Pull/Merge request 的审核人 | ✓ | ✘ | ⁄ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 解决 Merge 冲突 | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| 限制某些用户的 push 和 merge 权限 | ✓ | ✘ | ✓ | ⁄ | ✓ | ✓ | ✓ |
|
||||
| 回退某些 commits 或 merge request | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| Pull/Merge requests 模板 | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 查看 Cherry-picking 的更改 | ✘ | ✘ | ✘ | ✓ | ✓ | ✘ | ✘ |
|
||||
|
||||
|
||||
#### 第三方集成
|
||||
|
||||
| 特性 | Gitea | Gogs | GitHub EE | GitLab CE | GitLab EE | BitBucket | RhodeCode CE |
|
||||
|----------------------------|-------|------|-----------|-----------|-----------|-----------|--------------|
|
||||
| 支持 Webhook | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 自定义 Git 钩子 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 集成 AD / LDAP | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 支持多个 LDAP / AD 服务 | ✓ | ✓ | ✘ | ✘ | ✓ | ✓ | ✓ |
|
||||
| LDAP 用户同步 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
| 支持 OpenId 连接 | ✓ | ✘ | ✓ | ✓ | ✓ | ? | ✘ |
|
||||
| 集成 OAuth 2.0(外部授权) | ✓ | ✘ | ⁄ | ✓ | ✓ | ? | ✓ |
|
||||
| 作为 OAuth 2.0 provider | ✘ | ✘ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| 二次验证 (2FA) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ |
|
||||
| 集成 Mattermost/Slack | ✓ | ✓ | ⁄ | ✓ | ✓ | ⁄ | ✓ |
|
||||
| 集成 Discord | ✓ | ✓ | ✓ | ✓ | ✓ | ✘ | ✘ |
|
||||
| 显示外部 CI/CD 的状态 | ✓ | ✘ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
@@ -15,8 +15,8 @@ menu:
|
||||
|
||||
# Webhooks
|
||||
|
||||
Gitea supports web hooks for repository events, this can be found in the settings
|
||||
page(`/:username/:reponame/settings/hooks`). All event pushes are POST requests.
|
||||
Gitea supports web hooks for repository events. This can be found in the settings
|
||||
page `/:username/:reponame/settings/hooks`. All event pushes are POST requests.
|
||||
The two methods currently supported are Gitea and Slack.
|
||||
|
||||
### Event information
|
||||
@@ -26,8 +26,8 @@ a Payload URL:
|
||||
|
||||
|
||||
```
|
||||
X-Github-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
|
||||
X-Github-Event: push
|
||||
X-GitHub-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
|
||||
X-GitHub-Event: push
|
||||
X-Gogs-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
|
||||
X-Gogs-Event: push
|
||||
X-Gitea-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
|
||||
|
@@ -20,7 +20,7 @@ menu:
|
||||
|
||||
## Bugs
|
||||
|
||||
If you found a bug, please create an [issue on Github](https://github.com/go-gitea/gitea/issues).
|
||||
If you found a bug, please create an [issue on GitHub](https://github.com/go-gitea/gitea/issues).
|
||||
|
||||
## Chinese Support
|
||||
|
||||
|
@@ -19,7 +19,7 @@ This page contains some common seen issues and their solutions.
|
||||
|
||||
## SSH issues
|
||||
|
||||
For issues reaching repositories over `ssh` while the gitea web front-end, but
|
||||
For issues reaching repositories over `ssh` while the Gitea web front-end, but
|
||||
`https` based git repository access works fine, consider looking into the following.
|
||||
|
||||
```
|
||||
@@ -32,7 +32,7 @@ following things:
|
||||
|
||||
* On the client:
|
||||
* Ensure the public and private ssh keys are added to the correct Gitea user.
|
||||
* Make sure there are no issues in the remote url, ensure the name of the
|
||||
* Make sure there are no issues in the remote url. In particular, ensure the name of the
|
||||
git user (before the `@`) is spelled correctly.
|
||||
* Ensure public and private ssh keys are correct on client machine.
|
||||
* Try to connect using ssh (ssh git@myremote.example) to ensure a connection
|
||||
@@ -43,7 +43,7 @@ following things:
|
||||
* Verify that the correct public keys are added to `.ssh/authorized_keys`.
|
||||
Try to run `Rewrite '.ssh/authorized_keys' file (for Gitea SSH keys)` on the
|
||||
Gitea admin panel.
|
||||
* Read gitea logs.
|
||||
* Read Gitea logs.
|
||||
* Read /var/log/auth (or similar).
|
||||
* Check permissions of repositories.
|
||||
|
||||
@@ -69,14 +69,14 @@ In this case, look into the following settings:
|
||||
|
||||
## Missing releases after migrating repository with tags
|
||||
|
||||
To migrate an repository *with* all tags you need to do two things
|
||||
To migrate an repository *with* all tags, you need to do two things:
|
||||
|
||||
* Push tags to the repository:
|
||||
```
|
||||
git push --tags
|
||||
```
|
||||
|
||||
* (Re-)sync tags of all repositories within gitea:
|
||||
* (Re-)sync tags of all repositories within Gitea:
|
||||
```
|
||||
gitea admin repo-sync-releases
|
||||
```
|
||||
@@ -90,7 +90,7 @@ batch response: Authentication required: Authorization error: <GITEA_LFS_URL>/in
|
||||
Check that you have proper access to the repository
|
||||
error: failed to push some refs to '<GIT_REPO_URL>'
|
||||
```
|
||||
Have you checked the value of `LFS_HTTP_AUTH_EXPIRY` in your `app.ini` file? By default your LFS token will expire after 20 minutes. If you have a slow connection or a large file (or both) it may not finish uploading within the time limit.
|
||||
Have you checked the value of `LFS_HTTP_AUTH_EXPIRY` in your `app.ini` file? By default, your LFS token will expire after 20 minutes. If you have a slow connection or a large file (or both), it may not finish uploading within the time limit.
|
||||
|
||||
You may want to set this value to `60m` or `120m`.
|
||||
|
||||
|
@@ -17,20 +17,20 @@ menu:
|
||||
|
||||
All downloads come with SQLite, MySQL and PostgreSQL support, and are built with
|
||||
embedded assets. This can be different for older releases. Choose the file matching
|
||||
the destination platform from the [downloads page](https://dl.gitea.io/gitea), copy
|
||||
the destination platform from the [downloads page](https://dl.gitea.io/gitea/), copy
|
||||
the URL and replace the URL within the commands below:
|
||||
|
||||
```sh
|
||||
wget -O gitea https://dl.gitea.io/gitea/1.5.0/gitea-1.5.0-linux-amd64
|
||||
wget -O gitea https://dl.gitea.io/gitea/1.7.0/gitea-1.7.0-linux-amd64
|
||||
chmod +x gitea
|
||||
```
|
||||
|
||||
## Verify GPG signature
|
||||
Gitea signs all binaries with a [GPG key](https://pgp.mit.edu/pks/lookup?op=vindex&fingerprint=on&search=0x2D9AE806EC1592E2) to prevent against unwanted modification of binaries. To validate the binary download the signature file which ends in `.asc` for the binary you downloaded and use the gpg command line tool.
|
||||
Gitea signs all binaries with a [GPG key](https://pgp.mit.edu/pks/lookup?op=vindex&fingerprint=on&search=0x2D9AE806EC1592E2) to prevent against unwanted modification of binaries. To validate the binary, download the signature file which ends in `.asc` for the binary you downloaded and use the gpg command line tool.
|
||||
|
||||
```sh
|
||||
gpg --keyserver pgp.mit.edu --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
|
||||
gpg --verify gitea-1.5.0-linux-amd64.asc gitea-1.5.0-linux-amd64
|
||||
gpg --verify gitea-1.7.0-linux-amd64.asc gitea-1.7.0-linux-amd64
|
||||
```
|
||||
|
||||
## Test
|
||||
@@ -44,14 +44,17 @@ location. When launched manually, Gitea can be killed using `Ctrl+C`.
|
||||
|
||||
## Recommended server configuration
|
||||
|
||||
**NOTE:** Many of the following directories can be configured using [Environment Variables]({{< relref "doc/advanced/specific-variables.en-us.md" >}}) as well!
|
||||
Of note, configuring `GITEA_WORK_DIR` will tell Gitea where to base its working directory, as well as ease installation.
|
||||
|
||||
### Prepare environment
|
||||
|
||||
Check that git is installed on the server, if it is not install it first.
|
||||
Check that Git is installed on the server. If it is not, install it first.
|
||||
```sh
|
||||
git --version
|
||||
```
|
||||
|
||||
Create user to run gitea (ex. `git`)
|
||||
Create user to run Gitea (ex. `git`)
|
||||
```sh
|
||||
adduser \
|
||||
--system \
|
||||
@@ -66,33 +69,50 @@ adduser \
|
||||
### Create required directory structure
|
||||
|
||||
```sh
|
||||
mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
|
||||
chown git:git /var/lib/gitea/{data,indexers,log}
|
||||
chmod 750 /var/lib/gitea/{data,indexers,log}
|
||||
mkdir -p /var/lib/gitea/{custom,data,log}
|
||||
chown -R git:git /var/lib/gitea/
|
||||
chmod -R 750 /var/lib/gitea/
|
||||
mkdir /etc/gitea
|
||||
chown root:git /etc/gitea
|
||||
chmod 770 /etc/gitea
|
||||
```
|
||||
|
||||
**NOTE:** `/etc/gitea` is temporary set with write rights for user `git` so that Web installer could write configuration file. After installation is done it is recommended to set rights to read-only using:
|
||||
**NOTE:** `/etc/gitea` is temporary set with write rights for user `git` so that Web installer could write configuration file. After installation is done, it is recommended to set rights to read-only using:
|
||||
```
|
||||
chmod 750 /etc/gitea
|
||||
chmod 644 /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
### Copy gitea binary to global location
|
||||
### Configure Gitea's working directory
|
||||
|
||||
**NOTE:** If you plan on running Gitea as a Linux service, you can skip this step as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory.
|
||||
```
|
||||
export GITEA_WORK_DIR=/var/lib/gitea/
|
||||
```
|
||||
|
||||
### Copy Gitea binary to global location
|
||||
|
||||
```
|
||||
cp gitea /usr/local/bin/gitea
|
||||
```
|
||||
|
||||
### Create service file to start gitea automatically
|
||||
## Running Gitea
|
||||
|
||||
After the above steps, two options to run Gitea are:
|
||||
|
||||
### 1. Creating a service file to start Gitea automatically (recommended)
|
||||
|
||||
See how to create [Linux service]({{< relref "run-as-service-in-ubuntu.en-us.md" >}})
|
||||
|
||||
### 2. Running from command-line/terminal
|
||||
|
||||
```
|
||||
GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
## Updating to a new version
|
||||
|
||||
You can update to a new version of gitea by stopping gitea, replacing the binary at `/usr/local/bin/gitea` and restarting the instance.
|
||||
You can update to a new version of Gitea by stopping Gitea, replacing the binary at `/usr/local/bin/gitea` and restarting the instance.
|
||||
The binary file name should not be changed during the update to avoid problems
|
||||
in existing repositories.
|
||||
|
||||
@@ -102,7 +122,7 @@ If you have carried out the installation steps as described above, the binary sh
|
||||
have the generic name `gitea`. Do not change this, i.e. to include the version number.
|
||||
|
||||
See below for troubleshooting instructions to repair broken repositories after
|
||||
an update of your gitea version.
|
||||
an update of your Gitea version.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -115,16 +135,16 @@ SQLite support in the binaries provided by dl.gitea.io. In this situation, it is
|
||||
possible to [install from source]({{< relref "from-source.en-us.md" >}}) without sqlite
|
||||
support.
|
||||
|
||||
### Running gitea on another port
|
||||
### Running Gitea on another port
|
||||
|
||||
For errors like `702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000:
|
||||
bind: address already in use` gitea needs to be started on another free port. This
|
||||
is possible using `./gitea web -p $PORT`. It's possible another instance of gitea
|
||||
bind: address already in use` Gitea needs to be started on another free port. This
|
||||
is possible using `./gitea web -p $PORT`. It's possible another instance of Gitea
|
||||
is already running.
|
||||
|
||||
### Git error after updating to a new version of gitea
|
||||
### Git error after updating to a new version of Gitea
|
||||
|
||||
If the binary file name has been changed during the update to a new version of gitea,
|
||||
If the binary file name has been changed during the update to a new version of Gitea,
|
||||
git hooks in existing repositories will not work any more. In that case, a git
|
||||
error will be displayed when pushing to the repository.
|
||||
|
||||
@@ -132,7 +152,7 @@ error will be displayed when pushing to the repository.
|
||||
remote: ./hooks/pre-receive.d/gitea: line 2: [...]: No such file or directory
|
||||
```
|
||||
|
||||
The `[...]` part of the error message will contain the path to your previous gitea
|
||||
The `[...]` part of the error message will contain the path to your previous Gitea
|
||||
binary.
|
||||
|
||||
To solve this, go to the admin options and run the task `Resynchronize pre-receive,
|
||||
@@ -140,6 +160,6 @@ update and post-receive hooks of all repositories` to update all hooks to contai
|
||||
the new binary path. Please note that this overwrite all git hooks including ones
|
||||
with customizations made.
|
||||
|
||||
If you aren't using the built-in to Gitea ssh server you will also need to re-write
|
||||
If you aren't using the built-in to Gitea SSH server you will also need to re-write
|
||||
the authorized key file by running the `Update the '.ssh/authorized_keys' file with
|
||||
Gitea SSH keys.` task in the admin options.
|
||||
|
@@ -20,7 +20,7 @@ menu:
|
||||
Although there is a package of Gitea in Debian's [contrib](https://wiki.debian.org/SourcesList),
|
||||
it is not supported directly by us.
|
||||
|
||||
Unfortunately the package is not maintained anymore and broken because of missing sources.
|
||||
Unfortunately, the package is not maintained anymore and broken because of missing sources.
|
||||
Please follow the [deployment from binary]({{< relref "from-binary.en-us.md" >}}) guide instead.
|
||||
|
||||
Should the packages get updated and fixed, we will provide up-to-date installation instructions here.
|
||||
|
@@ -15,43 +15,60 @@ menu:
|
||||
|
||||
# Installation from source
|
||||
|
||||
This section will not include basic [installation instructions](https://golang.org/doc/install).
|
||||
You should [install go](https://golang.org/doc/install) and set up your go
|
||||
environment correctly. In particular, it is recommended to set the `$GOPATH`
|
||||
environment variable and to add the go bin directory or directories
|
||||
`${GOPATH//://bin:}/bin` to the `$PATH`. See the Go wiki entry for
|
||||
[GOPATH](https://github.com/golang/go/wiki/GOPATH).
|
||||
|
||||
**Note**: Go version 1.8 or higher is required
|
||||
**Note**: When executing make tasks that require external tools, like
|
||||
`make misspell-check`, Gitea will automatically download and build these as
|
||||
necessary. To be able to use these, you must have the `"$GOPATH/bin"` directory
|
||||
on the executable path. If you don't add the go bin directory to the
|
||||
executable path, you will have to manage this yourself.
|
||||
|
||||
**Note 2**: Go version 1.9 or higher is required. However, it is recommended to
|
||||
obtain the same version as our continuous integration, see the advice given in
|
||||
<a href='{{ relref "docs/advanced/hacking-on-gitea.en-us.md" }}'>Hacking on
|
||||
Gitea</a>
|
||||
|
||||
## Download
|
||||
|
||||
First retrieve the source code. The easiest way is to use the Go tool. Use the following
|
||||
commands to fetch the source and switch into the source directory.
|
||||
First, retrieve the source code. The easiest way is to use the Go tool. Use the
|
||||
following commands to fetch the source and switch into the source directory.
|
||||
Go is quite opinionated about where it expects its source code, and simply
|
||||
cloning the Gitea repository to an arbitrary path is likely to lead to
|
||||
problems - the fixing of which is out of scope for this document.
|
||||
|
||||
```
|
||||
```bash
|
||||
go get -d -u code.gitea.io/gitea
|
||||
cd $GOPATH/src/code.gitea.io/gitea
|
||||
cd "$GOPATH/src/code.gitea.io/gitea"
|
||||
```
|
||||
|
||||
Decide which version of Gitea to build and install. Currently, there are multiple options
|
||||
to choose from. The `master` branch represents the current development version. To build
|
||||
with master, skip to the [build section](#build).
|
||||
Decide which version of Gitea to build and install. Currently, there are
|
||||
multiple options to choose from. The `master` branch represents the current
|
||||
development version. To build with master, skip to the [build section](#build).
|
||||
|
||||
To work with tagged releases, the following commands can be used:
|
||||
```
|
||||
|
||||
```bash
|
||||
git branch -a
|
||||
git checkout v1.0
|
||||
```
|
||||
|
||||
To validate a Pull Request, first enable the new branch (`xyz` is the PR id; for example
|
||||
`2663` for [#2663](https://github.com/go-gitea/gitea/pull/2663)):
|
||||
To validate a Pull Request, first enable the new branch (`xyz` is the PR id;
|
||||
for example `2663` for [#2663](https://github.com/go-gitea/gitea/pull/2663)):
|
||||
|
||||
```
|
||||
```bash
|
||||
git fetch origin pull/xyz/head:pr-xyz
|
||||
```
|
||||
|
||||
To build Gitea from source at a specific tagged release (like v1.0.0), list the available
|
||||
tags and check out the specific tag.
|
||||
To build Gitea from source at a specific tagged release (like v1.0.0), list the
|
||||
available tags and check out the specific tag.
|
||||
|
||||
List available tags with the following.
|
||||
|
||||
```
|
||||
```bash
|
||||
git tag -l
|
||||
git checkout v1.0.0 # or git checkout pr-xyz
|
||||
```
|
||||
@@ -59,33 +76,44 @@ git checkout v1.0.0 # or git checkout pr-xyz
|
||||
## Build
|
||||
|
||||
Since all required libraries are already bundled in the Gitea source, it's
|
||||
possible to build Gitea with no additional downloads. Various
|
||||
[make tasks](https://github.com/go-gitea/gitea/blob/master/Makefile) are
|
||||
provided to keep the build process as simple as possible.
|
||||
<a href='{{< relref "doc/advanced/make.en-us.md" >}}'>See here how to get Make</a>.
|
||||
possible to build Gitea with no additional downloads apart from Make
|
||||
<a href='{{< relref "doc/advanced/make.en-us.md" >}}'>(See here how to get Make)</a>.
|
||||
Various [make tasks](https://github.com/go-gitea/gitea/blob/master/Makefile)
|
||||
are provided to keep the build process as simple as possible.
|
||||
|
||||
Depending on requirements, the following build tags can be included.
|
||||
|
||||
* `bindata`: Build a single monolithic binary, with all assets included.
|
||||
* `sqlite sqlite_unlock_notify`: Enable support for a [SQLite3](https://sqlite.org/) database. Suggested only
|
||||
for tiny installations.
|
||||
* `tidb`: Enable support for a [TiDB](https://github.com/pingcap/tidb) database.
|
||||
* `pam`: Enable support for PAM (Linux Pluggable Authentication Modules). Can be used to
|
||||
authenticate local users or extend authentication to methods available to PAM.
|
||||
* `sqlite sqlite_unlock_notify`: Enable support for a
|
||||
[SQLite3](https://sqlite.org/) database. Suggested only for tiny
|
||||
installations.
|
||||
* `pam`: Enable support for PAM (Linux Pluggable Authentication Modules). Can
|
||||
be used to authenticate local users or extend authentication to methods
|
||||
available to PAM.
|
||||
|
||||
Bundling assets into the binary using the `bindata` build tag can make development and
|
||||
testing easier, but is not ideal for a production deployment. To include assets, they
|
||||
must be built separately using the `generate` make task.
|
||||
Bundling assets into the binary using the `bindata` build tag can make
|
||||
development and testing easier, but is not ideal for a production deployment.
|
||||
To include assets, they must be built separately using the `generate` make
|
||||
task e.g.:
|
||||
|
||||
```
|
||||
```bash
|
||||
TAGS="bindata" make generate build
|
||||
```
|
||||
|
||||
In the default release build of our continuous integration system, the build
|
||||
tags are: `TAGS="bindata sqlite sqlite_unlock_notify"`. The simplest
|
||||
recommended way to build from source is therefore:
|
||||
|
||||
```bash
|
||||
TAGS="bindata sqlite sqlite_unlock_notify" make generate build
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
After following the steps above a `gitea` binary will be available in the working directory.
|
||||
After following the steps above, a `gitea` binary will be available in the working directory.
|
||||
It can be tested from this directory or moved to a directory with test data. When Gitea is
|
||||
launched manually from command line, it can be killed by pressing `Ctrl + C`.
|
||||
|
||||
```
|
||||
```bash
|
||||
./gitea web
|
||||
```
|
||||
|
@@ -58,7 +58,6 @@ Comme nous regroupons déjà toutes les bibliothèques requises pour compiler Gi
|
||||
|
||||
* `bindata`: Intègre toutes les ressources nécessaires à l'exécution d'une instance de Gitea, ce qui rend un déploiement facile car il n'est pas nécessaire de se préoccuper des fichiers supplémentaires.
|
||||
* `sqlite sqlite_unlock_notify`: Active la prise en charge d'une base de données [SQLite3](https://sqlite.org/), ceci n'est recommandé que pour les petites installations de Gitea.
|
||||
* `tidb`: Active la prise en charge d'une base de données [TiDB](https://github.com/pingcap/tidb), c'est une base de données simplet et basée sur des fichiers. Elle est comparable à SQLite.
|
||||
* `pam`: Active la prise en charge de PAM (mLinux Pluggable Authentication Modules), très utile si vos utilisateurs doivent être authentifiés avec les comptes du système.
|
||||
|
||||
Il est temps de compiler le binaire, nous suggérons d'intégrer les ressources avec l'option de compilation `bindata`. Pour inclure les ressources, vous devrez également exécuter la tâche Make `generate`. Dans le cas échéant, les ressources ne pourront pas être intégrées:
|
||||
|
@@ -48,7 +48,6 @@ git checkout v1.0.0
|
||||
|
||||
* `bindata`: 这个编译选项将会把运行Gitea所需的所有外部资源都打包到可执行文件中,这样部署将非常简单因为除了可执行程序将不再需要任何其他文件。
|
||||
* `sqlite sqlite_unlock_notify`: 这个编译选项将启用SQLite3数据库的支持,建议只在少数人使用时使用这个模式。
|
||||
* `tidb`: 这个编译选项启用tidb嵌入式数据库的支持,他跟SQLite类似但是是用纯Go编写的。
|
||||
* `pam`: 这个编译选项将会启用 PAM (Linux Pluggable Authentication Modules) 认证,如果你使用这一认证模式的话需要开启这个选项。
|
||||
|
||||
我们支持两种方式进行编译,Make 工具 和 Go 工具。不过我们推荐使用 Make工具,因为他将会给出更多的编译选项。
|
||||
|
@@ -48,7 +48,6 @@ git checkout v1.0.0
|
||||
|
||||
* `bindata`: 使用此標籤來嵌入所有 Gitea 相關資源,您不用擔心其他額外檔案,對於部署來說非常方便。
|
||||
* `sqlite sqlite_unlock_notify`: 使用此標籤來啟用 [SQLite3](https://sqlite.org/) 資料庫,建議只有少數人時才使用此模式。
|
||||
* `tidb`: 使用此標籤來啟用 [TiDB](https://github.com/pingcap/tidb) 資料庫,它是檔案形式的資料庫,跟 SQLite 類似。
|
||||
* `pam`: 使用此標籤來啟用 PAM (Linux Pluggable Authentication Modules) 認證,對於系統使用者來說,此方式最方便了。
|
||||
|
||||
現在您可以開始編譯執行檔了,我們建議使用 `bindata` 編譯選項,使用 `bindata` 選項前,您必須執行 `generate` 任務將所有資源都一起編譯進去,否則相關資源都不會被編譯進執行檔:
|
||||
|
@@ -29,7 +29,7 @@ Uncomment any service that needs to be enabled on this host, such as MySQL.
|
||||
Change the user, home directory, and other required startup values. Change the
|
||||
PORT or remove the -p flag if default port is used.
|
||||
|
||||
Enable and start gitea at boot:
|
||||
Enable and start Gitea at boot:
|
||||
```
|
||||
sudo systemctl enable gitea
|
||||
sudo systemctl start gitea
|
||||
@@ -45,7 +45,7 @@ sudo apt install supervisor
|
||||
|
||||
Create a log dir for the supervisor logs:
|
||||
```
|
||||
# assuming gitea is installed in /home/git/gitea/
|
||||
# assuming Gitea is installed in /home/git/gitea/
|
||||
mkdir /home/git/gitea/log/supervisor
|
||||
```
|
||||
|
||||
@@ -57,7 +57,7 @@ sudo vim /etc/supervisor/supervisord.conf
|
||||
Append the configuration from the sample
|
||||
[supervisord config](https://github.com/go-gitea/gitea/blob/master/contrib/supervisor/gitea).
|
||||
|
||||
Change the user(git) and home(/home/git) settings to match the deployment
|
||||
Change the user (git) and home (/home/git) settings to match the deployment
|
||||
environment. Change the PORT or remove the -p flag if default port is used.
|
||||
|
||||
Lastly enable and start supervisor at boot:
|
||||
|
@@ -13,6 +13,27 @@ menu:
|
||||
identifier: "windows-service"
|
||||
---
|
||||
|
||||
# Prerequisites
|
||||
|
||||
The following changes are made in C:\gitea\custom\conf\app.ini:
|
||||
|
||||
```
|
||||
RUN_USER = COMPUTERNAME$
|
||||
```
|
||||
|
||||
Sets Gitea to run as the local system user.
|
||||
|
||||
COMPUTERNAME is whatever the response is from `echo %COMPUTERNAME%` on the command line. If the response is `USER-PC` then `RUN_USER = USER-PC$`
|
||||
|
||||
## Use absolute paths
|
||||
|
||||
If you use sqlite3, change the `PATH` to include the full path:
|
||||
|
||||
```
|
||||
[database]
|
||||
PATH = c:/gitea/data/gitea.db
|
||||
```
|
||||
|
||||
# Register as a Windows Service
|
||||
|
||||
To register Gitea as a Windows service, open a command prompt (cmd) as an Administrator,
|
||||
@@ -25,7 +46,7 @@ sc create gitea start= auto binPath= ""C:\gitea\gitea.exe" web --config "C:\gite
|
||||
Do not forget to replace `C:\gitea` with the correct Gitea directory.
|
||||
|
||||
Open "Windows Services", search for the service named "gitea", right-click it and click on
|
||||
"Run". If everything is OK Gitea will be reachable on `http://localhost:3000` (or the port
|
||||
"Run". If everything is OK, Gitea will be reachable on `http://localhost:3000` (or the port
|
||||
that was configured).
|
||||
|
||||
## Unregister as a service
|
||||
|
@@ -20,13 +20,13 @@ possible to always use the latest stable tag or to use another service that hand
|
||||
Docker images.
|
||||
|
||||
This reference setup guides users through the setup based on `docker-compose`, but the installation
|
||||
of `docker-compose` is out of scope of this documentation. To install `docker-compose` itself follow
|
||||
of `docker-compose` is out of scope of this documentation. To install `docker-compose` itself, follow
|
||||
the official [install instructions](https://docs.docker.com/compose/install/).
|
||||
|
||||
## Basics
|
||||
|
||||
The most simple setup just creates a volume and a network and starts the `gitea/gitea:latest`
|
||||
image as a service. Since there is no database available one can be initialized using SQLite3.
|
||||
image as a service. Since there is no database available, one can be initialized using SQLite3.
|
||||
Create a directory like `gitea` and paste the following content into a file named `docker-compose.yml`.
|
||||
Note that the volume should be owned by the user/group with the UID/GID specified in the config file.
|
||||
If you don't give the volume correct permissions, the container may not start.
|
||||
@@ -187,7 +187,7 @@ services:
|
||||
To use named volumes instead of host volumes, define and use the named volume
|
||||
within the `docker-compose.yml` configuration. This change will automatically
|
||||
create the required volume. You don't need to worry about permissions with
|
||||
named volumes, Docker will deal with that automatically.
|
||||
named volumes; Docker will deal with that automatically.
|
||||
|
||||
```diff
|
||||
version: "2"
|
||||
@@ -230,10 +230,10 @@ Notice: if using a non-3000 port on http, change app.ini to match
|
||||
|
||||
## Install
|
||||
|
||||
After starting the Docker setup via `docker-compose` Gitea should be available using a
|
||||
After starting the Docker setup via `docker-compose`, Gitea should be available using a
|
||||
favorite browser to finalize the installation. Visit http://server-ip:3000 and follow the
|
||||
installation wizard. If the database was started with the `docker-compose` setup as
|
||||
documented above please note that `db` must be used as the database hostname.
|
||||
documented above, please note that `db` must be used as the database hostname.
|
||||
|
||||
## Environments variables
|
||||
|
||||
@@ -252,7 +252,7 @@ You can configure some of Gitea's settings via environment variables:
|
||||
* `DB_HOST`: **localhost:3306**: Database host address and port.
|
||||
* `DB_NAME`: **gitea**: Database name.
|
||||
* `DB_USER`: **root**: Database username.
|
||||
* `DB_PASSWD`: **"<empty>"**: Database user password. Use \`your password\` for quoting if you use special characters in the password.
|
||||
* `DB_PASSWD`: **"\<empty>"**: Database user password. Use \`your password\` for quoting if you use special characters in the password.
|
||||
* `INSTALL_LOCK`: **false**: Disallow access to the install page.
|
||||
* `SECRET_KEY`: **""**: Global secret key. This should be changed. If this has a value and `INSTALL_LOCK` is empty, `INSTALL_LOCK` will automatically set to `true`.
|
||||
* `DISABLE_REGISTRATION`: **false**: Disable registration, after which only admin can create accounts for users.
|
||||
@@ -263,8 +263,8 @@ You can configure some of Gitea's settings via environment variables:
|
||||
# Customization
|
||||
|
||||
Customization files described [here](https://docs.gitea.io/en-us/customizing-gitea/) should
|
||||
be placed in `/data/gitea` directory. If using host volumes it's quite easy to access these
|
||||
files; for named volumes this is done through another container or by direct access at
|
||||
be placed in `/data/gitea` directory. If using host volumes, it's quite easy to access these
|
||||
files; for named volumes, this is done through another container or by direct access at
|
||||
`/var/lib/docker/volumes/gitea_gitea/_data`. The configuration file will be saved at
|
||||
`/data/gitea/conf/app.ini` after the installation.
|
||||
|
||||
@@ -280,3 +280,67 @@ docker-compose pull
|
||||
# Start a new container, automatically removes old one
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
# SSH Container Passthrough
|
||||
|
||||
Since SSH is running inside the container, you'll have to pass SSH from the host to the
|
||||
container if you wish to use SSH support. If you wish to do this without running the container
|
||||
SSH on a non-standard port (or move your host port to a non-standard port), you can forward
|
||||
SSH connections destined for the container with a little extra setup.
|
||||
|
||||
This guide assumes that you have created a user on the host called `git` which shares the same
|
||||
UID/GID as the container values `USER_UID`/`USER_GID`. You should also create the directory
|
||||
`/var/lib/gitea` on the host, owned by the `git` user and mounted in the container, e.g.
|
||||
|
||||
```
|
||||
services:
|
||||
server:
|
||||
image: gitea/gitea:latest
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
volumes:
|
||||
- /var/lib/gitea:/data
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "127.0.0.1:2222:22"
|
||||
```
|
||||
|
||||
You can see that we're also exposing the container SSH port to port 2222 on the host, and binding this
|
||||
to 127.0.0.1 to prevent it being accessible external to the host machine itself.
|
||||
|
||||
On the **host**, you should create the file `/app/gitea/gitea` with the following contents and
|
||||
make it executable (`chmod +x /app/gitea/gitea`):
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
ssh -p 2222 -o StrictHostKeyChecking=no git@127.0.0.1 "SSH_ORIGINAL_COMMAND=\"$SSH_ORIGINAL_COMMAND\" $0 $@"
|
||||
```
|
||||
|
||||
Your `git` user needs to have an SSH key generated:
|
||||
|
||||
```
|
||||
sudo -u git ssh-keygen -t rsa -b 4096 -C "Gitea Host Key"
|
||||
```
|
||||
|
||||
Still on the host, symlink the container `.ssh/authorized_keys` file to your git user `.ssh/authorized_keys`.
|
||||
This can be done on the host as the `/var/lib/gitea` directory is mounted inside the container under `/data`:
|
||||
|
||||
```
|
||||
ln -s /var/lib/gitea/git/.ssh/authorized_keys /home/git/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
Then echo the `git` user SSH key into the authorized_keys file so the host can talk to the container over SSH:
|
||||
|
||||
```
|
||||
echo "no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $(cat /home/git/.ssh/id_rsa.pub)" >> /var/lib/gitea/git/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
Now you should be able to use Git over SSH to your container without disrupting SSH access to the host.
|
||||
|
||||
Please note: SSH container passthrough will work only if using opensshd in container, and will not work if
|
||||
`AuthorizedKeysCommand` is used in combination with setting `SSH_CREATE_AUTHORIZED_KEYS_FILE=false` to disable
|
||||
authorized files key generation.
|
||||
|
@@ -31,6 +31,7 @@ There are some basic steps to follow. On a Linux system run as the Gogs user:
|
||||
* Copy `gogs/data/` to `gitea/data/`. It contains issue attachments and avatars.
|
||||
* Verify by starting Gitea with `gitea web`.
|
||||
* Enter Gitea admin panel on the UI, run `Rewrite '.ssh/authorized_keys' file`.
|
||||
* Launch every major version of the binary ( `1.1.4` → `1.2.3` → `1.3.4` → `1.4.2` → etc ) to migrate database.
|
||||
* If custom or config path was changed, run `Rewrite all update hook of repositories`.
|
||||
|
||||
## Change gogs specific information
|
||||
@@ -69,7 +70,7 @@ There are some basic steps to follow. On a Linux system run as the Gogs user:
|
||||
|
||||
## Upgrading to most recent `gitea` version
|
||||
|
||||
After successful migration from `gogs` to `gitea 1.0.x` it is possible to upgrade to the recent `gitea` version.
|
||||
After successful migration from `gogs` to `gitea 1.0.x`, it is possible to upgrade to the recent `gitea` version.
|
||||
Simply download the file matching the destination platform from the [downloads page](https://dl.gitea.io/gitea)
|
||||
and replace the binary.
|
||||
|
||||
|
@@ -27,6 +27,7 @@ Veuillez suivre les étapes ci-dessous. Sur Unix, toute les commandes s'exécute
|
||||
* Si vous avez d'autres répertoires personnalisés comme `gitignore, label, license, locale, readme` dans `gogs/custom/conf` copiez-les vers `gitea/custom/options`.
|
||||
* Copiez le répertoire `gogs/data/` vers `gitea/data/`.
|
||||
* Vérifiez votre installation en exécutant Gitea avec la commande `gitea web`.
|
||||
* Lancez le binaire de version majeure en version majeure ( `1.1.4` → `1.2.3` → `1.3.4` → `1.4.2` → etc ) afin de récupérer les migrations de base de données.
|
||||
* Connectez vous au panel d'administration de Gitea et exécutez l'action `Rewrite '.ssh/authorized_keys' file`, puis l'action `Rewrite all update hook of repositories` (obligatoire si le chemin menant à votre configuration personnalisée à changé).
|
||||
|
||||
## Modifier les informations spécifiques de gogs
|
||||
|
@@ -50,12 +50,18 @@ Admin operations:
|
||||
|
||||
- Commands:
|
||||
- `create-user`
|
||||
- Options:
|
||||
- Options:
|
||||
- `--name value`: Username. Required.
|
||||
- `--password value`: Password. Required.
|
||||
- `--email value`: Email. Required.
|
||||
- `--admin`: If provided, this makes the user an admin. Optional.
|
||||
- `--config path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini).
|
||||
- `--must-change-password`: If provided, the created user will be required to choose a newer password after
|
||||
the initial login. Optional. (default: true).
|
||||
- ``--random-password``: If provided, a randomly generated password will be used as the password of
|
||||
the created user. The value of `--password` will be discarded. Optional.
|
||||
- `--random-password-length`: If provided, it will be used to configure the length of the randomly
|
||||
generated password. Optional. (default: 12)
|
||||
- Examples:
|
||||
- `gitea admin create-user --name myname --password asecurepassword --email me@example.com`
|
||||
- `change-password`
|
||||
@@ -143,6 +149,8 @@ in the current directory.
|
||||
- Options:
|
||||
- `--config path`, `-c path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini).
|
||||
- `--tempdir path`, `-t path`: Path to the temporary directory used. Optional. (default: /tmp).
|
||||
- `--skip-repository`, `-R`: Skip the repository dumping. Optional.
|
||||
- `--database`, `-d`: Specify the database SQL syntax. Optional.
|
||||
- `--verbose`, `-v`: If provided, shows additional details. Optional.
|
||||
- Examples:
|
||||
- `gitea dump`
|
||||
|
@@ -19,7 +19,7 @@ menu:
|
||||
sure to test this before relying on it so you don't lock yourself out.**
|
||||
|
||||
Gitea returns an HTTP 200 for bad logins in the web logs, but if you have logging options on in
|
||||
`app.ini`, then you should be able to go off of log/gitea.log, which gives you something like this
|
||||
`app.ini`, then you should be able to go off of `log/gitea.log`, which gives you something like this
|
||||
on a bad authentication:
|
||||
|
||||
```log
|
||||
@@ -52,8 +52,8 @@ action = iptables-allports
|
||||
Make sure and read up on fail2ban and configure it to your needs, this bans someone
|
||||
for **15 minutes** (from all ports) when they fail authentication 10 times in an hour.
|
||||
|
||||
If you run Gitea behind a reverse proxy with nginx (for example with docker), you need to add
|
||||
this to your nginx configuration so that IPs don't show up as 127.0.0.1:
|
||||
If you run Gitea behind a reverse proxy with Nginx (for example with Docker), you need to add
|
||||
this to your Nginx configuration so that IPs don't show up as 127.0.0.1:
|
||||
|
||||
```
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
@@ -15,12 +15,12 @@ menu:
|
||||
|
||||
# HTTPS setup to encrypt connections to Gitea
|
||||
|
||||
## Using built-in server
|
||||
## Using the built-in server
|
||||
|
||||
Before you enable HTTPS make sure that you have valid SSL/TLS certificates.
|
||||
Before you enable HTTPS, make sure that you have valid SSL/TLS certificates.
|
||||
You could use self-generated certificates for evaluation and testing. Please run `gitea cert --host [HOST]` to generate a self signed certificate.
|
||||
|
||||
To use Gitea's built-in HTTPS support you must change your `app.ini` file:
|
||||
To use Gitea's built-in HTTPS support, you must change your `app.ini` file:
|
||||
|
||||
```ini
|
||||
[server]
|
||||
@@ -30,13 +30,27 @@ HTTP_PORT = 3000
|
||||
CERT_FILE = cert.pem
|
||||
KEY_FILE = key.pem
|
||||
```
|
||||
|
||||
To learn more about the config values, please checkout the [Config Cheat Sheet](../config-cheat-sheet#server).
|
||||
|
||||
### Setting up HTTP redirection
|
||||
|
||||
The Gitea server is only able to listen to one port; to redirect HTTP requests to the HTTPS port, you will need to enable the HTTP redirection service:
|
||||
|
||||
```ini
|
||||
[server]
|
||||
REDIRECT_OTHER_PORT = true
|
||||
; Port the redirection service should listen on
|
||||
PORT_TO_REDIRECT = 3080
|
||||
```
|
||||
|
||||
If you are using Docker, make sure that this port is configured in your `docker-compose.yml` file.
|
||||
|
||||
## Using Let's Encrypt
|
||||
|
||||
[Let's Encrypt](https://letsencrypt.org/) is a Certificate Authority that allows you to automatically request and renew SSL/TLS certificates. In addition to starting Gitea on your configured port, to request HTTPS certificates Gitea will also need to listed on port 80, and will set up an autoredirect to HTTPS for you. Let's Encrypt will need to be able to access Gitea via the Internet to verify your ownership of the domain.
|
||||
[Let's Encrypt](https://letsencrypt.org/) is a Certificate Authority that allows you to automatically request and renew SSL/TLS certificates. In addition to starting Gitea on your configured port, to request HTTPS certificates, Gitea will also need to listed on port 80, and will set up an autoredirect to HTTPS for you. Let's Encrypt will need to be able to access Gitea via the Internet to verify your ownership of the domain.
|
||||
|
||||
By using Lets Encrypt **you must consent** to their [terms of service](https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf)
|
||||
By using Let's Encrypt **you must consent** to their [terms of service](https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf).
|
||||
|
||||
```ini
|
||||
[server]
|
||||
@@ -52,7 +66,7 @@ To learn more about the config values, please checkout the [Config Cheat Sheet](
|
||||
|
||||
## Using reverse proxy
|
||||
|
||||
Setup up your reverse proxy like shown in the [reverse proxy guide](../reverse-proxies).
|
||||
Setup up your reverse proxy as shown in the [reverse proxy guide](../reverse-proxies).
|
||||
|
||||
After that, enable HTTPS by following one of these guides:
|
||||
|
||||
@@ -60,5 +74,5 @@ After that, enable HTTPS by following one of these guides:
|
||||
* [apache2/httpd](https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html)
|
||||
* [caddy](https://caddyserver.com/docs/tls)
|
||||
|
||||
Note: You connection between your reverse proxy and gitea might be unencrypted. To encrypt it too follow the [built-in server guide](#using-built-in-server) and change
|
||||
Note: Your connection between your reverse proxy and Gitea might be unencrypted. To encrypt it too, follow the [built-in server guide](#using-built-in-server) and change
|
||||
the proxy url to `https://[URL]`.
|
||||
|
@@ -15,11 +15,11 @@ menu:
|
||||
|
||||
# Issue and Pull Request Templates
|
||||
|
||||
For some projects there are a standard list of questions that users need to be asked
|
||||
for creating an issue, or adding a pull request. Gitea supports adding templates to the
|
||||
Some projects have a standard list of questions that users need to answer
|
||||
when creating an issue or pull request. Gitea supports adding templates to the
|
||||
main branch of the repository so that they can autopopulate the form when users are
|
||||
creating issues, and pull requests. This will cut down on the initial back and forth
|
||||
of getting some clarifiying details.
|
||||
creating issues and pull requests. This will cut down on the initial back and forth
|
||||
of getting some clarifying details.
|
||||
|
||||
Possible file names for issue templates:
|
||||
|
||||
@@ -39,3 +39,6 @@ Possible file names for PR templates:
|
||||
* .gitea/pull_request_template.md
|
||||
* .github/PULL_REQUEST_TEMPLATE.md
|
||||
* .github/pull_request_template.md
|
||||
|
||||
|
||||
Additionally, the New Issue page URL can be suffixed with `?body=Issue+Text` and the form will be populated with that string. This string will be used instead of the template if there is one.
|
||||
|
@@ -28,4 +28,4 @@ The first value of the list will be used in helpers.
|
||||
|
||||
## Pull Request Templates
|
||||
|
||||
You can find more information about pull request templates in the dedicated page : [Issue and Pull Request templates](../issue-pull-request-templates)
|
||||
You can find more information about pull request templates at the page [Issue and Pull Request templates](../issue-pull-request-templates).
|
||||
|
@@ -14,7 +14,7 @@ menu:
|
||||
---
|
||||
|
||||
## Using Nginx as a reverse proxy
|
||||
If you want Nginx to serve your Gitea instance you can the following `server` section inside the `http` section of `nginx.conf`:
|
||||
If you want Nginx to serve your Gitea instance, you can the following `server` section inside the `http` section of `nginx.conf`:
|
||||
|
||||
```
|
||||
server {
|
||||
@@ -27,7 +27,7 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
## Using Nginx with a Sub-path as a reverse proxy
|
||||
## Using Nginx with a sub-path as a reverse proxy
|
||||
|
||||
In case you already have a site, and you want Gitea to share the domain name, you can setup Nginx to serve Gitea under a sub-path by adding the following `server` section inside the `http` section of `nginx.conf`:
|
||||
|
||||
@@ -46,7 +46,7 @@ Then set `[server] ROOT_URL = http://git.example.com/git/` in your configuration
|
||||
|
||||
## Using Apache HTTPD as a reverse proxy
|
||||
|
||||
If you want Apache HTTPD to serve your Gitea instance you can add the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
|
||||
If you want Apache HTTPD to serve your Gitea instance, you can add the following to your Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
|
||||
|
||||
```
|
||||
<VirtualHost *:80>
|
||||
@@ -60,7 +60,7 @@ If you want Apache HTTPD to serve your Gitea instance you can add the following
|
||||
|
||||
Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`
|
||||
|
||||
## Using Apache HTTPD with a Sub-path as a reverse proxy
|
||||
## Using Apache HTTPD with a sub-path as a reverse proxy
|
||||
|
||||
In case you already have a site, and you want Gitea to share the domain name, you can setup Apache HTTPD to serve Gitea under a sub-path by adding the following to you Apache HTTPD configuration (usually located at `/etc/apache2/httpd.conf` in Ubuntu):
|
||||
|
||||
@@ -83,7 +83,7 @@ Note: The following Apache HTTPD mods must be enabled: `proxy`, `proxy_http`
|
||||
|
||||
## Using Caddy as a reverse proxy
|
||||
|
||||
If you want Caddy to serve your Gitea instance you can add the following server block to your Caddyfile:
|
||||
If you want Caddy to serve your Gitea instance, you can add the following server block to your Caddyfile:
|
||||
|
||||
```
|
||||
git.example.com {
|
||||
@@ -91,9 +91,9 @@ git.example.com {
|
||||
}
|
||||
```
|
||||
|
||||
## Using Caddy with a Sub-path as a reverse proxy
|
||||
## Using Caddy with a sub-path as a reverse proxy
|
||||
|
||||
In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to you server block in your Caddyfile:
|
||||
In case you already have a site, and you want Gitea to share the domain name, you can setup Caddy to serve Gitea under a sub-path by adding the following to your server block in your Caddyfile:
|
||||
|
||||
```
|
||||
git.example.com {
|
||||
|
@@ -10,7 +10,7 @@ draft: false
|
||||
|
||||
# What is Gitea?
|
||||
|
||||
Gitea is a painless self-hosted Git service. It is similar to GitHub, Bitbucket, and Gitlab.
|
||||
Gitea is a painless self-hosted Git service. It is similar to GitHub, Bitbucket, and GitLab.
|
||||
Gitea is a fork of [Gogs](http://gogs.io). See the [Gitea Announcement](https://blog.gitea.io/2016/12/welcome-to-gitea/)
|
||||
blog post to read about the justification for a fork.
|
||||
|
||||
@@ -254,7 +254,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
|
||||
- A Raspberry Pi 3 is powerful enough to run Gitea for small workloads.
|
||||
- 2 CPU cores and 1GB RAM is typically sufficient for small teams/projects.
|
||||
- Gitea should be run with a dedicated non-root system account on UNIX-type systems.
|
||||
- Note: Gitea manages the `~/.ssh/authorized_keys` file. Running gitea as a regular user could break that user's ability to log in.
|
||||
- Note: Gitea manages the `~/.ssh/authorized_keys` file. Running Gitea as a regular user could break that user's ability to log in.
|
||||
|
||||
## Browser Support
|
||||
|
||||
|
152
integrations/api_helper_for_declarative_test.go
Normal file
152
integrations/api_helper_for_declarative_test.go
Normal file
@@ -0,0 +1,152 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type APITestContext struct {
|
||||
Reponame string
|
||||
Session *TestSession
|
||||
Token string
|
||||
Username string
|
||||
ExpectedCode int
|
||||
}
|
||||
|
||||
func NewAPITestContext(t *testing.T, username, reponame string) APITestContext {
|
||||
session := loginUser(t, username)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
return APITestContext{
|
||||
Session: session,
|
||||
Token: token,
|
||||
Username: username,
|
||||
Reponame: reponame,
|
||||
}
|
||||
}
|
||||
|
||||
func (ctx APITestContext) GitPath() string {
|
||||
return fmt.Sprintf("%s/%s.git", ctx.Username, ctx.Reponame)
|
||||
}
|
||||
|
||||
func doAPICreateRepository(ctx APITestContext, empty bool, callback ...func(*testing.T, api.Repository)) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
createRepoOption := &api.CreateRepoOption{
|
||||
AutoInit: !empty,
|
||||
Description: "Temporary repo",
|
||||
Name: ctx.Reponame,
|
||||
Private: true,
|
||||
Gitignores: "",
|
||||
License: "WTFPL",
|
||||
Readme: "Default",
|
||||
}
|
||||
req := NewRequestWithJSON(t, "POST", "/api/v1/user/repos?token="+ctx.Token, createRepoOption)
|
||||
if ctx.ExpectedCode != 0 {
|
||||
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
|
||||
return
|
||||
}
|
||||
resp := ctx.Session.MakeRequest(t, req, http.StatusCreated)
|
||||
|
||||
var repository api.Repository
|
||||
DecodeJSON(t, resp, &repository)
|
||||
if len(callback) > 0 {
|
||||
callback[0](t, repository)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func doAPIGetRepository(ctx APITestContext, callback ...func(*testing.T, api.Repository)) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", ctx.Username, ctx.Reponame, ctx.Token)
|
||||
|
||||
req := NewRequest(t, "GET", urlStr)
|
||||
if ctx.ExpectedCode != 0 {
|
||||
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
|
||||
return
|
||||
}
|
||||
resp := ctx.Session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var repository api.Repository
|
||||
DecodeJSON(t, resp, &repository)
|
||||
if len(callback) > 0 {
|
||||
callback[0](t, repository)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func doAPIDeleteRepository(ctx APITestContext) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s?token=%s", ctx.Username, ctx.Reponame, ctx.Token)
|
||||
|
||||
req := NewRequest(t, "DELETE", urlStr)
|
||||
if ctx.ExpectedCode != 0 {
|
||||
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
|
||||
return
|
||||
}
|
||||
ctx.Session.MakeRequest(t, req, http.StatusNoContent)
|
||||
}
|
||||
}
|
||||
|
||||
func doAPICreateUserKey(ctx APITestContext, keyname, keyFile string, callback ...func(*testing.T, api.PublicKey)) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
urlStr := fmt.Sprintf("/api/v1/user/keys?token=%s", ctx.Token)
|
||||
|
||||
dataPubKey, err := ioutil.ReadFile(keyFile + ".pub")
|
||||
assert.NoError(t, err)
|
||||
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateKeyOption{
|
||||
Title: keyname,
|
||||
Key: string(dataPubKey),
|
||||
})
|
||||
if ctx.ExpectedCode != 0 {
|
||||
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
|
||||
return
|
||||
}
|
||||
resp := ctx.Session.MakeRequest(t, req, http.StatusCreated)
|
||||
var publicKey api.PublicKey
|
||||
DecodeJSON(t, resp, &publicKey)
|
||||
if len(callback) > 0 {
|
||||
callback[0](t, publicKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func doAPIDeleteUserKey(ctx APITestContext, keyID int64) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
urlStr := fmt.Sprintf("/api/v1/user/keys/%d?token=%s", keyID, ctx.Token)
|
||||
|
||||
req := NewRequest(t, "DELETE", urlStr)
|
||||
if ctx.ExpectedCode != 0 {
|
||||
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
|
||||
return
|
||||
}
|
||||
ctx.Session.MakeRequest(t, req, http.StatusNoContent)
|
||||
}
|
||||
}
|
||||
|
||||
func doAPICreateDeployKey(ctx APITestContext, keyname, keyFile string, readOnly bool) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/keys?token=%s", ctx.Username, ctx.Reponame, ctx.Token)
|
||||
|
||||
dataPubKey, err := ioutil.ReadFile(keyFile + ".pub")
|
||||
assert.NoError(t, err)
|
||||
req := NewRequestWithJSON(t, "POST", urlStr, api.CreateKeyOption{
|
||||
Title: keyname,
|
||||
Key: string(dataPubKey),
|
||||
ReadOnly: readOnly,
|
||||
})
|
||||
|
||||
if ctx.ExpectedCode != 0 {
|
||||
ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
|
||||
return
|
||||
}
|
||||
ctx.Session.MakeRequest(t, req, http.StatusCreated)
|
||||
}
|
||||
}
|
@@ -16,31 +16,16 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPICreateRelease(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
session := loginUser(t, owner.LowerName)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
gitRepo, err := git.OpenRepository(repo.RepoPath())
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = gitRepo.CreateTag("v0.0.1", "master")
|
||||
assert.NoError(t, err)
|
||||
|
||||
commitID, err := gitRepo.GetTagCommitID("v0.0.1")
|
||||
assert.NoError(t, err)
|
||||
|
||||
func createNewReleaseUsingAPI(t *testing.T, session *TestSession, token string, owner *models.User, repo *models.Repository, name, target, title, desc string) *api.Release {
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/releases?token=%s",
|
||||
owner.Name, repo.Name, token)
|
||||
req := NewRequestWithJSON(t, "POST", urlStr, &api.CreateReleaseOption{
|
||||
TagName: "v0.0.1",
|
||||
Title: "v0.0.1",
|
||||
Note: "test",
|
||||
TagName: name,
|
||||
Title: title,
|
||||
Note: desc,
|
||||
IsDraft: false,
|
||||
IsPrerelease: false,
|
||||
Target: commitID,
|
||||
Target: target,
|
||||
})
|
||||
resp := session.MakeRequest(t, req, http.StatusCreated)
|
||||
|
||||
@@ -53,10 +38,32 @@ func TestAPICreateRelease(t *testing.T) {
|
||||
Note: newRelease.Note,
|
||||
})
|
||||
|
||||
urlStr = fmt.Sprintf("/api/v1/repos/%s/%s/releases/%d?token=%s",
|
||||
return &newRelease
|
||||
}
|
||||
|
||||
func TestAPICreateAndUpdateRelease(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
session := loginUser(t, owner.LowerName)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
gitRepo, err := git.OpenRepository(repo.RepoPath())
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = gitRepo.CreateTag("v0.0.1", "master")
|
||||
assert.NoError(t, err)
|
||||
|
||||
target, err := gitRepo.GetTagCommitID("v0.0.1")
|
||||
assert.NoError(t, err)
|
||||
|
||||
newRelease := createNewReleaseUsingAPI(t, session, token, owner, repo, "v0.0.1", target, "v0.0.1", "test")
|
||||
|
||||
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/releases/%d?token=%s",
|
||||
owner.Name, repo.Name, newRelease.ID, token)
|
||||
req = NewRequest(t, "GET", urlStr)
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
req := NewRequest(t, "GET", urlStr)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var release api.Release
|
||||
DecodeJSON(t, resp, &release)
|
||||
@@ -83,3 +90,31 @@ func TestAPICreateRelease(t *testing.T) {
|
||||
Note: newRelease.Note,
|
||||
})
|
||||
}
|
||||
|
||||
func TestAPICreateReleaseToDefaultBranch(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
session := loginUser(t, owner.LowerName)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
createNewReleaseUsingAPI(t, session, token, owner, repo, "v0.0.1", "", "v0.0.1", "test")
|
||||
}
|
||||
|
||||
func TestAPICreateReleaseToDefaultBranchOnExistingTag(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
|
||||
session := loginUser(t, owner.LowerName)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
gitRepo, err := git.OpenRepository(repo.RepoPath())
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = gitRepo.CreateTag("v0.0.1", "master")
|
||||
assert.NoError(t, err)
|
||||
|
||||
createNewReleaseUsingAPI(t, session, token, owner, repo, "v0.0.1", "", "v0.0.1", "test")
|
||||
}
|
||||
|
32
integrations/api_repo_git_commits_test.go
Normal file
32
integrations/api_repo_git_commits_test.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
)
|
||||
|
||||
func TestAPIReposGitCommits(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
|
||||
// Login as User2.
|
||||
session := loginUser(t, user.Name)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
for _, ref := range [...]string{
|
||||
"commits/master", // Branch
|
||||
"commits/v1.1", // Tag
|
||||
} {
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/git/%s?token="+token, user.Name, ref)
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
}
|
||||
|
||||
// Test getting non-existent refs
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/git/commits/unknown?token="+token, user.Name)
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
}
|
38
integrations/api_repo_tags_test.go
Normal file
38
integrations/api_repo_tags_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright 2018 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAPIReposGetTags(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
|
||||
// Login as User2.
|
||||
session := loginUser(t, user.Name)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
|
||||
req := NewRequestf(t, "GET", "/api/v1/repos/%s/repo1/tags?token="+token, user.Name)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var tags []*api.Tag
|
||||
DecodeJSON(t, resp, &tags)
|
||||
|
||||
assert.EqualValues(t, 1, len(tags))
|
||||
assert.Equal(t, "v1.1", tags[0].Name)
|
||||
assert.Equal(t, "65f1bf27bc3bf70f64657658635e66094edbcb4d", tags[0].Commit.SHA)
|
||||
assert.Equal(t, path.Join(setting.AppSubURL, "/user2/repo1/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d"), tags[0].Commit.URL)
|
||||
assert.Equal(t, path.Join(setting.AppSubURL, "/user2/repo1/archive/v1.1.zip"), tags[0].ZipballURL)
|
||||
assert.Equal(t, path.Join(setting.AppSubURL, "/user2/repo1/archive/v1.1.tar.gz"), tags[0].TarballURL)
|
||||
}
|
@@ -6,7 +6,10 @@ package integrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
@@ -291,6 +294,44 @@ func TestAPIRepoMigrate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIRepoMigrateConflict(t *testing.T) {
|
||||
onGiteaRun(t, testAPIRepoMigrateConflict)
|
||||
}
|
||||
|
||||
func testAPIRepoMigrateConflict(t *testing.T, u *url.URL) {
|
||||
username := "user2"
|
||||
baseAPITestContext := NewAPITestContext(t, username, "repo1")
|
||||
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
t.Run("Existing", func(t *testing.T) {
|
||||
httpContext := baseAPITestContext
|
||||
|
||||
httpContext.Reponame = "repo-tmp-17"
|
||||
dstPath, err := ioutil.TempDir("", httpContext.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
t.Run("CreateRepo", doAPICreateRepository(httpContext, false))
|
||||
|
||||
user, err := models.GetUserByName(httpContext.Username)
|
||||
assert.NoError(t, err)
|
||||
userID := user.ID
|
||||
|
||||
cloneURL := "https://github.com/go-gitea/git.git"
|
||||
|
||||
req := NewRequestWithJSON(t, "POST", "/api/v1/repos/migrate?token="+httpContext.Token,
|
||||
&api.MigrateRepoOption{
|
||||
CloneAddr: cloneURL,
|
||||
UID: int(userID),
|
||||
RepoName: httpContext.Reponame,
|
||||
})
|
||||
resp := httpContext.Session.MakeRequest(t, req, http.StatusConflict)
|
||||
respJSON := map[string]string{}
|
||||
DecodeJSON(t, resp, &respJSON)
|
||||
assert.Equal(t, respJSON["message"], "The repository with the same name already exists.")
|
||||
})
|
||||
}
|
||||
|
||||
func TestAPIOrgRepoCreate(t *testing.T) {
|
||||
testCases := []struct {
|
||||
ctxUserID int64
|
||||
@@ -313,3 +354,33 @@ func TestAPIOrgRepoCreate(t *testing.T) {
|
||||
session.MakeRequest(t, req, testCase.expectedStatus)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIRepoCreateConflict(t *testing.T) {
|
||||
onGiteaRun(t, testAPIRepoCreateConflict)
|
||||
}
|
||||
|
||||
func testAPIRepoCreateConflict(t *testing.T, u *url.URL) {
|
||||
username := "user2"
|
||||
baseAPITestContext := NewAPITestContext(t, username, "repo1")
|
||||
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
t.Run("Existing", func(t *testing.T) {
|
||||
httpContext := baseAPITestContext
|
||||
|
||||
httpContext.Reponame = "repo-tmp-17"
|
||||
dstPath, err := ioutil.TempDir("", httpContext.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
t.Run("CreateRepo", doAPICreateRepository(httpContext, false))
|
||||
|
||||
req := NewRequestWithJSON(t, "POST", "/api/v1/user/repos?token="+httpContext.Token,
|
||||
&api.CreateRepoOption{
|
||||
Name: httpContext.Reponame,
|
||||
})
|
||||
resp := httpContext.Session.MakeRequest(t, req, http.StatusConflict)
|
||||
respJSON := map[string]string{}
|
||||
DecodeJSON(t, resp, &respJSON)
|
||||
assert.Equal(t, respJSON["message"], "The repository with the same name already exists.")
|
||||
})
|
||||
}
|
||||
|
@@ -9,7 +9,9 @@ import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -23,14 +25,16 @@ func TestUserOrgs(t *testing.T) {
|
||||
req := NewRequest(t, "GET", urlStr)
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
var orgs []*api.Organization
|
||||
user3 := models.AssertExistsAndLoadBean(t, &models.User{Name: "user3"}).(*models.User)
|
||||
|
||||
DecodeJSON(t, resp, &orgs)
|
||||
|
||||
assert.Equal(t, []*api.Organization{
|
||||
{
|
||||
ID: 3,
|
||||
UserName: "user3",
|
||||
FullName: "User Three",
|
||||
AvatarURL: "https://secure.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?d=identicon",
|
||||
UserName: user3.Name,
|
||||
FullName: user3.FullName,
|
||||
AvatarURL: user3.AvatarLink(),
|
||||
Description: "",
|
||||
Website: "",
|
||||
Location: "",
|
||||
@@ -48,13 +52,14 @@ func TestMyOrgs(t *testing.T) {
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
var orgs []*api.Organization
|
||||
DecodeJSON(t, resp, &orgs)
|
||||
user3 := models.AssertExistsAndLoadBean(t, &models.User{Name: "user3"}).(*models.User)
|
||||
|
||||
assert.Equal(t, []*api.Organization{
|
||||
{
|
||||
ID: 3,
|
||||
UserName: "user3",
|
||||
FullName: "User Three",
|
||||
AvatarURL: "https://secure.gravatar.com/avatar/97d6d9441ff85fdc730e02a6068d267b?d=identicon",
|
||||
UserName: user3.Name,
|
||||
FullName: user3.FullName,
|
||||
AvatarURL: user3.AvatarLink(),
|
||||
Description: "",
|
||||
Website: "",
|
||||
Location: "",
|
||||
|
@@ -22,3 +22,15 @@ func TestDownloadByID(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "# repo1\n\nDescription for repo1", resp.Body.String())
|
||||
}
|
||||
|
||||
func TestDownloadByIDMedia(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
// Request raw blob
|
||||
req := NewRequest(t, "GET", "/user2/repo1/media/blob/4b4851ad51df6a7d9f25c979345979eaeb5b349f")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
assert.Equal(t, "# repo1\n\nDescription for repo1", resp.Body.String())
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
)
|
||||
|
||||
func TestBareRepo(t *testing.T) {
|
||||
func TestEmptyRepo(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
subpaths := []string{
|
||||
"commits/master",
|
||||
@@ -19,10 +19,10 @@ func TestBareRepo(t *testing.T) {
|
||||
"commit/1ae57b34ccf7e18373",
|
||||
"graph",
|
||||
}
|
||||
bareRepo := models.AssertExistsAndLoadBean(t, &models.Repository{}, models.Cond("is_bare = ?", true)).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: bareRepo.OwnerID}).(*models.User)
|
||||
emptyRepo := models.AssertExistsAndLoadBean(t, &models.Repository{}, models.Cond("is_empty = ?", true)).(*models.Repository)
|
||||
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: emptyRepo.OwnerID}).(*models.User)
|
||||
for _, subpath := range subpaths {
|
||||
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, bareRepo.Name, subpath)
|
||||
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath)
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
}
|
||||
}
|
127
integrations/git_helper_for_declarative_test.go
Normal file
127
integrations/git_helper_for_declarative_test.go
Normal file
@@ -0,0 +1,127 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/git"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/ssh"
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func withKeyFile(t *testing.T, keyname string, callback func(string)) {
|
||||
keyFile := filepath.Join(setting.AppDataPath, keyname)
|
||||
err := ssh.GenKeyPair(keyFile)
|
||||
assert.NoError(t, err)
|
||||
|
||||
//Setup ssh wrapper
|
||||
os.Setenv("GIT_SSH_COMMAND",
|
||||
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "+
|
||||
filepath.Join(setting.AppWorkPath, keyFile))
|
||||
os.Setenv("GIT_SSH_VARIANT", "ssh")
|
||||
|
||||
callback(keyFile)
|
||||
|
||||
defer os.RemoveAll(keyFile)
|
||||
defer os.RemoveAll(keyFile + ".pub")
|
||||
}
|
||||
|
||||
func createSSHUrl(gitPath string, u *url.URL) *url.URL {
|
||||
u2 := *u
|
||||
u2.Scheme = "ssh"
|
||||
u2.User = url.User("git")
|
||||
u2.Host = fmt.Sprintf("%s:%d", setting.SSH.ListenHost, setting.SSH.ListenPort)
|
||||
u2.Path = gitPath
|
||||
return &u2
|
||||
}
|
||||
|
||||
func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL)) {
|
||||
prepareTestEnv(t)
|
||||
s := http.Server{
|
||||
Handler: mac,
|
||||
}
|
||||
|
||||
u, err := url.Parse(setting.AppURL)
|
||||
assert.NoError(t, err)
|
||||
listener, err := net.Listen("tcp", u.Host)
|
||||
assert.NoError(t, err)
|
||||
|
||||
defer func() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||
s.Shutdown(ctx)
|
||||
cancel()
|
||||
}()
|
||||
|
||||
go s.Serve(listener)
|
||||
//Started by config go ssh.Listen(setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs)
|
||||
|
||||
callback(t, u)
|
||||
}
|
||||
|
||||
func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
assert.NoError(t, git.Clone(u.String(), dstLocalPath, git.CloneRepoOptions{}))
|
||||
assert.True(t, com.IsExist(filepath.Join(dstLocalPath, "README.md")))
|
||||
}
|
||||
}
|
||||
|
||||
func doGitCloneFail(dstLocalPath string, u *url.URL) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
assert.Error(t, git.Clone(u.String(), dstLocalPath, git.CloneRepoOptions{}))
|
||||
assert.False(t, com.IsExist(filepath.Join(dstLocalPath, "README.md")))
|
||||
}
|
||||
}
|
||||
|
||||
func doGitInitTestRepository(dstPath string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
// Init repository in dstPath
|
||||
assert.NoError(t, git.InitRepository(dstPath, false))
|
||||
assert.NoError(t, ioutil.WriteFile(filepath.Join(dstPath, "README.md"), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s", dstPath)), 0644))
|
||||
assert.NoError(t, git.AddChanges(dstPath, true))
|
||||
signature := git.Signature{
|
||||
Email: "test@example.com",
|
||||
Name: "test",
|
||||
When: time.Now(),
|
||||
}
|
||||
assert.NoError(t, git.CommitChanges(dstPath, git.CommitChangesOptions{
|
||||
Committer: &signature,
|
||||
Author: &signature,
|
||||
Message: "Initial Commit",
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
func doGitAddRemote(dstPath, remoteName string, u *url.URL) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
_, err := git.NewCommand("remote", "add", remoteName, u.String()).RunInDir(dstPath)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
func doGitPushTestRepository(dstPath, remoteName, branch string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
_, err := git.NewCommand("push", "-u", remoteName, branch).RunInDir(dstPath)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
func doGitPushTestRepositoryFail(dstPath, remoteName, branch string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
_, err := git.NewCommand("push", "-u", remoteName, branch).RunInDir(dstPath)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
}
|
@@ -5,25 +5,20 @@
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/git"
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -32,167 +27,140 @@ const (
|
||||
bigSize = 128 * 1024 * 1024 //128Mo
|
||||
)
|
||||
|
||||
func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL)) {
|
||||
prepareTestEnv(t)
|
||||
s := http.Server{
|
||||
Handler: mac,
|
||||
}
|
||||
|
||||
u, err := url.Parse(setting.AppURL)
|
||||
assert.NoError(t, err)
|
||||
listener, err := net.Listen("tcp", u.Host)
|
||||
assert.NoError(t, err)
|
||||
|
||||
defer func() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||
s.Shutdown(ctx)
|
||||
cancel()
|
||||
}()
|
||||
|
||||
go s.Serve(listener)
|
||||
//Started by config go ssh.Listen(setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs)
|
||||
|
||||
callback(t, u)
|
||||
func TestGit(t *testing.T) {
|
||||
onGiteaRun(t, testGit)
|
||||
}
|
||||
|
||||
func TestGit(t *testing.T) {
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
u.Path = "user2/repo1.git"
|
||||
func testGit(t *testing.T, u *url.URL) {
|
||||
username := "user2"
|
||||
baseAPITestContext := NewAPITestContext(t, username, "repo1")
|
||||
|
||||
t.Run("HTTP", func(t *testing.T) {
|
||||
dstPath, err := ioutil.TempDir("", "repo-tmp-17")
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
t.Run("Standard", func(t *testing.T) {
|
||||
t.Run("CloneNoLogin", func(t *testing.T) {
|
||||
dstLocalPath, err := ioutil.TempDir("", "repo1")
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstLocalPath)
|
||||
err = git.Clone(u.String(), dstLocalPath, git.CloneRepoOptions{})
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, com.IsExist(filepath.Join(dstLocalPath, "README.md")))
|
||||
})
|
||||
u.Path = baseAPITestContext.GitPath()
|
||||
|
||||
t.Run("CreateRepo", func(t *testing.T) {
|
||||
session := loginUser(t, "user2")
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
req := NewRequestWithJSON(t, "POST", "/api/v1/user/repos?token="+token, &api.CreateRepoOption{
|
||||
AutoInit: true,
|
||||
Description: "Temporary repo",
|
||||
Name: "repo-tmp-17",
|
||||
Private: false,
|
||||
Gitignores: "",
|
||||
License: "WTFPL",
|
||||
Readme: "Default",
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusCreated)
|
||||
})
|
||||
t.Run("HTTP", func(t *testing.T) {
|
||||
httpContext := baseAPITestContext
|
||||
httpContext.Reponame = "repo-tmp-17"
|
||||
|
||||
u.Path = "user2/repo-tmp-17.git"
|
||||
u.User = url.UserPassword("user2", userPassword)
|
||||
t.Run("Clone", func(t *testing.T) {
|
||||
err = git.Clone(u.String(), dstPath, git.CloneRepoOptions{})
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, com.IsExist(filepath.Join(dstPath, "README.md")))
|
||||
})
|
||||
dstPath, err := ioutil.TempDir("", httpContext.Reponame)
|
||||
var little, big, littleLFS, bigLFS string
|
||||
|
||||
t.Run("PushCommit", func(t *testing.T) {
|
||||
t.Run("Little", func(t *testing.T) {
|
||||
commitAndPush(t, littleSize, dstPath)
|
||||
})
|
||||
t.Run("Big", func(t *testing.T) {
|
||||
commitAndPush(t, bigSize, dstPath)
|
||||
})
|
||||
})
|
||||
})
|
||||
t.Run("LFS", func(t *testing.T) {
|
||||
t.Run("PushCommit", func(t *testing.T) {
|
||||
//Setup git LFS
|
||||
_, err = git.NewCommand("lfs").AddArguments("install").RunInDir(dstPath)
|
||||
assert.NoError(t, err)
|
||||
_, err = git.NewCommand("lfs").AddArguments("track", "data-file-*").RunInDir(dstPath)
|
||||
assert.NoError(t, err)
|
||||
err = git.AddChanges(dstPath, false, ".gitattributes")
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
t.Run("Standard", func(t *testing.T) {
|
||||
ensureAnonymousClone(t, u)
|
||||
|
||||
t.Run("Little", func(t *testing.T) {
|
||||
commitAndPush(t, littleSize, dstPath)
|
||||
})
|
||||
t.Run("Big", func(t *testing.T) {
|
||||
commitAndPush(t, bigSize, dstPath)
|
||||
})
|
||||
t.Run("CreateRepo", doAPICreateRepository(httpContext, false))
|
||||
|
||||
u.Path = httpContext.GitPath()
|
||||
u.User = url.UserPassword(username, userPassword)
|
||||
|
||||
t.Run("Clone", doGitClone(dstPath, u))
|
||||
|
||||
t.Run("PushCommit", func(t *testing.T) {
|
||||
t.Run("Little", func(t *testing.T) {
|
||||
little = commitAndPush(t, littleSize, dstPath)
|
||||
})
|
||||
t.Run("Locks", func(t *testing.T) {
|
||||
lockTest(t, u.String(), dstPath)
|
||||
t.Run("Big", func(t *testing.T) {
|
||||
big = commitAndPush(t, bigSize, dstPath)
|
||||
})
|
||||
})
|
||||
})
|
||||
t.Run("SSH", func(t *testing.T) {
|
||||
//Setup remote link
|
||||
u.Scheme = "ssh"
|
||||
u.User = url.User("git")
|
||||
u.Host = fmt.Sprintf("%s:%d", setting.SSH.ListenHost, setting.SSH.ListenPort)
|
||||
u.Path = "user2/repo-tmp-18.git"
|
||||
t.Run("LFS", func(t *testing.T) {
|
||||
t.Run("PushCommit", func(t *testing.T) {
|
||||
//Setup git LFS
|
||||
_, err = git.NewCommand("lfs").AddArguments("install").RunInDir(dstPath)
|
||||
assert.NoError(t, err)
|
||||
_, err = git.NewCommand("lfs").AddArguments("track", "data-file-*").RunInDir(dstPath)
|
||||
assert.NoError(t, err)
|
||||
err = git.AddChanges(dstPath, false, ".gitattributes")
|
||||
assert.NoError(t, err)
|
||||
|
||||
//Setup key
|
||||
keyFile := filepath.Join(setting.AppDataPath, "my-testing-key")
|
||||
err := exec.Command("ssh-keygen", "-f", keyFile, "-t", "rsa", "-N", "").Run()
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(keyFile)
|
||||
defer os.RemoveAll(keyFile + ".pub")
|
||||
|
||||
session := loginUser(t, "user1")
|
||||
keyOwner := models.AssertExistsAndLoadBean(t, &models.User{Name: "user2"}).(*models.User)
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
urlStr := fmt.Sprintf("/api/v1/admin/users/%s/keys?token=%s", keyOwner.Name, token)
|
||||
|
||||
dataPubKey, err := ioutil.ReadFile(keyFile + ".pub")
|
||||
assert.NoError(t, err)
|
||||
req := NewRequestWithValues(t, "POST", urlStr, map[string]string{
|
||||
"key": string(dataPubKey),
|
||||
"title": "test-key",
|
||||
t.Run("Little", func(t *testing.T) {
|
||||
littleLFS = commitAndPush(t, littleSize, dstPath)
|
||||
})
|
||||
t.Run("Big", func(t *testing.T) {
|
||||
bigLFS = commitAndPush(t, bigSize, dstPath)
|
||||
})
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusCreated)
|
||||
t.Run("Locks", func(t *testing.T) {
|
||||
lockTest(t, u.String(), dstPath)
|
||||
})
|
||||
})
|
||||
t.Run("Raw", func(t *testing.T) {
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
//Setup ssh wrapper
|
||||
os.Setenv("GIT_SSH_COMMAND",
|
||||
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i "+
|
||||
filepath.Join(setting.AppWorkPath, keyFile))
|
||||
os.Setenv("GIT_SSH_VARIANT", "ssh")
|
||||
// Request raw paths
|
||||
req := NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/raw/branch/master/", little))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Equal(t, littleSize, resp.Body.Len())
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/raw/branch/master/", big))
|
||||
nilResp := session.MakeRequestNilResponseRecorder(t, req, http.StatusOK)
|
||||
assert.Equal(t, bigSize, nilResp.Length)
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/raw/branch/master/", littleLFS))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.NotEqual(t, littleSize, resp.Body.Len())
|
||||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/raw/branch/master/", bigLFS))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.NotEqual(t, bigSize, resp.Body.Len())
|
||||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
|
||||
|
||||
})
|
||||
t.Run("Media", func(t *testing.T) {
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
// Request media paths
|
||||
req := NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/media/branch/master/", little))
|
||||
resp := session.MakeRequestNilResponseRecorder(t, req, http.StatusOK)
|
||||
assert.Equal(t, littleSize, resp.Length)
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/media/branch/master/", big))
|
||||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK)
|
||||
assert.Equal(t, bigSize, resp.Length)
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/media/branch/master/", littleLFS))
|
||||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK)
|
||||
assert.Equal(t, littleSize, resp.Length)
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-17/media/branch/master/", bigLFS))
|
||||
resp = session.MakeRequestNilResponseRecorder(t, req, http.StatusOK)
|
||||
assert.Equal(t, bigSize, resp.Length)
|
||||
})
|
||||
|
||||
})
|
||||
t.Run("SSH", func(t *testing.T) {
|
||||
sshContext := baseAPITestContext
|
||||
sshContext.Reponame = "repo-tmp-18"
|
||||
keyname := "my-testing-key"
|
||||
//Setup key the user ssh key
|
||||
withKeyFile(t, keyname, func(keyFile string) {
|
||||
t.Run("CreateUserKey", doAPICreateUserKey(sshContext, "test-key", keyFile))
|
||||
|
||||
//Setup remote link
|
||||
sshURL := createSSHUrl(sshContext.GitPath(), u)
|
||||
|
||||
//Setup clone folder
|
||||
dstPath, err := ioutil.TempDir("", "repo-tmp-18")
|
||||
dstPath, err := ioutil.TempDir("", sshContext.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
var little, big, littleLFS, bigLFS string
|
||||
|
||||
t.Run("Standard", func(t *testing.T) {
|
||||
t.Run("CreateRepo", func(t *testing.T) {
|
||||
session := loginUser(t, "user2")
|
||||
token := getTokenForLoggedInUser(t, session)
|
||||
req := NewRequestWithJSON(t, "POST", "/api/v1/user/repos?token="+token, &api.CreateRepoOption{
|
||||
AutoInit: true,
|
||||
Description: "Temporary repo",
|
||||
Name: "repo-tmp-18",
|
||||
Private: false,
|
||||
Gitignores: "",
|
||||
License: "WTFPL",
|
||||
Readme: "Default",
|
||||
})
|
||||
session.MakeRequest(t, req, http.StatusCreated)
|
||||
})
|
||||
t.Run("CreateRepo", doAPICreateRepository(sshContext, false))
|
||||
|
||||
//TODO get url from api
|
||||
t.Run("Clone", func(t *testing.T) {
|
||||
_, err = git.NewCommand("clone").AddArguments(u.String(), dstPath).Run()
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, com.IsExist(filepath.Join(dstPath, "README.md")))
|
||||
})
|
||||
t.Run("Clone", doGitClone(dstPath, sshURL))
|
||||
|
||||
//time.Sleep(5 * time.Minute)
|
||||
t.Run("PushCommit", func(t *testing.T) {
|
||||
t.Run("Little", func(t *testing.T) {
|
||||
commitAndPush(t, littleSize, dstPath)
|
||||
little = commitAndPush(t, littleSize, dstPath)
|
||||
})
|
||||
t.Run("Big", func(t *testing.T) {
|
||||
commitAndPush(t, bigSize, dstPath)
|
||||
big = commitAndPush(t, bigSize, dstPath)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -207,20 +175,73 @@ func TestGit(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Run("Little", func(t *testing.T) {
|
||||
commitAndPush(t, littleSize, dstPath)
|
||||
littleLFS = commitAndPush(t, littleSize, dstPath)
|
||||
})
|
||||
t.Run("Big", func(t *testing.T) {
|
||||
commitAndPush(t, bigSize, dstPath)
|
||||
bigLFS = commitAndPush(t, bigSize, dstPath)
|
||||
})
|
||||
})
|
||||
t.Run("Locks", func(t *testing.T) {
|
||||
lockTest(t, u.String(), dstPath)
|
||||
})
|
||||
})
|
||||
t.Run("Raw", func(t *testing.T) {
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
// Request raw paths
|
||||
req := NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/raw/branch/master/", little))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Equal(t, littleSize, resp.Body.Len())
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/raw/branch/master/", big))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Equal(t, bigSize, resp.Body.Len())
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/raw/branch/master/", littleLFS))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.NotEqual(t, littleSize, resp.Body.Len())
|
||||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/raw/branch/master/", bigLFS))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.NotEqual(t, bigSize, resp.Body.Len())
|
||||
assert.Contains(t, resp.Body.String(), models.LFSMetaFileIdentifier)
|
||||
|
||||
})
|
||||
t.Run("Media", func(t *testing.T) {
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
// Request media paths
|
||||
req := NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/media/branch/master/", little))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Equal(t, littleSize, resp.Body.Len())
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/media/branch/master/", big))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Equal(t, bigSize, resp.Body.Len())
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/media/branch/master/", littleLFS))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Equal(t, littleSize, resp.Body.Len())
|
||||
|
||||
req = NewRequest(t, "GET", path.Join("/user2/repo-tmp-18/media/branch/master/", bigLFS))
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Equal(t, bigSize, resp.Body.Len())
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
func ensureAnonymousClone(t *testing.T, u *url.URL) {
|
||||
dstLocalPath, err := ioutil.TempDir("", "repo1")
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstLocalPath)
|
||||
t.Run("CloneAnonymous", doGitClone(dstLocalPath, u))
|
||||
|
||||
}
|
||||
|
||||
func lockTest(t *testing.T, remote, repoPath string) {
|
||||
_, err := git.NewCommand("remote").AddArguments("set-url", "origin", remote).RunInDir(repoPath) //TODO add test ssh git-lfs-creds
|
||||
assert.NoError(t, err)
|
||||
@@ -234,34 +255,35 @@ func lockTest(t *testing.T, remote, repoPath string) {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func commitAndPush(t *testing.T, size int, repoPath string) {
|
||||
err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two")
|
||||
func commitAndPush(t *testing.T, size int, repoPath string) string {
|
||||
name, err := generateCommitWithNewData(size, repoPath, "user2@example.com", "User Two")
|
||||
assert.NoError(t, err)
|
||||
_, err = git.NewCommand("push").RunInDir(repoPath) //Push
|
||||
assert.NoError(t, err)
|
||||
return name
|
||||
}
|
||||
|
||||
func generateCommitWithNewData(size int, repoPath, email, fullName string) error {
|
||||
func generateCommitWithNewData(size int, repoPath, email, fullName string) (string, error) {
|
||||
//Generate random file
|
||||
data := make([]byte, size)
|
||||
_, err := rand.Read(data)
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
tmpFile, err := ioutil.TempFile(repoPath, "data-file-")
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
defer tmpFile.Close()
|
||||
_, err = tmpFile.Write(data)
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
//Commit
|
||||
err = git.AddChanges(repoPath, false, filepath.Base(tmpFile.Name()))
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
err = git.CommitChanges(repoPath, git.CommitChangesOptions{
|
||||
Committer: &git.Signature{
|
||||
@@ -276,5 +298,5 @@ func generateCommitWithNewData(size int, repoPath, email, fullName string) error
|
||||
},
|
||||
Message: fmt.Sprintf("Testing commit @ %v", time.Now()),
|
||||
})
|
||||
return err
|
||||
return filepath.Base(tmpFile.Name()), err
|
||||
}
|
||||
|
@@ -0,0 +1,2 @@
|
||||
x<01><><EFBFBD>m<EFBFBD> D<>M<15><>Y<EFBFBD><59><1A><>(<28>J<01>`<60>5<EFBFBD>ɜ-<2D>K*Ki,Hi!?<3F><><<3C>i<EFBFBD>Vki0Z<30><5A>XH<58>D(Z6ĨG<C4A8>Sb<53><62>3<EFBFBD>JD<4A>h<EFBFBD><68>!<21>uB<1D><>DaJp<> <09><><02><>F<EFBFBD>Lƹ4+~<7E><>v<EFBFBD>;<3B><><EFBFBD>
|
||||
e<><65><EFBFBD><EFBFBD><EFBFBD>[Nx>K<><4B><1C><><EFBFBD>_s<5F><73>q<>/<2F>]09MHpѤ<70><D1A4>k<EFBFBD><6B><EFBFBD>_d<5F>-%<25>풇۞<ED9287><DB9E> v<>_<>]<5D><>^<5E>/<2F>I[t
|
Binary file not shown.
@@ -0,0 +1 @@
|
||||
x<15>M<0E>@<0C><><EFBFBD>M<><19><17><08>r<EFBFBD><EFBFBD>6<EFBFBD><36>&&&<26><>9Le<4C>św<C59B><77><EFBFBD><EFBFBD>t<#<23><><EFBFBD>͡<>mv-<2D><>0w<30>b<EFBFBD><62>jy̖<79><CC96>ڗ~[<5B><><EFBFBD><EFBFBD><EFBFBD>=H<15><0C>.<2E>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǁ=
|
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
x<01><><EFBFBD>m<EFBFBD>0<10><><EFBFBD>)n<><06><>t2<14>S<07><04><><EFBFBD>`ņ<><C586><EFBFBD>e<EFBFBD>,VY<>/H<>#<23>[)<29><>E<EFBFBD><45>@N<>q<EFBFBD><71>툎<EFBFBD>r2<19>)D<><03>0<EFBFBD><30>j<EFBFBD>C<EFBFBD><1D><>L<07><>aC<61><43>&<26>4B<34>v]$E<><45><EFBFBD><1D>Iӑe<D391><65><EFBFBD><EFBFBD>P<EFBFBD>r<EFBFBD>I<EFBFBD>s<EFBFBD>e<EFBFBD>z<EFBFBD>˳~_
|
||||
<EFBFBD><EFBFBD><EFBFBD>[y<03><><EFBFBD><EFBFBD>v<EFBFBD><76>W<EFBFBD><57>V=헛<>˘<EFBFBD>H vZ~s<>@݉%<25><><EFBFBD><EFBFBD>?T<>ZH
|
Binary file not shown.
@@ -1 +1 @@
|
||||
2c54faec6c45d31c1abfaecdab471eac6633738a
|
||||
0cf15c3f66ec8384480ed9c3cf87c9e97fbb0ec3
|
||||
|
@@ -35,6 +35,23 @@ import (
|
||||
|
||||
var mac *macaron.Macaron
|
||||
|
||||
type NilResponseRecorder struct {
|
||||
httptest.ResponseRecorder
|
||||
Length int
|
||||
}
|
||||
|
||||
func (n *NilResponseRecorder) Write(b []byte) (int, error) {
|
||||
n.Length = n.Length + len(b)
|
||||
return len(b), nil
|
||||
}
|
||||
|
||||
// NewRecorder returns an initialized ResponseRecorder.
|
||||
func NewNilResponseRecorder() *NilResponseRecorder {
|
||||
return &NilResponseRecorder{
|
||||
ResponseRecorder: *httptest.NewRecorder(),
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
initIntegrationTest()
|
||||
mac = routes.NewMacaron()
|
||||
@@ -192,6 +209,22 @@ func (s *TestSession) MakeRequest(t testing.TB, req *http.Request, expectedStatu
|
||||
return resp
|
||||
}
|
||||
|
||||
func (s *TestSession) MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseRecorder {
|
||||
baseURL, err := url.Parse(setting.AppURL)
|
||||
assert.NoError(t, err)
|
||||
for _, c := range s.jar.Cookies(baseURL) {
|
||||
req.AddCookie(c)
|
||||
}
|
||||
resp := MakeRequestNilResponseRecorder(t, req, expectedStatus)
|
||||
|
||||
ch := http.Header{}
|
||||
ch.Add("Cookie", strings.Join(resp.HeaderMap["Set-Cookie"], ";"))
|
||||
cr := http.Request{Header: ch}
|
||||
s.jar.SetCookies(baseURL, cr.Cookies())
|
||||
|
||||
return resp
|
||||
}
|
||||
|
||||
const userPassword = "password"
|
||||
|
||||
var loginSessionCache = make(map[string]*TestSession, 10)
|
||||
@@ -305,6 +338,18 @@ func MakeRequest(t testing.TB, req *http.Request, expectedStatus int) *httptest.
|
||||
return recorder
|
||||
}
|
||||
|
||||
func MakeRequestNilResponseRecorder(t testing.TB, req *http.Request, expectedStatus int) *NilResponseRecorder {
|
||||
recorder := NewNilResponseRecorder()
|
||||
mac.ServeHTTP(recorder, req)
|
||||
if expectedStatus != NoExpectedStatus {
|
||||
if !assert.EqualValues(t, expectedStatus, recorder.Code,
|
||||
"Request: %s %s", req.Method, req.URL.String()) {
|
||||
logUnexpectedResponse(t, &recorder.ResponseRecorder)
|
||||
}
|
||||
}
|
||||
return recorder
|
||||
}
|
||||
|
||||
// logUnexpectedResponse logs the contents of an unexpected response.
|
||||
func logUnexpectedResponse(t testing.TB, recorder *httptest.ResponseRecorder) {
|
||||
respBytes := recorder.Body.Bytes()
|
||||
|
@@ -8,17 +8,17 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func assertProtectedBranch(t *testing.T, repoID int64, branchName string, isErr, canPush bool) {
|
||||
reqURL := fmt.Sprintf("/api/internal/branch/%d/%s", repoID, url.QueryEscape(branchName))
|
||||
reqURL := fmt.Sprintf("/api/internal/branch/%d/%s", repoID, util.PathEscapeSegments(branchName))
|
||||
req := NewRequest(t, "GET", reqURL)
|
||||
t.Log(reqURL)
|
||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", setting.InternalToken))
|
||||
|
129
integrations/lfs_getobject_test.go
Normal file
129
integrations/lfs_getobject_test.go
Normal file
@@ -0,0 +1,129 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/gzip"
|
||||
"code.gitea.io/gitea/modules/lfs"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
gzipp "github.com/klauspost/compress/gzip"
|
||||
)
|
||||
|
||||
func GenerateLFSOid(content io.Reader) (string, error) {
|
||||
h := sha256.New()
|
||||
if _, err := io.Copy(h, content); err != nil {
|
||||
return "", err
|
||||
}
|
||||
sum := h.Sum(nil)
|
||||
return hex.EncodeToString(sum), nil
|
||||
}
|
||||
|
||||
var lfsID = int64(20000)
|
||||
|
||||
func storeObjectInRepo(t *testing.T, repositoryID int64, content *[]byte) string {
|
||||
oid, err := GenerateLFSOid(bytes.NewReader(*content))
|
||||
assert.NoError(t, err)
|
||||
var lfsMetaObject *models.LFSMetaObject
|
||||
|
||||
if setting.UsePostgreSQL {
|
||||
lfsMetaObject = &models.LFSMetaObject{ID: lfsID, Oid: oid, Size: int64(len(*content)), RepositoryID: repositoryID}
|
||||
} else {
|
||||
lfsMetaObject = &models.LFSMetaObject{Oid: oid, Size: int64(len(*content)), RepositoryID: repositoryID}
|
||||
}
|
||||
|
||||
lfsID = lfsID + 1
|
||||
lfsMetaObject, err = models.NewLFSMetaObject(lfsMetaObject)
|
||||
assert.NoError(t, err)
|
||||
contentStore := &lfs.ContentStore{BasePath: setting.LFS.ContentPath}
|
||||
if !contentStore.Exists(lfsMetaObject) {
|
||||
err := contentStore.Put(lfsMetaObject, bytes.NewReader(*content))
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
return oid
|
||||
}
|
||||
|
||||
func doLfs(t *testing.T, content *[]byte, expectGzip bool) {
|
||||
prepareTestEnv(t)
|
||||
repo, err := models.GetRepositoryByOwnerAndName("user2", "repo1")
|
||||
assert.NoError(t, err)
|
||||
oid := storeObjectInRepo(t, repo.ID, content)
|
||||
defer repo.RemoveLFSMetaObjectByOid(oid)
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
// Request OID
|
||||
req := NewRequest(t, "GET", "/user2/repo1.git/info/lfs/objects/"+oid+"/test")
|
||||
req.Header.Set("Accept-Encoding", "gzip")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
contentEncoding := resp.Header().Get("Content-Encoding")
|
||||
if !expectGzip || !setting.EnableGzip {
|
||||
assert.NotContains(t, contentEncoding, "gzip")
|
||||
|
||||
result := resp.Body.Bytes()
|
||||
assert.Equal(t, *content, result)
|
||||
} else {
|
||||
assert.Contains(t, contentEncoding, "gzip")
|
||||
gzippReader, err := gzipp.NewReader(resp.Body)
|
||||
assert.NoError(t, err)
|
||||
result, err := ioutil.ReadAll(gzippReader)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, *content, result)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestGetLFSSmall(t *testing.T) {
|
||||
content := []byte("A very small file\n")
|
||||
doLfs(t, &content, false)
|
||||
}
|
||||
|
||||
func TestGetLFSLarge(t *testing.T) {
|
||||
content := make([]byte, gzip.MinSize*10)
|
||||
for i := range content {
|
||||
content[i] = byte(i % 256)
|
||||
}
|
||||
doLfs(t, &content, true)
|
||||
}
|
||||
|
||||
func TestGetLFSGzip(t *testing.T) {
|
||||
b := make([]byte, gzip.MinSize*10)
|
||||
for i := range b {
|
||||
b[i] = byte(i % 256)
|
||||
}
|
||||
outputBuffer := bytes.NewBuffer([]byte{})
|
||||
gzippWriter := gzipp.NewWriter(outputBuffer)
|
||||
gzippWriter.Write(b)
|
||||
gzippWriter.Close()
|
||||
content := outputBuffer.Bytes()
|
||||
doLfs(t, &content, false)
|
||||
}
|
||||
|
||||
func TestGetLFSZip(t *testing.T) {
|
||||
b := make([]byte, gzip.MinSize*10)
|
||||
for i := range b {
|
||||
b[i] = byte(i % 256)
|
||||
}
|
||||
outputBuffer := bytes.NewBuffer([]byte{})
|
||||
zipWriter := zip.NewWriter(outputBuffer)
|
||||
fileWriter, err := zipWriter.Create("default")
|
||||
assert.NoError(t, err)
|
||||
fileWriter.Write(b)
|
||||
zipWriter.Close()
|
||||
content := outputBuffer.Bytes()
|
||||
doLfs(t, &content, false)
|
||||
}
|
BIN
integrations/migration-test/gitea-v1.5.3.mysql.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.5.3.mysql.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.5.3.postgres.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.5.3.postgres.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.5.3.sqlite3.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.5.3.sqlite3.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.6.4.mysql.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.6.4.mysql.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.6.4.postgres.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.6.4.postgres.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.6.4.sqlite3.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.6.4.sqlite3.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.7.0.mysql.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.7.0.mysql.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.7.0.postgres.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.7.0.postgres.sql.gz
Normal file
Binary file not shown.
BIN
integrations/migration-test/gitea-v1.7.0.sqlite3.sql.gz
Normal file
BIN
integrations/migration-test/gitea-v1.7.0.sqlite3.sql.gz
Normal file
Binary file not shown.
245
integrations/migration-test/migration_test.go
Normal file
245
integrations/migration-test/migration_test.go
Normal file
@@ -0,0 +1,245 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/migrations"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/go-xorm/xorm"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var currentEngine *xorm.Engine
|
||||
|
||||
func initMigrationTest() {
|
||||
giteaRoot := os.Getenv("GITEA_ROOT")
|
||||
if giteaRoot == "" {
|
||||
fmt.Println("Environment variable $GITEA_ROOT not set")
|
||||
os.Exit(1)
|
||||
}
|
||||
setting.AppPath = path.Join(giteaRoot, "gitea")
|
||||
if _, err := os.Stat(setting.AppPath); err != nil {
|
||||
fmt.Printf("Could not find gitea binary at %s\n", setting.AppPath)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
giteaConf := os.Getenv("GITEA_CONF")
|
||||
if giteaConf == "" {
|
||||
fmt.Println("Environment variable $GITEA_CONF not set")
|
||||
os.Exit(1)
|
||||
} else if !path.IsAbs(giteaConf) {
|
||||
setting.CustomConf = path.Join(giteaRoot, giteaConf)
|
||||
} else {
|
||||
setting.CustomConf = giteaConf
|
||||
}
|
||||
|
||||
setting.NewContext()
|
||||
setting.CheckLFSVersion()
|
||||
models.LoadConfigs()
|
||||
}
|
||||
|
||||
func getDialect() string {
|
||||
dialect := "sqlite"
|
||||
switch {
|
||||
case setting.UseSQLite3:
|
||||
dialect = "sqlite"
|
||||
case setting.UseMySQL:
|
||||
dialect = "mysql"
|
||||
case setting.UsePostgreSQL:
|
||||
dialect = "pgsql"
|
||||
case setting.UseMSSQL:
|
||||
dialect = "mssql"
|
||||
}
|
||||
return dialect
|
||||
}
|
||||
|
||||
func availableVersions() ([]string, error) {
|
||||
migrationsDir, err := os.Open("integrations/migration-test")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer migrationsDir.Close()
|
||||
versionRE, err := regexp.Compile("gitea-v(?P<version>.+)\\." + regexp.QuoteMeta(models.DbCfg.Type) + "\\.sql.gz")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
filenames, err := migrationsDir.Readdirnames(-1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
versions := []string{}
|
||||
for _, filename := range filenames {
|
||||
if versionRE.MatchString(filename) {
|
||||
substrings := versionRE.FindStringSubmatch(filename)
|
||||
versions = append(versions, substrings[1])
|
||||
}
|
||||
}
|
||||
sort.Strings(versions)
|
||||
return versions, nil
|
||||
}
|
||||
|
||||
func readSQLFromFile(version string) (string, error) {
|
||||
filename := fmt.Sprintf("integrations/migration-test/gitea-v%s.%s.sql.gz", version, models.DbCfg.Type)
|
||||
|
||||
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
gr, err := gzip.NewReader(file)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer gr.Close()
|
||||
|
||||
bytes, err := ioutil.ReadAll(gr)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(bytes), nil
|
||||
}
|
||||
|
||||
func restoreOldDB(t *testing.T, version string) bool {
|
||||
data, err := readSQLFromFile(version)
|
||||
assert.NoError(t, err)
|
||||
if len(data) == 0 {
|
||||
log.Printf("No db found to restore for %s version: %s\n", models.DbCfg.Type, version)
|
||||
return false
|
||||
}
|
||||
|
||||
switch {
|
||||
case setting.UseSQLite3:
|
||||
os.Remove(models.DbCfg.Path)
|
||||
err := os.MkdirAll(path.Dir(models.DbCfg.Path), os.ModePerm)
|
||||
assert.NoError(t, err)
|
||||
|
||||
db, err := sql.Open("sqlite3", fmt.Sprintf("file:%s?cache=shared&mode=rwc&_busy_timeout=%d", models.DbCfg.Path, models.DbCfg.Timeout))
|
||||
assert.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
_, err = db.Exec(data)
|
||||
assert.NoError(t, err)
|
||||
db.Close()
|
||||
|
||||
case setting.UseMySQL:
|
||||
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/",
|
||||
models.DbCfg.User, models.DbCfg.Passwd, models.DbCfg.Host))
|
||||
assert.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
_, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s", models.DbCfg.Name))
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s", models.DbCfg.Name))
|
||||
assert.NoError(t, err)
|
||||
|
||||
db, err = sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s)/%s?multiStatements=true",
|
||||
models.DbCfg.User, models.DbCfg.Passwd, models.DbCfg.Host, models.DbCfg.Name))
|
||||
assert.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
_, err = db.Exec(data)
|
||||
assert.NoError(t, err)
|
||||
db.Close()
|
||||
|
||||
case setting.UsePostgreSQL:
|
||||
db, err := sql.Open("postgres", fmt.Sprintf("postgres://%s:%s@%s/?sslmode=%s",
|
||||
models.DbCfg.User, models.DbCfg.Passwd, models.DbCfg.Host, models.DbCfg.SSLMode))
|
||||
assert.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
_, err = db.Exec(fmt.Sprintf("DROP DATABASE IF EXISTS %s", models.DbCfg.Name))
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = db.Exec(fmt.Sprintf("CREATE DATABASE %s", models.DbCfg.Name))
|
||||
assert.NoError(t, err)
|
||||
db.Close()
|
||||
|
||||
db, err = sql.Open("postgres", fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=%s",
|
||||
models.DbCfg.User, models.DbCfg.Passwd, models.DbCfg.Host, models.DbCfg.Name, models.DbCfg.SSLMode))
|
||||
assert.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
_, err = db.Exec(data)
|
||||
assert.NoError(t, err)
|
||||
db.Close()
|
||||
|
||||
case setting.UseMSSQL:
|
||||
host, port := models.ParseMSSQLHostPort(models.DbCfg.Host)
|
||||
db, err := sql.Open("mssql", fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;",
|
||||
host, port, "master", models.DbCfg.User, models.DbCfg.Passwd))
|
||||
assert.NoError(t, err)
|
||||
defer db.Close()
|
||||
|
||||
_, err = db.Exec("DROP DATABASE IF EXISTS gitea")
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = db.Exec("CREATE DATABASE gitea")
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = db.Exec(data)
|
||||
assert.NoError(t, err)
|
||||
db.Close()
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func wrappedMigrate(x *xorm.Engine) error {
|
||||
currentEngine = x
|
||||
return migrations.Migrate(x)
|
||||
}
|
||||
|
||||
func doMigrationTest(t *testing.T, version string) {
|
||||
log.Printf("Performing migration test for %s version: %s", models.DbCfg.Type, version)
|
||||
if !restoreOldDB(t, version) {
|
||||
return
|
||||
}
|
||||
|
||||
setting.NewXORMLogService(false)
|
||||
err := models.SetEngine()
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = models.NewEngine(wrappedMigrate)
|
||||
assert.NoError(t, err)
|
||||
currentEngine.Close()
|
||||
}
|
||||
|
||||
func TestMigrations(t *testing.T) {
|
||||
initMigrationTest()
|
||||
|
||||
dialect := models.DbCfg.Type
|
||||
versions, err := availableVersions()
|
||||
assert.NoError(t, err)
|
||||
|
||||
if len(versions) == 0 {
|
||||
log.Printf("No old database versions available to migration test for %s\n", dialect)
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Preparing to test %d migrations for %s\n", len(versions), dialect)
|
||||
for _, version := range versions {
|
||||
doMigrationTest(t, version)
|
||||
}
|
||||
}
|
@@ -36,7 +36,9 @@ LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w
|
||||
APP_DATA_PATH = integrations/gitea-integration-mssql/data
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
ENABLED = true
|
||||
MAILER_TYPE = dummy
|
||||
FROM = mssql-integration-test@gitea.io
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
@@ -47,6 +49,7 @@ REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
NO_REPLY_ADDRESS = noreply.example.org
|
||||
ENABLE_NOTIFY_MAIL = true
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
|
@@ -36,7 +36,9 @@ LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w
|
||||
APP_DATA_PATH = integrations/gitea-integration-mysql/data
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
ENABLED = true
|
||||
MAILER_TYPE = dummy
|
||||
FROM = mysql-integration-test@gitea.io
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
@@ -47,6 +49,7 @@ REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
NO_REPLY_ADDRESS = noreply.example.org
|
||||
ENABLE_NOTIFY_MAIL = true
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
|
72
integrations/mysql8.ini.tmpl
Normal file
72
integrations/mysql8.ini.tmpl
Normal file
@@ -0,0 +1,72 @@
|
||||
APP_NAME = Gitea: Git with a cup of tea
|
||||
RUN_MODE = prod
|
||||
|
||||
[database]
|
||||
DB_TYPE = mysql
|
||||
HOST = {{TEST_MYSQL8_HOST}}
|
||||
NAME = {{TEST_MYSQL8_DBNAME}}
|
||||
USER = {{TEST_MYSQL8_USERNAME}}
|
||||
PASSWD = {{TEST_MYSQL8_PASSWORD}}
|
||||
SSL_MODE = disable
|
||||
|
||||
[indexer]
|
||||
ISSUE_INDEXER_PATH = integrations/indexers-mysql8/issues.bleve
|
||||
REPO_INDEXER_ENABLED = true
|
||||
REPO_INDEXER_PATH = integrations/indexers-mysql8/repos.bleve
|
||||
|
||||
[repository]
|
||||
ROOT = integrations/gitea-integration-mysql8/gitea-repositories
|
||||
|
||||
[repository.local]
|
||||
LOCAL_COPY_PATH = tmp/local-repo-mysql8
|
||||
LOCAL_WIKI_PATH = tmp/local-wiki-mysql8
|
||||
|
||||
[server]
|
||||
SSH_DOMAIN = localhost
|
||||
HTTP_PORT = 3004
|
||||
ROOT_URL = http://localhost:3004/
|
||||
DISABLE_SSH = false
|
||||
SSH_LISTEN_HOST = localhost
|
||||
SSH_PORT = 2204
|
||||
START_SSH_SERVER = true
|
||||
LFS_START_SERVER = true
|
||||
LFS_CONTENT_PATH = data/lfs-mysql8
|
||||
OFFLINE_MODE = false
|
||||
LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w
|
||||
APP_DATA_PATH = integrations/gitea-integration-mysql8/data
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
ENABLE_NOTIFY_MAIL = false
|
||||
DISABLE_REGISTRATION = false
|
||||
ENABLE_CAPTCHA = false
|
||||
REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
NO_REPLY_ADDRESS = noreply.example.org
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
ENABLE_FEDERATED_AVATAR = false
|
||||
|
||||
[session]
|
||||
PROVIDER = file
|
||||
PROVIDER_CONFIG = data/sessions-mysql8
|
||||
|
||||
[log]
|
||||
MODE = console,file
|
||||
ROOT_PATH = mysql8-log
|
||||
|
||||
[log.console]
|
||||
LEVEL = Warn
|
||||
|
||||
[log.file]
|
||||
LEVEL = Debug
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
SECRET_KEY = 9pCviYTWSb
|
||||
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTU1NTE2MTh9.hhSVGOANkaKk3vfCd2jDOIww4pUk0xtg9JRde5UogyQ
|
179
integrations/oauth_test.go
Normal file
179
integrations/oauth_test.go
Normal file
@@ -0,0 +1,179 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const defaultAuthorize = "/login/oauth/authorize?client_id=da7da3ba-9a13-4167-856f-3899de0b0138&redirect_uri=a&response_type=code&state=thestate"
|
||||
|
||||
func TestNoClientID(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequest(t, "GET", "/login/oauth/authorize")
|
||||
ctx := loginUser(t, "user2")
|
||||
ctx.MakeRequest(t, req, 400)
|
||||
}
|
||||
|
||||
func TestLoginRedirect(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequest(t, "GET", "/login/oauth/authorize")
|
||||
assert.Contains(t, MakeRequest(t, req, 302).Body.String(), "/user/login")
|
||||
}
|
||||
|
||||
func TestShowAuthorize(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequest(t, "GET", defaultAuthorize)
|
||||
ctx := loginUser(t, "user4")
|
||||
resp := ctx.MakeRequest(t, req, 200)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
htmlDoc.AssertElement(t, "#authorize-app", true)
|
||||
htmlDoc.GetCSRF()
|
||||
}
|
||||
|
||||
func TestRedirectWithExistingGrant(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequest(t, "GET", defaultAuthorize)
|
||||
ctx := loginUser(t, "user1")
|
||||
resp := ctx.MakeRequest(t, req, 302)
|
||||
u, err := resp.Result().Location()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "thestate", u.Query().Get("state"))
|
||||
assert.Truef(t, len(u.Query().Get("code")) > 30, "authorization code '%s' should be longer then 30", u.Query().Get("code"))
|
||||
}
|
||||
|
||||
func TestAccessTokenExchange(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": "da7da3ba-9a13-4167-856f-3899de0b0138",
|
||||
"client_secret": "4MK8Na6R55smdCY0WuCCumZ6hjRPnGY5saWVRHHjJiA=",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
resp := MakeRequest(t, req, 200)
|
||||
type response struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
ExpiresIn int64 `json:"expires_in"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
}
|
||||
parsed := new(response)
|
||||
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
||||
assert.True(t, len(parsed.AccessToken) > 10)
|
||||
assert.True(t, len(parsed.RefreshToken) > 10)
|
||||
}
|
||||
|
||||
func TestAccessTokenExchangeWithoutPKCE(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": "da7da3ba-9a13-4167-856f-3899de0b0138",
|
||||
"client_secret": "4MK8Na6R55smdCY0WuCCumZ6hjRPnGY5saWVRHHjJiA=",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
})
|
||||
MakeRequest(t, req, 400)
|
||||
}
|
||||
|
||||
func TestAccessTokenExchangeWithInvalidCredentials(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
// invalid client id
|
||||
req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": "???",
|
||||
"client_secret": "4MK8Na6R55smdCY0WuCCumZ6hjRPnGY5saWVRHHjJiA=",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
MakeRequest(t, req, 400)
|
||||
// invalid client secret
|
||||
req = NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": "da7da3ba-9a13-4167-856f-3899de0b0138",
|
||||
"client_secret": "???",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
MakeRequest(t, req, 400)
|
||||
// invalid redirect uri
|
||||
req = NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": "da7da3ba-9a13-4167-856f-3899de0b0138",
|
||||
"client_secret": "4MK8Na6R55smdCY0WuCCumZ6hjRPnGY5saWVRHHjJiA=",
|
||||
"redirect_uri": "???",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
MakeRequest(t, req, 400)
|
||||
// invalid authorization code
|
||||
req = NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"client_id": "da7da3ba-9a13-4167-856f-3899de0b0138",
|
||||
"client_secret": "4MK8Na6R55smdCY0WuCCumZ6hjRPnGY5saWVRHHjJiA=",
|
||||
"redirect_uri": "a",
|
||||
"code": "???",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
MakeRequest(t, req, 400)
|
||||
// invalid grant_type
|
||||
req = NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "???",
|
||||
"client_id": "da7da3ba-9a13-4167-856f-3899de0b0138",
|
||||
"client_secret": "4MK8Na6R55smdCY0WuCCumZ6hjRPnGY5saWVRHHjJiA=",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
MakeRequest(t, req, 400)
|
||||
}
|
||||
|
||||
func TestAccessTokenExchangeWithBasicAuth(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
req.Header.Add("Authorization", "Basic ZGE3ZGEzYmEtOWExMy00MTY3LTg1NmYtMzg5OWRlMGIwMTM4OjRNSzhOYTZSNTVzbWRDWTBXdUNDdW1aNmhqUlBuR1k1c2FXVlJISGpKaUE9")
|
||||
resp := MakeRequest(t, req, 200)
|
||||
type response struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
ExpiresIn int64 `json:"expires_in"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
}
|
||||
parsed := new(response)
|
||||
assert.NoError(t, json.Unmarshal(resp.Body.Bytes(), parsed))
|
||||
assert.True(t, len(parsed.AccessToken) > 10)
|
||||
assert.True(t, len(parsed.RefreshToken) > 10)
|
||||
|
||||
// use wrong client_secret
|
||||
req = NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
req.Header.Add("Authorization", "Basic ZGE3ZGEzYmEtOWExMy00MTY3LTg1NmYtMzg5OWRlMGIwMTM4OmJsYWJsYQ==")
|
||||
resp = MakeRequest(t, req, 400)
|
||||
|
||||
// missing header
|
||||
req = NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{
|
||||
"grant_type": "authorization_code",
|
||||
"redirect_uri": "a",
|
||||
"code": "authcode",
|
||||
"code_verifier": "N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt", // test PKCE additionally
|
||||
})
|
||||
resp = MakeRequest(t, req, 400)
|
||||
}
|
@@ -36,7 +36,9 @@ LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w
|
||||
APP_DATA_PATH = integrations/gitea-integration-pgsql/data
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
ENABLED = true
|
||||
MAILER_TYPE = dummy
|
||||
FROM = pgsql-integration-test@gitea.io
|
||||
|
||||
[service]
|
||||
REGISTER_EMAIL_CONFIRM = false
|
||||
@@ -47,6 +49,7 @@ REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
NO_REPLY_ADDRESS = noreply.example.org
|
||||
ENABLE_NOTIFY_MAIL = true
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
|
@@ -18,9 +18,9 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch, titl
|
||||
req := NewRequest(t, "GET", path.Join(user, repo))
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// Click the little green button to create a pull
|
||||
// Click the PR button to create a pull
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
link, exists := htmlDoc.doc.Find("button.ui.green.tiny.compact.button").Parent().Attr("href")
|
||||
link, exists := htmlDoc.doc.Find("#new-pull-request").Parent().Attr("href")
|
||||
assert.True(t, exists, "The template has changed")
|
||||
if branch != "master" {
|
||||
link = strings.Replace(link, ":master", ":"+branch, 1)
|
||||
|
@@ -112,7 +112,7 @@ func TestCreateReleasePaging(t *testing.T) {
|
||||
|
||||
checkLatestReleaseAndCount(t, session, "/user2/repo1", "v0.0.12", i18n.Tr("en", "repo.release.draft"), 10)
|
||||
|
||||
// Check that user3 does not see draft and still see 10 latest releases
|
||||
session2 := loginUser(t, "user3")
|
||||
// Check that user4 does not see draft and still see 10 latest releases
|
||||
session2 := loginUser(t, "user4")
|
||||
checkLatestReleaseAndCount(t, session2, "/user2/repo1", "v0.0.11", i18n.Tr("en", "repo.release.stable"), 10)
|
||||
}
|
||||
|
@@ -58,7 +58,7 @@ func TestCreateBranch(t *testing.T) {
|
||||
OldRefSubURL: "branch/master",
|
||||
NewBranch: "feature=test1",
|
||||
ExpectedStatus: http.StatusFound,
|
||||
FlashMessage: i18n.Tr("en", "form.NewBranchName") + i18n.Tr("en", "form.git_ref_name_error"),
|
||||
FlashMessage: i18n.Tr("en", "repo.branch.create_success", "feature=test1"),
|
||||
},
|
||||
{
|
||||
OldRefSubURL: "branch/master",
|
||||
|
@@ -99,3 +99,23 @@ func TestViewRepoWithSymlinks(t *testing.T) {
|
||||
assert.Equal(t, items[3], "link_hi: octicon octicon-file-symlink-file")
|
||||
assert.Equal(t, items[4], "link_link: octicon octicon-file-symlink-file")
|
||||
}
|
||||
|
||||
// TestViewAsRepoAdmin tests PR #2167
|
||||
func TestViewAsRepoAdmin(t *testing.T) {
|
||||
for user, expectedNoDescription := range map[string]bool{
|
||||
"user2": true,
|
||||
"user4": false,
|
||||
} {
|
||||
prepareTestEnv(t)
|
||||
|
||||
session := loginUser(t, user)
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1.git")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
noDescription := htmlDoc.doc.Find("#repo-desc").Children()
|
||||
|
||||
assert.Equal(t, expectedNoDescription, noDescription.HasClass("no-description"))
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ func TestSettingShowUserEmailExplore(t *testing.T) {
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
assert.Contains(t,
|
||||
htmlDoc.doc.Find(".ui.user.list").Text(),
|
||||
"user2@example.com",
|
||||
"user4@example.com",
|
||||
)
|
||||
|
||||
setting.UI.ShowUserEmail = false
|
||||
@@ -35,7 +35,7 @@ func TestSettingShowUserEmailExplore(t *testing.T) {
|
||||
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||
assert.NotContains(t,
|
||||
htmlDoc.doc.Find(".ui.user.list").Text(),
|
||||
"user2@example.com",
|
||||
"user4@example.com",
|
||||
)
|
||||
|
||||
setting.UI.ShowUserEmail = showUserEmail
|
||||
@@ -61,12 +61,23 @@ func TestSettingShowUserEmailProfile(t *testing.T) {
|
||||
req = NewRequest(t, "GET", "/user2")
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||
assert.NotContains(t,
|
||||
// Should contain since this user owns the profile page
|
||||
assert.Contains(t,
|
||||
htmlDoc.doc.Find(".user.profile").Text(),
|
||||
"user2@example.com",
|
||||
)
|
||||
|
||||
setting.UI.ShowUserEmail = showUserEmail
|
||||
|
||||
session = loginUser(t, "user4")
|
||||
req = NewRequest(t, "GET", "/user2")
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||
assert.NotContains(t,
|
||||
htmlDoc.doc.Find(".user.profile").Text(),
|
||||
"user2@example.com",
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
func TestSettingLandingPage(t *testing.T) {
|
||||
|
@@ -30,6 +30,7 @@ LFS_CONTENT_PATH = data/lfs-sqlite
|
||||
OFFLINE_MODE = false
|
||||
LFS_JWT_SECRET = Tv_MjmZuHqpIY6GFl12ebgkRAMt4RlWt0v4EHKSXO0w
|
||||
APP_DATA_PATH = integrations/gitea-integration-sqlite/data
|
||||
ENABLE_GZIP = true
|
||||
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
@@ -43,6 +44,7 @@ REQUIRE_SIGNIN_VIEW = false
|
||||
DEFAULT_KEEP_EMAIL_PRIVATE = false
|
||||
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
|
||||
NO_REPLY_ADDRESS = noreply.example.org
|
||||
ENABLE_NOTIFY_MAIL = true
|
||||
|
||||
[picture]
|
||||
DISABLE_GRAVATAR = false
|
||||
@@ -65,3 +67,8 @@ LEVEL = Debug
|
||||
INSTALL_LOCK = true
|
||||
SECRET_KEY = 9pCviYTWSb
|
||||
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0OTI3OTU5ODN9.OQkH5UmzID2XBdwQ9TAI6Jj2t1X-wElVTjbE7aoN4I8
|
||||
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
MAILER_TYPE = dummy
|
||||
FROM = sqlite-integration-test@gitea.io
|
||||
|
217
integrations/ssh_key_test.go
Normal file
217
integrations/ssh_key_test.go
Normal file
@@ -0,0 +1,217 @@
|
||||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/git"
|
||||
api "code.gitea.io/sdk/gitea"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func doCheckRepositoryEmptyStatus(ctx APITestContext, isEmpty bool) func(*testing.T) {
|
||||
return doAPIGetRepository(ctx, func(t *testing.T, repository api.Repository) {
|
||||
assert.Equal(t, isEmpty, repository.Empty)
|
||||
})
|
||||
}
|
||||
|
||||
func doAddChangesToCheckout(dstPath, filename string) func(*testing.T) {
|
||||
return func(t *testing.T) {
|
||||
assert.NoError(t, ioutil.WriteFile(filepath.Join(dstPath, filename), []byte(fmt.Sprintf("# Testing Repository\n\nOriginally created in: %s at time: %v", dstPath, time.Now())), 0644))
|
||||
assert.NoError(t, git.AddChanges(dstPath, true))
|
||||
signature := git.Signature{
|
||||
Email: "test@example.com",
|
||||
Name: "test",
|
||||
When: time.Now(),
|
||||
}
|
||||
assert.NoError(t, git.CommitChanges(dstPath, git.CommitChangesOptions{
|
||||
Committer: &signature,
|
||||
Author: &signature,
|
||||
Message: "Initial Commit",
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPushDeployKeyOnEmptyRepo(t *testing.T) {
|
||||
onGiteaRun(t, testPushDeployKeyOnEmptyRepo)
|
||||
}
|
||||
|
||||
func testPushDeployKeyOnEmptyRepo(t *testing.T, u *url.URL) {
|
||||
// OK login
|
||||
ctx := NewAPITestContext(t, "user2", "deploy-key-empty-repo-1")
|
||||
keyname := fmt.Sprintf("%s-push", ctx.Reponame)
|
||||
u.Path = ctx.GitPath()
|
||||
|
||||
t.Run("CreateEmptyRepository", doAPICreateRepository(ctx, true))
|
||||
|
||||
t.Run("CheckIsEmpty", doCheckRepositoryEmptyStatus(ctx, true))
|
||||
|
||||
withKeyFile(t, keyname, func(keyFile string) {
|
||||
t.Run("CreatePushDeployKey", doAPICreateDeployKey(ctx, keyname, keyFile, false))
|
||||
|
||||
// Setup the testing repository
|
||||
dstPath, err := ioutil.TempDir("", "repo-tmp-deploy-key-empty-repo-1")
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
|
||||
t.Run("InitTestRepository", doGitInitTestRepository(dstPath))
|
||||
|
||||
//Setup remote link
|
||||
sshURL := createSSHUrl(ctx.GitPath(), u)
|
||||
|
||||
t.Run("AddRemote", doGitAddRemote(dstPath, "origin", sshURL))
|
||||
|
||||
t.Run("SSHPushTestRepository", doGitPushTestRepository(dstPath, "origin", "master"))
|
||||
|
||||
t.Run("CheckIsNotEmpty", doCheckRepositoryEmptyStatus(ctx, false))
|
||||
|
||||
t.Run("DeleteRepository", doAPIDeleteRepository(ctx))
|
||||
})
|
||||
}
|
||||
|
||||
func TestKeyOnlyOneType(t *testing.T) {
|
||||
onGiteaRun(t, testKeyOnlyOneType)
|
||||
}
|
||||
|
||||
func testKeyOnlyOneType(t *testing.T, u *url.URL) {
|
||||
// Once a key is a user key we cannot use it as a deploy key
|
||||
// If we delete it from the user we should be able to use it as a deploy key
|
||||
reponame := "ssh-key-test-repo"
|
||||
username := "user2"
|
||||
u.Path = fmt.Sprintf("%s/%s.git", username, reponame)
|
||||
keyname := fmt.Sprintf("%s-push", reponame)
|
||||
|
||||
// OK login
|
||||
ctx := NewAPITestContext(t, username, reponame)
|
||||
|
||||
otherCtx := ctx
|
||||
otherCtx.Reponame = "ssh-key-test-repo-2"
|
||||
|
||||
failCtx := ctx
|
||||
failCtx.ExpectedCode = http.StatusUnprocessableEntity
|
||||
|
||||
t.Run("CreateRepository", doAPICreateRepository(ctx, false))
|
||||
t.Run("CreateOtherRepository", doAPICreateRepository(otherCtx, false))
|
||||
|
||||
withKeyFile(t, keyname, func(keyFile string) {
|
||||
var userKeyPublicKeyID int64
|
||||
t.Run("KeyCanOnlyBeUser", func(t *testing.T) {
|
||||
dstPath, err := ioutil.TempDir("", ctx.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
|
||||
sshURL := createSSHUrl(ctx.GitPath(), u)
|
||||
|
||||
t.Run("FailToClone", doGitCloneFail(dstPath, sshURL))
|
||||
|
||||
t.Run("CreateUserKey", doAPICreateUserKey(ctx, keyname, keyFile, func(t *testing.T, publicKey api.PublicKey) {
|
||||
userKeyPublicKeyID = publicKey.ID
|
||||
}))
|
||||
|
||||
t.Run("FailToAddReadOnlyDeployKey", doAPICreateDeployKey(failCtx, keyname, keyFile, true))
|
||||
|
||||
t.Run("FailToAddDeployKey", doAPICreateDeployKey(failCtx, keyname, keyFile, false))
|
||||
|
||||
t.Run("Clone", doGitClone(dstPath, sshURL))
|
||||
|
||||
t.Run("AddChanges", doAddChangesToCheckout(dstPath, "CHANGES1.md"))
|
||||
|
||||
t.Run("Push", doGitPushTestRepository(dstPath, "origin", "master"))
|
||||
|
||||
t.Run("DeleteUserKey", doAPIDeleteUserKey(ctx, userKeyPublicKeyID))
|
||||
})
|
||||
|
||||
t.Run("KeyCanBeAnyDeployButNotUserAswell", func(t *testing.T) {
|
||||
dstPath, err := ioutil.TempDir("", ctx.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
|
||||
sshURL := createSSHUrl(ctx.GitPath(), u)
|
||||
|
||||
t.Run("FailToClone", doGitCloneFail(dstPath, sshURL))
|
||||
|
||||
// Should now be able to add...
|
||||
t.Run("AddReadOnlyDeployKey", doAPICreateDeployKey(ctx, keyname, keyFile, true))
|
||||
|
||||
t.Run("Clone", doGitClone(dstPath, sshURL))
|
||||
|
||||
t.Run("AddChanges", doAddChangesToCheckout(dstPath, "CHANGES2.md"))
|
||||
|
||||
t.Run("FailToPush", doGitPushTestRepositoryFail(dstPath, "origin", "master"))
|
||||
|
||||
otherSSHURL := createSSHUrl(otherCtx.GitPath(), u)
|
||||
dstOtherPath, err := ioutil.TempDir("", otherCtx.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstOtherPath)
|
||||
|
||||
t.Run("AddWriterDeployKeyToOther", doAPICreateDeployKey(otherCtx, keyname, keyFile, false))
|
||||
|
||||
t.Run("CloneOther", doGitClone(dstOtherPath, otherSSHURL))
|
||||
|
||||
t.Run("AddChangesToOther", doAddChangesToCheckout(dstOtherPath, "CHANGES3.md"))
|
||||
|
||||
t.Run("PushToOther", doGitPushTestRepository(dstOtherPath, "origin", "master"))
|
||||
|
||||
t.Run("FailToCreateUserKey", doAPICreateUserKey(failCtx, keyname, keyFile))
|
||||
})
|
||||
|
||||
t.Run("DeleteRepositoryShouldReleaseKey", func(t *testing.T) {
|
||||
otherSSHURL := createSSHUrl(otherCtx.GitPath(), u)
|
||||
dstOtherPath, err := ioutil.TempDir("", otherCtx.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstOtherPath)
|
||||
|
||||
t.Run("DeleteRepository", doAPIDeleteRepository(ctx))
|
||||
|
||||
t.Run("FailToCreateUserKeyAsStillDeploy", doAPICreateUserKey(failCtx, keyname, keyFile))
|
||||
|
||||
t.Run("MakeSureCloneOtherStillWorks", doGitClone(dstOtherPath, otherSSHURL))
|
||||
|
||||
t.Run("AddChangesToOther", doAddChangesToCheckout(dstOtherPath, "CHANGES3.md"))
|
||||
|
||||
t.Run("PushToOther", doGitPushTestRepository(dstOtherPath, "origin", "master"))
|
||||
|
||||
t.Run("DeleteOtherRepository", doAPIDeleteRepository(otherCtx))
|
||||
|
||||
t.Run("RecreateRepository", doAPICreateRepository(ctx, false))
|
||||
|
||||
t.Run("CreateUserKey", doAPICreateUserKey(ctx, keyname, keyFile, func(t *testing.T, publicKey api.PublicKey) {
|
||||
userKeyPublicKeyID = publicKey.ID
|
||||
}))
|
||||
|
||||
dstPath, err := ioutil.TempDir("", ctx.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
|
||||
sshURL := createSSHUrl(ctx.GitPath(), u)
|
||||
|
||||
t.Run("Clone", doGitClone(dstPath, sshURL))
|
||||
|
||||
t.Run("AddChanges", doAddChangesToCheckout(dstPath, "CHANGES1.md"))
|
||||
|
||||
t.Run("Push", doGitPushTestRepository(dstPath, "origin", "master"))
|
||||
})
|
||||
|
||||
t.Run("DeleteUserKeyShouldRemoveAbilityToClone", func(t *testing.T) {
|
||||
dstPath, err := ioutil.TempDir("", ctx.Reponame)
|
||||
assert.NoError(t, err)
|
||||
defer os.RemoveAll(dstPath)
|
||||
|
||||
sshURL := createSSHUrl(ctx.GitPath(), u)
|
||||
|
||||
t.Run("DeleteUserKey", doAPIDeleteUserKey(ctx, userKeyPublicKeyID))
|
||||
|
||||
t.Run("FailToClone", doGitCloneFail(dstPath, sshURL))
|
||||
})
|
||||
})
|
||||
}
|
@@ -47,6 +47,7 @@ func TestRenameInvalidUsername(t *testing.T) {
|
||||
"%2f..",
|
||||
"%00",
|
||||
"thisHas ASpace",
|
||||
"p<A>tho>lo<gical",
|
||||
}
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user