mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-15 12:33:45 +09:00
Compare commits
176 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
221b90d289 | ||
|
|
81f5a87eb4 | ||
|
|
8b002b429d | ||
|
|
dfd371a363 | ||
|
|
54a516e9da | ||
|
|
ac129d4b4c | ||
|
|
4d5e3b9372 | ||
|
|
1ba0baa030 | ||
|
|
28e8c691a6 | ||
|
|
f81a612eb1 | ||
|
|
ee47face12 | ||
|
|
864bdd0ac8 | ||
|
|
037a3f0d8c | ||
|
|
227c3b67e0 | ||
|
|
5c3662b902 | ||
|
|
ab54310731 | ||
|
|
b7d054e4b5 | ||
|
|
d032500687 | ||
|
|
9159964ada | ||
|
|
9369b38315 | ||
|
|
6e82d0bb7c | ||
|
|
36b9a86bd8 | ||
|
|
e627f161c2 | ||
|
|
de8127e78b | ||
|
|
f7e271ff85 | ||
|
|
186f07bbf7 | ||
|
|
45b1f4dd3b | ||
|
|
026e745b9e | ||
|
|
c334be8284 | ||
|
|
353dcc5ad4 | ||
|
|
7811027ca1 | ||
|
|
abe9c641ce | ||
|
|
052e65e63f | ||
|
|
c1a10be07e | ||
|
|
2b79d3fd52 | ||
|
|
b4460cf541 | ||
|
|
a1bc2aa05e | ||
|
|
d713cf6150 | ||
|
|
012b804a9a | ||
|
|
372b622c2b | ||
|
|
06bcdfe77a | ||
|
|
a5a3c81412 | ||
|
|
ea2c9de3c4 | ||
|
|
348a6bf70d | ||
|
|
68a3961bf1 | ||
|
|
91dadedddf | ||
|
|
32eaba1b40 | ||
|
|
582dcaa12e | ||
|
|
917ca5ded9 | ||
|
|
e595dfeec7 | ||
|
|
03cacf971e | ||
|
|
68e0c802f7 | ||
|
|
09668b2e2e | ||
|
|
04eea29ecb | ||
|
|
511be9fe6e | ||
|
|
24e64fe372 | ||
|
|
4e310133f9 | ||
|
|
491f36d32a | ||
|
|
9111d2d037 | ||
|
|
5510ed34f1 | ||
|
|
39fce5750d | ||
|
|
1f90376041 | ||
|
|
0af6542a34 | ||
|
|
69bdcf41f3 | ||
|
|
e610b0389a | ||
|
|
13ffa287b1 | ||
|
|
e5b684e567 | ||
|
|
64ed262e18 | ||
|
|
f51c8e0008 | ||
|
|
d8a59d5f12 | ||
|
|
1ddfe03131 | ||
|
|
24cf06592e | ||
|
|
0b6f7fb607 | ||
|
|
c27a3af728 | ||
|
|
12aca3ef20 | ||
|
|
2390a46d0f | ||
|
|
51b6a78791 | ||
|
|
e6f62eea70 | ||
|
|
8981f6d0fc | ||
|
|
b2b5c80cb2 | ||
|
|
77db40e084 | ||
|
|
7222bac4e3 | ||
|
|
0eb4ab4246 | ||
|
|
102dcfa3a0 | ||
|
|
614d6df2d8 | ||
|
|
345a25d016 | ||
|
|
e8a7cd4a1d | ||
|
|
6c43b9f6f6 | ||
|
|
40744f8976 | ||
|
|
9d69a4758e | ||
|
|
53747a58a0 | ||
|
|
00ba826360 | ||
|
|
9bbb4d8d6d | ||
|
|
5703a0d3e3 | ||
|
|
85bad22ff8 | ||
|
|
71d2a6a41a | ||
|
|
d1f1f1142e | ||
|
|
2cd9d6b3f9 | ||
|
|
050c38ca19 | ||
|
|
51789ba12d | ||
|
|
b0de3d08b8 | ||
|
|
2e64449de7 | ||
|
|
ec539b7a77 | ||
|
|
6fbdacb524 | ||
|
|
948f6ca029 | ||
|
|
061b68e995 | ||
|
|
734fd93f59 | ||
|
|
203fe2841d | ||
|
|
056829749e | ||
|
|
f18b8e7d8a | ||
|
|
ea00ed320d | ||
|
|
30a783879f | ||
|
|
cb3173a1e9 | ||
|
|
ffe089432f | ||
|
|
8302b95d6b | ||
|
|
6f1c95ec5b | ||
|
|
cda69a0363 | ||
|
|
4908cc9adf | ||
|
|
28ed763f55 | ||
|
|
8e89eb8f43 | ||
|
|
dfefe86045 | ||
|
|
10fcb55507 | ||
|
|
e9105ac281 | ||
|
|
e6e1cfd8e4 | ||
|
|
072997692c | ||
|
|
e9fab3ea3e | ||
|
|
e0bd6ebabd | ||
|
|
cc73f6e821 | ||
|
|
ff18c3ba65 | ||
|
|
b673edbeaf | ||
|
|
05431593ef | ||
|
|
aa4c9c3215 | ||
|
|
4e79c76ed0 | ||
|
|
3bd311c3f4 | ||
|
|
7e06e6a042 | ||
|
|
e5629d9701 | ||
|
|
4ea38bba73 | ||
|
|
25cb1fb994 | ||
|
|
e5422db5c7 | ||
|
|
3a29f6aaff | ||
|
|
99d71b2b65 | ||
|
|
783f7ccb2c | ||
|
|
3f75fbf8fe | ||
|
|
4124f8ef70 | ||
|
|
b45ea0280b | ||
|
|
031ddfcb7b | ||
|
|
d686aa0d31 | ||
|
|
037366f93f | ||
|
|
5191ab6445 | ||
|
|
bfd3eb9dbc | ||
|
|
8fa9d9dcc9 | ||
|
|
21cd5c2f3d | ||
|
|
22948048b2 | ||
|
|
fa28d0e706 | ||
|
|
3ea544d89c | ||
|
|
9cef7a4600 | ||
|
|
c207b94e0c | ||
|
|
506c70884a | ||
|
|
f64f5495af | ||
|
|
3e9fc36729 | ||
|
|
8e798ebbdf | ||
|
|
0ad5ae0dbf | ||
|
|
0cf467e9e0 | ||
|
|
5ff0f7d0ca | ||
|
|
224ee0d4e5 | ||
|
|
ee26d1c578 | ||
|
|
18093d4c9a | ||
|
|
de1d14590d | ||
|
|
0058453fd9 | ||
|
|
7679f4d51a | ||
|
|
82a8c26bbf | ||
|
|
cb113991a3 | ||
|
|
0bf07a7f61 | ||
|
|
adb5b9c061 | ||
|
|
f0c967560a | ||
|
|
1cc63ade82 |
@@ -13,42 +13,46 @@ groups:
|
|||||||
-
|
-
|
||||||
name: BREAKING
|
name: BREAKING
|
||||||
labels:
|
labels:
|
||||||
- pr/breaking
|
- kind/breaking
|
||||||
-
|
-
|
||||||
name: SECURITY
|
name: SECURITY
|
||||||
labels:
|
labels:
|
||||||
- topic/security
|
- kind/security
|
||||||
-
|
-
|
||||||
name: FEATURES
|
name: FEATURES
|
||||||
labels:
|
labels:
|
||||||
- type/feature
|
- kind/feature
|
||||||
-
|
-
|
||||||
name: API
|
name: API
|
||||||
labels:
|
labels:
|
||||||
- modifies/api
|
- kind/api
|
||||||
-
|
-
|
||||||
name: ENHANCEMENTS
|
name: ENHANCEMENTS
|
||||||
labels:
|
labels:
|
||||||
- type/enhancement
|
- kind/enhancement
|
||||||
- type/refactoring
|
- kind/refactor
|
||||||
- topic/ui
|
- kind/ui
|
||||||
-
|
-
|
||||||
name: BUGFIXES
|
name: BUGFIXES
|
||||||
labels:
|
labels:
|
||||||
- type/bug
|
- kind/bug
|
||||||
-
|
-
|
||||||
name: TESTING
|
name: TESTING
|
||||||
labels:
|
labels:
|
||||||
- type/testing
|
- kind/testing
|
||||||
|
-
|
||||||
|
name: TRANSLATION
|
||||||
|
labels:
|
||||||
|
- kind/translation
|
||||||
-
|
-
|
||||||
name: BUILD
|
name: BUILD
|
||||||
labels:
|
labels:
|
||||||
- topic/build
|
- kind/build
|
||||||
- topic/code-linting
|
- kind/lint
|
||||||
-
|
-
|
||||||
name: DOCS
|
name: DOCS
|
||||||
labels:
|
labels:
|
||||||
- type/docs
|
- kind/docs
|
||||||
-
|
-
|
||||||
name: MISC
|
name: MISC
|
||||||
default: true
|
default: true
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Gitea DevContainer",
|
|
||||||
"image": "mcr.microsoft.com/devcontainers/go:1.21-bullseye",
|
|
||||||
"features": {
|
|
||||||
// installs nodejs into container
|
|
||||||
"ghcr.io/devcontainers/features/node:1": {
|
|
||||||
"version":"20"
|
|
||||||
},
|
|
||||||
"ghcr.io/devcontainers/features/git-lfs:1.1.0": {},
|
|
||||||
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
|
|
||||||
"ghcr.io/devcontainers/features/python:1": {}
|
|
||||||
},
|
|
||||||
"customizations": {
|
|
||||||
"vscode": {
|
|
||||||
"settings": {},
|
|
||||||
// same extensions as Gitpod, should match /.gitpod.yml
|
|
||||||
"extensions": [
|
|
||||||
"editorconfig.editorconfig",
|
|
||||||
"dbaeumer.vscode-eslint",
|
|
||||||
"golang.go",
|
|
||||||
"stylelint.vscode-stylelint",
|
|
||||||
"DavidAnson.vscode-markdownlint",
|
|
||||||
"Vue.volar",
|
|
||||||
"ms-azuretools.vscode-docker",
|
|
||||||
"zixuanchen.vitest-explorer",
|
|
||||||
"qwtel.sqlite-viewer",
|
|
||||||
"GitHub.vscode-pull-request-github"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"portsAttributes": {
|
|
||||||
"3000": {
|
|
||||||
"label": "Gitea Web",
|
|
||||||
"onAutoForward": "notify"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"postCreateCommand": "make deps"
|
|
||||||
}
|
|
||||||
@@ -75,10 +75,10 @@ cpu.out
|
|||||||
/yarn.lock
|
/yarn.lock
|
||||||
/yarn-error.log
|
/yarn-error.log
|
||||||
/npm-debug.log*
|
/npm-debug.log*
|
||||||
/public/assets/js
|
/public/js
|
||||||
/public/assets/css
|
/public/css
|
||||||
/public/assets/fonts
|
/public/fonts
|
||||||
/public/assets/img/webpack
|
/public/img/webpack
|
||||||
/vendor
|
/vendor
|
||||||
/web_src/fomantic/node_modules
|
/web_src/fomantic/node_modules
|
||||||
/web_src/fomantic/build/*
|
/web_src/fomantic/build/*
|
||||||
|
|||||||
426
.drone.yml
Normal file
426
.drone.yml
Normal file
@@ -0,0 +1,426 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: release-version
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
base: /source
|
||||||
|
path: /
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: deps
|
||||||
|
temp: {}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: fetch-tags
|
||||||
|
image: docker:git
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- git fetch --tags --force
|
||||||
|
|
||||||
|
- name: deps-frontend
|
||||||
|
image: node:20
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- make deps-frontend
|
||||||
|
|
||||||
|
- name: deps-backend
|
||||||
|
image: gitea/test_env:linux-1.20-amd64
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- make deps-backend
|
||||||
|
volumes:
|
||||||
|
- name: deps
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
- name: static
|
||||||
|
image: techknowlogick/xgo:go-1.20.x
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
# Upgrade to node 20 once https://github.com/techknowlogick/xgo/issues/163 is resolved
|
||||||
|
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
|
||||||
|
- export PATH=$PATH:$GOPATH/bin
|
||||||
|
- make release
|
||||||
|
environment:
|
||||||
|
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
|
||||||
|
TAGS: bindata sqlite sqlite_unlock_notify
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
depends_on: [fetch-tags]
|
||||||
|
volumes:
|
||||||
|
- name: deps
|
||||||
|
path: /go
|
||||||
|
|
||||||
|
- name: gpg-sign
|
||||||
|
image: plugins/gpgsign:1
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
detach_sign: true
|
||||||
|
excludes:
|
||||||
|
- "dist/release/*.sha256"
|
||||||
|
files:
|
||||||
|
- "dist/release/*"
|
||||||
|
environment:
|
||||||
|
GPGSIGN_KEY:
|
||||||
|
from_secret: gpgsign_key
|
||||||
|
GPGSIGN_PASSPHRASE:
|
||||||
|
from_secret: gpgsign_passphrase
|
||||||
|
depends_on: [static]
|
||||||
|
|
||||||
|
- name: release-tag
|
||||||
|
image: woodpeckerci/plugin-s3:latest
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
acl:
|
||||||
|
from_secret: aws_s3_acl
|
||||||
|
region:
|
||||||
|
from_secret: aws_s3_region
|
||||||
|
bucket:
|
||||||
|
from_secret: aws_s3_bucket
|
||||||
|
endpoint:
|
||||||
|
from_secret: aws_s3_endpoint
|
||||||
|
path_style:
|
||||||
|
from_secret: aws_s3_path_style
|
||||||
|
source: "dist/release/*"
|
||||||
|
strip_prefix: dist/release/
|
||||||
|
target: "/gitea/${DRONE_TAG##v}"
|
||||||
|
environment:
|
||||||
|
AWS_ACCESS_KEY_ID:
|
||||||
|
from_secret: aws_access_key_id
|
||||||
|
AWS_SECRET_ACCESS_KEY:
|
||||||
|
from_secret: aws_secret_access_key
|
||||||
|
depends_on: [gpg-sign]
|
||||||
|
|
||||||
|
- name: github
|
||||||
|
image: plugins/github-release:latest
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
files:
|
||||||
|
- "dist/release/*"
|
||||||
|
file_exists: overwrite
|
||||||
|
environment:
|
||||||
|
GITHUB_TOKEN:
|
||||||
|
from_secret: github_token
|
||||||
|
depends_on: [gpg-sign]
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: docker-linux-amd64-release-version
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
include:
|
||||||
|
- "refs/tags/**"
|
||||||
|
exclude:
|
||||||
|
- "refs/tags/**-rc*"
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: fetch-tags
|
||||||
|
image: docker:git
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- git fetch --tags --force
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker:latest
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-amd64
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- name: publish-rootless
|
||||||
|
image: plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile.rootless
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-amd64-rootless
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
---
|
||||||
|
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: docker-linux-amd64-release-candidate-version
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- "refs/tags/**-rc*"
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: fetch-tags
|
||||||
|
image: docker:git
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- git fetch --tags --force
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker:latest
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
tags: ${DRONE_TAG##v}-linux-amd64
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- name: publish-rootless
|
||||||
|
image: plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile.rootless
|
||||||
|
tags: ${DRONE_TAG##v}-linux-amd64-rootless
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: docker-linux-arm64-release-version
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
include:
|
||||||
|
- "refs/tags/**"
|
||||||
|
exclude:
|
||||||
|
- "refs/tags/**-rc*"
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: fetch-tags
|
||||||
|
image: docker:git
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- git fetch --tags --force
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker:latest
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-arm64
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- name: publish-rootless
|
||||||
|
image: plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile.rootless
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-arm64-rootless
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: docker-linux-arm64-release-candidate-version
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- "refs/tags/**-rc*"
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: fetch-tags
|
||||||
|
image: docker:git
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- git fetch --tags --force
|
||||||
|
|
||||||
|
- name: publish
|
||||||
|
image: plugins/docker:latest
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
tags: ${DRONE_TAG##v}-linux-arm64
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- name: publish-rootless
|
||||||
|
image: plugins/docker:latest
|
||||||
|
settings:
|
||||||
|
dockerfile: Dockerfile.rootless
|
||||||
|
tags: ${DRONE_TAG##v}-linux-arm64-rootless
|
||||||
|
repo: gitea/gitea
|
||||||
|
build_args:
|
||||||
|
- GOPROXY=https://goproxy.io
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
environment:
|
||||||
|
PLUGIN_MIRROR:
|
||||||
|
from_secret: plugin_mirror
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: docker-manifest-version
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: manifest-rootless
|
||||||
|
image: plugins/manifest
|
||||||
|
pull: always
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
spec: docker/manifest.rootless.tmpl
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
|
||||||
|
- name: manifest
|
||||||
|
image: plugins/manifest
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
spec: docker/manifest.tmpl
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
ref:
|
||||||
|
- "refs/tags/**"
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- docker-linux-amd64-release-version
|
||||||
|
- docker-linux-amd64-release-candidate-version
|
||||||
|
- docker-linux-arm64-release-version
|
||||||
|
- docker-linux-arm64-release-candidate-version
|
||||||
@@ -11,6 +11,7 @@ parserOptions:
|
|||||||
plugins:
|
plugins:
|
||||||
- "@eslint-community/eslint-plugin-eslint-comments"
|
- "@eslint-community/eslint-plugin-eslint-comments"
|
||||||
- eslint-plugin-array-func
|
- eslint-plugin-array-func
|
||||||
|
- eslint-plugin-custom-elements
|
||||||
- eslint-plugin-import
|
- eslint-plugin-import
|
||||||
- eslint-plugin-jquery
|
- eslint-plugin-jquery
|
||||||
- eslint-plugin-no-jquery
|
- eslint-plugin-no-jquery
|
||||||
@@ -18,18 +19,16 @@ plugins:
|
|||||||
- eslint-plugin-regexp
|
- eslint-plugin-regexp
|
||||||
- eslint-plugin-sonarjs
|
- eslint-plugin-sonarjs
|
||||||
- eslint-plugin-unicorn
|
- eslint-plugin-unicorn
|
||||||
- eslint-plugin-vitest-globals
|
|
||||||
- eslint-plugin-wc
|
- eslint-plugin-wc
|
||||||
|
|
||||||
env:
|
env:
|
||||||
es2024: true
|
es2022: true
|
||||||
node: true
|
node: true
|
||||||
|
|
||||||
|
globals:
|
||||||
|
__webpack_public_path__: true
|
||||||
|
|
||||||
overrides:
|
overrides:
|
||||||
- files: ["web_src/**/*"]
|
|
||||||
globals:
|
|
||||||
__webpack_public_path__: true
|
|
||||||
process: false # https://github.com/webpack/webpack/issues/15833
|
|
||||||
- files: ["web_src/**/*", "docs/**/*"]
|
- files: ["web_src/**/*", "docs/**/*"]
|
||||||
env:
|
env:
|
||||||
browser: true
|
browser: true
|
||||||
@@ -46,12 +45,6 @@ overrides:
|
|||||||
- files: ["*.config.*"]
|
- files: ["*.config.*"]
|
||||||
rules:
|
rules:
|
||||||
import/no-unused-modules: [0]
|
import/no-unused-modules: [0]
|
||||||
- files: ["**/*.test.*", "web_src/js/test/setup.js"]
|
|
||||||
env:
|
|
||||||
vitest-globals/env: true
|
|
||||||
- files: ["web_src/js/modules/fetch.js", "web_src/js/standalone/**/*"]
|
|
||||||
rules:
|
|
||||||
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression]
|
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
"@eslint-community/eslint-comments/disable-enable-pair": [2]
|
"@eslint-community/eslint-comments/disable-enable-pair": [2]
|
||||||
@@ -91,6 +84,19 @@ rules:
|
|||||||
consistent-this: [0]
|
consistent-this: [0]
|
||||||
constructor-super: [2]
|
constructor-super: [2]
|
||||||
curly: [0]
|
curly: [0]
|
||||||
|
custom-elements/expose-class-on-global: [0]
|
||||||
|
custom-elements/extends-correct-class: [2]
|
||||||
|
custom-elements/file-name-matches-element: [2]
|
||||||
|
custom-elements/no-constructor: [2]
|
||||||
|
custom-elements/no-customized-built-in-elements: [2]
|
||||||
|
custom-elements/no-dom-traversal-in-attributechangedcallback: [2]
|
||||||
|
custom-elements/no-dom-traversal-in-connectedcallback: [2]
|
||||||
|
custom-elements/no-exports-with-element: [2]
|
||||||
|
custom-elements/no-method-prefixed-with-on: [2]
|
||||||
|
custom-elements/no-unchecked-define: [0]
|
||||||
|
custom-elements/one-element-per-file: [0]
|
||||||
|
custom-elements/tag-name-matches-class: [2]
|
||||||
|
custom-elements/valid-tag-name: [2]
|
||||||
default-case-last: [2]
|
default-case-last: [2]
|
||||||
default-case: [0]
|
default-case: [0]
|
||||||
default-param-last: [0]
|
default-param-last: [0]
|
||||||
@@ -149,7 +155,7 @@ rules:
|
|||||||
import/no-restricted-paths: [0]
|
import/no-restricted-paths: [0]
|
||||||
import/no-self-import: [2]
|
import/no-self-import: [2]
|
||||||
import/no-unassigned-import: [0]
|
import/no-unassigned-import: [0]
|
||||||
import/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$", ^vitest/]}]
|
import/no-unresolved: [2, {commonjs: true, ignore: ["\\?.+$"]}]
|
||||||
import/no-unused-modules: [2, {unusedExports: true}]
|
import/no-unused-modules: [2, {unusedExports: true}]
|
||||||
import/no-useless-path-segments: [2, {commonjs: true}]
|
import/no-useless-path-segments: [2, {commonjs: true}]
|
||||||
import/no-webpack-loader-syntax: [2]
|
import/no-webpack-loader-syntax: [2]
|
||||||
@@ -413,8 +419,9 @@ rules:
|
|||||||
no-restricted-exports: [0]
|
no-restricted-exports: [0]
|
||||||
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, self, status, statusbar, stop, toolbar, top, __dirname, __filename]
|
no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, self, status, statusbar, stop, toolbar, top, __dirname, __filename]
|
||||||
no-restricted-imports: [0]
|
no-restricted-imports: [0]
|
||||||
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement, SequenceExpression, {selector: "CallExpression[callee.name='fetch']", message: "use modules/fetch.js instead"}]
|
no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement]
|
||||||
no-return-assign: [0]
|
no-return-assign: [0]
|
||||||
|
no-return-await: [0]
|
||||||
no-script-url: [2]
|
no-script-url: [2]
|
||||||
no-self-assign: [2, {props: true}]
|
no-self-assign: [2, {props: true}]
|
||||||
no-self-compare: [2]
|
no-self-compare: [2]
|
||||||
@@ -476,7 +483,7 @@ rules:
|
|||||||
prefer-exponentiation-operator: [2]
|
prefer-exponentiation-operator: [2]
|
||||||
prefer-named-capture-group: [0]
|
prefer-named-capture-group: [0]
|
||||||
prefer-numeric-literals: [2]
|
prefer-numeric-literals: [2]
|
||||||
prefer-object-has-own: [2]
|
prefer-object-has-own: [0]
|
||||||
prefer-object-spread: [2]
|
prefer-object-spread: [2]
|
||||||
prefer-promise-reject-errors: [2, {allowEmptyReject: false}]
|
prefer-promise-reject-errors: [2, {allowEmptyReject: false}]
|
||||||
prefer-regex-literals: [2]
|
prefer-regex-literals: [2]
|
||||||
@@ -658,6 +665,7 @@ rules:
|
|||||||
unicorn/no-unnecessary-await: [2]
|
unicorn/no-unnecessary-await: [2]
|
||||||
unicorn/no-unreadable-array-destructuring: [0]
|
unicorn/no-unreadable-array-destructuring: [0]
|
||||||
unicorn/no-unreadable-iife: [2]
|
unicorn/no-unreadable-iife: [2]
|
||||||
|
unicorn/no-unsafe-regex: [0]
|
||||||
unicorn/no-unused-properties: [2]
|
unicorn/no-unused-properties: [2]
|
||||||
unicorn/no-useless-fallback-in-spread: [2]
|
unicorn/no-useless-fallback-in-spread: [2]
|
||||||
unicorn/no-useless-length-check: [2]
|
unicorn/no-useless-length-check: [2]
|
||||||
@@ -684,7 +692,7 @@ rules:
|
|||||||
unicorn/prefer-dom-node-remove: [2]
|
unicorn/prefer-dom-node-remove: [2]
|
||||||
unicorn/prefer-dom-node-text-content: [2]
|
unicorn/prefer-dom-node-text-content: [2]
|
||||||
unicorn/prefer-event-target: [2]
|
unicorn/prefer-event-target: [2]
|
||||||
unicorn/prefer-export-from: [0]
|
unicorn/prefer-export-from: [2, {ignoreUsedVariables: true}]
|
||||||
unicorn/prefer-includes: [2]
|
unicorn/prefer-includes: [2]
|
||||||
unicorn/prefer-json-parse-buffer: [0]
|
unicorn/prefer-json-parse-buffer: [0]
|
||||||
unicorn/prefer-keyboard-event-key: [2]
|
unicorn/prefer-keyboard-event-key: [2]
|
||||||
@@ -730,27 +738,14 @@ rules:
|
|||||||
valid-typeof: [2, {requireStringLiterals: true}]
|
valid-typeof: [2, {requireStringLiterals: true}]
|
||||||
vars-on-top: [0]
|
vars-on-top: [0]
|
||||||
wc/attach-shadow-constructor: [2]
|
wc/attach-shadow-constructor: [2]
|
||||||
wc/define-tag-after-class-definition: [0]
|
|
||||||
wc/expose-class-on-global: [0]
|
|
||||||
wc/file-name-matches-element: [2]
|
|
||||||
wc/guard-define-call: [0]
|
|
||||||
wc/guard-super-call: [2]
|
wc/guard-super-call: [2]
|
||||||
wc/max-elements-per-file: [0]
|
|
||||||
wc/no-child-traversal-in-attributechangedcallback: [2]
|
|
||||||
wc/no-child-traversal-in-connectedcallback: [2]
|
|
||||||
wc/no-closed-shadow-root: [2]
|
wc/no-closed-shadow-root: [2]
|
||||||
wc/no-constructor-attributes: [2]
|
wc/no-constructor-attributes: [2]
|
||||||
wc/no-constructor-params: [2]
|
wc/no-constructor-params: [2]
|
||||||
wc/no-constructor: [2]
|
wc/no-invalid-element-name: [0] # covered by custom-elements/valid-tag-name
|
||||||
wc/no-customized-built-in-elements: [2]
|
|
||||||
wc/no-exports-with-element: [2]
|
|
||||||
wc/no-invalid-element-name: [2]
|
|
||||||
wc/no-invalid-extends: [2]
|
|
||||||
wc/no-method-prefixed-with-on: [2]
|
|
||||||
wc/no-self-class: [2]
|
wc/no-self-class: [2]
|
||||||
wc/no-typos: [2]
|
wc/no-typos: [2]
|
||||||
wc/require-listener-teardown: [2]
|
wc/require-listener-teardown: [2]
|
||||||
wc/tag-name-matches-class: [2]
|
|
||||||
wrap-iife: [2, inside]
|
wrap-iife: [2, inside]
|
||||||
wrap-regex: [0]
|
wrap-regex: [0]
|
||||||
yield-star-spacing: [2, after]
|
yield-star-spacing: [2, after]
|
||||||
|
|||||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,7 +1,7 @@
|
|||||||
* text=auto eol=lf
|
* text=auto eol=lf
|
||||||
*.tmpl linguist-language=Handlebars
|
*.tmpl linguist-language=Handlebars
|
||||||
/assets/*.json linguist-generated
|
/assets/*.json linguist-generated
|
||||||
/public/assets/img/svg/*.svg linguist-generated
|
/public/img/svg/*.svg linguist-generated
|
||||||
/templates/swagger/v1_json.tmpl linguist-generated
|
/templates/swagger/v1_json.tmpl linguist-generated
|
||||||
/vendor/** -text -eol linguist-vendored
|
/vendor/** -text -eol linguist-vendored
|
||||||
/web_src/fomantic/build/** linguist-generated
|
/web_src/fomantic/build/** linguist-generated
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
2. Please ask questions or configuration/deploy problems on our Discord
|
2. Please ask questions or configuration/deploy problems on our Discord
|
||||||
server (https://discord.gg/gitea) 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.
|
3. Please take a moment to check that your issue doesn't already exist.
|
||||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
|
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
|
||||||
5. Please give all relevant information below for bug reports, because
|
5. Please give all relevant information below for bug reports, because
|
||||||
incomplete details will be handled as an invalid report.
|
incomplete details will be handled as an invalid report.
|
||||||
-->
|
-->
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
- [ ] No
|
- [ ] No
|
||||||
- Log gist:
|
- Log gist:
|
||||||
<!-- It really is important to provide pertinent logs -->
|
<!-- It really is important to provide pertinent logs -->
|
||||||
<!-- Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help -->
|
<!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems -->
|
||||||
<!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini -->
|
<!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini -->
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|||||||
179
.github/ISSUE_TEMPLATE/bug-report.yaml
vendored
179
.github/ISSUE_TEMPLATE/bug-report.yaml
vendored
@@ -1,91 +1,94 @@
|
|||||||
name: Bug Report
|
name: Bug Report
|
||||||
description: Found something you weren't expecting? Report it here!
|
description: Found something you weren't expecting? Report it here!
|
||||||
labels: ["kind/bug"]
|
labels: kind/bug
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue.
|
NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue.
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
1. Please speak English, this is the language all maintainers 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
|
2. Please ask questions or configuration/deploy problems on our Discord
|
||||||
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
|
server (https://discord.gg/gitea) or forum (https://discourse.gitea.io).
|
||||||
3. Make sure you are using the latest release and
|
3. Make sure you are using the latest release and
|
||||||
take a moment to check that your issue hasn't been reported before.
|
take a moment to check that your issue hasn't been reported before.
|
||||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
|
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
|
||||||
5. It's really important to provide pertinent details and logs (https://docs.gitea.com/help/support),
|
5. Please give all relevant information below for bug reports, because
|
||||||
incomplete details will be handled as an invalid report.
|
incomplete details will be handled as an invalid report.
|
||||||
- type: textarea
|
6. In particular it's really important to provide pertinent logs. You must give us DEBUG level logs.
|
||||||
id: description
|
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
|
||||||
attributes:
|
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
|
||||||
label: Description
|
- type: textarea
|
||||||
description: |
|
id: description
|
||||||
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below)
|
attributes:
|
||||||
If you are using a proxy or a CDN (e.g. Cloudflare) in front of Gitea, please disable the proxy/CDN fully and access Gitea directly to confirm the issue still persists without those services.
|
label: Description
|
||||||
- type: input
|
description: |
|
||||||
id: gitea-ver
|
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below)
|
||||||
attributes:
|
If you are using a proxy or a CDN (e.g. Cloudflare) in front of Gitea, please disable the proxy/CDN fully and access Gitea directly to confirm the issue still persists without those services.
|
||||||
label: Gitea Version
|
- type: input
|
||||||
description: Gitea version (or commit reference) of your instance
|
id: gitea-ver
|
||||||
validations:
|
attributes:
|
||||||
required: true
|
label: Gitea Version
|
||||||
- type: dropdown
|
description: Gitea version (or commit reference) of your instance
|
||||||
id: can-reproduce
|
validations:
|
||||||
attributes:
|
required: true
|
||||||
label: Can you reproduce the bug on the Gitea demo site?
|
- type: dropdown
|
||||||
description: |
|
id: can-reproduce
|
||||||
If so, please provide a URL in the Description field
|
attributes:
|
||||||
URL of Gitea demo: https://try.gitea.io
|
label: Can you reproduce the bug on the Gitea demo site?
|
||||||
options:
|
description: |
|
||||||
- "Yes"
|
If so, please provide a URL in the Description field
|
||||||
- "No"
|
URL of Gitea demo: https://try.gitea.io
|
||||||
validations:
|
options:
|
||||||
required: true
|
- "Yes"
|
||||||
- type: markdown
|
- "No"
|
||||||
attributes:
|
validations:
|
||||||
value: |
|
required: true
|
||||||
It's really important to provide pertinent logs
|
- type: markdown
|
||||||
Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help
|
attributes:
|
||||||
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
|
value: |
|
||||||
- type: input
|
It's really important to provide pertinent logs
|
||||||
id: logs
|
Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems
|
||||||
attributes:
|
In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini
|
||||||
label: Log Gist
|
- type: input
|
||||||
description: Please provide a gist URL of your logs, with any sensitive information (e.g. API keys) removed/hidden
|
id: logs
|
||||||
- type: textarea
|
attributes:
|
||||||
id: screenshots
|
label: Log Gist
|
||||||
attributes:
|
description: Please provide a gist URL of your logs, with any sensitive information (e.g. API keys) removed/hidden
|
||||||
label: Screenshots
|
- type: textarea
|
||||||
description: If this issue involves the Web Interface, please provide one or more screenshots
|
id: screenshots
|
||||||
- type: input
|
attributes:
|
||||||
id: git-ver
|
label: Screenshots
|
||||||
attributes:
|
description: If this issue involves the Web Interface, please provide one or more screenshots
|
||||||
label: Git Version
|
- type: input
|
||||||
description: The version of git running on the server
|
id: git-ver
|
||||||
- type: input
|
attributes:
|
||||||
id: os-ver
|
label: Git Version
|
||||||
attributes:
|
description: The version of git running on the server
|
||||||
label: Operating System
|
- type: input
|
||||||
description: The operating system you are using to run Gitea
|
id: os-ver
|
||||||
- type: textarea
|
attributes:
|
||||||
id: run-info
|
label: Operating System
|
||||||
attributes:
|
description: The operating system you are using to run Gitea
|
||||||
label: How are you running Gitea?
|
- type: textarea
|
||||||
description: |
|
id: run-info
|
||||||
Please include information on whether you built Gitea yourself, used one of our downloads, are using https://try.gitea.io or are using some other package
|
attributes:
|
||||||
Please also tell us how you are running Gitea, e.g. if it is being run from docker, a command-line, systemd etc.
|
label: How are you running Gitea?
|
||||||
If you are using a package or systemd tell us what distribution you are using
|
description: |
|
||||||
validations:
|
Please include information on whether you built Gitea yourself, used one of our downloads, are using https://try.gitea.io or are using some other package
|
||||||
required: true
|
Please also tell us how you are running Gitea, e.g. if it is being run from docker, a command-line, systemd etc.
|
||||||
- type: dropdown
|
If you are using a package or systemd tell us what distribution you are using
|
||||||
id: database
|
validations:
|
||||||
attributes:
|
required: true
|
||||||
label: Database
|
- type: dropdown
|
||||||
description: What database system are you running?
|
id: database
|
||||||
options:
|
attributes:
|
||||||
- PostgreSQL
|
label: Database
|
||||||
- MySQL/MariaDB
|
description: What database system are you running?
|
||||||
- MSSQL
|
options:
|
||||||
- SQLite
|
- PostgreSQL
|
||||||
|
- MySQL
|
||||||
|
- MSSQL
|
||||||
|
- SQLite
|
||||||
|
|||||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -8,9 +8,9 @@ contact_links:
|
|||||||
about: Please ask questions and discuss configuration or deployment problems here.
|
about: Please ask questions and discuss configuration or deployment problems here.
|
||||||
- name: Discourse Forum
|
- name: Discourse Forum
|
||||||
url: https://discourse.gitea.io
|
url: https://discourse.gitea.io
|
||||||
about: Questions and configuration or deployment problems can also be discussed on our forum.
|
about: Questions and configuration or deployment problems can also be discussed on our forum.
|
||||||
- name: Frequently Asked Questions
|
- name: Frequently Asked Questions
|
||||||
url: https://docs.gitea.com/help/faq
|
url: https://docs.gitea.io/en-us/faq
|
||||||
about: Please check if your question isn't mentioned here.
|
about: Please check if your question isn't mentioned here.
|
||||||
- name: Crowdin Translations
|
- name: Crowdin Translations
|
||||||
url: https://crowdin.com/project/gitea
|
url: https://crowdin.com/project/gitea
|
||||||
|
|||||||
42
.github/ISSUE_TEMPLATE/feature-request.yaml
vendored
42
.github/ISSUE_TEMPLATE/feature-request.yaml
vendored
@@ -1,24 +1,24 @@
|
|||||||
name: Feature Request
|
name: Feature Request
|
||||||
description: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here!
|
description: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here!
|
||||||
labels: ["kind/proposal"]
|
labels: ["kind/feature", "kind/proposal"]
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
1. Please speak English, this is the language all maintainers 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
|
2. Please ask questions or configuration/deploy problems on our Discord
|
||||||
server (https://discord.gg/gitea) 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 feature hasn't already been suggested.
|
3. Please take a moment to check that your feature hasn't already been suggested.
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
label: Feature Description
|
label: Feature Description
|
||||||
placeholder: |
|
placeholder: |
|
||||||
I think it would be great if Gitea had...
|
I think it would be great if Gitea had...
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: screenshots
|
id: screenshots
|
||||||
attributes:
|
attributes:
|
||||||
label: Screenshots
|
label: Screenshots
|
||||||
description: If you can, provide screenshots of an implementation on another site e.g. GitHub
|
description: If you can, provide screenshots of an implementation on another site e.g. GitHub
|
||||||
|
|||||||
124
.github/ISSUE_TEMPLATE/ui.bug-report.yaml
vendored
124
.github/ISSUE_TEMPLATE/ui.bug-report.yaml
vendored
@@ -2,65 +2,65 @@ name: Web Interface Bug Report
|
|||||||
description: Something doesn't look quite as it should? Report it here!
|
description: Something doesn't look quite as it should? Report it here!
|
||||||
labels: ["kind/bug", "kind/ui"]
|
labels: ["kind/bug", "kind/ui"]
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue.
|
NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue.
|
||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
1. Please speak English, this is the language all maintainers 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
|
2. Please ask questions or configuration/deploy problems on our Discord
|
||||||
server (https://discord.gg/gitea) 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.
|
3. Please take a moment to check that your issue doesn't already exist.
|
||||||
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq)
|
4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq)
|
||||||
5. Please give all relevant information below for bug reports, because
|
5. Please give all relevant information below for bug reports, because
|
||||||
incomplete details will be handled as an invalid report.
|
incomplete details will be handled as an invalid report.
|
||||||
6. In particular it's really important to provide pertinent logs. If you are certain that this is a javascript
|
6. In particular it's really important to provide pertinent logs. If you are certain that this is a javascript
|
||||||
error, show us the javascript console. If the error appears to relate to Gitea the server you must also give us
|
error, show us the javascript console. If the error appears to relate to Gitea the server you must also give us
|
||||||
DEBUG level logs. (See https://docs.gitea.com/administration/logging-config#collecting-logs-for-help)
|
DEBUG level logs. (See https://docs.gitea.io/en-us/logging-configuration/#debugging-problems)
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
label: Description
|
label: Description
|
||||||
description: |
|
description: |
|
||||||
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below)
|
Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below)
|
||||||
If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services.
|
If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services.
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: screenshots
|
id: screenshots
|
||||||
attributes:
|
attributes:
|
||||||
label: Screenshots
|
label: Screenshots
|
||||||
description: Please provide at least 1 screenshot showing the issue.
|
description: Please provide at least 1 screenshot showing the issue.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
id: gitea-ver
|
id: gitea-ver
|
||||||
attributes:
|
attributes:
|
||||||
label: Gitea Version
|
label: Gitea Version
|
||||||
description: Gitea version (or commit reference) your instance is running
|
description: Gitea version (or commit reference) your instance is running
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: can-reproduce
|
id: can-reproduce
|
||||||
attributes:
|
attributes:
|
||||||
label: Can you reproduce the bug on the Gitea demo site?
|
label: Can you reproduce the bug on the Gitea demo site?
|
||||||
description: |
|
description: |
|
||||||
If so, please provide a URL in the Description field
|
If so, please provide a URL in the Description field
|
||||||
URL of Gitea demo: https://try.gitea.io
|
URL of Gitea demo: https://try.gitea.io
|
||||||
options:
|
options:
|
||||||
- "Yes"
|
- "Yes"
|
||||||
- "No"
|
- "No"
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: input
|
- type: input
|
||||||
id: os-ver
|
id: os-ver
|
||||||
attributes:
|
attributes:
|
||||||
label: Operating System
|
label: Operating System
|
||||||
description: The operating system you are using to access Gitea
|
description: The operating system you are using to access Gitea
|
||||||
- type: input
|
- type: input
|
||||||
id: browser-ver
|
id: browser-ver
|
||||||
attributes:
|
attributes:
|
||||||
label: Browser Version
|
label: Browser Version
|
||||||
description: The browser and version that you are using to access Gitea
|
description: The browser and version that you are using to access Gitea
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
5
.github/actionlint.yaml
vendored
5
.github/actionlint.yaml
vendored
@@ -1,5 +0,0 @@
|
|||||||
self-hosted-runner:
|
|
||||||
labels:
|
|
||||||
- actuated-4cpu-8gb
|
|
||||||
- actuated-4cpu-16gb
|
|
||||||
- nscloud
|
|
||||||
36
.github/labeler.yml
vendored
36
.github/labeler.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
modifies/docs:
|
|
||||||
- "**/*.md"
|
|
||||||
- "docs/**"
|
|
||||||
|
|
||||||
modifies/frontend:
|
|
||||||
- "web_src/**/*"
|
|
||||||
|
|
||||||
modifies/templates:
|
|
||||||
- all: ["templates/**", "!templates/swagger/v1_json.tmpl"]
|
|
||||||
|
|
||||||
modifies/api:
|
|
||||||
- "routers/api/**"
|
|
||||||
- "templates/swagger/v1_json.tmpl"
|
|
||||||
|
|
||||||
modifies/cli:
|
|
||||||
- "cmd/**"
|
|
||||||
|
|
||||||
modifies/translation:
|
|
||||||
- "options/locale/*.ini"
|
|
||||||
|
|
||||||
modifies/migrations:
|
|
||||||
- "models/migrations/**/*"
|
|
||||||
|
|
||||||
modifies/internal:
|
|
||||||
- "Makefile"
|
|
||||||
- "Dockerfile"
|
|
||||||
- "Dockerfile.rootless"
|
|
||||||
- "docker/**"
|
|
||||||
- "webpack.config.js"
|
|
||||||
- ".eslintrc.yaml"
|
|
||||||
- ".golangci.yml"
|
|
||||||
- ".markdownlint.yaml"
|
|
||||||
- ".spectral.yaml"
|
|
||||||
- ".stylelintrc.yaml"
|
|
||||||
- ".yamllint.yaml"
|
|
||||||
- ".github/**"
|
|
||||||
6
.github/stale.yml
vendored
6
.github/stale.yml
vendored
@@ -9,8 +9,8 @@ daysUntilClose: 14
|
|||||||
|
|
||||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||||
exemptLabels:
|
exemptLabels:
|
||||||
- status/blocked
|
- status/blocked
|
||||||
- kind/security
|
- kind/security
|
||||||
- lgtm/done
|
- lgtm/done
|
||||||
- reviewed/confirmed
|
- reviewed/confirmed
|
||||||
- priority/critical
|
- priority/critical
|
||||||
@@ -27,7 +27,7 @@ staleLabel: stale
|
|||||||
|
|
||||||
# Comment to post when marking as stale. Set to `false` to disable
|
# Comment to post when marking as stale. Set to `false` to disable
|
||||||
markComment: >
|
markComment: >
|
||||||
This issue has been automatically marked as stale because it has not had recent activity.
|
This issue has been automatically marked as stale because it has not had recent activity.
|
||||||
I am here to help clear issues left open even if solved or waiting for more insight.
|
I am here to help clear issues left open even if solved or waiting for more insight.
|
||||||
This issue will be closed if no further activity occurs during the next 2 weeks.
|
This issue will be closed if no further activity occurs during the next 2 weeks.
|
||||||
If the issue is still valid just add a comment to keep it alive.
|
If the issue is still valid just add a comment to keep it alive.
|
||||||
|
|||||||
7
.github/workflows/cron-licenses.yml
vendored
7
.github/workflows/cron-licenses.yml
vendored
@@ -10,11 +10,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'go-gitea/gitea'
|
if: github.repository == 'go-gitea/gitea'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20.1"
|
||||||
check-latest: true
|
|
||||||
- run: make generate-license generate-gitignore
|
- run: make generate-license generate-gitignore
|
||||||
timeout-minutes: 40
|
timeout-minutes: 40
|
||||||
- name: push translations to repo
|
- name: push translations to repo
|
||||||
|
|||||||
4
.github/workflows/cron-translations.yml
vendored
4
.github/workflows/cron-translations.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'go-gitea/gitea'
|
if: github.repository == 'go-gitea/gitea'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- name: download from crowdin
|
- name: download from crowdin
|
||||||
uses: docker://jonasfranz/crowdin
|
uses: docker://jonasfranz/crowdin
|
||||||
env:
|
env:
|
||||||
@@ -35,7 +35,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository == 'go-gitea/gitea'
|
if: github.repository == 'go-gitea/gitea'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- name: push translations to crowdin
|
- name: push translations to crowdin
|
||||||
uses: docker://jonasfranz/crowdin
|
uses: docker://jonasfranz/crowdin
|
||||||
env:
|
env:
|
||||||
|
|||||||
36
.github/workflows/disk-clean.yml
vendored
36
.github/workflows/disk-clean.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
name: disk-clean
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
triage:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# FIXME: https://github.com/jlumbroso/free-disk-space/issues/17
|
|
||||||
- name: same as 'large-packages' but without 'google-cloud-sdk'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
sudo apt-get remove -y '^dotnet-.*'
|
|
||||||
sudo apt-get remove -y '^llvm-.*'
|
|
||||||
sudo apt-get remove -y 'php.*'
|
|
||||||
sudo apt-get remove -y '^mongodb-.*'
|
|
||||||
sudo apt-get remove -y '^mysql-.*'
|
|
||||||
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri
|
|
||||||
sudo apt-get autoremove -y
|
|
||||||
sudo apt-get clean
|
|
||||||
- name: Free Disk Space (Ubuntu)
|
|
||||||
uses: jlumbroso/free-disk-space@main
|
|
||||||
with:
|
|
||||||
# this might remove tools that are actually needed,
|
|
||||||
# if set to "true" but frees about 6 GB
|
|
||||||
tool-cache: false
|
|
||||||
|
|
||||||
# all of these default to true, but feel free to set to
|
|
||||||
# "false" if necessary for your workflow
|
|
||||||
android: true
|
|
||||||
dotnet: true
|
|
||||||
haskell: true
|
|
||||||
large-packages: false
|
|
||||||
docker-images: false
|
|
||||||
swap-storage: true
|
|
||||||
60
.github/workflows/files-changed.yml
vendored
60
.github/workflows/files-changed.yml
vendored
@@ -4,94 +4,50 @@ on:
|
|||||||
workflow_call:
|
workflow_call:
|
||||||
outputs:
|
outputs:
|
||||||
backend:
|
backend:
|
||||||
|
description: "whether backend files changed"
|
||||||
value: ${{ jobs.detect.outputs.backend }}
|
value: ${{ jobs.detect.outputs.backend }}
|
||||||
frontend:
|
frontend:
|
||||||
|
description: "whether frontend files changed"
|
||||||
value: ${{ jobs.detect.outputs.frontend }}
|
value: ${{ jobs.detect.outputs.frontend }}
|
||||||
docs:
|
docs:
|
||||||
|
description: "whether docs files changed"
|
||||||
value: ${{ jobs.detect.outputs.docs }}
|
value: ${{ jobs.detect.outputs.docs }}
|
||||||
actions:
|
actions:
|
||||||
|
description: "whether actions files changed"
|
||||||
value: ${{ jobs.detect.outputs.actions }}
|
value: ${{ jobs.detect.outputs.actions }}
|
||||||
templates:
|
|
||||||
value: ${{ jobs.detect.outputs.templates }}
|
|
||||||
docker:
|
|
||||||
value: ${{ jobs.detect.outputs.docker }}
|
|
||||||
swagger:
|
|
||||||
value: ${{ jobs.detect.outputs.swagger }}
|
|
||||||
yaml:
|
|
||||||
value: ${{ jobs.detect.outputs.yaml }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect:
|
detect:
|
||||||
|
name: detect which files changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 3
|
timeout-minutes: 3
|
||||||
|
# Map a step output to a job output
|
||||||
outputs:
|
outputs:
|
||||||
backend: ${{ steps.changes.outputs.backend }}
|
backend: ${{ steps.changes.outputs.backend }}
|
||||||
frontend: ${{ steps.changes.outputs.frontend }}
|
frontend: ${{ steps.changes.outputs.frontend }}
|
||||||
docs: ${{ steps.changes.outputs.docs }}
|
docs: ${{ steps.changes.outputs.docs }}
|
||||||
actions: ${{ steps.changes.outputs.actions }}
|
actions: ${{ steps.changes.outputs.actions }}
|
||||||
templates: ${{ steps.changes.outputs.templates }}
|
|
||||||
docker: ${{ steps.changes.outputs.docker }}
|
|
||||||
swagger: ${{ steps.changes.outputs.swagger }}
|
|
||||||
yaml: ${{ steps.changes.outputs.yaml }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: dorny/paths-filter@v2
|
- uses: dorny/paths-filter@v2
|
||||||
id: changes
|
id: changes
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
backend:
|
backend:
|
||||||
- "**/*.go"
|
- "**/*.go"
|
||||||
- "templates/**/*.tmpl"
|
- "**/*.tmpl"
|
||||||
- "assets/emoji.json"
|
|
||||||
- "go.mod"
|
- "go.mod"
|
||||||
- "go.sum"
|
- "go.sum"
|
||||||
- "Makefile"
|
|
||||||
- ".golangci.yml"
|
|
||||||
- ".editorconfig"
|
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
- "**/*.js"
|
- "**/*.js"
|
||||||
- "web_src/**"
|
- "web_src/**"
|
||||||
- "assets/emoji.json"
|
|
||||||
- "package.json"
|
- "package.json"
|
||||||
- "package-lock.json"
|
- "package-lock.json"
|
||||||
- "Makefile"
|
|
||||||
- ".eslintrc.yaml"
|
|
||||||
- ".stylelintrc.yaml"
|
|
||||||
- ".npmrc"
|
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
- "**/*.md"
|
- "**/*.md"
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- ".markdownlint.yaml"
|
|
||||||
- "package.json"
|
|
||||||
- "package-lock.json"
|
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
- ".github/workflows/*"
|
- ".github/workflows/*"
|
||||||
- "Makefile"
|
|
||||||
|
|
||||||
templates:
|
|
||||||
- "templates/**/*.tmpl"
|
|
||||||
- "pyproject.toml"
|
|
||||||
- "poetry.lock"
|
|
||||||
|
|
||||||
docker:
|
|
||||||
- "Dockerfile"
|
|
||||||
- "Dockerfile.rootless"
|
|
||||||
- "docker/**"
|
|
||||||
- "Makefile"
|
|
||||||
|
|
||||||
swagger:
|
|
||||||
- "templates/swagger/v1_json.tmpl"
|
|
||||||
- "Makefile"
|
|
||||||
- "package.json"
|
|
||||||
- "package-lock.json"
|
|
||||||
- ".spectral.yaml"
|
|
||||||
|
|
||||||
yaml:
|
|
||||||
- "**/*.yml"
|
|
||||||
- "**/*.yaml"
|
|
||||||
- ".yamllint.yaml"
|
|
||||||
- "pyproject.toml"
|
|
||||||
- "poetry.lock"
|
|
||||||
|
|||||||
69
.github/workflows/pull-compliance.yml
vendored
69
.github/workflows/pull-compliance.yml
vendored
@@ -16,63 +16,25 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20"
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: make deps-backend deps-tools
|
- run: make deps-backend deps-tools
|
||||||
- run: make lint-backend
|
- run: make lint-backend
|
||||||
env:
|
env:
|
||||||
TAGS: bindata sqlite sqlite_unlock_notify
|
TAGS: bindata sqlite sqlite_unlock_notify
|
||||||
|
|
||||||
lint-templates:
|
|
||||||
if: needs.files-changed.outputs.templates == 'true'
|
|
||||||
needs: files-changed
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: "3.11"
|
|
||||||
- run: pip install poetry
|
|
||||||
- run: make deps-py
|
|
||||||
- run: make lint-templates
|
|
||||||
|
|
||||||
lint-yaml:
|
|
||||||
if: needs.files-changed.outputs.yaml == 'true'
|
|
||||||
needs: files-changed
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: "3.11"
|
|
||||||
- run: pip install poetry
|
|
||||||
- run: make deps-py
|
|
||||||
- run: make lint-yaml
|
|
||||||
|
|
||||||
lint-swagger:
|
|
||||||
if: needs.files-changed.outputs.swagger == 'true'
|
|
||||||
needs: files-changed
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- run: make deps-frontend
|
|
||||||
- run: make lint-swagger
|
|
||||||
|
|
||||||
lint-go-windows:
|
lint-go-windows:
|
||||||
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
|
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20"
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: make deps-backend deps-tools
|
- run: make deps-backend deps-tools
|
||||||
- run: make lint-go-windows lint-go-vet
|
- run: make lint-go-windows lint-go-vet
|
||||||
@@ -86,10 +48,10 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20"
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: make deps-backend deps-tools
|
- run: make deps-backend deps-tools
|
||||||
- run: make lint-go
|
- run: make lint-go
|
||||||
@@ -101,10 +63,10 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20"
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: make deps-backend deps-tools
|
- run: make deps-backend deps-tools
|
||||||
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs
|
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs
|
||||||
@@ -114,14 +76,13 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
- run: make deps-frontend
|
- run: make deps-frontend
|
||||||
- run: make lint-frontend
|
- run: make lint-frontend
|
||||||
- run: make checks-frontend
|
- run: make checks-frontend
|
||||||
- run: make test-frontend
|
|
||||||
- run: make frontend
|
- run: make frontend
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
@@ -129,14 +90,14 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20"
|
||||||
check-latest: true
|
check-latest: true
|
||||||
# no frontend build here as backend should be able to build
|
# no frontend build here as backend should be able to build
|
||||||
# even without any frontend files
|
# even without any frontend files
|
||||||
- run: make deps-backend
|
- run: make deps-backend deps-tools
|
||||||
- run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
|
- run: go build -o gitea_no_gcc # test if build succeeds without the sqlite tag
|
||||||
- name: build-backend-arm64
|
- name: build-backend-arm64
|
||||||
run: make backend # test cross compile
|
run: make backend # test cross compile
|
||||||
@@ -161,19 +122,19 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
- run: make deps-frontend
|
- run: make deps-frontend
|
||||||
- run: make lint-md
|
- run: make lint-md
|
||||||
- run: make docs
|
- run: make docs # test if build could succeed
|
||||||
|
|
||||||
actions:
|
actions:
|
||||||
if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true'
|
if: needs.files-changed.outputs.actions == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
- run: make lint-actions
|
- run: make lint-actions
|
||||||
|
|||||||
44
.github/workflows/pull-db-tests.yml
vendored
44
.github/workflows/pull-db-tests.yml
vendored
@@ -38,11 +38,10 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- "9000:9000"
|
- "9000:9000"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20.0"
|
||||||
check-latest: true
|
|
||||||
- name: Add hosts to /etc/hosts
|
- name: Add hosts to /etc/hosts
|
||||||
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
|
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
|
||||||
- run: make deps-backend
|
- run: make deps-backend
|
||||||
@@ -63,11 +62,10 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20.0"
|
||||||
check-latest: true
|
|
||||||
- run: make deps-backend
|
- run: make deps-backend
|
||||||
- run: make backend
|
- run: make backend
|
||||||
env:
|
env:
|
||||||
@@ -88,7 +86,7 @@ jobs:
|
|||||||
mysql:
|
mysql:
|
||||||
image: mysql:5.7
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||||
MYSQL_DATABASE: test
|
MYSQL_DATABASE: test
|
||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
@@ -98,12 +96,6 @@ jobs:
|
|||||||
discovery.type: single-node
|
discovery.type: single-node
|
||||||
ports:
|
ports:
|
||||||
- "9200:9200"
|
- "9200:9200"
|
||||||
meilisearch:
|
|
||||||
image: getmeili/meilisearch:v1.2.0
|
|
||||||
env:
|
|
||||||
MEILI_ENV: development # disable auth
|
|
||||||
ports:
|
|
||||||
- "7700:7700"
|
|
||||||
smtpimap:
|
smtpimap:
|
||||||
image: tabascoterrier/docker-imap-devel:latest
|
image: tabascoterrier/docker-imap-devel:latest
|
||||||
ports:
|
ports:
|
||||||
@@ -128,13 +120,12 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- "9000:9000"
|
- "9000:9000"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20.0"
|
||||||
check-latest: true
|
|
||||||
- name: Add hosts to /etc/hosts
|
- name: Add hosts to /etc/hosts
|
||||||
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
|
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
|
||||||
- run: make deps-backend
|
- run: make deps-backend
|
||||||
- run: make backend
|
- run: make backend
|
||||||
env:
|
env:
|
||||||
@@ -160,7 +151,7 @@ jobs:
|
|||||||
mysql:
|
mysql:
|
||||||
image: mysql:5.7
|
image: mysql:5.7
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||||
MYSQL_DATABASE: test
|
MYSQL_DATABASE: test
|
||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
@@ -178,11 +169,10 @@ jobs:
|
|||||||
- "587:587"
|
- "587:587"
|
||||||
- "993:993"
|
- "993:993"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20.0"
|
||||||
check-latest: true
|
|
||||||
- name: Add hosts to /etc/hosts
|
- name: Add hosts to /etc/hosts
|
||||||
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
|
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
|
||||||
- run: make deps-backend
|
- run: make deps-backend
|
||||||
@@ -205,16 +195,15 @@ jobs:
|
|||||||
mysql8:
|
mysql8:
|
||||||
image: mysql:8
|
image: mysql:8
|
||||||
env:
|
env:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
||||||
MYSQL_DATABASE: testgitea
|
MYSQL_DATABASE: testgitea
|
||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20.0"
|
||||||
check-latest: true
|
|
||||||
- name: Add hosts to /etc/hosts
|
- name: Add hosts to /etc/hosts
|
||||||
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts'
|
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts'
|
||||||
- run: make deps-backend
|
- run: make deps-backend
|
||||||
@@ -241,11 +230,10 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- "1433:1433"
|
- "1433:1433"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20.0"
|
||||||
check-latest: true
|
|
||||||
- name: Add hosts to /etc/hosts
|
- name: Add hosts to /etc/hosts
|
||||||
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'
|
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'
|
||||||
- run: make deps-backend
|
- run: make deps-backend
|
||||||
|
|||||||
16
.github/workflows/pull-docker-dryrun.yml
vendored
16
.github/workflows/pull-docker-dryrun.yml
vendored
@@ -11,8 +11,8 @@ jobs:
|
|||||||
files-changed:
|
files-changed:
|
||||||
uses: ./.github/workflows/files-changed.yml
|
uses: ./.github/workflows/files-changed.yml
|
||||||
|
|
||||||
regular:
|
docker-dryrun:
|
||||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true'
|
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
|
||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -21,15 +21,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
push: false
|
push: false
|
||||||
tags: gitea/gitea:linux-amd64
|
tags: gitea/gitea:linux-amd64
|
||||||
|
|
||||||
rootless:
|
|
||||||
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true'
|
|
||||||
needs: files-changed
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: docker/setup-buildx-action@v2
|
|
||||||
- uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
push: false
|
|
||||||
file: Dockerfile.rootless
|
|
||||||
tags: gitea/gitea:linux-amd64
|
|
||||||
|
|||||||
4
.github/workflows/pull-e2e-tests.yml
vendored
4
.github/workflows/pull-e2e-tests.yml
vendored
@@ -16,10 +16,10 @@ jobs:
|
|||||||
needs: files-changed
|
needs: files-changed
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20"
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
21
.github/workflows/pull-labeler.yml
vendored
21
.github/workflows/pull-labeler.yml
vendored
@@ -1,21 +0,0 @@
|
|||||||
name: labeler
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened, synchronize, reopened]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
label:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/labeler@v4
|
|
||||||
with:
|
|
||||||
dot: true
|
|
||||||
sync-labels: true
|
|
||||||
68
.github/workflows/release-nightly.yml
vendored
68
.github/workflows/release-nightly.yml
vendored
@@ -1,24 +1,20 @@
|
|||||||
name: release-nightly
|
name: release-nightly-assets
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, release/v* ]
|
branches: [ main, release/v* ]
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
nightly-binary:
|
nightly-binary:
|
||||||
runs-on: nscloud
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
- run: git fetch --unshallow --quiet --tags --force
|
||||||
- uses: actions/setup-go@v4
|
- uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: "~1.21"
|
go-version: ">=1.20"
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
@@ -46,26 +42,22 @@ jobs:
|
|||||||
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
|
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
|
||||||
echo "Cleaned name is ${REF_NAME}"
|
echo "Cleaned name is ${REF_NAME}"
|
||||||
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
|
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
|
||||||
- name: configure aws
|
|
||||||
uses: aws-actions/configure-aws-credentials@v4
|
|
||||||
with:
|
|
||||||
aws-region: ${{ secrets.AWS_REGION }}
|
|
||||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
- name: upload binaries to s3
|
- name: upload binaries to s3
|
||||||
run: |
|
uses: jakejarvis/s3-sync-action@master
|
||||||
aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
|
env:
|
||||||
nightly-docker-rootful:
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_REGION: ${{ secrets.AWS_REGION }}
|
||||||
|
SOURCE_DIR: dist/release
|
||||||
|
DEST_DIR: gitea/${{ steps.clean_name.outputs.branch }}
|
||||||
|
nightly-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
- run: git fetch --unshallow --quiet --tags --force
|
||||||
- uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: "~1.21"
|
|
||||||
check-latest: true
|
|
||||||
- uses: docker/setup-qemu-action@v2
|
- uses: docker/setup-qemu-action@v2
|
||||||
- uses: docker/setup-buildx-action@v2
|
- uses: docker/setup-buildx-action@v2
|
||||||
- name: Get cleaned branch name
|
- name: Get cleaned branch name
|
||||||
@@ -83,8 +75,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: fetch go modules
|
|
||||||
run: make vendor
|
|
||||||
- name: build rootful docker image
|
- name: build rootful docker image
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
@@ -92,36 +82,6 @@ jobs:
|
|||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
|
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
|
||||||
nightly-docker-rootless:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
|
||||||
- uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: "~1.21"
|
|
||||||
check-latest: true
|
|
||||||
- uses: docker/setup-qemu-action@v2
|
|
||||||
- uses: docker/setup-buildx-action@v2
|
|
||||||
- name: Get cleaned branch name
|
|
||||||
id: clean_name
|
|
||||||
run: |
|
|
||||||
# if main then say nightly otherwise cleanup name
|
|
||||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
||||||
echo "branch=nightly" >> "$GITHUB_OUTPUT"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
|
|
||||||
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: fetch go modules
|
|
||||||
run: make vendor
|
|
||||||
- name: build rootless docker image
|
- name: build rootless docker image
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
132
.github/workflows/release-tag-rc.yml
vendored
132
.github/workflows/release-tag-rc.yml
vendored
@@ -1,132 +0,0 @@
|
|||||||
name: release-tag-rc
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v1*-rc*'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
binary:
|
|
||||||
runs-on: nscloud
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
|
||||||
- uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: "~1.21"
|
|
||||||
check-latest: true
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- run: make deps-frontend deps-backend
|
|
||||||
# xgo build
|
|
||||||
- run: make release
|
|
||||||
env:
|
|
||||||
TAGS: bindata sqlite sqlite_unlock_notify
|
|
||||||
- name: import gpg key
|
|
||||||
id: import_gpg
|
|
||||||
uses: crazy-max/ghaction-import-gpg@v5
|
|
||||||
with:
|
|
||||||
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
|
||||||
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
|
||||||
- name: sign binaries
|
|
||||||
run: |
|
|
||||||
for f in dist/release/*; do
|
|
||||||
echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f"
|
|
||||||
done
|
|
||||||
# clean branch name to get the folder name in S3
|
|
||||||
- name: Get cleaned branch name
|
|
||||||
id: clean_name
|
|
||||||
run: |
|
|
||||||
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//')
|
|
||||||
echo "Cleaned name is ${REF_NAME}"
|
|
||||||
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: configure aws
|
|
||||||
uses: aws-actions/configure-aws-credentials@v4
|
|
||||||
with:
|
|
||||||
aws-region: ${{ secrets.AWS_REGION }}
|
|
||||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
- name: upload binaries to s3
|
|
||||||
run: |
|
|
||||||
aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
|
|
||||||
- name: Install GH CLI
|
|
||||||
uses: dev-hanz-ops/install-gh-cli-action@v0.1.0
|
|
||||||
with:
|
|
||||||
gh-cli-version: 2.39.1
|
|
||||||
- name: create github release
|
|
||||||
run: |
|
|
||||||
gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --draft --notes-from-tag dist/release/*
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
docker-rootful:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
|
||||||
- uses: docker/setup-qemu-action@v2
|
|
||||||
- uses: docker/setup-buildx-action@v2
|
|
||||||
- uses: docker/metadata-action@v5
|
|
||||||
id: meta
|
|
||||||
with:
|
|
||||||
images: gitea/gitea
|
|
||||||
flavor: |
|
|
||||||
latest=false
|
|
||||||
# 1.2.3-rc0
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: build rootful docker image
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
docker-rootless:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
|
||||||
- uses: docker/setup-qemu-action@v2
|
|
||||||
- uses: docker/setup-buildx-action@v2
|
|
||||||
- uses: docker/metadata-action@v5
|
|
||||||
id: meta
|
|
||||||
with:
|
|
||||||
images: gitea/gitea
|
|
||||||
# each tag below will have the suffix of -rootless
|
|
||||||
flavor: |
|
|
||||||
latest=false
|
|
||||||
suffix=-rootless
|
|
||||||
# 1.2.3-rc0
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: build rootless docker image
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
file: Dockerfile.rootless
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
143
.github/workflows/release-tag-version.yml
vendored
143
.github/workflows/release-tag-version.yml
vendored
@@ -1,143 +0,0 @@
|
|||||||
name: release-tag-version
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v1.*'
|
|
||||||
- '!v1*-rc*'
|
|
||||||
- '!v1*-dev'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
binary:
|
|
||||||
runs-on: nscloud
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
|
||||||
- uses: actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: "~1.21"
|
|
||||||
check-latest: true
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- run: make deps-frontend deps-backend
|
|
||||||
# xgo build
|
|
||||||
- run: make release
|
|
||||||
env:
|
|
||||||
TAGS: bindata sqlite sqlite_unlock_notify
|
|
||||||
- name: import gpg key
|
|
||||||
id: import_gpg
|
|
||||||
uses: crazy-max/ghaction-import-gpg@v5
|
|
||||||
with:
|
|
||||||
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
|
|
||||||
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
|
|
||||||
- name: sign binaries
|
|
||||||
run: |
|
|
||||||
for f in dist/release/*; do
|
|
||||||
echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f"
|
|
||||||
done
|
|
||||||
# clean branch name to get the folder name in S3
|
|
||||||
- name: Get cleaned branch name
|
|
||||||
id: clean_name
|
|
||||||
run: |
|
|
||||||
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//')
|
|
||||||
echo "Cleaned name is ${REF_NAME}"
|
|
||||||
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: configure aws
|
|
||||||
uses: aws-actions/configure-aws-credentials@v4
|
|
||||||
with:
|
|
||||||
aws-region: ${{ secrets.AWS_REGION }}
|
|
||||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
- name: upload binaries to s3
|
|
||||||
run: |
|
|
||||||
aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress
|
|
||||||
- name: Install GH CLI
|
|
||||||
uses: dev-hanz-ops/install-gh-cli-action@v0.1.0
|
|
||||||
with:
|
|
||||||
gh-cli-version: 2.39.1
|
|
||||||
- name: create github release
|
|
||||||
run: |
|
|
||||||
gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-from-tag dist/release/*
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
||||||
docker-rootful:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
|
||||||
- uses: docker/setup-qemu-action@v2
|
|
||||||
- uses: docker/setup-buildx-action@v2
|
|
||||||
- uses: docker/metadata-action@v5
|
|
||||||
id: meta
|
|
||||||
with:
|
|
||||||
images: gitea/gitea
|
|
||||||
# this will generate tags in the following format:
|
|
||||||
# latest
|
|
||||||
# 1
|
|
||||||
# 1.2
|
|
||||||
# 1.2.3
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: build rootful docker image
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
docker-rootless:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
|
|
||||||
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
|
|
||||||
- run: git fetch --unshallow --quiet --tags --force
|
|
||||||
- uses: docker/setup-qemu-action@v2
|
|
||||||
- uses: docker/setup-buildx-action@v2
|
|
||||||
- uses: docker/metadata-action@v5
|
|
||||||
id: meta
|
|
||||||
with:
|
|
||||||
images: gitea/gitea
|
|
||||||
# each tag below will have the suffix of -rootless
|
|
||||||
flavor: |
|
|
||||||
suffix=-rootless,onlatest=true
|
|
||||||
# this will generate tags in the following format (with -rootless suffix added):
|
|
||||||
# latest
|
|
||||||
# 1
|
|
||||||
# 1.2
|
|
||||||
# 1.2.3
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
- name: build rootless docker image
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
file: Dockerfile.rootless
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -68,15 +68,13 @@ cpu.out
|
|||||||
/tests/*.ini
|
/tests/*.ini
|
||||||
/tests/**/*.git/**/*.sample
|
/tests/**/*.git/**/*.sample
|
||||||
/node_modules
|
/node_modules
|
||||||
/.venv
|
|
||||||
/yarn.lock
|
/yarn.lock
|
||||||
/yarn-error.log
|
/yarn-error.log
|
||||||
/npm-debug.log*
|
/npm-debug.log*
|
||||||
/public/assets/js
|
/public/js
|
||||||
/public/assets/css
|
/public/css
|
||||||
/public/assets/fonts
|
/public/fonts
|
||||||
/public/assets/licenses.txt
|
/public/img/webpack
|
||||||
/public/assets/img/webpack
|
|
||||||
/vendor
|
/vendor
|
||||||
/web_src/fomantic/node_modules
|
/web_src/fomantic/node_modules
|
||||||
/web_src/fomantic/build/*
|
/web_src/fomantic/build/*
|
||||||
@@ -95,7 +93,6 @@ cpu.out
|
|||||||
/.go-licenses
|
/.go-licenses
|
||||||
|
|
||||||
# Snapcraft
|
# Snapcraft
|
||||||
/gitea_a*.txt
|
|
||||||
snap/.snapcraft/
|
snap/.snapcraft/
|
||||||
parts/
|
parts/
|
||||||
stage/
|
stage/
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ vscode:
|
|||||||
- Vue.volar
|
- Vue.volar
|
||||||
- ms-azuretools.vscode-docker
|
- ms-azuretools.vscode-docker
|
||||||
- zixuanchen.vitest-explorer
|
- zixuanchen.vitest-explorer
|
||||||
- qwtel.sqlite-viewer
|
- alexcvzz.vscode-sqlite
|
||||||
- GitHub.vscode-pull-request-github
|
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- name: Gitea
|
- name: Gitea
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ linters:
|
|||||||
fast: false
|
fast: false
|
||||||
|
|
||||||
run:
|
run:
|
||||||
go: "1.21"
|
go: "1.20"
|
||||||
timeout: 10m
|
timeout: 10m
|
||||||
skip-dirs:
|
skip-dirs:
|
||||||
- node_modules
|
- node_modules
|
||||||
@@ -75,23 +75,18 @@ linters-settings:
|
|||||||
- name: modifies-value-receiver
|
- name: modifies-value-receiver
|
||||||
gofumpt:
|
gofumpt:
|
||||||
extra-rules: true
|
extra-rules: true
|
||||||
lang-version: "1.21"
|
lang-version: "1.20"
|
||||||
depguard:
|
depguard:
|
||||||
rules:
|
list-type: denylist
|
||||||
main:
|
# Check the list against standard lib.
|
||||||
deny:
|
include-go-root: true
|
||||||
- pkg: encoding/json
|
packages-with-error-message:
|
||||||
desc: use gitea's modules/json instead of encoding/json
|
- encoding/json: "use gitea's modules/json instead of encoding/json"
|
||||||
- pkg: github.com/unknwon/com
|
- github.com/unknwon/com: "use gitea's util and replacements"
|
||||||
desc: use gitea's util and replacements
|
- io/ioutil: "use os or io instead"
|
||||||
- pkg: io/ioutil
|
- golang.org/x/exp: "it's experimental and unreliable."
|
||||||
desc: use os or io instead
|
- code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead"
|
||||||
- pkg: golang.org/x/exp
|
- gopkg.in/ini.v1: "do not use the ini package, use gitea's config system instead"
|
||||||
desc: it's experimental and unreliable
|
|
||||||
- pkg: code.gitea.io/gitea/modules/git/internal
|
|
||||||
desc: do not use the internal package, use AddXxx function instead
|
|
||||||
- pkg: gopkg.in/ini.v1
|
|
||||||
desc: do not use the ini package, use gitea's config system instead
|
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
max-issues-per-linter: 0
|
max-issues-per-linter: 0
|
||||||
|
|||||||
1
.ignore
1
.ignore
@@ -5,5 +5,4 @@
|
|||||||
/modules/public/bindata.go
|
/modules/public/bindata.go
|
||||||
/modules/templates/bindata.go
|
/modules/templates/bindata.go
|
||||||
/vendor
|
/vendor
|
||||||
/public/assets
|
|
||||||
node_modules
|
node_modules
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ line-length: {code_blocks: false, tables: false, stern: true, line_length: -1}
|
|||||||
no-alt-text: false
|
no-alt-text: false
|
||||||
no-bare-urls: false
|
no-bare-urls: false
|
||||||
no-blanks-blockquote: false
|
no-blanks-blockquote: false
|
||||||
|
no-duplicate-header: {allow_different_nesting: true}
|
||||||
no-emphasis-as-header: false
|
no-emphasis-as-header: false
|
||||||
no-empty-links: false
|
no-empty-links: false
|
||||||
no-hard-tabs: {code_blocks: false}
|
no-hard-tabs: {code_blocks: false}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
plugins:
|
plugins:
|
||||||
- stylelint-declaration-strict-value
|
- stylelint-declaration-strict-value
|
||||||
- stylelint-declaration-block-no-ignored-properties
|
|
||||||
- stylelint-stylistic
|
|
||||||
|
|
||||||
ignoreFiles:
|
ignoreFiles:
|
||||||
- "**/*.go"
|
- "**/*.go"
|
||||||
@@ -50,7 +48,7 @@ rules:
|
|||||||
declaration-no-important: null
|
declaration-no-important: null
|
||||||
declaration-property-max-values: null
|
declaration-property-max-values: null
|
||||||
declaration-property-unit-allowed-list: null
|
declaration-property-unit-allowed-list: null
|
||||||
declaration-property-unit-disallowed-list: {line-height: [em]}
|
declaration-property-unit-disallowed-list: null
|
||||||
declaration-property-value-allowed-list: null
|
declaration-property-value-allowed-list: null
|
||||||
declaration-property-value-disallowed-list: null
|
declaration-property-value-disallowed-list: null
|
||||||
declaration-property-value-no-unknown: true
|
declaration-property-value-no-unknown: true
|
||||||
@@ -84,7 +82,6 @@ rules:
|
|||||||
media-feature-name-value-allowed-list: null
|
media-feature-name-value-allowed-list: null
|
||||||
media-feature-name-value-no-unknown: true
|
media-feature-name-value-no-unknown: true
|
||||||
media-feature-range-notation: null
|
media-feature-range-notation: null
|
||||||
media-query-no-invalid: true
|
|
||||||
named-grid-areas-no-invalid: true
|
named-grid-areas-no-invalid: true
|
||||||
no-descending-specificity: null
|
no-descending-specificity: null
|
||||||
no-duplicate-at-import-rules: true
|
no-duplicate-at-import-rules: true
|
||||||
@@ -96,7 +93,6 @@ rules:
|
|||||||
no-unknown-animations: null
|
no-unknown-animations: null
|
||||||
no-unknown-custom-properties: null
|
no-unknown-custom-properties: null
|
||||||
number-max-precision: null
|
number-max-precision: null
|
||||||
plugin/declaration-block-no-ignored-properties: true
|
|
||||||
property-allowed-list: null
|
property-allowed-list: null
|
||||||
property-disallowed-list: null
|
property-disallowed-list: null
|
||||||
property-no-unknown: true
|
property-no-unknown: true
|
||||||
@@ -137,82 +133,6 @@ rules:
|
|||||||
selector-type-no-unknown: [true, {ignore: [custom-elements]}]
|
selector-type-no-unknown: [true, {ignore: [custom-elements]}]
|
||||||
shorthand-property-no-redundant-values: true
|
shorthand-property-no-redundant-values: true
|
||||||
string-no-newline: true
|
string-no-newline: true
|
||||||
stylistic/at-rule-name-case: null
|
|
||||||
stylistic/at-rule-name-newline-after: null
|
|
||||||
stylistic/at-rule-name-space-after: null
|
|
||||||
stylistic/at-rule-semicolon-newline-after: null
|
|
||||||
stylistic/at-rule-semicolon-space-before: null
|
|
||||||
stylistic/block-closing-brace-empty-line-before: null
|
|
||||||
stylistic/block-closing-brace-newline-after: null
|
|
||||||
stylistic/block-closing-brace-newline-before: null
|
|
||||||
stylistic/block-closing-brace-space-after: null
|
|
||||||
stylistic/block-closing-brace-space-before: null
|
|
||||||
stylistic/block-opening-brace-newline-after: null
|
|
||||||
stylistic/block-opening-brace-newline-before: null
|
|
||||||
stylistic/block-opening-brace-space-after: null
|
|
||||||
stylistic/block-opening-brace-space-before: null
|
|
||||||
stylistic/color-hex-case: lower
|
|
||||||
stylistic/declaration-bang-space-after: never
|
|
||||||
stylistic/declaration-bang-space-before: null
|
|
||||||
stylistic/declaration-block-semicolon-newline-after: null
|
|
||||||
stylistic/declaration-block-semicolon-newline-before: null
|
|
||||||
stylistic/declaration-block-semicolon-space-after: null
|
|
||||||
stylistic/declaration-block-semicolon-space-before: never
|
|
||||||
stylistic/declaration-block-trailing-semicolon: null
|
|
||||||
stylistic/declaration-colon-newline-after: null
|
|
||||||
stylistic/declaration-colon-space-after: null
|
|
||||||
stylistic/declaration-colon-space-before: never
|
|
||||||
stylistic/function-comma-newline-after: null
|
|
||||||
stylistic/function-comma-newline-before: null
|
|
||||||
stylistic/function-comma-space-after: null
|
|
||||||
stylistic/function-comma-space-before: null
|
|
||||||
stylistic/function-max-empty-lines: 0
|
|
||||||
stylistic/function-parentheses-newline-inside: never-multi-line
|
|
||||||
stylistic/function-parentheses-space-inside: null
|
|
||||||
stylistic/function-whitespace-after: null
|
|
||||||
stylistic/indentation: 2
|
|
||||||
stylistic/linebreaks: null
|
|
||||||
stylistic/max-empty-lines: 1
|
|
||||||
stylistic/max-line-length: null
|
|
||||||
stylistic/media-feature-colon-space-after: null
|
|
||||||
stylistic/media-feature-colon-space-before: never
|
|
||||||
stylistic/media-feature-name-case: null
|
|
||||||
stylistic/media-feature-parentheses-space-inside: null
|
|
||||||
stylistic/media-feature-range-operator-space-after: always
|
|
||||||
stylistic/media-feature-range-operator-space-before: always
|
|
||||||
stylistic/media-query-list-comma-newline-after: null
|
|
||||||
stylistic/media-query-list-comma-newline-before: null
|
|
||||||
stylistic/media-query-list-comma-space-after: null
|
|
||||||
stylistic/media-query-list-comma-space-before: null
|
|
||||||
stylistic/no-empty-first-line: null
|
|
||||||
stylistic/no-eol-whitespace: true
|
|
||||||
stylistic/no-extra-semicolons: true
|
|
||||||
stylistic/no-missing-end-of-source-newline: null
|
|
||||||
stylistic/number-leading-zero: null
|
|
||||||
stylistic/number-no-trailing-zeros: null
|
|
||||||
stylistic/property-case: lower
|
|
||||||
stylistic/selector-attribute-brackets-space-inside: null
|
|
||||||
stylistic/selector-attribute-operator-space-after: null
|
|
||||||
stylistic/selector-attribute-operator-space-before: null
|
|
||||||
stylistic/selector-combinator-space-after: null
|
|
||||||
stylistic/selector-combinator-space-before: null
|
|
||||||
stylistic/selector-descendant-combinator-no-non-space: null
|
|
||||||
stylistic/selector-list-comma-newline-after: null
|
|
||||||
stylistic/selector-list-comma-newline-before: null
|
|
||||||
stylistic/selector-list-comma-space-after: always-single-line
|
|
||||||
stylistic/selector-list-comma-space-before: never-single-line
|
|
||||||
stylistic/selector-max-empty-lines: 0
|
|
||||||
stylistic/selector-pseudo-class-case: lower
|
|
||||||
stylistic/selector-pseudo-class-parentheses-space-inside: never
|
|
||||||
stylistic/selector-pseudo-element-case: lower
|
|
||||||
stylistic/string-quotes: double
|
|
||||||
stylistic/unicode-bom: null
|
|
||||||
stylistic/unit-case: lower
|
|
||||||
stylistic/value-list-comma-newline-after: null
|
|
||||||
stylistic/value-list-comma-newline-before: null
|
|
||||||
stylistic/value-list-comma-space-after: null
|
|
||||||
stylistic/value-list-comma-space-before: null
|
|
||||||
stylistic/value-list-max-empty-lines: 0
|
|
||||||
time-min-milliseconds: null
|
time-min-milliseconds: null
|
||||||
unit-allowed-list: null
|
unit-allowed-list: null
|
||||||
unit-disallowed-list: null
|
unit-disallowed-list: null
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
extends: default
|
|
||||||
|
|
||||||
rules:
|
|
||||||
braces:
|
|
||||||
min-spaces-inside: 0
|
|
||||||
max-spaces-inside: 1
|
|
||||||
min-spaces-inside-empty: 0
|
|
||||||
max-spaces-inside-empty: 0
|
|
||||||
|
|
||||||
brackets:
|
|
||||||
min-spaces-inside: 0
|
|
||||||
max-spaces-inside: 1
|
|
||||||
min-spaces-inside-empty: 0
|
|
||||||
max-spaces-inside-empty: 0
|
|
||||||
|
|
||||||
comments:
|
|
||||||
require-starting-space: true
|
|
||||||
ignore-shebangs: true
|
|
||||||
min-spaces-from-content: 1
|
|
||||||
|
|
||||||
comments-indentation:
|
|
||||||
level: error
|
|
||||||
|
|
||||||
document-start:
|
|
||||||
level: error
|
|
||||||
present: false
|
|
||||||
|
|
||||||
document-end:
|
|
||||||
present: false
|
|
||||||
|
|
||||||
empty-lines:
|
|
||||||
max: 1
|
|
||||||
|
|
||||||
indentation:
|
|
||||||
spaces: 2
|
|
||||||
|
|
||||||
line-length: disable
|
|
||||||
|
|
||||||
truthy:
|
|
||||||
allowed-values: ["true", "false", "on", "off"]
|
|
||||||
|
|
||||||
ignore: |
|
|
||||||
.venv
|
|
||||||
node_modules
|
|
||||||
@@ -42,13 +42,13 @@ GARGS = "--no-print-directory"
|
|||||||
|
|
||||||
# The GNU convention is to use the lowercased `prefix` variable/macro to
|
# The GNU convention is to use the lowercased `prefix` variable/macro to
|
||||||
# specify the installation directory. Humor them.
|
# specify the installation directory. Humor them.
|
||||||
GPREFIX =
|
GPREFIX = ""
|
||||||
.if defined(PREFIX) && ! defined(prefix)
|
.if defined(PREFIX) && ! defined(prefix)
|
||||||
GPREFIX = 'prefix = "$(PREFIX)"'
|
GPREFIX = 'prefix = "$(PREFIX)"'
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.BEGIN: .SILENT
|
.BEGIN: .SILENT
|
||||||
which $(GMAKE) || (printf "Error: GNU Make is required!\n\n" 1>&2 && false)
|
which $(GMAKE) || printf "Error: GNU Make is required!\n\n" 1>&2 && false
|
||||||
|
|
||||||
.PHONY: FRC
|
.PHONY: FRC
|
||||||
$(.TARGETS): FRC
|
$(.TARGETS): FRC
|
||||||
|
|||||||
1271
CHANGELOG.md
1271
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@
|
|||||||
- [Backport PRs](#backport-prs)
|
- [Backport PRs](#backport-prs)
|
||||||
- [Documentation](#documentation)
|
- [Documentation](#documentation)
|
||||||
- [API v1](#api-v1)
|
- [API v1](#api-v1)
|
||||||
- [GitHub API compatibility](#github-api-compatibility)
|
- [GitHub API compatability](#github-api-compatability)
|
||||||
- [Adding/Maintaining API routes](#addingmaintaining-api-routes)
|
- [Adding/Maintaining API routes](#addingmaintaining-api-routes)
|
||||||
- [When to use what HTTP method](#when-to-use-what-http-method)
|
- [When to use what HTTP method](#when-to-use-what-http-method)
|
||||||
- [Requirements for API routes](#requirements-for-api-routes)
|
- [Requirements for API routes](#requirements-for-api-routes)
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
This document explains how to contribute changes to the Gitea project. \
|
This document explains how to contribute changes to the Gitea project. \
|
||||||
It assumes you have followed the [installation instructions](https://docs.gitea.com/category/installation). \
|
It assumes you have followed the [installation instructions](https://docs.gitea.io/en-us/). \
|
||||||
Sensitive security-related issues should be reported to [security@gitea.io](mailto:security@gitea.io).
|
Sensitive security-related issues should be reported to [security@gitea.io](mailto:security@gitea.io).
|
||||||
|
|
||||||
For configuring IDEs for Gitea development, see the [contributed IDE configurations](contrib/ide/).
|
For configuring IDEs for Gitea development, see the [contributed IDE configurations](contrib/ide/).
|
||||||
@@ -339,7 +339,7 @@ If you add a new feature or change an existing aspect of Gitea, the documentatio
|
|||||||
|
|
||||||
The API is documented by [swagger](http://try.gitea.io/api/swagger) and is based on [the GitHub API](https://docs.github.com/en/rest).
|
The API is documented by [swagger](http://try.gitea.io/api/swagger) and is based on [the GitHub API](https://docs.github.com/en/rest).
|
||||||
|
|
||||||
### GitHub API compatibility
|
### GitHub API compatability
|
||||||
|
|
||||||
Gitea's API should use the same endpoints and fields as the GitHub API as far as possible, unless there are good reasons to deviate. \
|
Gitea's API should use the same endpoints and fields as the GitHub API as far as possible, unless there are good reasons to deviate. \
|
||||||
If Gitea provides functionality that GitHub does not, a new endpoint can be created. \
|
If Gitea provides functionality that GitHub does not, a new endpoint can be created. \
|
||||||
@@ -473,14 +473,14 @@ https://help.github.com/articles/signing-commits-with-gpg/
|
|||||||
## Technical Oversight Committee (TOC)
|
## Technical Oversight Committee (TOC)
|
||||||
|
|
||||||
At the start of 2023, the `Owners` team was dissolved. Instead, the governance charter proposed a technical oversight committee (TOC) which expands the ownership team of the Gitea project from three elected positions to six positions. Three positions would be elected as it has been over the past years, and the other three would consist of appointed members from the Gitea company.
|
At the start of 2023, the `Owners` team was dissolved. Instead, the governance charter proposed a technical oversight committee (TOC) which expands the ownership team of the Gitea project from three elected positions to six positions. Three positions would be elected as it has been over the past years, and the other three would consist of appointed members from the Gitea company.
|
||||||
https://blog.gitea.com/quarterly-23q1/
|
https://blog.gitea.io/2023/02/gitea-quarterly-report-23q1/
|
||||||
|
|
||||||
When the new community members have been elected, the old members will give up ownership to the newly elected members. For security reasons, TOC members or any account with write access (like a bot) must use 2FA.
|
When the new community members have been elected, the old members will give up ownership to the newly elected members. For security reasons, TOC members or any account with write access (like a bot) must use 2FA.
|
||||||
https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/
|
https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/
|
||||||
|
|
||||||
### Current TOC members
|
### Current TOC members
|
||||||
|
|
||||||
- 2023-01-01 ~ 2023-12-31 - https://blog.gitea.com/quarterly-23q1/
|
- 2023-01-01 ~ 2023-12-31 - https://blog.gitea.io/2023/02/gitea-quarterly-report-23q1/
|
||||||
- Company
|
- Company
|
||||||
- [Jason Song](https://gitea.com/wolfogre) <i@wolfogre.com>
|
- [Jason Song](https://gitea.com/wolfogre) <i@wolfogre.com>
|
||||||
- [Lunny Xiao](https://gitea.com/lunny) <xiaolunwen@gmail.com>
|
- [Lunny Xiao](https://gitea.com/lunny) <xiaolunwen@gmail.com>
|
||||||
|
|||||||
38
Dockerfile
38
Dockerfile
@@ -1,5 +1,5 @@
|
|||||||
# Build stage
|
#Build stage
|
||||||
FROM docker.io/library/golang:1.21-alpine3.18 AS build-env
|
FROM docker.io/library/golang:1.20-alpine3.18 AS build-env
|
||||||
|
|
||||||
ARG GOPROXY
|
ARG GOPROXY
|
||||||
ENV GOPROXY ${GOPROXY:-direct}
|
ENV GOPROXY ${GOPROXY:-direct}
|
||||||
@@ -9,38 +9,20 @@ ARG TAGS="sqlite sqlite_unlock_notify"
|
|||||||
ENV TAGS "bindata timetzdata $TAGS"
|
ENV TAGS "bindata timetzdata $TAGS"
|
||||||
ARG CGO_EXTRA_CFLAGS
|
ARG CGO_EXTRA_CFLAGS
|
||||||
|
|
||||||
# Build deps
|
#Build deps
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add build-base git nodejs npm
|
||||||
build-base \
|
|
||||||
git \
|
|
||||||
nodejs \
|
|
||||||
npm \
|
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
# Setup repo
|
#Setup repo
|
||||||
COPY . ${GOPATH}/src/code.gitea.io/gitea
|
COPY . ${GOPATH}/src/code.gitea.io/gitea
|
||||||
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
||||||
|
|
||||||
# Checkout version if set
|
#Checkout version if set
|
||||||
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
||||||
&& make clean-all build
|
&& make clean-all build
|
||||||
|
|
||||||
# Begin env-to-ini build
|
# Begin env-to-ini build
|
||||||
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
||||||
|
|
||||||
# Copy local files
|
|
||||||
COPY docker/root /tmp/local
|
|
||||||
|
|
||||||
# Set permissions
|
|
||||||
RUN chmod 755 /tmp/local/usr/bin/entrypoint \
|
|
||||||
/tmp/local/usr/local/bin/gitea \
|
|
||||||
/tmp/local/etc/s6/gitea/* \
|
|
||||||
/tmp/local/etc/s6/openssh/* \
|
|
||||||
/tmp/local/etc/s6/.s6-svscan/* \
|
|
||||||
/go/src/code.gitea.io/gitea/gitea \
|
|
||||||
/go/src/code.gitea.io/gitea/environment-to-ini
|
|
||||||
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
|
|
||||||
|
|
||||||
FROM docker.io/library/alpine:3.18
|
FROM docker.io/library/alpine:3.18
|
||||||
LABEL maintainer="maintainers@gitea.io"
|
LABEL maintainer="maintainers@gitea.io"
|
||||||
|
|
||||||
@@ -57,8 +39,7 @@ RUN apk --no-cache add \
|
|||||||
s6 \
|
s6 \
|
||||||
sqlite \
|
sqlite \
|
||||||
su-exec \
|
su-exec \
|
||||||
gnupg \
|
gnupg
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
RUN addgroup \
|
RUN addgroup \
|
||||||
-S -g 1000 \
|
-S -g 1000 \
|
||||||
@@ -80,7 +61,10 @@ VOLUME ["/data"]
|
|||||||
ENTRYPOINT ["/usr/bin/entrypoint"]
|
ENTRYPOINT ["/usr/bin/entrypoint"]
|
||||||
CMD ["/bin/s6-svscan", "/etc/s6"]
|
CMD ["/bin/s6-svscan", "/etc/s6"]
|
||||||
|
|
||||||
COPY --from=build-env /tmp/local /
|
COPY docker/root /
|
||||||
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
|
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
|
||||||
COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
|
COPY --from=build-env /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
|
||||||
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
|
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
|
||||||
|
RUN chmod 755 /usr/bin/entrypoint /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini
|
||||||
|
RUN chmod 755 /etc/s6/gitea/* /etc/s6/openssh/* /etc/s6/.s6-svscan/*
|
||||||
|
RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Build stage
|
#Build stage
|
||||||
FROM docker.io/library/golang:1.21-alpine3.18 AS build-env
|
FROM docker.io/library/golang:1.20-alpine3.18 AS build-env
|
||||||
|
|
||||||
ARG GOPROXY
|
ARG GOPROXY
|
||||||
ENV GOPROXY ${GOPROXY:-direct}
|
ENV GOPROXY ${GOPROXY:-direct}
|
||||||
@@ -10,35 +10,19 @@ ENV TAGS "bindata timetzdata $TAGS"
|
|||||||
ARG CGO_EXTRA_CFLAGS
|
ARG CGO_EXTRA_CFLAGS
|
||||||
|
|
||||||
#Build deps
|
#Build deps
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add build-base git nodejs npm
|
||||||
build-base \
|
|
||||||
git \
|
|
||||||
nodejs \
|
|
||||||
npm \
|
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
# Setup repo
|
#Setup repo
|
||||||
COPY . ${GOPATH}/src/code.gitea.io/gitea
|
COPY . ${GOPATH}/src/code.gitea.io/gitea
|
||||||
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
|
||||||
|
|
||||||
# Checkout version if set
|
#Checkout version if set
|
||||||
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
|
||||||
&& make clean-all build
|
&& make clean-all build
|
||||||
|
|
||||||
# Begin env-to-ini build
|
# Begin env-to-ini build
|
||||||
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
RUN go build contrib/environment-to-ini/environment-to-ini.go
|
||||||
|
|
||||||
# Copy local files
|
|
||||||
COPY docker/rootless /tmp/local
|
|
||||||
|
|
||||||
# Set permissions
|
|
||||||
RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \
|
|
||||||
/tmp/local/usr/local/bin/docker-setup.sh \
|
|
||||||
/tmp/local/usr/local/bin/gitea \
|
|
||||||
/go/src/code.gitea.io/gitea/gitea \
|
|
||||||
/go/src/code.gitea.io/gitea/environment-to-ini
|
|
||||||
RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
|
|
||||||
|
|
||||||
FROM docker.io/library/alpine:3.18
|
FROM docker.io/library/alpine:3.18
|
||||||
LABEL maintainer="maintainers@gitea.io"
|
LABEL maintainer="maintainers@gitea.io"
|
||||||
|
|
||||||
@@ -51,8 +35,7 @@ RUN apk --no-cache add \
|
|||||||
gettext \
|
gettext \
|
||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
gnupg \
|
gnupg
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
RUN addgroup \
|
RUN addgroup \
|
||||||
-S -g 1000 \
|
-S -g 1000 \
|
||||||
@@ -68,19 +51,21 @@ RUN addgroup \
|
|||||||
RUN mkdir -p /var/lib/gitea /etc/gitea
|
RUN mkdir -p /var/lib/gitea /etc/gitea
|
||||||
RUN chown git:git /var/lib/gitea /etc/gitea
|
RUN chown git:git /var/lib/gitea /etc/gitea
|
||||||
|
|
||||||
COPY --from=build-env /tmp/local /
|
COPY docker/rootless /
|
||||||
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
|
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea
|
||||||
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
|
COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/environment-to-ini /usr/local/bin/environment-to-ini
|
||||||
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
|
COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete /etc/profile.d/gitea_bash_autocomplete.sh
|
||||||
|
RUN chmod 755 /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-setup.sh /app/gitea/gitea /usr/local/bin/gitea /usr/local/bin/environment-to-ini
|
||||||
|
RUN chmod 644 /etc/profile.d/gitea_bash_autocomplete.sh
|
||||||
|
|
||||||
# git:git
|
#git:git
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
ENV GITEA_WORK_DIR /var/lib/gitea
|
ENV GITEA_WORK_DIR /var/lib/gitea
|
||||||
ENV GITEA_CUSTOM /var/lib/gitea/custom
|
ENV GITEA_CUSTOM /var/lib/gitea/custom
|
||||||
ENV GITEA_TEMP /tmp/gitea
|
ENV GITEA_TEMP /tmp/gitea
|
||||||
ENV TMPDIR /tmp/gitea
|
ENV TMPDIR /tmp/gitea
|
||||||
|
|
||||||
# TODO add to docs the ability to define the ini to load (useful to test and revert a config)
|
#TODO add to docs the ability to define the ini to load (useful to test and revert a config)
|
||||||
ENV GITEA_APP_INI /etc/gitea/app.ini
|
ENV GITEA_APP_INI /etc/gitea/app.ini
|
||||||
ENV HOME "/var/lib/gitea/git"
|
ENV HOME "/var/lib/gitea/git"
|
||||||
VOLUME ["/var/lib/gitea", "/etc/gitea"]
|
VOLUME ["/var/lib/gitea", "/etc/gitea"]
|
||||||
@@ -88,3 +73,4 @@ WORKDIR /var/lib/gitea
|
|||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]
|
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]
|
||||||
CMD []
|
CMD []
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,3 @@ Xinyi Gong <hestergong@gmail.com> (@HesterG)
|
|||||||
wxiaoguang <wxiaoguang@gmail.com> (@wxiaoguang)
|
wxiaoguang <wxiaoguang@gmail.com> (@wxiaoguang)
|
||||||
Gary Moon <gary@garymoon.net> (@garymoon)
|
Gary Moon <gary@garymoon.net> (@garymoon)
|
||||||
Philip Peterson <philip.c.peterson@gmail.com> (@philip-peterson)
|
Philip Peterson <philip.c.peterson@gmail.com> (@philip-peterson)
|
||||||
Denys Konovalov <kontakt@denyskon.de> (@denyskon)
|
|
||||||
Punit Inani <punitinani1@gmail.com> (@puni9869)
|
|
||||||
CaiCandong <1290147055@qq.com> (@caicandong)
|
|
||||||
Rui Chen <rui@chenrui.dev> (@chenrui333)
|
|
||||||
Nanguan Lin <nanguanlin6@gmail.com> (@lng2020)
|
|
||||||
|
|||||||
104
Makefile
104
Makefile
@@ -23,19 +23,19 @@ SHASUM ?= shasum -a 256
|
|||||||
HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes)
|
HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes)
|
||||||
COMMA := ,
|
COMMA := ,
|
||||||
|
|
||||||
XGO_VERSION := go-1.21.x
|
XGO_VERSION := go-1.20.x
|
||||||
|
|
||||||
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.44.0
|
AIR_PACKAGE ?= github.com/cosmtrek/air@v1.43.0
|
||||||
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.7.0
|
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.7.0
|
||||||
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.5.0
|
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.5.0
|
||||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
|
||||||
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11
|
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.11
|
||||||
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
||||||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5
|
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4
|
||||||
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
||||||
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0
|
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.6.0
|
||||||
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1.0.1
|
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.6.25
|
ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@latest
|
||||||
|
|
||||||
DOCKER_IMAGE ?= gitea/gitea
|
DOCKER_IMAGE ?= gitea/gitea
|
||||||
DOCKER_TAG ?= latest
|
DOCKER_TAG ?= latest
|
||||||
@@ -68,7 +68,7 @@ endif
|
|||||||
|
|
||||||
EXTRA_GOFLAGS ?=
|
EXTRA_GOFLAGS ?=
|
||||||
|
|
||||||
MAKE_VERSION := $(shell "$(MAKE)" -v | cat | head -n 1)
|
MAKE_VERSION := $(shell "$(MAKE)" -v | head -n 1)
|
||||||
MAKE_EVIDENCE_DIR := .make_evidence
|
MAKE_EVIDENCE_DIR := .make_evidence
|
||||||
|
|
||||||
ifeq ($(RACE_ENABLED),true)
|
ifeq ($(RACE_ENABLED),true)
|
||||||
@@ -82,6 +82,12 @@ HUGO_VERSION ?= 0.111.3
|
|||||||
GITHUB_REF_TYPE ?= branch
|
GITHUB_REF_TYPE ?= branch
|
||||||
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
|
# backwards compatible to build with Drone
|
||||||
|
ifneq ($(DRONE_TAG),)
|
||||||
|
GITHUB_REF_TYPE := tag
|
||||||
|
GITHUB_REF_NAME := $(DRONE_TAG)
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(GITHUB_REF_TYPE),branch)
|
ifneq ($(GITHUB_REF_TYPE),branch)
|
||||||
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
|
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
|
||||||
GITEA_VERSION ?= $(VERSION)
|
GITEA_VERSION ?= $(VERSION)
|
||||||
@@ -116,15 +122,15 @@ FOMANTIC_WORK_DIR := web_src/fomantic
|
|||||||
|
|
||||||
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
|
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
|
||||||
WEBPACK_CONFIGS := webpack.config.js
|
WEBPACK_CONFIGS := webpack.config.js
|
||||||
WEBPACK_DEST := public/assets/js/index.js public/assets/css/index.css
|
WEBPACK_DEST := public/js/index.js public/css/index.css
|
||||||
WEBPACK_DEST_ENTRIES := public/assets/js public/assets/css public/assets/fonts public/assets/img/webpack
|
WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack
|
||||||
|
|
||||||
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
|
BINDATA_DEST := modules/public/bindata.go modules/options/bindata.go modules/templates/bindata.go
|
||||||
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
|
BINDATA_HASH := $(addsuffix .hash,$(BINDATA_DEST))
|
||||||
|
|
||||||
GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go
|
GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go
|
||||||
|
|
||||||
SVG_DEST_DIR := public/assets/img/svg
|
SVG_DEST_DIR := public/img/svg
|
||||||
|
|
||||||
AIR_TMP_DIR := .air
|
AIR_TMP_DIR := .air
|
||||||
|
|
||||||
@@ -197,10 +203,10 @@ help:
|
|||||||
@echo " - clean delete backend and integration files"
|
@echo " - clean delete backend and integration files"
|
||||||
@echo " - clean-all delete backend, frontend and integration files"
|
@echo " - clean-all delete backend, frontend and integration files"
|
||||||
@echo " - deps install dependencies"
|
@echo " - deps install dependencies"
|
||||||
|
@echo " - deps-docs install docs dependencies"
|
||||||
@echo " - deps-frontend install frontend dependencies"
|
@echo " - deps-frontend install frontend dependencies"
|
||||||
@echo " - deps-backend install backend dependencies"
|
@echo " - deps-backend install backend dependencies"
|
||||||
@echo " - deps-tools install tool dependencies"
|
@echo " - deps-tools install tool dependencies"
|
||||||
@echo " - deps-py install python dependencies"
|
|
||||||
@echo " - lint lint everything"
|
@echo " - lint lint everything"
|
||||||
@echo " - lint-fix lint everything and fix issues"
|
@echo " - lint-fix lint everything and fix issues"
|
||||||
@echo " - lint-actions lint action workflow files"
|
@echo " - lint-actions lint action workflow files"
|
||||||
@@ -217,8 +223,6 @@ help:
|
|||||||
@echo " - lint-css-fix lint css files and fix issues"
|
@echo " - lint-css-fix lint css files and fix issues"
|
||||||
@echo " - lint-md lint markdown files"
|
@echo " - lint-md lint markdown files"
|
||||||
@echo " - lint-swagger lint swagger files"
|
@echo " - lint-swagger lint swagger files"
|
||||||
@echo " - lint-templates lint template files"
|
|
||||||
@echo " - lint-yaml lint yaml files"
|
|
||||||
@echo " - checks run various consistency checks"
|
@echo " - checks run various consistency checks"
|
||||||
@echo " - checks-frontend check frontend files"
|
@echo " - checks-frontend check frontend files"
|
||||||
@echo " - checks-backend check backend files"
|
@echo " - checks-backend check backend files"
|
||||||
@@ -226,9 +230,6 @@ help:
|
|||||||
@echo " - test-frontend test frontend files"
|
@echo " - test-frontend test frontend files"
|
||||||
@echo " - test-backend test backend files"
|
@echo " - test-backend test backend files"
|
||||||
@echo " - test-e2e[\#TestSpecificName] test end to end using playwright"
|
@echo " - test-e2e[\#TestSpecificName] test end to end using playwright"
|
||||||
@echo " - update update js and py dependencies"
|
|
||||||
@echo " - update-js update js dependencies"
|
|
||||||
@echo " - update-py update py dependencies"
|
|
||||||
@echo " - webpack build webpack files"
|
@echo " - webpack build webpack files"
|
||||||
@echo " - svg build svg files"
|
@echo " - svg build svg files"
|
||||||
@echo " - fomantic build fomantic files"
|
@echo " - fomantic build fomantic files"
|
||||||
@@ -361,10 +362,10 @@ lint: lint-frontend lint-backend
|
|||||||
lint-fix: lint-frontend-fix lint-backend-fix
|
lint-fix: lint-frontend-fix lint-backend-fix
|
||||||
|
|
||||||
.PHONY: lint-frontend
|
.PHONY: lint-frontend
|
||||||
lint-frontend: lint-js lint-css
|
lint-frontend: lint-js lint-css lint-md lint-swagger
|
||||||
|
|
||||||
.PHONY: lint-frontend-fix
|
.PHONY: lint-frontend-fix
|
||||||
lint-frontend-fix: lint-js-fix lint-css-fix
|
lint-frontend-fix: lint-js-fix lint-css-fix lint-md lint-swagger
|
||||||
|
|
||||||
.PHONY: lint-backend
|
.PHONY: lint-backend
|
||||||
lint-backend: lint-go lint-go-vet lint-editorconfig
|
lint-backend: lint-go lint-go-vet lint-editorconfig
|
||||||
@@ -374,11 +375,11 @@ lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig
|
|||||||
|
|
||||||
.PHONY: lint-js
|
.PHONY: lint-js
|
||||||
lint-js: node_modules
|
lint-js: node_modules
|
||||||
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js tests/e2e
|
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e
|
||||||
|
|
||||||
.PHONY: lint-js-fix
|
.PHONY: lint-js-fix
|
||||||
lint-js-fix: node_modules
|
lint-js-fix: node_modules
|
||||||
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js tests/e2e --fix
|
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e --fix
|
||||||
|
|
||||||
.PHONY: lint-css
|
.PHONY: lint-css
|
||||||
lint-css: node_modules
|
lint-css: node_modules
|
||||||
@@ -425,14 +426,6 @@ lint-editorconfig:
|
|||||||
lint-actions:
|
lint-actions:
|
||||||
$(GO) run $(ACTIONLINT_PACKAGE)
|
$(GO) run $(ACTIONLINT_PACKAGE)
|
||||||
|
|
||||||
.PHONY: lint-templates
|
|
||||||
lint-templates: .venv
|
|
||||||
@poetry run djlint $(shell find templates -type f -iname '*.tmpl')
|
|
||||||
|
|
||||||
.PHONY: lint-yaml
|
|
||||||
lint-yaml: .venv
|
|
||||||
@poetry run yamllint .
|
|
||||||
|
|
||||||
.PHONY: watch
|
.PHONY: watch
|
||||||
watch:
|
watch:
|
||||||
@bash build/watch.sh
|
@bash build/watch.sh
|
||||||
@@ -847,18 +840,30 @@ release-windows: | $(DIST_DIRS)
|
|||||||
ifeq (,$(findstring gogit,$(TAGS)))
|
ifeq (,$(findstring gogit,$(TAGS)))
|
||||||
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo gogit $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo gogit $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
|
||||||
endif
|
endif
|
||||||
|
ifneq ($(DRONE_TAG),)
|
||||||
|
cp /build/* $(DIST)/binaries
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: release-linux
|
.PHONY: release-linux
|
||||||
release-linux: | $(DIST_DIRS)
|
release-linux: | $(DIST_DIRS)
|
||||||
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
|
||||||
|
ifneq ($(DRONE_TAG),)
|
||||||
|
cp /build/* $(DIST)/binaries
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: release-darwin
|
.PHONY: release-darwin
|
||||||
release-darwin: | $(DIST_DIRS)
|
release-darwin: | $(DIST_DIRS)
|
||||||
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
|
||||||
|
ifneq ($(DRONE_TAG),)
|
||||||
|
cp /build/* $(DIST)/binaries
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: release-freebsd
|
.PHONY: release-freebsd
|
||||||
release-freebsd: | $(DIST_DIRS)
|
release-freebsd: | $(DIST_DIRS)
|
||||||
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'freebsd/amd64' -out gitea-$(VERSION) .
|
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'freebsd/amd64' -out gitea-$(VERSION) .
|
||||||
|
ifneq ($(DRONE_TAG),)
|
||||||
|
cp /build/* $(DIST)/binaries
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: release-copy
|
.PHONY: release-copy
|
||||||
release-copy: | $(DIST_DIRS)
|
release-copy: | $(DIST_DIRS)
|
||||||
@@ -870,7 +875,7 @@ release-check: | $(DIST_DIRS)
|
|||||||
|
|
||||||
.PHONY: release-compress
|
.PHONY: release-compress
|
||||||
release-compress: | $(DIST_DIRS)
|
release-compress: | $(DIST_DIRS)
|
||||||
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && $(GO) run $(GXZ_PACKAGE) -k -9 $${file}; done;
|
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && $(GO) run $(GXZ_PAGAGE) -k -9 $${file}; done;
|
||||||
|
|
||||||
.PHONY: release-sources
|
.PHONY: release-sources
|
||||||
release-sources: | $(DIST_DIRS)
|
release-sources: | $(DIST_DIRS)
|
||||||
@@ -884,17 +889,20 @@ release-sources: | $(DIST_DIRS)
|
|||||||
|
|
||||||
.PHONY: release-docs
|
.PHONY: release-docs
|
||||||
release-docs: | $(DIST_DIRS) docs
|
release-docs: | $(DIST_DIRS) docs
|
||||||
tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs .
|
tar -czf $(DIST)/release/gitea-docs-$(VERSION).tar.gz -C ./docs/public .
|
||||||
|
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs:
|
docs: deps-docs
|
||||||
cd docs; bash scripts/trans-copy.sh;
|
cd docs; make trans-copy clean build-offline;
|
||||||
|
|
||||||
|
.PHONY: deps-docs
|
||||||
|
deps-docs:
|
||||||
|
@hash hugo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
|
||||||
|
curl -sL https://github.com/gohugoio/hugo/releases/download/v$(HUGO_VERSION)/hugo_$(HUGO_VERSION)_Linux-64bit.tar.gz | tar zxf - -C /tmp && mkdir -p ~/go/bin && mv /tmp/hugo ~/go/bin/hugo && chmod +x ~/go/bin/hugo; \
|
||||||
|
fi
|
||||||
|
|
||||||
.PHONY: deps
|
.PHONY: deps
|
||||||
deps: deps-frontend deps-backend deps-tools deps-py
|
deps: deps-frontend deps-backend deps-tools deps-docs
|
||||||
|
|
||||||
.PHONY: deps-py
|
|
||||||
deps-py: .venv
|
|
||||||
|
|
||||||
.PHONY: deps-frontend
|
.PHONY: deps-frontend
|
||||||
deps-frontend: node_modules
|
deps-frontend: node_modules
|
||||||
@@ -909,7 +917,7 @@ deps-tools:
|
|||||||
$(GO) install $(EDITORCONFIG_CHECKER_PACKAGE)
|
$(GO) install $(EDITORCONFIG_CHECKER_PACKAGE)
|
||||||
$(GO) install $(GOFUMPT_PACKAGE)
|
$(GO) install $(GOFUMPT_PACKAGE)
|
||||||
$(GO) install $(GOLANGCI_LINT_PACKAGE)
|
$(GO) install $(GOLANGCI_LINT_PACKAGE)
|
||||||
$(GO) install $(GXZ_PACKAGE)
|
$(GO) install $(GXZ_PAGAGE)
|
||||||
$(GO) install $(MISSPELL_PACKAGE)
|
$(GO) install $(MISSPELL_PACKAGE)
|
||||||
$(GO) install $(SWAGGER_PACKAGE)
|
$(GO) install $(SWAGGER_PACKAGE)
|
||||||
$(GO) install $(XGO_PACKAGE)
|
$(GO) install $(XGO_PACKAGE)
|
||||||
@@ -921,27 +929,13 @@ node_modules: package-lock.json
|
|||||||
npm install --no-save
|
npm install --no-save
|
||||||
@touch node_modules
|
@touch node_modules
|
||||||
|
|
||||||
.venv: poetry.lock
|
.PHONY: npm-update
|
||||||
poetry install --no-root
|
npm-update: node-check | node_modules
|
||||||
@touch .venv
|
npx updates -cu
|
||||||
|
|
||||||
.PHONY: update
|
|
||||||
update: update-js update-py
|
|
||||||
|
|
||||||
.PHONY: update-js
|
|
||||||
update-js: node-check | node_modules
|
|
||||||
npx updates -u -f package.json
|
|
||||||
rm -rf node_modules package-lock.json
|
rm -rf node_modules package-lock.json
|
||||||
npm install --package-lock
|
npm install --package-lock
|
||||||
@touch node_modules
|
@touch node_modules
|
||||||
|
|
||||||
.PHONY: update-py
|
|
||||||
update-py: node-check | node_modules
|
|
||||||
npx updates -u -f pyproject.toml
|
|
||||||
rm -rf .venv poetry.lock
|
|
||||||
poetry install
|
|
||||||
@touch .venv
|
|
||||||
|
|
||||||
.PHONY: fomantic
|
.PHONY: fomantic
|
||||||
fomantic:
|
fomantic:
|
||||||
rm -rf $(FOMANTIC_WORK_DIR)/build
|
rm -rf $(FOMANTIC_WORK_DIR)/build
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -1,6 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://gitea.io/">
|
<a href="https://gitea.io/">
|
||||||
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/assets/img/gitea.svg" width="220"/>
|
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/img/gitea.svg" width="220"/>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center">Gitea - Git with a cup of tea</h1>
|
<h1 align="center">Gitea - Git with a cup of tea</h1>
|
||||||
@@ -64,7 +64,7 @@ architectures that are supported by Go, including Linux, macOS, and
|
|||||||
Windows on x86, amd64, ARM and PowerPC architectures.
|
Windows on x86, amd64, ARM and PowerPC architectures.
|
||||||
You can try it out using [the online demo](https://try.gitea.io/).
|
You can try it out using [the online demo](https://try.gitea.io/).
|
||||||
This project has been
|
This project has been
|
||||||
[forked](https://blog.gitea.com/welcome-to-gitea/) from
|
[forked](https://blog.gitea.io/2016/12/welcome-to-gitea/) from
|
||||||
[Gogs](https://gogs.io) since November of 2016, but a lot has changed.
|
[Gogs](https://gogs.io) since November of 2016, but a lot has changed.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
@@ -79,14 +79,14 @@ or if SQLite support is required:
|
|||||||
|
|
||||||
The `build` target is split into two sub-targets:
|
The `build` target is split into two sub-targets:
|
||||||
|
|
||||||
- `make backend` which requires [Go Stable](https://go.dev/dl/), the required version is defined in [go.mod](/go.mod).
|
- `make backend` which requires [Go Stable](https://go.dev/dl/), required version is defined in [go.mod](/go.mod).
|
||||||
- `make frontend` which requires [Node.js LTS](https://nodejs.org/en/download/) or greater.
|
- `make frontend` which requires [Node.js LTS](https://nodejs.org/en/download/) or greater and Internet connectivity to download npm dependencies.
|
||||||
|
|
||||||
Internet connectivity is required to download the go and npm modules. When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js.
|
When building from the official source tarballs which include pre-built frontend files, the `frontend` target will not be triggered, making it possible to build without Node.js and Internet connectivity.
|
||||||
|
|
||||||
Parallelism (`make -j <num>`) is not supported.
|
Parallelism (`make -j <num>`) is not supported.
|
||||||
|
|
||||||
More info: https://docs.gitea.com/installation/install-from-source
|
More info: https://docs.gitea.io/en-us/install-from-source/
|
||||||
|
|
||||||
## Using
|
## Using
|
||||||
|
|
||||||
@@ -110,17 +110,19 @@ Translations are done through Crowdin. If you want to translate to a new languag
|
|||||||
|
|
||||||
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up.
|
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up.
|
||||||
|
|
||||||
https://docs.gitea.com/contributing/localization
|
https://docs.gitea.io/en-us/contributing/translation-guidelines/
|
||||||
|
|
||||||
[](https://crowdin.com/project/gitea)
|
[](https://crowdin.com/project/gitea)
|
||||||
|
|
||||||
## Further information
|
## Further information
|
||||||
|
|
||||||
For more information and instructions about how to install Gitea, please look at our [documentation](https://docs.gitea.com/).
|
For more information and instructions about how to install Gitea, please look at our [documentation](https://docs.gitea.io/en-us/).
|
||||||
If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/).
|
If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/).
|
||||||
|
|
||||||
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
|
We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea).
|
||||||
|
|
||||||
|
The Hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme).
|
||||||
|
|
||||||
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
|
The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea).
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
@@ -149,6 +151,7 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|||||||
<a href="https://opencollective.com/gitea/sponsor/7/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/7/avatar.svg"></a>
|
<a href="https://opencollective.com/gitea/sponsor/7/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/7/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/gitea/sponsor/8/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/8/avatar.svg"></a>
|
<a href="https://opencollective.com/gitea/sponsor/8/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/8/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/gitea/sponsor/9/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/9/avatar.svg"></a>
|
<a href="https://opencollective.com/gitea/sponsor/9/website" target="_blank"><img src="https://opencollective.com/gitea/sponsor/9/avatar.svg"></a>
|
||||||
|
<a href="https://cynkra.com/" target="_blank"><img src="https://images.opencollective.com/cynkra/logo/square/64/192.png"></a>
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://gitea.io/">
|
<a href="https://gitea.io/">
|
||||||
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/assets/img/gitea.svg" width="220"/>
|
<img alt="Gitea" src="https://raw.githubusercontent.com/go-gitea/gitea/main/public/img/gitea.svg" width="220"/>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center">Gitea - Git with a cup of tea</h1>
|
<h1 align="center">Gitea - Git with a cup of tea</h1>
|
||||||
@@ -68,7 +68,7 @@ Gitea 的首要目标是创建一个极易安装,运行非常快速,安装
|
|||||||
|
|
||||||
## 文档
|
## 文档
|
||||||
|
|
||||||
关于如何安装请访问我们的 [文档站](https://docs.gitea.com/zh-cn/category/installation),如果没有找到对应的文档,你也可以通过 [Discord - 英文](https://discord.gg/gitea) 和 QQ群 328432459 来和我们交流。
|
关于如何安装请访问我们的 [文档站](https://docs.gitea.io/zh-cn/),如果没有找到对应的文档,你也可以通过 [Discord - 英文](https://discord.gg/gitea) 和 QQ群 328432459 来和我们交流。
|
||||||
|
|
||||||
## 贡献流程
|
## 贡献流程
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ The Gitea maintainers take security seriously.
|
|||||||
|
|
||||||
If you discover a security issue, please bring it to their attention right away!
|
If you discover a security issue, please bring it to their attention right away!
|
||||||
|
|
||||||
Previous vulnerabilities are listed at https://about.gitea.com/security.
|
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
Please **DO NOT** file a public issue, instead send your report privately to `security@gitea.io`.
|
Please **DO NOT** file a public issue, instead send your report privately to `security@gitea.io`.
|
||||||
|
|||||||
2
assets/emoji.json
generated
2
assets/emoji.json
generated
File diff suppressed because one or more lines are too long
100
assets/go-licenses.json
generated
100
assets/go-licenses.json
generated
File diff suppressed because one or more lines are too long
@@ -12,7 +12,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/container"
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ func main() {
|
|||||||
|
|
||||||
// use old en-US as the base, and copy the new translations to the old locales
|
// use old en-US as the base, and copy the new translations to the old locales
|
||||||
enUsOld := inisOld["options/locale/locale_en-US.ini"]
|
enUsOld := inisOld["options/locale/locale_en-US.ini"]
|
||||||
brokenWarned := make(container.Set[string])
|
brokenWarned := map[string]bool{}
|
||||||
for path, iniOld := range inisOld {
|
for path, iniOld := range inisOld {
|
||||||
if iniOld == enUsOld {
|
if iniOld == enUsOld {
|
||||||
continue
|
continue
|
||||||
@@ -78,7 +77,7 @@ func main() {
|
|||||||
broken := oldStr != "" && strings.Count(oldStr, "%") != strings.Count(newStr, "%")
|
broken := oldStr != "" && strings.Count(oldStr, "%") != strings.Count(newStr, "%")
|
||||||
broken = broken || strings.Contains(oldStr, "\n") || strings.Contains(oldStr, "\n")
|
broken = broken || strings.Contains(oldStr, "\n") || strings.Contains(oldStr, "\n")
|
||||||
if broken {
|
if broken {
|
||||||
brokenWarned.Add(secOld.Name() + "." + keyEnUs.Name())
|
brokenWarned[secOld.Name()+"."+keyEnUs.Name()] = true
|
||||||
fmt.Println("----")
|
fmt.Println("----")
|
||||||
fmt.Printf("WARNING: skip broken locale: %s , [%s] %s\n", path, secEnUS.Name(), keyEnUs.Name())
|
fmt.Printf("WARNING: skip broken locale: %s , [%s] %s\n", path, secEnUS.Name(), keyEnUs.Name())
|
||||||
fmt.Printf("\told: %s\n", strings.ReplaceAll(oldStr, "\n", "\\n"))
|
fmt.Printf("\told: %s\n", strings.ReplaceAll(oldStr, "\n", "\\n"))
|
||||||
@@ -104,7 +103,7 @@ func main() {
|
|||||||
broken = broken || strings.HasPrefix(str, "`\"")
|
broken = broken || strings.HasPrefix(str, "`\"")
|
||||||
broken = broken || strings.Count(str, `"`)%2 == 1
|
broken = broken || strings.Count(str, `"`)%2 == 1
|
||||||
broken = broken || strings.Count(str, "`")%2 == 1
|
broken = broken || strings.Count(str, "`")%2 == 1
|
||||||
if broken && !brokenWarned.Contains(sec.Name()+"."+key.Name()) {
|
if broken && !brokenWarned[sec.Name()+"."+key.Name()] {
|
||||||
fmt.Printf("WARNING: found broken locale: %s , [%s] %s\n", path, sec.Name(), key.Name())
|
fmt.Printf("WARNING: found broken locale: %s , [%s] %s\n", path, sec.Name(), key.Name())
|
||||||
fmt.Printf("\tstr: %s\n", strings.ReplaceAll(str, "\n", "\\n"))
|
fmt.Printf("\tstr: %s\n", strings.ReplaceAll(str, "\n", "\\n"))
|
||||||
fmt.Println("----")
|
fmt.Println("----")
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
gemojiURL = "https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json"
|
gemojiURL = "https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json"
|
||||||
maxUnicodeVersion = 15
|
maxUnicodeVersion = 14
|
||||||
)
|
)
|
||||||
|
|
||||||
var flagOut = flag.String("o", "modules/emoji/emoji_data.go", "out")
|
var flagOut = flag.String("o", "modules/emoji/emoji_data.go", "out")
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/container"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// regexp is based on go-license, excluding README and NOTICE
|
// regexp is based on go-license, excluding README and NOTICE
|
||||||
@@ -57,14 +55,20 @@ func main() {
|
|||||||
// yml
|
// yml
|
||||||
//
|
//
|
||||||
// It could be removed once we have a better regex.
|
// It could be removed once we have a better regex.
|
||||||
excludedExt := container.SetOf(".gitignore", ".go", ".mod", ".sum", ".toml", ".yml")
|
excludedExt := map[string]bool{
|
||||||
|
".gitignore": true,
|
||||||
|
".go": true,
|
||||||
|
".mod": true,
|
||||||
|
".sum": true,
|
||||||
|
".toml": true,
|
||||||
|
".yml": true,
|
||||||
|
}
|
||||||
var paths []string
|
var paths []string
|
||||||
err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error {
|
err := filepath.WalkDir(base, func(path string, entry fs.DirEntry, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if entry.IsDir() || !licenseRe.MatchString(entry.Name()) || excludedExt.Contains(filepath.Ext(entry.Name())) {
|
if entry.IsDir() || !licenseRe.MatchString(entry.Name()) || excludedExt[filepath.Ext(entry.Name())] {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
paths = append(paths, path)
|
paths = append(paths, path)
|
||||||
|
|||||||
@@ -69,13 +69,13 @@ async function main() {
|
|||||||
const faviconSvg = await readFile(new URL('../assets/favicon.svg', import.meta.url), 'utf8');
|
const faviconSvg = await readFile(new URL('../assets/favicon.svg', import.meta.url), 'utf8');
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
generate(logoSvg, '../public/assets/img/logo.svg', {size: 32}),
|
generate(logoSvg, '../public/img/logo.svg', {size: 32}),
|
||||||
generate(logoSvg, '../public/assets/img/logo.png', {size: 512}),
|
generate(logoSvg, '../public/img/logo.png', {size: 512}),
|
||||||
generate(faviconSvg, '../public/assets/img/favicon.svg', {size: 32}),
|
generate(faviconSvg, '../public/img/favicon.svg', {size: 32}),
|
||||||
generate(faviconSvg, '../public/assets/img/favicon.png', {size: 180}),
|
generate(faviconSvg, '../public/img/favicon.png', {size: 180}),
|
||||||
generate(logoSvg, '../public/assets/img/avatar_default.png', {size: 200}),
|
generate(logoSvg, '../public/img/avatar_default.png', {size: 200}),
|
||||||
generate(logoSvg, '../public/assets/img/apple-touch-icon.png', {size: 180, bg: true}),
|
generate(logoSvg, '../public/img/apple-touch-icon.png', {size: 180, bg: true}),
|
||||||
gitea && generate(logoSvg, '../public/assets/img/gitea.svg', {size: 32}),
|
gitea && generate(logoSvg, '../public/img/gitea.svg', {size: 32}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ async function processFile(file, {prefix, fullName} = {}) {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
await writeFile(fileURLToPath(new URL(`../public/assets/img/svg/${name}.svg`, import.meta.url)), data);
|
await writeFile(fileURLToPath(new URL(`../public/img/svg/${name}.svg`, import.meta.url)), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function processFiles(pattern, opts) {
|
function processFiles(pattern, opts) {
|
||||||
@@ -53,13 +53,13 @@ function processFiles(pattern, opts) {
|
|||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
await mkdir(fileURLToPath(new URL('../public/assets/img/svg', import.meta.url)), {recursive: true});
|
await mkdir(fileURLToPath(new URL('../public/img/svg', import.meta.url)), {recursive: true});
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
...processFiles('node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
|
...processFiles('node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
|
||||||
...processFiles('web_src/svg/*.svg'),
|
...processFiles('web_src/svg/*.svg'),
|
||||||
...processFiles('public/assets/img/gitea.svg', {fullName: 'gitea-gitea'}),
|
...processFiles('public/img/gitea.svg', {fullName: 'gitea-gitea'}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,31 +9,30 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// CmdActions represents the available actions sub-commands.
|
// CmdActions represents the available actions sub-commands.
|
||||||
CmdActions = &cli.Command{
|
CmdActions = cli.Command{
|
||||||
Name: "actions",
|
Name: "actions",
|
||||||
Usage: "",
|
Usage: "",
|
||||||
Description: "Commands for managing Gitea Actions",
|
Description: "Commands for managing Gitea Actions",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
subcmdActionsGenRunnerToken,
|
subcmdActionsGenRunnerToken,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdActionsGenRunnerToken = &cli.Command{
|
subcmdActionsGenRunnerToken = cli.Command{
|
||||||
Name: "generate-runner-token",
|
Name: "generate-runner-token",
|
||||||
Usage: "Generate a new token for a runner to use to register with the server",
|
Usage: "Generate a new token for a runner to use to register with the server",
|
||||||
Action: runGenerateActionsRunnerToken,
|
Action: runGenerateActionsRunnerToken,
|
||||||
Aliases: []string{"grt"},
|
Aliases: []string{"grt"},
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "scope",
|
Name: "scope, s",
|
||||||
Aliases: []string{"s"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "{owner}[/{repo}] - leave empty for a global runner",
|
||||||
Usage: "{owner}[/{repo}] - leave empty for a global runner",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
155
cmd/admin.go
155
cmd/admin.go
@@ -5,7 +5,6 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -27,15 +26,15 @@ import (
|
|||||||
"code.gitea.io/gitea/services/auth/source/smtp"
|
"code.gitea.io/gitea/services/auth/source/smtp"
|
||||||
repo_service "code.gitea.io/gitea/services/repository"
|
repo_service "code.gitea.io/gitea/services/repository"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// CmdAdmin represents the available admin sub-command.
|
// CmdAdmin represents the available admin sub-command.
|
||||||
CmdAdmin = &cli.Command{
|
CmdAdmin = cli.Command{
|
||||||
Name: "admin",
|
Name: "admin",
|
||||||
Usage: "Command line interface to perform common administrative operations",
|
Usage: "Command line interface to perform common administrative operations",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
subcmdUser,
|
subcmdUser,
|
||||||
subcmdRepoSyncReleases,
|
subcmdRepoSyncReleases,
|
||||||
subcmdRegenerate,
|
subcmdRegenerate,
|
||||||
@@ -44,37 +43,37 @@ var (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdRepoSyncReleases = &cli.Command{
|
subcmdRepoSyncReleases = cli.Command{
|
||||||
Name: "repo-sync-releases",
|
Name: "repo-sync-releases",
|
||||||
Usage: "Synchronize repository releases with tags",
|
Usage: "Synchronize repository releases with tags",
|
||||||
Action: runRepoSyncReleases,
|
Action: runRepoSyncReleases,
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdRegenerate = &cli.Command{
|
subcmdRegenerate = cli.Command{
|
||||||
Name: "regenerate",
|
Name: "regenerate",
|
||||||
Usage: "Regenerate specific files",
|
Usage: "Regenerate specific files",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
microcmdRegenHooks,
|
microcmdRegenHooks,
|
||||||
microcmdRegenKeys,
|
microcmdRegenKeys,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdRegenHooks = &cli.Command{
|
microcmdRegenHooks = cli.Command{
|
||||||
Name: "hooks",
|
Name: "hooks",
|
||||||
Usage: "Regenerate git-hooks",
|
Usage: "Regenerate git-hooks",
|
||||||
Action: runRegenerateHooks,
|
Action: runRegenerateHooks,
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdRegenKeys = &cli.Command{
|
microcmdRegenKeys = cli.Command{
|
||||||
Name: "keys",
|
Name: "keys",
|
||||||
Usage: "Regenerate authorized_keys file",
|
Usage: "Regenerate authorized_keys file",
|
||||||
Action: runRegenerateKeys,
|
Action: runRegenerateKeys,
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdAuth = &cli.Command{
|
subcmdAuth = cli.Command{
|
||||||
Name: "auth",
|
Name: "auth",
|
||||||
Usage: "Modify external auth providers",
|
Usage: "Modify external auth providers",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
microcmdAuthAddOauth,
|
microcmdAuthAddOauth,
|
||||||
microcmdAuthUpdateOauth,
|
microcmdAuthUpdateOauth,
|
||||||
cmdAuthAddLdapBindDn,
|
cmdAuthAddLdapBindDn,
|
||||||
@@ -88,44 +87,44 @@ var (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdAuthList = &cli.Command{
|
microcmdAuthList = cli.Command{
|
||||||
Name: "list",
|
Name: "list",
|
||||||
Usage: "List auth sources",
|
Usage: "List auth sources",
|
||||||
Action: runListAuth,
|
Action: runListAuth,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "min-width",
|
Name: "min-width",
|
||||||
Usage: "Minimal cell width including any padding for the formatted table",
|
Usage: "Minimal cell width including any padding for the formatted table",
|
||||||
Value: 0,
|
Value: 0,
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "tab-width",
|
Name: "tab-width",
|
||||||
Usage: "width of tab characters in formatted table (equivalent number of spaces)",
|
Usage: "width of tab characters in formatted table (equivalent number of spaces)",
|
||||||
Value: 8,
|
Value: 8,
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "padding",
|
Name: "padding",
|
||||||
Usage: "padding added to a cell before computing its width",
|
Usage: "padding added to a cell before computing its width",
|
||||||
Value: 1,
|
Value: 1,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "pad-char",
|
Name: "pad-char",
|
||||||
Usage: `ASCII char used for padding if padchar == '\\t', the Writer will assume that the width of a '\\t' in the formatted output is tabwidth, and cells are left-aligned independent of align_left (for correct-looking results, tabwidth must correspond to the tab width in the viewer displaying the result)`,
|
Usage: `ASCII char used for padding if padchar == '\\t', the Writer will assume that the width of a '\\t' in the formatted output is tabwidth, and cells are left-aligned independent of align_left (for correct-looking results, tabwidth must correspond to the tab width in the viewer displaying the result)`,
|
||||||
Value: "\t",
|
Value: "\t",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "vertical-bars",
|
Name: "vertical-bars",
|
||||||
Usage: "Set to true to print vertical bars between columns",
|
Usage: "Set to true to print vertical bars between columns",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
idFlag = &cli.Int64Flag{
|
idFlag = cli.Int64Flag{
|
||||||
Name: "id",
|
Name: "id",
|
||||||
Usage: "ID of authentication source",
|
Usage: "ID of authentication source",
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdAuthDelete = &cli.Command{
|
microcmdAuthDelete = cli.Command{
|
||||||
Name: "delete",
|
Name: "delete",
|
||||||
Usage: "Delete specific auth source",
|
Usage: "Delete specific auth source",
|
||||||
Flags: []cli.Flag{idFlag},
|
Flags: []cli.Flag{idFlag},
|
||||||
@@ -133,213 +132,207 @@ var (
|
|||||||
}
|
}
|
||||||
|
|
||||||
oauthCLIFlags = []cli.Flag{
|
oauthCLIFlags = []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Application Name",
|
Usage: "Application Name",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "provider",
|
Name: "provider",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "OAuth2 Provider",
|
Usage: "OAuth2 Provider",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "key",
|
Name: "key",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Client ID (Key)",
|
Usage: "Client ID (Key)",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "secret",
|
Name: "secret",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Client Secret",
|
Usage: "Client Secret",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "auto-discover-url",
|
Name: "auto-discover-url",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider)",
|
Usage: "OpenID Connect Auto Discovery URL (only required when using OpenID Connect as provider)",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "use-custom-urls",
|
Name: "use-custom-urls",
|
||||||
Value: "false",
|
Value: "false",
|
||||||
Usage: "Use custom URLs for GitLab/GitHub OAuth endpoints",
|
Usage: "Use custom URLs for GitLab/GitHub OAuth endpoints",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "custom-tenant-id",
|
Name: "custom-tenant-id",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Use custom Tenant ID for OAuth endpoints",
|
Usage: "Use custom Tenant ID for OAuth endpoints",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "custom-auth-url",
|
Name: "custom-auth-url",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Use a custom Authorization URL (option for GitLab/GitHub)",
|
Usage: "Use a custom Authorization URL (option for GitLab/GitHub)",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "custom-token-url",
|
Name: "custom-token-url",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Use a custom Token URL (option for GitLab/GitHub)",
|
Usage: "Use a custom Token URL (option for GitLab/GitHub)",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "custom-profile-url",
|
Name: "custom-profile-url",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Use a custom Profile URL (option for GitLab/GitHub)",
|
Usage: "Use a custom Profile URL (option for GitLab/GitHub)",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "custom-email-url",
|
Name: "custom-email-url",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Use a custom Email URL (option for GitHub)",
|
Usage: "Use a custom Email URL (option for GitHub)",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "icon-url",
|
Name: "icon-url",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Custom icon URL for OAuth2 login source",
|
Usage: "Custom icon URL for OAuth2 login source",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-local-2fa",
|
Name: "skip-local-2fa",
|
||||||
Usage: "Set to true to skip local 2fa for users authenticated by this source",
|
Usage: "Set to true to skip local 2fa for users authenticated by this source",
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "scopes",
|
Name: "scopes",
|
||||||
Value: nil,
|
Value: nil,
|
||||||
Usage: "Scopes to request when to authenticate against this OAuth2 source",
|
Usage: "Scopes to request when to authenticate against this OAuth2 source",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "required-claim-name",
|
Name: "required-claim-name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Claim name that has to be set to allow users to login with this source",
|
Usage: "Claim name that has to be set to allow users to login with this source",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "required-claim-value",
|
Name: "required-claim-value",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Claim value that has to be set to allow users to login with this source",
|
Usage: "Claim value that has to be set to allow users to login with this source",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "group-claim-name",
|
Name: "group-claim-name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Claim name providing group names for this source",
|
Usage: "Claim name providing group names for this source",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "admin-group",
|
Name: "admin-group",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Group Claim value for administrator users",
|
Usage: "Group Claim value for administrator users",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "restricted-group",
|
Name: "restricted-group",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Group Claim value for restricted users",
|
Usage: "Group Claim value for restricted users",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "group-team-map",
|
Name: "group-team-map",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "JSON mapping between groups and org teams",
|
Usage: "JSON mapping between groups and org teams",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "group-team-map-removal",
|
Name: "group-team-map-removal",
|
||||||
Usage: "Activate automatic team membership removal depending on groups",
|
Usage: "Activate automatic team membership removal depending on groups",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdAuthUpdateOauth = &cli.Command{
|
microcmdAuthUpdateOauth = cli.Command{
|
||||||
Name: "update-oauth",
|
Name: "update-oauth",
|
||||||
Usage: "Update existing Oauth authentication source",
|
Usage: "Update existing Oauth authentication source",
|
||||||
Action: runUpdateOauth,
|
Action: runUpdateOauth,
|
||||||
Flags: append(oauthCLIFlags[:1], append([]cli.Flag{idFlag}, oauthCLIFlags[1:]...)...),
|
Flags: append(oauthCLIFlags[:1], append([]cli.Flag{idFlag}, oauthCLIFlags[1:]...)...),
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdAuthAddOauth = &cli.Command{
|
microcmdAuthAddOauth = cli.Command{
|
||||||
Name: "add-oauth",
|
Name: "add-oauth",
|
||||||
Usage: "Add new Oauth authentication source",
|
Usage: "Add new Oauth authentication source",
|
||||||
Action: runAddOauth,
|
Action: runAddOauth,
|
||||||
Flags: oauthCLIFlags,
|
Flags: oauthCLIFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdSendMail = &cli.Command{
|
subcmdSendMail = cli.Command{
|
||||||
Name: "sendmail",
|
Name: "sendmail",
|
||||||
Usage: "Send a message to all users",
|
Usage: "Send a message to all users",
|
||||||
Action: runSendMail,
|
Action: runSendMail,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "title",
|
Name: "title",
|
||||||
Usage: `a title of a message`,
|
Usage: `a title of a message`,
|
||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "content",
|
Name: "content",
|
||||||
Usage: "a content of a message",
|
Usage: "a content of a message",
|
||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "force",
|
Name: "force,f",
|
||||||
Aliases: []string{"f"},
|
Usage: "A flag to bypass a confirmation step",
|
||||||
Usage: "A flag to bypass a confirmation step",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
smtpCLIFlags = []cli.Flag{
|
smtpCLIFlags = []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Application Name",
|
Usage: "Application Name",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "auth-type",
|
Name: "auth-type",
|
||||||
Value: "PLAIN",
|
Value: "PLAIN",
|
||||||
Usage: "SMTP Authentication Type (PLAIN/LOGIN/CRAM-MD5) default PLAIN",
|
Usage: "SMTP Authentication Type (PLAIN/LOGIN/CRAM-MD5) default PLAIN",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "host",
|
Name: "host",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "SMTP Host",
|
Usage: "SMTP Host",
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "port",
|
Name: "port",
|
||||||
Usage: "SMTP Port",
|
Usage: "SMTP Port",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolTFlag{
|
||||||
Name: "force-smtps",
|
Name: "force-smtps",
|
||||||
Usage: "SMTPS is always used on port 465. Set this to force SMTPS on other ports.",
|
Usage: "SMTPS is always used on port 465. Set this to force SMTPS on other ports.",
|
||||||
Value: true,
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolTFlag{
|
||||||
Name: "skip-verify",
|
Name: "skip-verify",
|
||||||
Usage: "Skip TLS verify.",
|
Usage: "Skip TLS verify.",
|
||||||
Value: true,
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "helo-hostname",
|
Name: "helo-hostname",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Hostname sent with HELO. Leave blank to send current hostname",
|
Usage: "Hostname sent with HELO. Leave blank to send current hostname",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolTFlag{
|
||||||
Name: "disable-helo",
|
Name: "disable-helo",
|
||||||
Usage: "Disable SMTP helo.",
|
Usage: "Disable SMTP helo.",
|
||||||
Value: true,
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "allowed-domains",
|
Name: "allowed-domains",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Leave empty to allow all domains. Separate multiple domains with a comma (',')",
|
Usage: "Leave empty to allow all domains. Separate multiple domains with a comma (',')",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolTFlag{
|
||||||
Name: "skip-local-2fa",
|
Name: "skip-local-2fa",
|
||||||
Usage: "Skip 2FA to log on.",
|
Usage: "Skip 2FA to log on.",
|
||||||
Value: true,
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolTFlag{
|
||||||
Name: "active",
|
Name: "active",
|
||||||
Usage: "This Authentication Source is Activated.",
|
Usage: "This Authentication Source is Activated.",
|
||||||
Value: true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdAuthAddSMTP = &cli.Command{
|
microcmdAuthAddSMTP = cli.Command{
|
||||||
Name: "add-smtp",
|
Name: "add-smtp",
|
||||||
Usage: "Add new SMTP authentication source",
|
Usage: "Add new SMTP authentication source",
|
||||||
Action: runAddSMTP,
|
Action: runAddSMTP,
|
||||||
Flags: smtpCLIFlags,
|
Flags: smtpCLIFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdAuthUpdateSMTP = &cli.Command{
|
microcmdAuthUpdateSMTP = cli.Command{
|
||||||
Name: "update-smtp",
|
Name: "update-smtp",
|
||||||
Usage: "Update existing SMTP authentication source",
|
Usage: "Update existing SMTP authentication source",
|
||||||
Action: runUpdateSMTP,
|
Action: runUpdateSMTP,
|
||||||
@@ -355,10 +348,6 @@ func runRepoSyncReleases(_ *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := git.InitSimple(ctx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Trace("Synchronizing repository releases (this may take a while)")
|
log.Trace("Synchronizing repository releases (this may take a while)")
|
||||||
for page := 1; ; page++ {
|
for page := 1; ; page++ {
|
||||||
repos, count, err := repo_model.SearchRepositoryByName(ctx, &repo_model.SearchRepoOptions{
|
repos, count, err := repo_model.SearchRepositoryByName(ctx, &repo_model.SearchRepoOptions{
|
||||||
@@ -383,19 +372,19 @@ func runRepoSyncReleases(_ *cli.Context) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
oldnum, err := getReleaseCount(ctx, repo.ID)
|
oldnum, err := getReleaseCount(repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(" GetReleaseCountByRepoID: %v", err)
|
log.Warn(" GetReleaseCountByRepoID: %v", err)
|
||||||
}
|
}
|
||||||
log.Trace(" currentNumReleases is %d, running SyncReleasesWithTags", oldnum)
|
log.Trace(" currentNumReleases is %d, running SyncReleasesWithTags", oldnum)
|
||||||
|
|
||||||
if err = repo_module.SyncReleasesWithTags(ctx, repo, gitRepo); err != nil {
|
if err = repo_module.SyncReleasesWithTags(repo, gitRepo); err != nil {
|
||||||
log.Warn(" SyncReleasesWithTags: %v", err)
|
log.Warn(" SyncReleasesWithTags: %v", err)
|
||||||
gitRepo.Close()
|
gitRepo.Close()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
count, err = getReleaseCount(ctx, repo.ID)
|
count, err = getReleaseCount(repo.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(" GetReleaseCountByRepoID: %v", err)
|
log.Warn(" GetReleaseCountByRepoID: %v", err)
|
||||||
gitRepo.Close()
|
gitRepo.Close()
|
||||||
@@ -411,9 +400,9 @@ func runRepoSyncReleases(_ *cli.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getReleaseCount(ctx context.Context, id int64) (int64, error) {
|
func getReleaseCount(id int64) (int64, error) {
|
||||||
return repo_model.GetReleaseCountByRepoID(
|
return repo_model.GetReleaseCountByRepoID(
|
||||||
ctx,
|
db.DefaultContext,
|
||||||
id,
|
id,
|
||||||
repo_model.FindReleasesOptions{
|
repo_model.FindReleasesOptions{
|
||||||
IncludeTags: true,
|
IncludeTags: true,
|
||||||
@@ -438,7 +427,7 @@ func runRegenerateKeys(_ *cli.Context) error {
|
|||||||
if err := initDB(ctx); err != nil {
|
if err := initDB(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return asymkey_model.RewriteAllPublicKeys(ctx)
|
return asymkey_model.RewriteAllPublicKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseOAuth2Config(c *cli.Context) *oauth2.Source {
|
func parseOAuth2Config(c *cli.Context) *oauth2.Source {
|
||||||
@@ -622,19 +611,19 @@ func parseSMTPConfig(c *cli.Context, conf *smtp.Source) error {
|
|||||||
conf.AllowedDomains = c.String("allowed-domains")
|
conf.AllowedDomains = c.String("allowed-domains")
|
||||||
}
|
}
|
||||||
if c.IsSet("force-smtps") {
|
if c.IsSet("force-smtps") {
|
||||||
conf.ForceSMTPS = c.Bool("force-smtps")
|
conf.ForceSMTPS = c.BoolT("force-smtps")
|
||||||
}
|
}
|
||||||
if c.IsSet("skip-verify") {
|
if c.IsSet("skip-verify") {
|
||||||
conf.SkipVerify = c.Bool("skip-verify")
|
conf.SkipVerify = c.BoolT("skip-verify")
|
||||||
}
|
}
|
||||||
if c.IsSet("helo-hostname") {
|
if c.IsSet("helo-hostname") {
|
||||||
conf.HeloHostname = c.String("helo-hostname")
|
conf.HeloHostname = c.String("helo-hostname")
|
||||||
}
|
}
|
||||||
if c.IsSet("disable-helo") {
|
if c.IsSet("disable-helo") {
|
||||||
conf.DisableHelo = c.Bool("disable-helo")
|
conf.DisableHelo = c.BoolT("disable-helo")
|
||||||
}
|
}
|
||||||
if c.IsSet("skip-local-2fa") {
|
if c.IsSet("skip-local-2fa") {
|
||||||
conf.SkipLocalTwoFA = c.Bool("skip-local-2fa")
|
conf.SkipLocalTwoFA = c.BoolT("skip-local-2fa")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -658,7 +647,7 @@ func runAddSMTP(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
active := true
|
active := true
|
||||||
if c.IsSet("active") {
|
if c.IsSet("active") {
|
||||||
active = c.Bool("active")
|
active = c.BoolT("active")
|
||||||
}
|
}
|
||||||
|
|
||||||
var smtpConfig smtp.Source
|
var smtpConfig smtp.Source
|
||||||
@@ -707,7 +696,7 @@ func runUpdateSMTP(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if c.IsSet("active") {
|
if c.IsSet("active") {
|
||||||
source.IsActive = c.Bool("active")
|
source.IsActive = c.BoolT("active")
|
||||||
}
|
}
|
||||||
|
|
||||||
source.Cfg = smtpConfig
|
source.Cfg = smtpConfig
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"code.gitea.io/gitea/models/auth"
|
"code.gitea.io/gitea/models/auth"
|
||||||
"code.gitea.io/gitea/services/auth/source/ldap"
|
"code.gitea.io/gitea/services/auth/source/ldap"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -25,117 +25,117 @@ type (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
commonLdapCLIFlags = []cli.Flag{
|
commonLdapCLIFlags = []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Usage: "Authentication name.",
|
Usage: "Authentication name.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "not-active",
|
Name: "not-active",
|
||||||
Usage: "Deactivate the authentication source.",
|
Usage: "Deactivate the authentication source.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "active",
|
Name: "active",
|
||||||
Usage: "Activate the authentication source.",
|
Usage: "Activate the authentication source.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "security-protocol",
|
Name: "security-protocol",
|
||||||
Usage: "Security protocol name.",
|
Usage: "Security protocol name.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-tls-verify",
|
Name: "skip-tls-verify",
|
||||||
Usage: "Disable TLS verification.",
|
Usage: "Disable TLS verification.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "host",
|
Name: "host",
|
||||||
Usage: "The address where the LDAP server can be reached.",
|
Usage: "The address where the LDAP server can be reached.",
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "port",
|
Name: "port",
|
||||||
Usage: "The port to use when connecting to the LDAP server.",
|
Usage: "The port to use when connecting to the LDAP server.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "user-search-base",
|
Name: "user-search-base",
|
||||||
Usage: "The LDAP base at which user accounts will be searched for.",
|
Usage: "The LDAP base at which user accounts will be searched for.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "user-filter",
|
Name: "user-filter",
|
||||||
Usage: "An LDAP filter declaring how to find the user record that is attempting to authenticate.",
|
Usage: "An LDAP filter declaring how to find the user record that is attempting to authenticate.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "admin-filter",
|
Name: "admin-filter",
|
||||||
Usage: "An LDAP filter specifying if a user should be given administrator privileges.",
|
Usage: "An LDAP filter specifying if a user should be given administrator privileges.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "restricted-filter",
|
Name: "restricted-filter",
|
||||||
Usage: "An LDAP filter specifying if a user should be given restricted status.",
|
Usage: "An LDAP filter specifying if a user should be given restricted status.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "allow-deactivate-all",
|
Name: "allow-deactivate-all",
|
||||||
Usage: "Allow empty search results to deactivate all users.",
|
Usage: "Allow empty search results to deactivate all users.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username-attribute",
|
Name: "username-attribute",
|
||||||
Usage: "The attribute of the user’s LDAP record containing the user name.",
|
Usage: "The attribute of the user’s LDAP record containing the user name.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "firstname-attribute",
|
Name: "firstname-attribute",
|
||||||
Usage: "The attribute of the user’s LDAP record containing the user’s first name.",
|
Usage: "The attribute of the user’s LDAP record containing the user’s first name.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "surname-attribute",
|
Name: "surname-attribute",
|
||||||
Usage: "The attribute of the user’s LDAP record containing the user’s surname.",
|
Usage: "The attribute of the user’s LDAP record containing the user’s surname.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "email-attribute",
|
Name: "email-attribute",
|
||||||
Usage: "The attribute of the user’s LDAP record containing the user’s email address.",
|
Usage: "The attribute of the user’s LDAP record containing the user’s email address.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "public-ssh-key-attribute",
|
Name: "public-ssh-key-attribute",
|
||||||
Usage: "The attribute of the user’s LDAP record containing the user’s public ssh key.",
|
Usage: "The attribute of the user’s LDAP record containing the user’s public ssh key.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-local-2fa",
|
Name: "skip-local-2fa",
|
||||||
Usage: "Set to true to skip local 2fa for users authenticated by this source",
|
Usage: "Set to true to skip local 2fa for users authenticated by this source",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "avatar-attribute",
|
Name: "avatar-attribute",
|
||||||
Usage: "The attribute of the user’s LDAP record containing the user’s avatar.",
|
Usage: "The attribute of the user’s LDAP record containing the user’s avatar.",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
ldapBindDnCLIFlags = append(commonLdapCLIFlags,
|
ldapBindDnCLIFlags = append(commonLdapCLIFlags,
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "bind-dn",
|
Name: "bind-dn",
|
||||||
Usage: "The DN to bind to the LDAP server with when searching for the user.",
|
Usage: "The DN to bind to the LDAP server with when searching for the user.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "bind-password",
|
Name: "bind-password",
|
||||||
Usage: "The password for the Bind DN, if any.",
|
Usage: "The password for the Bind DN, if any.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "attributes-in-bind",
|
Name: "attributes-in-bind",
|
||||||
Usage: "Fetch attributes in bind DN context.",
|
Usage: "Fetch attributes in bind DN context.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "synchronize-users",
|
Name: "synchronize-users",
|
||||||
Usage: "Enable user synchronization.",
|
Usage: "Enable user synchronization.",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "disable-synchronize-users",
|
Name: "disable-synchronize-users",
|
||||||
Usage: "Disable user synchronization.",
|
Usage: "Disable user synchronization.",
|
||||||
},
|
},
|
||||||
&cli.UintFlag{
|
cli.UintFlag{
|
||||||
Name: "page-size",
|
Name: "page-size",
|
||||||
Usage: "Search page size.",
|
Usage: "Search page size.",
|
||||||
})
|
})
|
||||||
|
|
||||||
ldapSimpleAuthCLIFlags = append(commonLdapCLIFlags,
|
ldapSimpleAuthCLIFlags = append(commonLdapCLIFlags,
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "user-dn",
|
Name: "user-dn",
|
||||||
Usage: "The user’s DN.",
|
Usage: "The user’s DN.",
|
||||||
})
|
})
|
||||||
|
|
||||||
cmdAuthAddLdapBindDn = &cli.Command{
|
cmdAuthAddLdapBindDn = cli.Command{
|
||||||
Name: "add-ldap",
|
Name: "add-ldap",
|
||||||
Usage: "Add new LDAP (via Bind DN) authentication source",
|
Usage: "Add new LDAP (via Bind DN) authentication source",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
@@ -144,7 +144,7 @@ var (
|
|||||||
Flags: ldapBindDnCLIFlags,
|
Flags: ldapBindDnCLIFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdAuthUpdateLdapBindDn = &cli.Command{
|
cmdAuthUpdateLdapBindDn = cli.Command{
|
||||||
Name: "update-ldap",
|
Name: "update-ldap",
|
||||||
Usage: "Update existing LDAP (via Bind DN) authentication source",
|
Usage: "Update existing LDAP (via Bind DN) authentication source",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
@@ -153,7 +153,7 @@ var (
|
|||||||
Flags: append([]cli.Flag{idFlag}, ldapBindDnCLIFlags...),
|
Flags: append([]cli.Flag{idFlag}, ldapBindDnCLIFlags...),
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdAuthAddLdapSimpleAuth = &cli.Command{
|
cmdAuthAddLdapSimpleAuth = cli.Command{
|
||||||
Name: "add-ldap-simple",
|
Name: "add-ldap-simple",
|
||||||
Usage: "Add new LDAP (simple auth) authentication source",
|
Usage: "Add new LDAP (simple auth) authentication source",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
@@ -162,7 +162,7 @@ var (
|
|||||||
Flags: ldapSimpleAuthCLIFlags,
|
Flags: ldapSimpleAuthCLIFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdAuthUpdateLdapSimpleAuth = &cli.Command{
|
cmdAuthUpdateLdapSimpleAuth = cli.Command{
|
||||||
Name: "update-ldap-simple",
|
Name: "update-ldap-simple",
|
||||||
Usage: "Update existing LDAP (simple auth) authentication source",
|
Usage: "Update existing LDAP (simple auth) authentication source",
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"code.gitea.io/gitea/services/auth/source/ldap"
|
"code.gitea.io/gitea/services/auth/source/ldap"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAddLdapBindDn(t *testing.T) {
|
func TestAddLdapBindDn(t *testing.T) {
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var subcmdUser = &cli.Command{
|
var subcmdUser = cli.Command{
|
||||||
Name: "user",
|
Name: "user",
|
||||||
Usage: "Modify users",
|
Usage: "Modify users",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
microcmdUserCreate,
|
microcmdUserCreate,
|
||||||
microcmdUserList,
|
microcmdUserList,
|
||||||
microcmdUserChangePassword,
|
microcmdUserChangePassword,
|
||||||
|
|||||||
@@ -12,25 +12,23 @@ import (
|
|||||||
pwd "code.gitea.io/gitea/modules/auth/password"
|
pwd "code.gitea.io/gitea/modules/auth/password"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var microcmdUserChangePassword = &cli.Command{
|
var microcmdUserChangePassword = cli.Command{
|
||||||
Name: "change-password",
|
Name: "change-password",
|
||||||
Usage: "Change a user's password",
|
Usage: "Change a user's password",
|
||||||
Action: runChangePassword,
|
Action: runChangePassword,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username",
|
Name: "username,u",
|
||||||
Aliases: []string{"u"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "The user to change password for",
|
||||||
Usage: "The user to change password for",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "password",
|
Name: "password,p",
|
||||||
Aliases: []string{"p"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "New password to set for user",
|
||||||
Usage: "New password to set for user",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
auth_model "code.gitea.io/gitea/models/auth"
|
auth_model "code.gitea.io/gitea/models/auth"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
@@ -13,52 +14,52 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var microcmdUserCreate = &cli.Command{
|
var microcmdUserCreate = cli.Command{
|
||||||
Name: "create",
|
Name: "create",
|
||||||
Usage: "Create a new user in database",
|
Usage: "Create a new user in database",
|
||||||
Action: runCreateUser,
|
Action: runCreateUser,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Usage: "Username. DEPRECATED: use username instead",
|
Usage: "Username. DEPRECATED: use username instead",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username",
|
Name: "username",
|
||||||
Usage: "Username",
|
Usage: "Username",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "password",
|
Name: "password",
|
||||||
Usage: "User password",
|
Usage: "User password",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "email",
|
Name: "email",
|
||||||
Usage: "User email address",
|
Usage: "User email address",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "admin",
|
Name: "admin",
|
||||||
Usage: "User is an admin",
|
Usage: "User is an admin",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "random-password",
|
Name: "random-password",
|
||||||
Usage: "Generate a random password for the user",
|
Usage: "Generate a random password for the user",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "must-change-password",
|
Name: "must-change-password",
|
||||||
Usage: "Set this option to false to prevent forcing the user to change their password after initial login, (Default: true)",
|
Usage: "Set this option to false to prevent forcing the user to change their password after initial login, (Default: true)",
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "random-password-length",
|
Name: "random-password-length",
|
||||||
Usage: "Length of the random password to be generated",
|
Usage: "Length of the random password to be generated",
|
||||||
Value: 12,
|
Value: 12,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "access-token",
|
Name: "access-token",
|
||||||
Usage: "Generate access token for the user",
|
Usage: "Generate access token for the user",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "restricted",
|
Name: "restricted",
|
||||||
Usage: "Make a restricted user account",
|
Usage: "Make a restricted user account",
|
||||||
},
|
},
|
||||||
@@ -86,7 +87,7 @@ func runCreateUser(c *cli.Context) error {
|
|||||||
username = c.String("username")
|
username = c.String("username")
|
||||||
} else {
|
} else {
|
||||||
username = c.String("name")
|
username = c.String("name")
|
||||||
_, _ = fmt.Fprintf(c.App.ErrWriter, "--name flag is deprecated. Use --username instead.\n")
|
fmt.Fprintf(os.Stderr, "--name flag is deprecated. Use --username instead.\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := installSignals()
|
ctx, cancel := installSignals()
|
||||||
@@ -115,7 +116,7 @@ func runCreateUser(c *cli.Context) error {
|
|||||||
|
|
||||||
// If this is the first user being created.
|
// If this is the first user being created.
|
||||||
// Take it as the admin and don't force a password update.
|
// Take it as the admin and don't force a password update.
|
||||||
if n := user_model.CountUsers(ctx, nil); n == 0 {
|
if n := user_model.CountUsers(nil); n == 0 {
|
||||||
changePassword = false
|
changePassword = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +147,7 @@ func runCreateUser(c *cli.Context) error {
|
|||||||
IsRestricted: restricted,
|
IsRestricted: restricted,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := user_model.CreateUser(ctx, u, overwriteDefault); err != nil {
|
if err := user_model.CreateUser(u, overwriteDefault); err != nil {
|
||||||
return fmt.Errorf("CreateUser: %w", err)
|
return fmt.Errorf("CreateUser: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +157,7 @@ func runCreateUser(c *cli.Context) error {
|
|||||||
UID: u.ID,
|
UID: u.ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := auth_model.NewAccessToken(ctx, t); err != nil {
|
if err := auth_model.NewAccessToken(t); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,28 +11,26 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/storage"
|
"code.gitea.io/gitea/modules/storage"
|
||||||
user_service "code.gitea.io/gitea/services/user"
|
user_service "code.gitea.io/gitea/services/user"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var microcmdUserDelete = &cli.Command{
|
var microcmdUserDelete = cli.Command{
|
||||||
Name: "delete",
|
Name: "delete",
|
||||||
Usage: "Delete specific user by id, name or email",
|
Usage: "Delete specific user by id, name or email",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.Int64Flag{
|
cli.Int64Flag{
|
||||||
Name: "id",
|
Name: "id",
|
||||||
Usage: "ID of user of the user to delete",
|
Usage: "ID of user of the user to delete",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username",
|
Name: "username,u",
|
||||||
Aliases: []string{"u"},
|
Usage: "Username of the user to delete",
|
||||||
Usage: "Username of the user to delete",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "email",
|
Name: "email,e",
|
||||||
Aliases: []string{"e"},
|
Usage: "Email of the user to delete",
|
||||||
Usage: "Email of the user to delete",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "purge",
|
Name: "purge",
|
||||||
Usage: "Purge user, all their repositories, organizations and comments",
|
Usage: "Purge user, all their repositories, organizations and comments",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,29 +9,27 @@ import (
|
|||||||
auth_model "code.gitea.io/gitea/models/auth"
|
auth_model "code.gitea.io/gitea/models/auth"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var microcmdUserGenerateAccessToken = &cli.Command{
|
var microcmdUserGenerateAccessToken = cli.Command{
|
||||||
Name: "generate-access-token",
|
Name: "generate-access-token",
|
||||||
Usage: "Generate an access token for a specific user",
|
Usage: "Generate an access token for a specific user",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username",
|
Name: "username,u",
|
||||||
Aliases: []string{"u"},
|
Usage: "Username",
|
||||||
Usage: "Username",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "token-name",
|
Name: "token-name,t",
|
||||||
Aliases: []string{"t"},
|
Usage: "Token name",
|
||||||
Usage: "Token name",
|
Value: "gitea-admin",
|
||||||
Value: "gitea-admin",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "raw",
|
Name: "raw",
|
||||||
Usage: "Display only the token value",
|
Usage: "Display only the token value",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "scopes",
|
Name: "scopes",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Comma separated list of scopes to apply to access token",
|
Usage: "Comma separated list of scopes to apply to access token",
|
||||||
@@ -57,29 +55,18 @@ func runGenerateAccessToken(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// construct token with name and user so we can make sure it is unique
|
accessTokenScope, err := auth_model.AccessTokenScope(c.String("scopes")).Normalize()
|
||||||
t := &auth_model.AccessToken{
|
|
||||||
Name: c.String("token-name"),
|
|
||||||
UID: user.ID,
|
|
||||||
}
|
|
||||||
|
|
||||||
exist, err := auth_model.AccessTokenByNameExists(ctx, t)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if exist {
|
|
||||||
return fmt.Errorf("access token name has been used already")
|
t := &auth_model.AccessToken{
|
||||||
|
Name: c.String("token-name"),
|
||||||
|
UID: user.ID,
|
||||||
|
Scope: accessTokenScope,
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the scopes are valid
|
if err := auth_model.NewAccessToken(t); err != nil {
|
||||||
accessTokenScope, err := auth_model.AccessTokenScope(c.String("scopes")).Normalize()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("invalid access token scope provided: %w", err)
|
|
||||||
}
|
|
||||||
t.Scope = accessTokenScope
|
|
||||||
|
|
||||||
// create the token
|
|
||||||
if err := auth_model.NewAccessToken(ctx, t); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,15 @@ import (
|
|||||||
|
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var microcmdUserList = &cli.Command{
|
var microcmdUserList = cli.Command{
|
||||||
Name: "list",
|
Name: "list",
|
||||||
Usage: "List users",
|
Usage: "List users",
|
||||||
Action: runListUsers,
|
Action: runListUsers,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "admin",
|
Name: "admin",
|
||||||
Usage: "List only admin users",
|
Usage: "List only admin users",
|
||||||
},
|
},
|
||||||
@@ -33,7 +33,7 @@ func runListUsers(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
users, err := user_model.GetAllUsers(ctx)
|
users, err := user_model.GetAllUsers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ func runListUsers(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
twofa := user_model.UserList(users).GetTwoFaStatus(ctx)
|
twofa := user_model.UserList(users).GetTwoFaStatus()
|
||||||
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\t2FA\n")
|
fmt.Fprintf(w, "ID\tUsername\tEmail\tIsActive\tIsAdmin\t2FA\n")
|
||||||
for _, u := range users {
|
for _, u := range users {
|
||||||
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin, twofa[u.ID])
|
fmt.Fprintf(w, "%d\t%s\t%s\t%t\t%t\t%t\n", u.ID, u.Name, u.Email, u.IsActive, u.IsAdmin, twofa[u.ID])
|
||||||
|
|||||||
@@ -9,25 +9,23 @@ import (
|
|||||||
|
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var microcmdUserMustChangePassword = &cli.Command{
|
var microcmdUserMustChangePassword = cli.Command{
|
||||||
Name: "must-change-password",
|
Name: "must-change-password",
|
||||||
Usage: "Set the must change password flag for the provided users or all users",
|
Usage: "Set the must change password flag for the provided users or all users",
|
||||||
Action: runMustChangePassword,
|
Action: runMustChangePassword,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "all",
|
Name: "all,A",
|
||||||
Aliases: []string{"A"},
|
Usage: "All users must change password, except those explicitly excluded with --exclude",
|
||||||
Usage: "All users must change password, except those explicitly excluded with --exclude",
|
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "exclude",
|
Name: "exclude,e",
|
||||||
Aliases: []string{"e"},
|
Usage: "Do not change the must-change-password flag for these users",
|
||||||
Usage: "Do not change the must-change-password flag for these users",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "unset",
|
Name: "unset",
|
||||||
Usage: "Instead of setting the must-change-password flag, unset it",
|
Usage: "Instead of setting the must-change-password flag, unset it",
|
||||||
},
|
},
|
||||||
@@ -50,7 +48,7 @@ func runMustChangePassword(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
n, err := user_model.SetMustChangePassword(ctx, all, mustChangePassword, c.Args().Slice(), exclude)
|
n, err := user_model.SetMustChangePassword(ctx, all, mustChangePassword, c.Args(), exclude)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
18
cmd/cert.go
18
cmd/cert.go
@@ -20,43 +20,43 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdCert represents the available cert sub-command.
|
// CmdCert represents the available cert sub-command.
|
||||||
var CmdCert = &cli.Command{
|
var CmdCert = cli.Command{
|
||||||
Name: "cert",
|
Name: "cert",
|
||||||
Usage: "Generate self-signed certificate",
|
Usage: "Generate self-signed certificate",
|
||||||
Description: `Generate a self-signed X.509 certificate for a TLS server.
|
Description: `Generate a self-signed X.509 certificate for a TLS server.
|
||||||
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
|
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
|
||||||
Action: runCert,
|
Action: runCert,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "host",
|
Name: "host",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Comma-separated hostnames and IPs to generate a certificate for",
|
Usage: "Comma-separated hostnames and IPs to generate a certificate for",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "ecdsa-curve",
|
Name: "ecdsa-curve",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521",
|
Usage: "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521",
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "rsa-bits",
|
Name: "rsa-bits",
|
||||||
Value: 3072,
|
Value: 2048,
|
||||||
Usage: "Size of RSA key to generate. Ignored if --ecdsa-curve is set",
|
Usage: "Size of RSA key to generate. Ignored if --ecdsa-curve is set",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "start-date",
|
Name: "start-date",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Creation date formatted as Jan 1 15:04:05 2011",
|
Usage: "Creation date formatted as Jan 1 15:04:05 2011",
|
||||||
},
|
},
|
||||||
&cli.DurationFlag{
|
cli.DurationFlag{
|
||||||
Name: "duration",
|
Name: "duration",
|
||||||
Value: 365 * 24 * time.Hour,
|
Value: 365 * 24 * time.Hour,
|
||||||
Usage: "Duration that certificate is valid for",
|
Usage: "Duration that certificate is valid for",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "ca",
|
Name: "ca",
|
||||||
Usage: "whether this cert should be its own Certificate Authority",
|
Usage: "whether this cert should be its own Certificate Authority",
|
||||||
},
|
},
|
||||||
|
|||||||
15
cmd/cmd.go
15
cmd/cmd.go
@@ -20,7 +20,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// argsSet checks that all the required arguments are set. args is a list of
|
// argsSet checks that all the required arguments are set. args is a list of
|
||||||
@@ -109,24 +109,15 @@ func setupConsoleLogger(level log.Level, colorize bool, out io.Writer) {
|
|||||||
log.GetManager().GetLogger(log.DEFAULT).ReplaceAllWriters(writer)
|
log.GetManager().GetLogger(log.DEFAULT).ReplaceAllWriters(writer)
|
||||||
}
|
}
|
||||||
|
|
||||||
func globalBool(c *cli.Context, name string) bool {
|
|
||||||
for _, ctx := range c.Lineage() {
|
|
||||||
if ctx.Bool(name) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// PrepareConsoleLoggerLevel by default, use INFO level for console logger, but some sub-commands (for git/ssh protocol) shouldn't output any log to stdout.
|
// PrepareConsoleLoggerLevel by default, use INFO level for console logger, but some sub-commands (for git/ssh protocol) shouldn't output any log to stdout.
|
||||||
// Any log appears in git stdout pipe will break the git protocol, eg: client can't push and hangs forever.
|
// Any log appears in git stdout pipe will break the git protocol, eg: client can't push and hangs forever.
|
||||||
func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(*cli.Context) error {
|
func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(*cli.Context) error {
|
||||||
return func(c *cli.Context) error {
|
return func(c *cli.Context) error {
|
||||||
level := defaultLevel
|
level := defaultLevel
|
||||||
if globalBool(c, "quiet") {
|
if c.Bool("quiet") || c.GlobalBoolT("quiet") {
|
||||||
level = log.FATAL
|
level = log.FATAL
|
||||||
}
|
}
|
||||||
if globalBool(c, "debug") || globalBool(c, "verbose") {
|
if c.Bool("debug") || c.GlobalBool("debug") || c.Bool("verbose") || c.GlobalBool("verbose") {
|
||||||
level = log.TRACE
|
level = log.TRACE
|
||||||
}
|
}
|
||||||
log.SetConsoleLogger(log.DEFAULT, "console-default", level)
|
log.SetConsoleLogger(log.DEFAULT, "console-default", level)
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// cmdDoctorConvert represents the available convert sub-command.
|
// CmdConvert represents the available convert sub-command.
|
||||||
var cmdDoctorConvert = &cli.Command{
|
var CmdConvert = cli.Command{
|
||||||
Name: "convert",
|
Name: "convert",
|
||||||
Usage: "Convert the database",
|
Usage: "Convert the database",
|
||||||
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar",
|
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar",
|
||||||
Action: runDoctorConvert,
|
Action: runConvert,
|
||||||
}
|
}
|
||||||
|
|
||||||
func runDoctorConvert(ctx *cli.Context) error {
|
func runConvert(ctx *cli.Context) error {
|
||||||
stdCtx, cancel := installSignals()
|
stdCtx, cancel := installSignals()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@@ -8,11 +8,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdDocs represents the available docs sub-command.
|
// CmdDocs represents the available docs sub-command.
|
||||||
var CmdDocs = &cli.Command{
|
var CmdDocs = cli.Command{
|
||||||
Name: "docs",
|
Name: "docs",
|
||||||
Usage: "Output CLI documentation",
|
Usage: "Output CLI documentation",
|
||||||
Description: "A command to output Gitea's CLI documentation, optionally to a file.",
|
Description: "A command to output Gitea's CLI documentation, optionally to a file.",
|
||||||
@@ -23,9 +23,8 @@ var CmdDocs = &cli.Command{
|
|||||||
Usage: "Output man pages instead",
|
Usage: "Output man pages instead",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "output",
|
Name: "output, o",
|
||||||
Aliases: []string{"o"},
|
Usage: "Path to output to instead of stdout (will overwrite if exists)",
|
||||||
Usage: "Path to output to instead of stdout (will overwrite if exists)",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,72 +14,61 @@ import (
|
|||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
"code.gitea.io/gitea/models/migrations"
|
"code.gitea.io/gitea/models/migrations"
|
||||||
migrate_base "code.gitea.io/gitea/models/migrations/base"
|
migrate_base "code.gitea.io/gitea/models/migrations/base"
|
||||||
"code.gitea.io/gitea/modules/container"
|
|
||||||
"code.gitea.io/gitea/modules/doctor"
|
"code.gitea.io/gitea/modules/doctor"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
"xorm.io/xorm"
|
"xorm.io/xorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdDoctor represents the available doctor sub-command.
|
// CmdDoctor represents the available doctor sub-command.
|
||||||
var CmdDoctor = &cli.Command{
|
var CmdDoctor = cli.Command{
|
||||||
Name: "doctor",
|
Name: "doctor",
|
||||||
Usage: "Diagnose and optionally fix problems",
|
Usage: "Diagnose and optionally fix problems",
|
||||||
Description: "A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
|
Description: "A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
|
||||||
|
Action: runDoctor,
|
||||||
Subcommands: []*cli.Command{
|
|
||||||
cmdDoctorCheck,
|
|
||||||
cmdRecreateTable,
|
|
||||||
cmdDoctorConvert,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
var cmdDoctorCheck = &cli.Command{
|
|
||||||
Name: "check",
|
|
||||||
Usage: "Diagnose and optionally fix problems",
|
|
||||||
Description: "A command to diagnose problems with the current Gitea instance according to the given configuration. Some problems can optionally be fixed by modifying the database or data storage.",
|
|
||||||
Action: runDoctorCheck,
|
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "list",
|
Name: "list",
|
||||||
Usage: "List the available checks",
|
Usage: "List the available checks",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "default",
|
Name: "default",
|
||||||
Usage: "Run the default checks (if neither --run or --all is set, this is the default behaviour)",
|
Usage: "Run the default checks (if neither --run or --all is set, this is the default behaviour)",
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "run",
|
Name: "run",
|
||||||
Usage: "Run the provided checks - (if --default is set, the default checks will also run)",
|
Usage: "Run the provided checks - (if --default is set, the default checks will also run)",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "all",
|
Name: "all",
|
||||||
Usage: "Run all the available checks",
|
Usage: "Run all the available checks",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "fix",
|
Name: "fix",
|
||||||
Usage: "Automatically fix what we can",
|
Usage: "Automatically fix what we can",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "log-file",
|
Name: "log-file",
|
||||||
Usage: `Name of the log file (no verbose log output by default). Set to "-" to output to stdout`,
|
Usage: `Name of the log file (default: "doctor.log"). Set to "-" to output to stdout, set to "" to disable`,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "color",
|
Name: "color, H",
|
||||||
Aliases: []string{"H"},
|
Usage: "Use color for outputted information",
|
||||||
Usage: "Use color for outputted information",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Subcommands: []cli.Command{
|
||||||
|
cmdRecreateTable,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdRecreateTable = &cli.Command{
|
var cmdRecreateTable = cli.Command{
|
||||||
Name: "recreate-table",
|
Name: "recreate-table",
|
||||||
Usage: "Recreate tables from XORM definitions and copy the data.",
|
Usage: "Recreate tables from XORM definitions and copy the data.",
|
||||||
ArgsUsage: "[TABLE]... : (TABLEs to recreate - leave blank for all)",
|
ArgsUsage: "[TABLE]... : (TABLEs to recreate - leave blank for all)",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
Usage: "Print SQL commands sent",
|
Usage: "Print SQL commands sent",
|
||||||
},
|
},
|
||||||
@@ -143,9 +132,16 @@ func setupDoctorDefaultLogger(ctx *cli.Context, colorize bool) {
|
|||||||
setupConsoleLogger(log.FATAL, log.CanColorStderr, os.Stderr)
|
setupConsoleLogger(log.FATAL, log.CanColorStderr, os.Stderr)
|
||||||
|
|
||||||
logFile := ctx.String("log-file")
|
logFile := ctx.String("log-file")
|
||||||
if logFile == "" {
|
if !ctx.IsSet("log-file") {
|
||||||
return // if no doctor log-file is set, do not show any log from default logger
|
logFile = "doctor.log"
|
||||||
} else if logFile == "-" {
|
}
|
||||||
|
|
||||||
|
if len(logFile) == 0 {
|
||||||
|
// if no doctor log-file is set, do not show any log from default logger
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if logFile == "-" {
|
||||||
setupConsoleLogger(log.TRACE, colorize, os.Stdout)
|
setupConsoleLogger(log.TRACE, colorize, os.Stdout)
|
||||||
} else {
|
} else {
|
||||||
logFile, _ = filepath.Abs(logFile)
|
logFile, _ = filepath.Abs(logFile)
|
||||||
@@ -159,7 +155,7 @@ func setupDoctorDefaultLogger(ctx *cli.Context, colorize bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runDoctorCheck(ctx *cli.Context) error {
|
func runDoctor(ctx *cli.Context) error {
|
||||||
stdCtx, cancel := installSignals()
|
stdCtx, cancel := installSignals()
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@@ -178,7 +174,6 @@ func runDoctorCheck(ctx *cli.Context) error {
|
|||||||
if ctx.IsSet("list") {
|
if ctx.IsSet("list") {
|
||||||
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
|
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
|
||||||
_, _ = w.Write([]byte("Default\tName\tTitle\n"))
|
_, _ = w.Write([]byte("Default\tName\tTitle\n"))
|
||||||
doctor.SortChecks(doctor.Checks)
|
|
||||||
for _, check := range doctor.Checks {
|
for _, check := range doctor.Checks {
|
||||||
if check.IsDefault {
|
if check.IsDefault {
|
||||||
_, _ = w.Write([]byte{'*'})
|
_, _ = w.Write([]byte{'*'})
|
||||||
@@ -194,19 +189,25 @@ func runDoctorCheck(ctx *cli.Context) error {
|
|||||||
|
|
||||||
var checks []*doctor.Check
|
var checks []*doctor.Check
|
||||||
if ctx.Bool("all") {
|
if ctx.Bool("all") {
|
||||||
checks = make([]*doctor.Check, len(doctor.Checks))
|
checks = doctor.Checks
|
||||||
copy(checks, doctor.Checks)
|
|
||||||
} else if ctx.IsSet("run") {
|
} else if ctx.IsSet("run") {
|
||||||
addDefault := ctx.Bool("default")
|
addDefault := ctx.Bool("default")
|
||||||
runNamesSet := container.SetOf(ctx.StringSlice("run")...)
|
names := ctx.StringSlice("run")
|
||||||
for _, check := range doctor.Checks {
|
for i, name := range names {
|
||||||
if (addDefault && check.IsDefault) || runNamesSet.Contains(check.Name) {
|
names[i] = strings.ToLower(strings.TrimSpace(name))
|
||||||
checks = append(checks, check)
|
|
||||||
runNamesSet.Remove(check.Name)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if len(runNamesSet) > 0 {
|
|
||||||
return fmt.Errorf("unknown checks: %q", strings.Join(runNamesSet.Values(), ","))
|
for _, check := range doctor.Checks {
|
||||||
|
if addDefault && check.IsDefault {
|
||||||
|
checks = append(checks, check)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, name := range names {
|
||||||
|
if name == check.Name {
|
||||||
|
checks = append(checks, check)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for _, check := range doctor.Checks {
|
for _, check := range doctor.Checks {
|
||||||
@@ -215,5 +216,6 @@ func runDoctorCheck(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return doctor.RunChecks(stdCtx, colorize, ctx.Bool("fix"), checks)
|
return doctor.RunChecks(stdCtx, colorize, ctx.Bool("fix"), checks)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/doctor"
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/urfave/cli/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestDoctorRun(t *testing.T) {
|
|
||||||
doctor.Register(&doctor.Check{
|
|
||||||
Title: "Test Check",
|
|
||||||
Name: "test-check",
|
|
||||||
Run: func(ctx context.Context, logger log.Logger, autofix bool) error { return nil },
|
|
||||||
|
|
||||||
SkipDatabaseInitialization: true,
|
|
||||||
})
|
|
||||||
app := cli.NewApp()
|
|
||||||
app.Commands = []*cli.Command{cmdDoctorCheck}
|
|
||||||
err := app.Run([]string{"./gitea", "check", "--run", "test-check"})
|
|
||||||
assert.NoError(t, err)
|
|
||||||
err = app.Run([]string{"./gitea", "check", "--run", "no-such"})
|
|
||||||
assert.ErrorContains(t, err, `unknown checks: "no-such"`)
|
|
||||||
err = app.Run([]string{"./gitea", "check", "--run", "test-check,no-such"})
|
|
||||||
assert.ErrorContains(t, err, `unknown checks: "no-such"`)
|
|
||||||
}
|
|
||||||
71
cmd/dump.go
71
cmd/dump.go
@@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
"gitea.com/go-chi/session"
|
"gitea.com/go-chi/session"
|
||||||
"github.com/mholt/archiver/v3"
|
"github.com/mholt/archiver/v3"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func addReader(w archiver.Writer, r io.ReadCloser, info os.FileInfo, customName string, verbose bool) error {
|
func addReader(w archiver.Writer, r io.ReadCloser, info os.FileInfo, customName string, verbose bool) error {
|
||||||
@@ -96,71 +96,64 @@ var outputTypeEnum = &outputType{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CmdDump represents the available dump sub-command.
|
// CmdDump represents the available dump sub-command.
|
||||||
var CmdDump = &cli.Command{
|
var CmdDump = cli.Command{
|
||||||
Name: "dump",
|
Name: "dump",
|
||||||
Usage: "Dump Gitea files and database",
|
Usage: "Dump Gitea files and database",
|
||||||
Description: `Dump compresses all related files and database into zip file.
|
Description: `Dump compresses all related files and database into zip file.
|
||||||
It can be used for backup and capture Gitea server image to send to maintainer`,
|
It can be used for backup and capture Gitea server image to send to maintainer`,
|
||||||
Action: runDump,
|
Action: runDump,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "file",
|
Name: "file, f",
|
||||||
Aliases: []string{"f"},
|
Value: fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix()),
|
||||||
Value: fmt.Sprintf("gitea-dump-%d.zip", time.Now().Unix()),
|
Usage: "Name of the dump file which will be created. Supply '-' for stdout. See type for available types.",
|
||||||
Usage: "Name of the dump file which will be created. Supply '-' for stdout. See type for available types.",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "verbose",
|
Name: "verbose, V",
|
||||||
Aliases: []string{"V"},
|
Usage: "Show process details",
|
||||||
Usage: "Show process details",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "quiet",
|
Name: "quiet, q",
|
||||||
Aliases: []string{"q"},
|
Usage: "Only display warnings and errors",
|
||||||
Usage: "Only display warnings and errors",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "tempdir",
|
Name: "tempdir, t",
|
||||||
Aliases: []string{"t"},
|
Value: os.TempDir(),
|
||||||
Value: os.TempDir(),
|
Usage: "Temporary dir path",
|
||||||
Usage: "Temporary dir path",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "database",
|
Name: "database, d",
|
||||||
Aliases: []string{"d"},
|
Usage: "Specify the database SQL syntax",
|
||||||
Usage: "Specify the database SQL syntax: sqlite3, mysql, mssql, postgres",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-repository",
|
Name: "skip-repository, R",
|
||||||
Aliases: []string{"R"},
|
Usage: "Skip the repository dumping",
|
||||||
Usage: "Skip the repository dumping",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-log",
|
Name: "skip-log, L",
|
||||||
Aliases: []string{"L"},
|
Usage: "Skip the log dumping",
|
||||||
Usage: "Skip the log dumping",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-custom-dir",
|
Name: "skip-custom-dir",
|
||||||
Usage: "Skip custom directory",
|
Usage: "Skip custom directory",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-lfs-data",
|
Name: "skip-lfs-data",
|
||||||
Usage: "Skip LFS data",
|
Usage: "Skip LFS data",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-attachment-data",
|
Name: "skip-attachment-data",
|
||||||
Usage: "Skip attachment data",
|
Usage: "Skip attachment data",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-package-data",
|
Name: "skip-package-data",
|
||||||
Usage: "Skip package data",
|
Usage: "Skip package data",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "skip-index",
|
Name: "skip-index",
|
||||||
Usage: "Skip bleve index data",
|
Usage: "Skip bleve index data",
|
||||||
},
|
},
|
||||||
&cli.GenericFlag{
|
cli.GenericFlag{
|
||||||
Name: "type",
|
Name: "type",
|
||||||
Value: outputTypeEnum,
|
Value: outputTypeEnum,
|
||||||
Usage: fmt.Sprintf("Dump output format: %s", outputTypeEnum.Join()),
|
Usage: fmt.Sprintf("Dump output format: %s", outputTypeEnum.Join()),
|
||||||
@@ -452,7 +445,7 @@ func addRecursiveExclude(w archiver.Writer, insidePath, absPath string, excludeA
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
currentAbsPath := filepath.Join(absPath, file.Name())
|
currentAbsPath := path.Join(absPath, file.Name())
|
||||||
currentInsidePath := path.Join(insidePath, file.Name())
|
currentInsidePath := path.Join(insidePath, file.Name())
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
if !util.SliceContainsString(excludeAbsPath, currentAbsPath) {
|
if !util.SliceContainsString(excludeAbsPath, currentAbsPath) {
|
||||||
|
|||||||
@@ -19,58 +19,57 @@ import (
|
|||||||
"code.gitea.io/gitea/services/convert"
|
"code.gitea.io/gitea/services/convert"
|
||||||
"code.gitea.io/gitea/services/migrations"
|
"code.gitea.io/gitea/services/migrations"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdDumpRepository represents the available dump repository sub-command.
|
// CmdDumpRepository represents the available dump repository sub-command.
|
||||||
var CmdDumpRepository = &cli.Command{
|
var CmdDumpRepository = cli.Command{
|
||||||
Name: "dump-repo",
|
Name: "dump-repo",
|
||||||
Usage: "Dump the repository from git/github/gitea/gitlab",
|
Usage: "Dump the repository from git/github/gitea/gitlab",
|
||||||
Description: "This is a command for dumping the repository data.",
|
Description: "This is a command for dumping the repository data.",
|
||||||
Action: runDumpRepository,
|
Action: runDumpRepository,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "git_service",
|
Name: "git_service",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Git service, git, github, gitea, gitlab. If clone_addr could be recognized, this could be ignored.",
|
Usage: "Git service, git, github, gitea, gitlab. If clone_addr could be recognized, this could be ignored.",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "repo_dir",
|
Name: "repo_dir, r",
|
||||||
Aliases: []string{"r"},
|
Value: "./data",
|
||||||
Value: "./data",
|
Usage: "Repository dir path to store the data",
|
||||||
Usage: "Repository dir path to store the data",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "clone_addr",
|
Name: "clone_addr",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "The URL will be clone, currently could be a git/github/gitea/gitlab http/https URL",
|
Usage: "The URL will be clone, currently could be a git/github/gitea/gitlab http/https URL",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "auth_username",
|
Name: "auth_username",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "The username to visit the clone_addr",
|
Usage: "The username to visit the clone_addr",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "auth_password",
|
Name: "auth_password",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "The password to visit the clone_addr",
|
Usage: "The password to visit the clone_addr",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "auth_token",
|
Name: "auth_token",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "The personal token to visit the clone_addr",
|
Usage: "The personal token to visit the clone_addr",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "owner_name",
|
Name: "owner_name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "The data will be stored on a directory with owner name if not empty",
|
Usage: "The data will be stored on a directory with owner name if not empty",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "repo_name",
|
Name: "repo_name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "The data will be stored on a directory with repository name if not empty",
|
Usage: "The data will be stored on a directory with repository name if not empty",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "units",
|
Name: "units",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: `Which items will be migrated, one or more units should be separated as comma.
|
Usage: `Which items will be migrated, one or more units should be separated as comma.
|
||||||
|
|||||||
@@ -19,74 +19,70 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/util"
|
"code.gitea.io/gitea/modules/util"
|
||||||
|
|
||||||
"github.com/gobwas/glob"
|
"github.com/gobwas/glob"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdEmbedded represents the available extract sub-command.
|
// CmdEmbedded represents the available extract sub-command.
|
||||||
var (
|
var (
|
||||||
CmdEmbedded = &cli.Command{
|
CmdEmbedded = cli.Command{
|
||||||
Name: "embedded",
|
Name: "embedded",
|
||||||
Usage: "Extract embedded resources",
|
Usage: "Extract embedded resources",
|
||||||
Description: "A command for extracting embedded resources, like templates and images",
|
Description: "A command for extracting embedded resources, like templates and images",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
subcmdList,
|
subcmdList,
|
||||||
subcmdView,
|
subcmdView,
|
||||||
subcmdExtract,
|
subcmdExtract,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdList = &cli.Command{
|
subcmdList = cli.Command{
|
||||||
Name: "list",
|
Name: "list",
|
||||||
Usage: "List files matching the given pattern",
|
Usage: "List files matching the given pattern",
|
||||||
Action: runList,
|
Action: runList,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "include-vendored",
|
Name: "include-vendored,vendor",
|
||||||
Aliases: []string{"vendor"},
|
Usage: "Include files under public/vendor as well",
|
||||||
Usage: "Include files under public/vendor as well",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdView = &cli.Command{
|
subcmdView = cli.Command{
|
||||||
Name: "view",
|
Name: "view",
|
||||||
Usage: "View a file matching the given pattern",
|
Usage: "View a file matching the given pattern",
|
||||||
Action: runView,
|
Action: runView,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "include-vendored",
|
Name: "include-vendored,vendor",
|
||||||
Aliases: []string{"vendor"},
|
Usage: "Include files under public/vendor as well",
|
||||||
Usage: "Include files under public/vendor as well",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdExtract = &cli.Command{
|
subcmdExtract = cli.Command{
|
||||||
Name: "extract",
|
Name: "extract",
|
||||||
Usage: "Extract resources",
|
Usage: "Extract resources",
|
||||||
Action: runExtract,
|
Action: runExtract,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "include-vendored",
|
Name: "include-vendored,vendor",
|
||||||
Aliases: []string{"vendor"},
|
Usage: "Include files under public/vendor as well",
|
||||||
Usage: "Include files under public/vendor as well",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "overwrite",
|
Name: "overwrite",
|
||||||
Usage: "Overwrite files if they already exist",
|
Usage: "Overwrite files if they already exist",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "rename",
|
Name: "rename",
|
||||||
Usage: "Rename files as {name}.bak if they already exist (overwrites previous .bak)",
|
Usage: "Rename files as {name}.bak if they already exist (overwrites previous .bak)",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "custom",
|
Name: "custom",
|
||||||
Usage: "Extract to the 'custom' directory as per app.ini",
|
Usage: "Extract to the 'custom' directory as per app.ini",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "destination",
|
Name: "destination,dest-dir",
|
||||||
Aliases: []string{"dest-dir"},
|
Usage: "Extract to the specified directory",
|
||||||
Usage: "Extract to the specified directory",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -103,7 +99,7 @@ type assetFile struct {
|
|||||||
func initEmbeddedExtractor(c *cli.Context) error {
|
func initEmbeddedExtractor(c *cli.Context) error {
|
||||||
setupConsoleLogger(log.ERROR, log.CanColorStderr, os.Stderr)
|
setupConsoleLogger(log.ERROR, log.CanColorStderr, os.Stderr)
|
||||||
|
|
||||||
patterns, err := compileCollectPatterns(c.Args().Slice())
|
patterns, err := compileCollectPatterns(c.Args())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -179,7 +175,7 @@ func runExtractDo(c *cli.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.NArg() == 0 {
|
if len(c.Args()) == 0 {
|
||||||
return fmt.Errorf("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
|
return fmt.Errorf("a list of pattern of files to extract is mandatory (e.g. '**' for all)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,43 +11,43 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/generate"
|
"code.gitea.io/gitea/modules/generate"
|
||||||
|
|
||||||
"github.com/mattn/go-isatty"
|
"github.com/mattn/go-isatty"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// CmdGenerate represents the available generate sub-command.
|
// CmdGenerate represents the available generate sub-command.
|
||||||
CmdGenerate = &cli.Command{
|
CmdGenerate = cli.Command{
|
||||||
Name: "generate",
|
Name: "generate",
|
||||||
Usage: "Command line interface for running generators",
|
Usage: "Command line interface for running generators",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
subcmdSecret,
|
subcmdSecret,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdSecret = &cli.Command{
|
subcmdSecret = cli.Command{
|
||||||
Name: "secret",
|
Name: "secret",
|
||||||
Usage: "Generate a secret token",
|
Usage: "Generate a secret token",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
microcmdGenerateInternalToken,
|
microcmdGenerateInternalToken,
|
||||||
microcmdGenerateLfsJwtSecret,
|
microcmdGenerateLfsJwtSecret,
|
||||||
microcmdGenerateSecretKey,
|
microcmdGenerateSecretKey,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdGenerateInternalToken = &cli.Command{
|
microcmdGenerateInternalToken = cli.Command{
|
||||||
Name: "INTERNAL_TOKEN",
|
Name: "INTERNAL_TOKEN",
|
||||||
Usage: "Generate a new INTERNAL_TOKEN",
|
Usage: "Generate a new INTERNAL_TOKEN",
|
||||||
Action: runGenerateInternalToken,
|
Action: runGenerateInternalToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdGenerateLfsJwtSecret = &cli.Command{
|
microcmdGenerateLfsJwtSecret = cli.Command{
|
||||||
Name: "JWT_SECRET",
|
Name: "JWT_SECRET",
|
||||||
Aliases: []string{"LFS_JWT_SECRET"},
|
Aliases: []string{"LFS_JWT_SECRET"},
|
||||||
Usage: "Generate a new JWT_SECRET",
|
Usage: "Generate a new JWT_SECRET",
|
||||||
Action: runGenerateLfsJwtSecret,
|
Action: runGenerateLfsJwtSecret,
|
||||||
}
|
}
|
||||||
|
|
||||||
microcmdGenerateSecretKey = &cli.Command{
|
microcmdGenerateSecretKey = cli.Command{
|
||||||
Name: "SECRET_KEY",
|
Name: "SECRET_KEY",
|
||||||
Usage: "Generate a new SECRET_KEY",
|
Usage: "Generate a new SECRET_KEY",
|
||||||
Action: runGenerateSecretKey,
|
Action: runGenerateSecretKey,
|
||||||
@@ -70,12 +70,12 @@ func runGenerateInternalToken(c *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runGenerateLfsJwtSecret(c *cli.Context) error {
|
func runGenerateLfsJwtSecret(c *cli.Context) error {
|
||||||
_, jwtSecretBase64, err := generate.NewJwtSecretBase64()
|
JWTSecretBase64, err := generate.NewJwtSecretBase64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%s", jwtSecretBase64)
|
fmt.Printf("%s", JWTSecretBase64)
|
||||||
|
|
||||||
if isatty.IsTerminal(os.Stdout.Fd()) {
|
if isatty.IsTerminal(os.Stdout.Fd()) {
|
||||||
fmt.Printf("\n")
|
fmt.Printf("\n")
|
||||||
|
|||||||
22
cmd/hook.go
22
cmd/hook.go
@@ -20,7 +20,7 @@ import (
|
|||||||
repo_module "code.gitea.io/gitea/modules/repository"
|
repo_module "code.gitea.io/gitea/modules/repository"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -29,12 +29,12 @@ const (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// CmdHook represents the available hooks sub-command.
|
// CmdHook represents the available hooks sub-command.
|
||||||
CmdHook = &cli.Command{
|
CmdHook = cli.Command{
|
||||||
Name: "hook",
|
Name: "hook",
|
||||||
Usage: "Delegate commands to corresponding Git hooks",
|
Usage: "Delegate commands to corresponding Git hooks",
|
||||||
Description: "This should only be called by Git",
|
Description: "This should only be called by Git",
|
||||||
Before: PrepareConsoleLoggerLevel(log.FATAL),
|
Before: PrepareConsoleLoggerLevel(log.FATAL),
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
subcmdHookPreReceive,
|
subcmdHookPreReceive,
|
||||||
subcmdHookUpdate,
|
subcmdHookUpdate,
|
||||||
subcmdHookPostReceive,
|
subcmdHookPostReceive,
|
||||||
@@ -42,47 +42,47 @@ var (
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdHookPreReceive = &cli.Command{
|
subcmdHookPreReceive = cli.Command{
|
||||||
Name: "pre-receive",
|
Name: "pre-receive",
|
||||||
Usage: "Delegate pre-receive Git hook",
|
Usage: "Delegate pre-receive Git hook",
|
||||||
Description: "This command should only be called by Git",
|
Description: "This command should only be called by Git",
|
||||||
Action: runHookPreReceive,
|
Action: runHookPreReceive,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
subcmdHookUpdate = &cli.Command{
|
subcmdHookUpdate = cli.Command{
|
||||||
Name: "update",
|
Name: "update",
|
||||||
Usage: "Delegate update Git hook",
|
Usage: "Delegate update Git hook",
|
||||||
Description: "This command should only be called by Git",
|
Description: "This command should only be called by Git",
|
||||||
Action: runHookUpdate,
|
Action: runHookUpdate,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
subcmdHookPostReceive = &cli.Command{
|
subcmdHookPostReceive = cli.Command{
|
||||||
Name: "post-receive",
|
Name: "post-receive",
|
||||||
Usage: "Delegate post-receive Git hook",
|
Usage: "Delegate post-receive Git hook",
|
||||||
Description: "This command should only be called by Git",
|
Description: "This command should only be called by Git",
|
||||||
Action: runHookPostReceive,
|
Action: runHookPostReceive,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
// Note: new hook since git 2.29
|
// Note: new hook since git 2.29
|
||||||
subcmdHookProcReceive = &cli.Command{
|
subcmdHookProcReceive = cli.Command{
|
||||||
Name: "proc-receive",
|
Name: "proc-receive",
|
||||||
Usage: "Delegate proc-receive Git hook",
|
Usage: "Delegate proc-receive Git hook",
|
||||||
Description: "This command should only be called by Git",
|
Description: "This command should only be called by Git",
|
||||||
Action: runHookProcReceive,
|
Action: runHookProcReceive,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
42
cmd/keys.go
42
cmd/keys.go
@@ -11,39 +11,35 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdKeys represents the available keys sub-command
|
// CmdKeys represents the available keys sub-command
|
||||||
var CmdKeys = &cli.Command{
|
var CmdKeys = cli.Command{
|
||||||
Name: "keys",
|
Name: "keys",
|
||||||
Usage: "This command queries the Gitea database to get the authorized command for a given ssh key fingerprint",
|
Usage: "This command queries the Gitea database to get the authorized command for a given ssh key fingerprint",
|
||||||
Before: PrepareConsoleLoggerLevel(log.FATAL),
|
Before: PrepareConsoleLoggerLevel(log.FATAL),
|
||||||
Action: runKeys,
|
Action: runKeys,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "expected",
|
Name: "expected, e",
|
||||||
Aliases: []string{"e"},
|
Value: "git",
|
||||||
Value: "git",
|
Usage: "Expected user for whom provide key commands",
|
||||||
Usage: "Expected user for whom provide key commands",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "username",
|
Name: "username, u",
|
||||||
Aliases: []string{"u"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "Username trying to log in by SSH",
|
||||||
Usage: "Username trying to log in by SSH",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "type",
|
Name: "type, t",
|
||||||
Aliases: []string{"t"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "Type of the SSH key provided to the SSH Server (requires content to be provided too)",
|
||||||
Usage: "Type of the SSH key provided to the SSH Server (requires content to be provided too)",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "content",
|
Name: "content, k",
|
||||||
Aliases: []string{"k"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "Base64 encoded content of the SSH key provided to the SSH Server (requires type to be provided too)",
|
||||||
Usage: "Base64 encoded content of the SSH key provided to the SSH Server (requires type to be provided too)",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -77,6 +73,6 @@ func runKeys(c *cli.Context) error {
|
|||||||
if extra.Error != nil {
|
if extra.Error != nil {
|
||||||
return extra.Error
|
return extra.Error
|
||||||
}
|
}
|
||||||
_, _ = fmt.Fprintln(c.App.Writer, strings.TrimSpace(authorizedString))
|
fmt.Println(strings.TrimSpace(authorizedString))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runSendMail(c *cli.Context) error {
|
func runSendMail(c *cli.Context) error {
|
||||||
|
|||||||
188
cmd/main.go
188
cmd/main.go
@@ -1,188 +0,0 @@
|
|||||||
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package cmd
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
|
||||||
"code.gitea.io/gitea/modules/util"
|
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
// cmdHelp is our own help subcommand with more information
|
|
||||||
func cmdHelp() *cli.Command {
|
|
||||||
c := &cli.Command{
|
|
||||||
Name: "help",
|
|
||||||
Aliases: []string{"h"},
|
|
||||||
Usage: "Shows a list of commands or help for one command",
|
|
||||||
ArgsUsage: "[command]",
|
|
||||||
Action: func(c *cli.Context) (err error) {
|
|
||||||
lineage := c.Lineage() // The order is from child to parent: help, doctor, Gitea, {Command:nil}
|
|
||||||
targetCmdIdx := 0
|
|
||||||
if c.Command.Name == "help" {
|
|
||||||
targetCmdIdx = 1
|
|
||||||
}
|
|
||||||
if lineage[targetCmdIdx+1].Command != nil {
|
|
||||||
err = cli.ShowCommandHelp(lineage[targetCmdIdx+1], lineage[targetCmdIdx].Command.Name)
|
|
||||||
} else {
|
|
||||||
err = cli.ShowAppHelp(c)
|
|
||||||
}
|
|
||||||
_, _ = fmt.Fprintf(c.App.Writer, `
|
|
||||||
DEFAULT CONFIGURATION:
|
|
||||||
AppPath: %s
|
|
||||||
WorkPath: %s
|
|
||||||
CustomPath: %s
|
|
||||||
ConfigFile: %s
|
|
||||||
|
|
||||||
`, setting.AppPath, setting.AppWorkPath, setting.CustomPath, setting.CustomConf)
|
|
||||||
return err
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return c
|
|
||||||
}
|
|
||||||
|
|
||||||
var helpFlag = cli.HelpFlag
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
// cli.HelpFlag = nil TODO: after https://github.com/urfave/cli/issues/1794 we can use this
|
|
||||||
}
|
|
||||||
|
|
||||||
func appGlobalFlags() []cli.Flag {
|
|
||||||
return []cli.Flag{
|
|
||||||
// make the builtin flags at the top
|
|
||||||
helpFlag,
|
|
||||||
|
|
||||||
// shared configuration flags, they are for global and for each sub-command at the same time
|
|
||||||
// eg: such command is valid: "./gitea --config /tmp/app.ini web --config /tmp/app.ini", while it's discouraged indeed
|
|
||||||
// keep in mind that the short flags like "-C", "-c" and "-w" are globally polluted, they can't be used for sub-commands anymore.
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "custom-path",
|
|
||||||
Aliases: []string{"C"},
|
|
||||||
Usage: "Set custom path (defaults to '{WorkPath}/custom')",
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "config",
|
|
||||||
Aliases: []string{"c"},
|
|
||||||
Value: setting.CustomConf,
|
|
||||||
Usage: "Set custom config file (defaults to '{WorkPath}/custom/conf/app.ini')",
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "work-path",
|
|
||||||
Aliases: []string{"w"},
|
|
||||||
Usage: "Set Gitea's working path (defaults to the Gitea's binary directory)",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func prepareSubcommandWithConfig(command *cli.Command, globalFlags []cli.Flag) {
|
|
||||||
command.Flags = append(append([]cli.Flag{}, globalFlags...), command.Flags...)
|
|
||||||
command.Action = prepareWorkPathAndCustomConf(command.Action)
|
|
||||||
command.HideHelp = true
|
|
||||||
if command.Name != "help" {
|
|
||||||
command.Subcommands = append(command.Subcommands, cmdHelp())
|
|
||||||
}
|
|
||||||
for i := range command.Subcommands {
|
|
||||||
prepareSubcommandWithConfig(command.Subcommands[i], globalFlags)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepareWorkPathAndCustomConf wraps the Action to prepare the work path and custom config
|
|
||||||
// It can't use "Before", because each level's sub-command's Before will be called one by one, so the "init" would be done multiple times
|
|
||||||
func prepareWorkPathAndCustomConf(action cli.ActionFunc) func(ctx *cli.Context) error {
|
|
||||||
return func(ctx *cli.Context) error {
|
|
||||||
var args setting.ArgWorkPathAndCustomConf
|
|
||||||
// from children to parent, check the global flags
|
|
||||||
for _, curCtx := range ctx.Lineage() {
|
|
||||||
if curCtx.IsSet("work-path") && args.WorkPath == "" {
|
|
||||||
args.WorkPath = curCtx.String("work-path")
|
|
||||||
}
|
|
||||||
if curCtx.IsSet("custom-path") && args.CustomPath == "" {
|
|
||||||
args.CustomPath = curCtx.String("custom-path")
|
|
||||||
}
|
|
||||||
if curCtx.IsSet("config") && args.CustomConf == "" {
|
|
||||||
args.CustomConf = curCtx.String("config")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setting.InitWorkPathAndCommonConfig(os.Getenv, args)
|
|
||||||
if ctx.Bool("help") || action == nil {
|
|
||||||
// the default behavior of "urfave/cli": "nil action" means "show help"
|
|
||||||
return cmdHelp().Action(ctx)
|
|
||||||
}
|
|
||||||
return action(ctx)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewMainApp(version, versionExtra string) *cli.App {
|
|
||||||
app := cli.NewApp()
|
|
||||||
app.Name = "Gitea"
|
|
||||||
app.Usage = "A painless self-hosted Git service"
|
|
||||||
app.Description = `By default, Gitea will start serving using the web-server with no argument, which can alternatively be run by running the subcommand "web".`
|
|
||||||
app.Version = version + versionExtra
|
|
||||||
app.EnableBashCompletion = true
|
|
||||||
|
|
||||||
// these sub-commands need to use config file
|
|
||||||
subCmdWithConfig := []*cli.Command{
|
|
||||||
CmdWeb,
|
|
||||||
CmdServ,
|
|
||||||
CmdHook,
|
|
||||||
CmdDump,
|
|
||||||
CmdAdmin,
|
|
||||||
CmdMigrate,
|
|
||||||
CmdKeys,
|
|
||||||
CmdDoctor,
|
|
||||||
CmdManager,
|
|
||||||
CmdEmbedded,
|
|
||||||
CmdMigrateStorage,
|
|
||||||
CmdDumpRepository,
|
|
||||||
CmdRestoreRepository,
|
|
||||||
CmdActions,
|
|
||||||
cmdHelp(), // the "help" sub-command was used to show the more information for "work path" and "custom config"
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdConvert := util.ToPointer(*cmdDoctorConvert)
|
|
||||||
cmdConvert.Hidden = true // still support the legacy "./gitea doctor" by the hidden sub-command, remove it in next release
|
|
||||||
subCmdWithConfig = append(subCmdWithConfig, cmdConvert)
|
|
||||||
|
|
||||||
// these sub-commands do not need the config file, and they do not depend on any path or environment variable.
|
|
||||||
subCmdStandalone := []*cli.Command{
|
|
||||||
CmdCert,
|
|
||||||
CmdGenerate,
|
|
||||||
CmdDocs,
|
|
||||||
}
|
|
||||||
|
|
||||||
app.DefaultCommand = CmdWeb.Name
|
|
||||||
|
|
||||||
globalFlags := appGlobalFlags()
|
|
||||||
app.Flags = append(app.Flags, cli.VersionFlag)
|
|
||||||
app.Flags = append(app.Flags, globalFlags...)
|
|
||||||
app.HideHelp = true // use our own help action to show helps (with more information like default config)
|
|
||||||
app.Before = PrepareConsoleLoggerLevel(log.INFO)
|
|
||||||
for i := range subCmdWithConfig {
|
|
||||||
prepareSubcommandWithConfig(subCmdWithConfig[i], globalFlags)
|
|
||||||
}
|
|
||||||
app.Commands = append(app.Commands, subCmdWithConfig...)
|
|
||||||
app.Commands = append(app.Commands, subCmdStandalone...)
|
|
||||||
|
|
||||||
return app
|
|
||||||
}
|
|
||||||
|
|
||||||
func RunMainApp(app *cli.App, args ...string) error {
|
|
||||||
err := app.Run(args)
|
|
||||||
if err == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if strings.HasPrefix(err.Error(), "flag provided but not defined:") {
|
|
||||||
// the cli package should already have output the error message, so just exit
|
|
||||||
cli.OsExiter(1)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_, _ = fmt.Fprintf(app.ErrWriter, "Command error: %v\n", err)
|
|
||||||
cli.OsExiter(1)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
164
cmd/main_test.go
164
cmd/main_test.go
@@ -4,19 +4,9 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models/unittest"
|
"code.gitea.io/gitea/models/unittest"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
|
||||||
"code.gitea.io/gitea/modules/test"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"github.com/urfave/cli/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
@@ -24,157 +14,3 @@ func TestMain(m *testing.M) {
|
|||||||
GiteaRootPath: "..",
|
GiteaRootPath: "..",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func makePathOutput(workPath, customPath, customConf string) string {
|
|
||||||
return fmt.Sprintf("WorkPath=%s\nCustomPath=%s\nCustomConf=%s", workPath, customPath, customConf)
|
|
||||||
}
|
|
||||||
|
|
||||||
func newTestApp(testCmdAction func(ctx *cli.Context) error) *cli.App {
|
|
||||||
app := NewMainApp("version", "version-extra")
|
|
||||||
testCmd := &cli.Command{Name: "test-cmd", Action: testCmdAction}
|
|
||||||
prepareSubcommandWithConfig(testCmd, appGlobalFlags())
|
|
||||||
app.Commands = append(app.Commands, testCmd)
|
|
||||||
app.DefaultCommand = testCmd.Name
|
|
||||||
return app
|
|
||||||
}
|
|
||||||
|
|
||||||
type runResult struct {
|
|
||||||
Stdout string
|
|
||||||
Stderr string
|
|
||||||
ExitCode int
|
|
||||||
}
|
|
||||||
|
|
||||||
func runTestApp(app *cli.App, args ...string) (runResult, error) {
|
|
||||||
outBuf := new(strings.Builder)
|
|
||||||
errBuf := new(strings.Builder)
|
|
||||||
app.Writer = outBuf
|
|
||||||
app.ErrWriter = errBuf
|
|
||||||
exitCode := -1
|
|
||||||
defer test.MockVariableValue(&cli.ErrWriter, app.ErrWriter)()
|
|
||||||
defer test.MockVariableValue(&cli.OsExiter, func(code int) {
|
|
||||||
if exitCode == -1 {
|
|
||||||
exitCode = code // save the exit code once and then reset the writer (to simulate the exit)
|
|
||||||
app.Writer, app.ErrWriter, cli.ErrWriter = io.Discard, io.Discard, io.Discard
|
|
||||||
}
|
|
||||||
})()
|
|
||||||
err := RunMainApp(app, args...)
|
|
||||||
return runResult{outBuf.String(), errBuf.String(), exitCode}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCliCmd(t *testing.T) {
|
|
||||||
defaultWorkPath := filepath.Dir(setting.AppPath)
|
|
||||||
defaultCustomPath := filepath.Join(defaultWorkPath, "custom")
|
|
||||||
defaultCustomConf := filepath.Join(defaultCustomPath, "conf/app.ini")
|
|
||||||
|
|
||||||
cli.CommandHelpTemplate = "(command help template)"
|
|
||||||
cli.AppHelpTemplate = "(app help template)"
|
|
||||||
cli.SubcommandHelpTemplate = "(subcommand help template)"
|
|
||||||
|
|
||||||
cases := []struct {
|
|
||||||
env map[string]string
|
|
||||||
cmd string
|
|
||||||
exp string
|
|
||||||
}{
|
|
||||||
// main command help
|
|
||||||
{
|
|
||||||
cmd: "./gitea help",
|
|
||||||
exp: "DEFAULT CONFIGURATION:",
|
|
||||||
},
|
|
||||||
|
|
||||||
// parse paths
|
|
||||||
{
|
|
||||||
cmd: "./gitea test-cmd",
|
|
||||||
exp: makePathOutput(defaultWorkPath, defaultCustomPath, defaultCustomConf),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
cmd: "./gitea -c /tmp/app.ini test-cmd",
|
|
||||||
exp: makePathOutput(defaultWorkPath, defaultCustomPath, "/tmp/app.ini"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
cmd: "./gitea test-cmd -c /tmp/app.ini",
|
|
||||||
exp: makePathOutput(defaultWorkPath, defaultCustomPath, "/tmp/app.ini"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: map[string]string{"GITEA_WORK_DIR": "/tmp"},
|
|
||||||
cmd: "./gitea test-cmd",
|
|
||||||
exp: makePathOutput("/tmp", "/tmp/custom", "/tmp/custom/conf/app.ini"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: map[string]string{"GITEA_WORK_DIR": "/tmp"},
|
|
||||||
cmd: "./gitea test-cmd --work-path /tmp/other",
|
|
||||||
exp: makePathOutput("/tmp/other", "/tmp/other/custom", "/tmp/other/custom/conf/app.ini"),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
env: map[string]string{"GITEA_WORK_DIR": "/tmp"},
|
|
||||||
cmd: "./gitea test-cmd --config /tmp/app-other.ini",
|
|
||||||
exp: makePathOutput("/tmp", "/tmp/custom", "/tmp/app-other.ini"),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
app := newTestApp(func(ctx *cli.Context) error {
|
|
||||||
_, _ = fmt.Fprint(ctx.App.Writer, makePathOutput(setting.AppWorkPath, setting.CustomPath, setting.CustomConf))
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
var envBackup []string
|
|
||||||
for _, s := range os.Environ() {
|
|
||||||
if strings.HasPrefix(s, "GITEA_") && strings.Contains(s, "=") {
|
|
||||||
envBackup = append(envBackup, s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clearGiteaEnv := func() {
|
|
||||||
for _, s := range os.Environ() {
|
|
||||||
if strings.HasPrefix(s, "GITEA_") {
|
|
||||||
_ = os.Unsetenv(s)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
clearGiteaEnv()
|
|
||||||
for _, s := range envBackup {
|
|
||||||
k, v, _ := strings.Cut(s, "=")
|
|
||||||
_ = os.Setenv(k, v)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
for _, c := range cases {
|
|
||||||
clearGiteaEnv()
|
|
||||||
for k, v := range c.env {
|
|
||||||
_ = os.Setenv(k, v)
|
|
||||||
}
|
|
||||||
args := strings.Split(c.cmd, " ") // for test only, "split" is good enough
|
|
||||||
r, err := runTestApp(app, args...)
|
|
||||||
assert.NoError(t, err, c.cmd)
|
|
||||||
assert.NotEmpty(t, c.exp, c.cmd)
|
|
||||||
assert.Contains(t, r.Stdout, c.exp, c.cmd)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCliCmdError(t *testing.T) {
|
|
||||||
app := newTestApp(func(ctx *cli.Context) error { return fmt.Errorf("normal error") })
|
|
||||||
r, err := runTestApp(app, "./gitea", "test-cmd")
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Equal(t, 1, r.ExitCode)
|
|
||||||
assert.Equal(t, "", r.Stdout)
|
|
||||||
assert.Equal(t, "Command error: normal error\n", r.Stderr)
|
|
||||||
|
|
||||||
app = newTestApp(func(ctx *cli.Context) error { return cli.Exit("exit error", 2) })
|
|
||||||
r, err = runTestApp(app, "./gitea", "test-cmd")
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Equal(t, 2, r.ExitCode)
|
|
||||||
assert.Equal(t, "", r.Stdout)
|
|
||||||
assert.Equal(t, "exit error\n", r.Stderr)
|
|
||||||
|
|
||||||
app = newTestApp(func(ctx *cli.Context) error { return nil })
|
|
||||||
r, err = runTestApp(app, "./gitea", "test-cmd", "--no-such")
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Equal(t, 1, r.ExitCode)
|
|
||||||
assert.Equal(t, "Incorrect Usage: flag provided but not defined: -no-such\n\n", r.Stdout)
|
|
||||||
assert.Equal(t, "", r.Stderr) // the cli package's strange behavior, the error message is not in stderr ....
|
|
||||||
|
|
||||||
app = newTestApp(func(ctx *cli.Context) error { return nil })
|
|
||||||
r, err = runTestApp(app, "./gitea", "test-cmd")
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, -1, r.ExitCode) // the cli.OsExiter is not called
|
|
||||||
assert.Equal(t, "", r.Stdout)
|
|
||||||
assert.Equal(t, "", r.Stderr)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9,16 +9,16 @@ import (
|
|||||||
|
|
||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// CmdManager represents the manager command
|
// CmdManager represents the manager command
|
||||||
CmdManager = &cli.Command{
|
CmdManager = cli.Command{
|
||||||
Name: "manager",
|
Name: "manager",
|
||||||
Usage: "Manage the running gitea process",
|
Usage: "Manage the running gitea process",
|
||||||
Description: "This is a command for managing the running gitea process",
|
Description: "This is a command for managing the running gitea process",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
subcmdShutdown,
|
subcmdShutdown,
|
||||||
subcmdRestart,
|
subcmdRestart,
|
||||||
subcmdReloadTemplates,
|
subcmdReloadTemplates,
|
||||||
@@ -27,80 +27,80 @@ var (
|
|||||||
subCmdProcesses,
|
subCmdProcesses,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
subcmdShutdown = &cli.Command{
|
subcmdShutdown = cli.Command{
|
||||||
Name: "shutdown",
|
Name: "shutdown",
|
||||||
Usage: "Gracefully shutdown the running process",
|
Usage: "Gracefully shutdown the running process",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: runShutdown,
|
Action: runShutdown,
|
||||||
}
|
}
|
||||||
subcmdRestart = &cli.Command{
|
subcmdRestart = cli.Command{
|
||||||
Name: "restart",
|
Name: "restart",
|
||||||
Usage: "Gracefully restart the running process - (not implemented for windows servers)",
|
Usage: "Gracefully restart the running process - (not implemented for windows servers)",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: runRestart,
|
Action: runRestart,
|
||||||
}
|
}
|
||||||
subcmdReloadTemplates = &cli.Command{
|
subcmdReloadTemplates = cli.Command{
|
||||||
Name: "reload-templates",
|
Name: "reload-templates",
|
||||||
Usage: "Reload template files in the running process",
|
Usage: "Reload template files in the running process",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: runReloadTemplates,
|
Action: runReloadTemplates,
|
||||||
}
|
}
|
||||||
subcmdFlushQueues = &cli.Command{
|
subcmdFlushQueues = cli.Command{
|
||||||
Name: "flush-queues",
|
Name: "flush-queues",
|
||||||
Usage: "Flush queues in the running process",
|
Usage: "Flush queues in the running process",
|
||||||
Action: runFlushQueues,
|
Action: runFlushQueues,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.DurationFlag{
|
cli.DurationFlag{
|
||||||
Name: "timeout",
|
Name: "timeout",
|
||||||
Value: 60 * time.Second,
|
Value: 60 * time.Second,
|
||||||
Usage: "Timeout for the flushing process",
|
Usage: "Timeout for the flushing process",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "non-blocking",
|
Name: "non-blocking",
|
||||||
Usage: "Set to true to not wait for flush to complete before returning",
|
Usage: "Set to true to not wait for flush to complete before returning",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
subCmdProcesses = &cli.Command{
|
subCmdProcesses = cli.Command{
|
||||||
Name: "processes",
|
Name: "processes",
|
||||||
Usage: "Display running processes within the current process",
|
Usage: "Display running processes within the current process",
|
||||||
Action: runProcesses,
|
Action: runProcesses,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "flat",
|
Name: "flat",
|
||||||
Usage: "Show processes as flat table rather than as tree",
|
Usage: "Show processes as flat table rather than as tree",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "no-system",
|
Name: "no-system",
|
||||||
Usage: "Do not show system processes",
|
Usage: "Do not show system processes",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "stacktraces",
|
Name: "stacktraces",
|
||||||
Usage: "Show stacktraces",
|
Usage: "Show stacktraces",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "json",
|
Name: "json",
|
||||||
Usage: "Output as json",
|
Usage: "Output as json",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "cancel",
|
Name: "cancel",
|
||||||
Usage: "Process PID to cancel. (Only available for non-system processes.)",
|
Usage: "Process PID to cancel. (Only available for non-system processes.)",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,61 +10,49 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
defaultLoggingFlags = []cli.Flag{
|
defaultLoggingFlags = []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "logger",
|
Name: "logger",
|
||||||
Usage: `Logger name - will default to "default"`,
|
Usage: `Logger name - will default to "default"`,
|
||||||
},
|
}, cli.StringFlag{
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "writer",
|
Name: "writer",
|
||||||
Usage: "Name of the log writer - will default to mode",
|
Usage: "Name of the log writer - will default to mode",
|
||||||
},
|
}, cli.StringFlag{
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "level",
|
Name: "level",
|
||||||
Usage: "Logging level for the new logger",
|
Usage: "Logging level for the new logger",
|
||||||
},
|
}, cli.StringFlag{
|
||||||
&cli.StringFlag{
|
Name: "stacktrace-level, L",
|
||||||
Name: "stacktrace-level",
|
Usage: "Stacktrace logging level",
|
||||||
Aliases: []string{"L"},
|
}, cli.StringFlag{
|
||||||
Usage: "Stacktrace logging level",
|
Name: "flags, F",
|
||||||
},
|
Usage: "Flags for the logger",
|
||||||
&cli.StringFlag{
|
}, cli.StringFlag{
|
||||||
Name: "flags",
|
Name: "expression, e",
|
||||||
Aliases: []string{"F"},
|
Usage: "Matching expression for the logger",
|
||||||
Usage: "Flags for the logger",
|
}, cli.StringFlag{
|
||||||
},
|
Name: "prefix, p",
|
||||||
&cli.StringFlag{
|
Usage: "Prefix for the logger",
|
||||||
Name: "expression",
|
}, cli.BoolFlag{
|
||||||
Aliases: []string{"e"},
|
|
||||||
Usage: "Matching expression for the logger",
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "prefix",
|
|
||||||
Aliases: []string{"p"},
|
|
||||||
Usage: "Prefix for the logger",
|
|
||||||
},
|
|
||||||
&cli.BoolFlag{
|
|
||||||
Name: "color",
|
Name: "color",
|
||||||
Usage: "Use color in the logs",
|
Usage: "Use color in the logs",
|
||||||
},
|
}, cli.BoolFlag{
|
||||||
&cli.BoolFlag{
|
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
subcmdLogging = &cli.Command{
|
subcmdLogging = cli.Command{
|
||||||
Name: "logging",
|
Name: "logging",
|
||||||
Usage: "Adjust logging commands",
|
Usage: "Adjust logging commands",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
{
|
{
|
||||||
Name: "pause",
|
Name: "pause",
|
||||||
Usage: "Pause logging (Gitea will buffer logs up to a certain point and will drop them after that point)",
|
Usage: "Pause logging (Gitea will buffer logs up to a certain point and will drop them after that point)",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -73,7 +61,7 @@ var (
|
|||||||
Name: "resume",
|
Name: "resume",
|
||||||
Usage: "Resume logging",
|
Usage: "Resume logging",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -82,7 +70,7 @@ var (
|
|||||||
Name: "release-and-reopen",
|
Name: "release-and-reopen",
|
||||||
Usage: "Cause Gitea to release and re-open files used for logging",
|
Usage: "Cause Gitea to release and re-open files used for logging",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -92,9 +80,9 @@ var (
|
|||||||
Usage: "Remove a logger",
|
Usage: "Remove a logger",
|
||||||
ArgsUsage: "[name] Name of logger to remove",
|
ArgsUsage: "[name] Name of logger to remove",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
}, &cli.StringFlag{
|
}, cli.StringFlag{
|
||||||
Name: "logger",
|
Name: "logger",
|
||||||
Usage: `Logger name - will default to "default"`,
|
Usage: `Logger name - will default to "default"`,
|
||||||
},
|
},
|
||||||
@@ -103,48 +91,32 @@ var (
|
|||||||
}, {
|
}, {
|
||||||
Name: "add",
|
Name: "add",
|
||||||
Usage: "Add a logger",
|
Usage: "Add a logger",
|
||||||
Subcommands: []*cli.Command{
|
Subcommands: []cli.Command{
|
||||||
{
|
{
|
||||||
Name: "file",
|
Name: "file",
|
||||||
Usage: "Add a file logger",
|
Usage: "Add a file logger",
|
||||||
Flags: append(defaultLoggingFlags, []cli.Flag{
|
Flags: append(defaultLoggingFlags, []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "filename",
|
Name: "filename, f",
|
||||||
Aliases: []string{"f"},
|
Usage: "Filename for the logger - this must be set.",
|
||||||
Usage: "Filename for the logger - this must be set.",
|
}, cli.BoolTFlag{
|
||||||
},
|
Name: "rotate, r",
|
||||||
&cli.BoolFlag{
|
Usage: "Rotate logs",
|
||||||
Name: "rotate",
|
}, cli.Int64Flag{
|
||||||
Aliases: []string{"r"},
|
Name: "max-size, s",
|
||||||
Usage: "Rotate logs",
|
Usage: "Maximum size in bytes before rotation",
|
||||||
Value: true,
|
}, cli.BoolTFlag{
|
||||||
},
|
Name: "daily, d",
|
||||||
&cli.Int64Flag{
|
Usage: "Rotate logs daily",
|
||||||
Name: "max-size",
|
}, cli.IntFlag{
|
||||||
Aliases: []string{"s"},
|
Name: "max-days, D",
|
||||||
Usage: "Maximum size in bytes before rotation",
|
Usage: "Maximum number of daily logs to keep",
|
||||||
},
|
}, cli.BoolTFlag{
|
||||||
&cli.BoolFlag{
|
Name: "compress, z",
|
||||||
Name: "daily",
|
Usage: "Compress rotated logs",
|
||||||
Aliases: []string{"d"},
|
}, cli.IntFlag{
|
||||||
Usage: "Rotate logs daily",
|
Name: "compression-level, Z",
|
||||||
Value: true,
|
Usage: "Compression level to use",
|
||||||
},
|
|
||||||
&cli.IntFlag{
|
|
||||||
Name: "max-days",
|
|
||||||
Aliases: []string{"D"},
|
|
||||||
Usage: "Maximum number of daily logs to keep",
|
|
||||||
},
|
|
||||||
&cli.BoolFlag{
|
|
||||||
Name: "compress",
|
|
||||||
Aliases: []string{"z"},
|
|
||||||
Usage: "Compress rotated logs",
|
|
||||||
Value: true,
|
|
||||||
},
|
|
||||||
&cli.IntFlag{
|
|
||||||
Name: "compression-level",
|
|
||||||
Aliases: []string{"Z"},
|
|
||||||
Usage: "Compression level to use",
|
|
||||||
},
|
},
|
||||||
}...),
|
}...),
|
||||||
Action: runAddFileLogger,
|
Action: runAddFileLogger,
|
||||||
@@ -152,25 +124,18 @@ var (
|
|||||||
Name: "conn",
|
Name: "conn",
|
||||||
Usage: "Add a net conn logger",
|
Usage: "Add a net conn logger",
|
||||||
Flags: append(defaultLoggingFlags, []cli.Flag{
|
Flags: append(defaultLoggingFlags, []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "reconnect-on-message",
|
Name: "reconnect-on-message, R",
|
||||||
Aliases: []string{"R"},
|
Usage: "Reconnect to host for every message",
|
||||||
Usage: "Reconnect to host for every message",
|
}, cli.BoolFlag{
|
||||||
},
|
Name: "reconnect, r",
|
||||||
&cli.BoolFlag{
|
Usage: "Reconnect to host when connection is dropped",
|
||||||
Name: "reconnect",
|
}, cli.StringFlag{
|
||||||
Aliases: []string{"r"},
|
Name: "protocol, P",
|
||||||
Usage: "Reconnect to host when connection is dropped",
|
Usage: "Set protocol to use: tcp, unix, or udp (defaults to tcp)",
|
||||||
},
|
}, cli.StringFlag{
|
||||||
&cli.StringFlag{
|
Name: "address, a",
|
||||||
Name: "protocol",
|
Usage: "Host address and port to connect to (defaults to :7020)",
|
||||||
Aliases: []string{"P"},
|
|
||||||
Usage: "Set protocol to use: tcp, unix, or udp (defaults to tcp)",
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
|
||||||
Name: "address",
|
|
||||||
Aliases: []string{"a"},
|
|
||||||
Usage: "Host address and port to connect to (defaults to :7020)",
|
|
||||||
},
|
},
|
||||||
}...),
|
}...),
|
||||||
Action: runAddConnLogger,
|
Action: runAddConnLogger,
|
||||||
@@ -180,10 +145,9 @@ var (
|
|||||||
Name: "log-sql",
|
Name: "log-sql",
|
||||||
Usage: "Set LogSQL",
|
Usage: "Set LogSQL",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
}, cli.BoolFlag{
|
||||||
&cli.BoolFlag{
|
|
||||||
Name: "off",
|
Name: "off",
|
||||||
Usage: "Switch off SQL logging",
|
Usage: "Switch off SQL logging",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdMigrate represents the available migrate sub-command.
|
// CmdMigrate represents the available migrate sub-command.
|
||||||
var CmdMigrate = &cli.Command{
|
var CmdMigrate = cli.Command{
|
||||||
Name: "migrate",
|
Name: "migrate",
|
||||||
Usage: "Migrate the database",
|
Usage: "Migrate the database",
|
||||||
Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.",
|
Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.",
|
||||||
|
|||||||
@@ -20,73 +20,70 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/storage"
|
"code.gitea.io/gitea/modules/storage"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdMigrateStorage represents the available migrate storage sub-command.
|
// CmdMigrateStorage represents the available migrate storage sub-command.
|
||||||
var CmdMigrateStorage = &cli.Command{
|
var CmdMigrateStorage = cli.Command{
|
||||||
Name: "migrate-storage",
|
Name: "migrate-storage",
|
||||||
Usage: "Migrate the storage",
|
Usage: "Migrate the storage",
|
||||||
Description: "Copies stored files from storage configured in app.ini to parameter-configured storage",
|
Description: "Copies stored files from storage configured in app.ini to parameter-configured storage",
|
||||||
Action: runMigrateStorage,
|
Action: runMigrateStorage,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "type",
|
Name: "type, t",
|
||||||
Aliases: []string{"t"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log'",
|
||||||
Usage: "Type of stored files to copy. Allowed types: 'attachments', 'lfs', 'avatars', 'repo-avatars', 'repo-archivers', 'packages', 'actions-log'",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "storage",
|
Name: "storage, s",
|
||||||
Aliases: []string{"s"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "New storage type: local (default) or minio",
|
||||||
Usage: "New storage type: local (default) or minio",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "path",
|
Name: "path, p",
|
||||||
Aliases: []string{"p"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "New storage placement if store is local (leave blank for default)",
|
||||||
Usage: "New storage placement if store is local (leave blank for default)",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "minio-endpoint",
|
Name: "minio-endpoint",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Minio storage endpoint",
|
Usage: "Minio storage endpoint",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "minio-access-key-id",
|
Name: "minio-access-key-id",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Minio storage accessKeyID",
|
Usage: "Minio storage accessKeyID",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "minio-secret-access-key",
|
Name: "minio-secret-access-key",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Minio storage secretAccessKey",
|
Usage: "Minio storage secretAccessKey",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "minio-bucket",
|
Name: "minio-bucket",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Minio storage bucket",
|
Usage: "Minio storage bucket",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "minio-location",
|
Name: "minio-location",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Minio storage location to create bucket",
|
Usage: "Minio storage location to create bucket",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "minio-base-path",
|
Name: "minio-base-path",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Minio storage base path on the bucket",
|
Usage: "Minio storage base path on the bucket",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "minio-use-ssl",
|
Name: "minio-use-ssl",
|
||||||
Usage: "Enable SSL for minio",
|
Usage: "Enable SSL for minio",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "minio-insecure-skip-verify",
|
Name: "minio-insecure-skip-verify",
|
||||||
Usage: "Skip SSL verification",
|
Usage: "Skip SSL verification",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "minio-checksum-algorithm",
|
Name: "minio-checksum-algorithm",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Minio checksum algorithm (default/md5)",
|
Usage: "Minio checksum algorithm (default/md5)",
|
||||||
@@ -185,7 +182,7 @@ func runMigrateStorage(ctx *cli.Context) error {
|
|||||||
case string(setting.LocalStorageType):
|
case string(setting.LocalStorageType):
|
||||||
p := ctx.String("path")
|
p := ctx.String("path")
|
||||||
if p == "" {
|
if p == "" {
|
||||||
log.Fatal("Path must be given when storage is local")
|
log.Fatal("Path must be given when storage is loal")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
dstStorage, err = storage.NewLocalStorage(
|
dstStorage, err = storage.NewLocalStorage(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models/db"
|
|
||||||
"code.gitea.io/gitea/models/packages"
|
"code.gitea.io/gitea/models/packages"
|
||||||
"code.gitea.io/gitea/models/unittest"
|
"code.gitea.io/gitea/models/unittest"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
@@ -31,7 +30,7 @@ func TestMigratePackages(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
defer buf.Close()
|
defer buf.Close()
|
||||||
|
|
||||||
v, f, err := packages_service.CreatePackageAndAddFile(db.DefaultContext, &packages_service.PackageCreationInfo{
|
v, f, err := packages_service.CreatePackageAndAddFile(&packages_service.PackageCreationInfo{
|
||||||
PackageInfo: packages_service.PackageInfo{
|
PackageInfo: packages_service.PackageInfo{
|
||||||
Owner: creator,
|
Owner: creator,
|
||||||
PackageType: packages.TypeGeneric,
|
PackageType: packages.TypeGeneric,
|
||||||
|
|||||||
@@ -9,39 +9,38 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/private"
|
"code.gitea.io/gitea/modules/private"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CmdRestoreRepository represents the available restore a repository sub-command.
|
// CmdRestoreRepository represents the available restore a repository sub-command.
|
||||||
var CmdRestoreRepository = &cli.Command{
|
var CmdRestoreRepository = cli.Command{
|
||||||
Name: "restore-repo",
|
Name: "restore-repo",
|
||||||
Usage: "Restore the repository from disk",
|
Usage: "Restore the repository from disk",
|
||||||
Description: "This is a command for restoring the repository data.",
|
Description: "This is a command for restoring the repository data.",
|
||||||
Action: runRestoreRepository,
|
Action: runRestoreRepository,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "repo_dir",
|
Name: "repo_dir, r",
|
||||||
Aliases: []string{"r"},
|
Value: "./data",
|
||||||
Value: "./data",
|
Usage: "Repository dir path to restore from",
|
||||||
Usage: "Repository dir path to restore from",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "owner_name",
|
Name: "owner_name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Restore destination owner name",
|
Usage: "Restore destination owner name",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "repo_name",
|
Name: "repo_name",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Restore destination repository name",
|
Usage: "Restore destination repository name",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "units",
|
Name: "units",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: `Which items will be restored, one or more units should be separated as comma.
|
Usage: `Which items will be restored, one or more units should be separated as comma.
|
||||||
wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.`,
|
wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.`,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "validation",
|
Name: "validation",
|
||||||
Usage: "Sanity check the content of the files before trying to load them",
|
Usage: "Sanity check the content of the files before trying to load them",
|
||||||
},
|
},
|
||||||
|
|||||||
22
cmd/serv.go
22
cmd/serv.go
@@ -30,9 +30,9 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/services/lfs"
|
"code.gitea.io/gitea/services/lfs"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v4"
|
||||||
"github.com/kballard/go-shellquote"
|
"github.com/kballard/go-shellquote"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -40,17 +40,17 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// CmdServ represents the available serv sub-command.
|
// CmdServ represents the available serv sub-command.
|
||||||
var CmdServ = &cli.Command{
|
var CmdServ = cli.Command{
|
||||||
Name: "serv",
|
Name: "serv",
|
||||||
Usage: "This command should only be called by SSH shell",
|
Usage: "This command should only be called by SSH shell",
|
||||||
Description: "Serv provides access auth for repositories",
|
Description: "Serv provides access auth for repositories",
|
||||||
Before: PrepareConsoleLoggerLevel(log.FATAL),
|
Before: PrepareConsoleLoggerLevel(log.FATAL),
|
||||||
Action: runServ,
|
Action: runServ,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "enable-pprof",
|
Name: "enable-pprof",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "debug",
|
Name: "debug",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -119,7 +119,7 @@ func fail(ctx context.Context, userMessage, logMsgFmt string, args ...any) error
|
|||||||
}
|
}
|
||||||
_ = private.SSHLog(ctx, true, logMsg)
|
_ = private.SSHLog(ctx, true, logMsg)
|
||||||
}
|
}
|
||||||
return cli.Exit("", 1)
|
return cli.NewExitError("", 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// handleCliResponseExtra handles the extra response from the cli sub-commands
|
// handleCliResponseExtra handles the extra response from the cli sub-commands
|
||||||
@@ -130,7 +130,7 @@ func handleCliResponseExtra(extra private.ResponseExtra) error {
|
|||||||
_, _ = fmt.Fprintln(os.Stdout, extra.UserMsg)
|
_, _ = fmt.Fprintln(os.Stdout, extra.UserMsg)
|
||||||
}
|
}
|
||||||
if extra.HasError() {
|
if extra.HasError() {
|
||||||
return cli.Exit(extra.Error, 1)
|
return cli.NewExitError(extra.Error, 1)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -147,20 +147,20 @@ func runServ(c *cli.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.NArg() < 1 {
|
if len(c.Args()) < 1 {
|
||||||
if err := cli.ShowSubcommandHelp(c); err != nil {
|
if err := cli.ShowSubcommandHelp(c); err != nil {
|
||||||
fmt.Printf("error showing subcommand help: %v\n", err)
|
fmt.Printf("error showing subcommand help: %v\n", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
keys := strings.Split(c.Args().First(), "-")
|
keys := strings.Split(c.Args()[0], "-")
|
||||||
if len(keys) != 2 || keys[0] != "key" {
|
if len(keys) != 2 || keys[0] != "key" {
|
||||||
return fail(ctx, "Key ID format error", "Invalid key argument: %s", c.Args().First())
|
return fail(ctx, "Key ID format error", "Invalid key argument: %s", c.Args()[0])
|
||||||
}
|
}
|
||||||
keyID, err := strconv.ParseInt(keys[1], 10, 64)
|
keyID, err := strconv.ParseInt(keys[1], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fail(ctx, "Key ID parsing error", "Invalid key argument: %s", c.Args().Get(1))
|
return fail(ctx, "Key ID parsing error", "Invalid key argument: %s", c.Args()[1])
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
|
||||||
|
|||||||
85
cmd/web.go
85
cmd/web.go
@@ -15,24 +15,22 @@ import (
|
|||||||
|
|
||||||
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
|
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/container"
|
|
||||||
"code.gitea.io/gitea/modules/graceful"
|
"code.gitea.io/gitea/modules/graceful"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/process"
|
"code.gitea.io/gitea/modules/process"
|
||||||
"code.gitea.io/gitea/modules/public"
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/routers"
|
"code.gitea.io/gitea/routers"
|
||||||
"code.gitea.io/gitea/routers/install"
|
"code.gitea.io/gitea/routers/install"
|
||||||
|
|
||||||
"github.com/felixge/fgprof"
|
"github.com/felixge/fgprof"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PIDFile could be set from build tag
|
// PIDFile could be set from build tag
|
||||||
var PIDFile = "/run/gitea.pid"
|
var PIDFile = "/run/gitea.pid"
|
||||||
|
|
||||||
// CmdWeb represents the available web sub-command.
|
// CmdWeb represents the available web sub-command.
|
||||||
var CmdWeb = &cli.Command{
|
var CmdWeb = cli.Command{
|
||||||
Name: "web",
|
Name: "web",
|
||||||
Usage: "Start Gitea web server",
|
Usage: "Start Gitea web server",
|
||||||
Description: `Gitea web server is the only thing you need to run,
|
Description: `Gitea web server is the only thing you need to run,
|
||||||
@@ -40,29 +38,26 @@ and it takes care of all the other things for you`,
|
|||||||
Before: PrepareConsoleLoggerLevel(log.INFO),
|
Before: PrepareConsoleLoggerLevel(log.INFO),
|
||||||
Action: runWeb,
|
Action: runWeb,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "port",
|
Name: "port, p",
|
||||||
Aliases: []string{"p"},
|
Value: "3000",
|
||||||
Value: "3000",
|
Usage: "Temporary port number to prevent conflict",
|
||||||
Usage: "Temporary port number to prevent conflict",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "install-port",
|
Name: "install-port",
|
||||||
Value: "3000",
|
Value: "3000",
|
||||||
Usage: "Temporary port number to run the install page on to prevent conflict",
|
Usage: "Temporary port number to run the install page on to prevent conflict",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "pid",
|
Name: "pid, P",
|
||||||
Aliases: []string{"P"},
|
Value: PIDFile,
|
||||||
Value: PIDFile,
|
Usage: "Custom pid file path",
|
||||||
Usage: "Custom pid file path",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "quiet",
|
Name: "quiet, q",
|
||||||
Aliases: []string{"q"},
|
Usage: "Only display Fatal logging errors until logging is set-up",
|
||||||
Usage: "Only display Fatal logging errors until logging is set-up",
|
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "verbose",
|
Name: "verbose",
|
||||||
Usage: "Set initial logging to TRACE level until logging is properly set-up",
|
Usage: "Set initial logging to TRACE level until logging is properly set-up",
|
||||||
},
|
},
|
||||||
@@ -107,18 +102,13 @@ func createPIDFile(pidPath string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func showWebStartupMessage(msg string) {
|
|
||||||
log.Info("Gitea version: %s%s", setting.AppVer, setting.AppBuiltWith)
|
|
||||||
log.Info("* RunMode: %s", setting.RunMode)
|
|
||||||
log.Info("* AppPath: %s", setting.AppPath)
|
|
||||||
log.Info("* WorkPath: %s", setting.AppWorkPath)
|
|
||||||
log.Info("* CustomPath: %s", setting.CustomPath)
|
|
||||||
log.Info("* ConfigFile: %s", setting.CustomConf)
|
|
||||||
log.Info("%s", msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
func serveInstall(ctx *cli.Context) error {
|
func serveInstall(ctx *cli.Context) error {
|
||||||
showWebStartupMessage("Prepare to run install page")
|
log.Info("Gitea version: %s%s", setting.AppVer, setting.AppBuiltWith)
|
||||||
|
log.Info("App path: %s", setting.AppPath)
|
||||||
|
log.Info("Work path: %s", setting.AppWorkPath)
|
||||||
|
log.Info("Custom path: %s", setting.CustomPath)
|
||||||
|
log.Info("Config file: %s", setting.CustomConf)
|
||||||
|
log.Info("Prepare to run install page")
|
||||||
|
|
||||||
routers.InitWebInstallPage(graceful.GetManager().HammerContext())
|
routers.InitWebInstallPage(graceful.GetManager().HammerContext())
|
||||||
|
|
||||||
@@ -155,42 +145,33 @@ func serveInstalled(ctx *cli.Context) error {
|
|||||||
setting.LoadCommonSettings()
|
setting.LoadCommonSettings()
|
||||||
setting.MustInstalled()
|
setting.MustInstalled()
|
||||||
|
|
||||||
showWebStartupMessage("Prepare to run web server")
|
log.Info("Gitea version: %s%s", setting.AppVer, setting.AppBuiltWith)
|
||||||
|
log.Info("App path: %s", setting.AppPath)
|
||||||
|
log.Info("Work path: %s", setting.AppWorkPath)
|
||||||
|
log.Info("Custom path: %s", setting.CustomPath)
|
||||||
|
log.Info("Config file: %s", setting.CustomConf)
|
||||||
|
log.Info("Run mode: %s", setting.RunMode)
|
||||||
|
log.Info("Prepare to run web server")
|
||||||
|
|
||||||
if setting.AppWorkPathMismatch {
|
if setting.AppWorkPathMismatch {
|
||||||
log.Error("WORK_PATH from config %q doesn't match other paths from environment variables or command arguments. "+
|
log.Error("WORK_PATH from config %q doesn't match other paths from environment variables or command arguments. "+
|
||||||
"Only WORK_PATH in config should be set and used. Please make sure the path in config file is correct, "+
|
"Only WORK_PATH in config should be set and used. Please remove the other outdated work paths from environment variables and command arguments", setting.CustomConf)
|
||||||
"remove the other outdated work paths from environment variables and command arguments", setting.CustomConf)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rootCfg := setting.CfgProvider
|
rootCfg := setting.CfgProvider
|
||||||
if rootCfg.Section("").Key("WORK_PATH").String() == "" {
|
if rootCfg.Section("").Key("WORK_PATH").String() == "" {
|
||||||
saveCfg, err := rootCfg.PrepareSaving()
|
saveCfg, err := rootCfg.PrepareSaving()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Unable to prepare saving WORK_PATH=%s to config %q: %v\nYou should set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err)
|
log.Error("Unable to prepare saving WORK_PATH=%s to config %q: %v\nYou must set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err)
|
||||||
} else {
|
} else {
|
||||||
rootCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath)
|
rootCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath)
|
||||||
saveCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath)
|
saveCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath)
|
||||||
if err = saveCfg.Save(); err != nil {
|
if err = saveCfg.Save(); err != nil {
|
||||||
log.Error("Unable to update WORK_PATH=%s to config %q: %v\nYou should set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err)
|
log.Error("Unable to update WORK_PATH=%s to config %q: %v\nYou must set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// in old versions, user's custom web files are placed in "custom/public", and they were served as "http://domain.com/assets/xxx"
|
|
||||||
// now, Gitea only serves pre-defined files in the "custom/public" folder basing on the web root, the user should move their custom files to "custom/public/assets"
|
|
||||||
publicFiles, _ := public.AssetFS().ListFiles(".")
|
|
||||||
publicFilesSet := container.SetOf(publicFiles...)
|
|
||||||
publicFilesSet.Remove(".well-known")
|
|
||||||
publicFilesSet.Remove("assets")
|
|
||||||
publicFilesSet.Remove("robots.txt")
|
|
||||||
for _, fn := range publicFilesSet.Values() {
|
|
||||||
log.Error("Found legacy public asset %q in CustomPath. Please move it to %s/public/assets/%s", fn, setting.CustomPath, fn)
|
|
||||||
}
|
|
||||||
if _, err := os.Stat(filepath.Join(setting.CustomPath, "robots.txt")); err == nil {
|
|
||||||
log.Error(`Found legacy public asset "robots.txt" in CustomPath. Please move it to %s/public/robots.txt`, setting.CustomPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
routers.InitWebInstalled(graceful.GetManager().HammerContext())
|
routers.InitWebInstalled(graceful.GetManager().HammerContext())
|
||||||
|
|
||||||
// We check that AppDataPath exists here (it should have been created during installation)
|
// We check that AppDataPath exists here (it should have been created during installation)
|
||||||
@@ -208,8 +189,8 @@ func serveInstalled(ctx *cli.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up Chi routes
|
// Set up Chi routes
|
||||||
webRoutes := routers.NormalRoutes()
|
c := routers.NormalRoutes(graceful.GetManager().HammerContext())
|
||||||
err := listen(webRoutes, true)
|
err := listen(c, true)
|
||||||
<-graceful.GetManager().Done()
|
<-graceful.GetManager().Done()
|
||||||
log.Info("PID: %d Gitea Web Finished", os.Getpid())
|
log.Info("PID: %d Gitea Web Finished", os.Getpid())
|
||||||
log.GetManager().Close()
|
log.GetManager().Close()
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/google/go-github/v53/github"
|
"github.com/google/go-github/v52/github"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -32,55 +32,55 @@ func main() {
|
|||||||
app.ArgsUsage = "<PR-to-backport>"
|
app.ArgsUsage = "<PR-to-backport>"
|
||||||
|
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "version",
|
Name: "version",
|
||||||
Usage: "Version branch to backport on to",
|
Usage: "Version branch to backport on to",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "upstream",
|
Name: "upstream",
|
||||||
Value: "origin",
|
Value: "origin",
|
||||||
Usage: "Upstream remote for the Gitea upstream",
|
Usage: "Upstream remote for the Gitea upstream",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "release-branch",
|
Name: "release-branch",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Release branch to backport on. Will default to release/<version>",
|
Usage: "Release branch to backport on. Will default to release/<version>",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "cherry-pick",
|
Name: "cherry-pick",
|
||||||
Usage: "SHA to cherry-pick as backport",
|
Usage: "SHA to cherry-pick as backport",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "backport-branch",
|
Name: "backport-branch",
|
||||||
Usage: "Backport branch to backport on to (default: backport-<pr>-<version>",
|
Usage: "Backport branch to backport on to (default: backport-<pr>-<version>",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "remote",
|
Name: "remote",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Remote for your fork of the Gitea upstream",
|
Usage: "Remote for your fork of the Gitea upstream",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "fork-user",
|
Name: "fork-user",
|
||||||
Value: "",
|
Value: "",
|
||||||
Usage: "Forked user name on Github",
|
Usage: "Forked user name on Github",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "no-fetch",
|
Name: "no-fetch",
|
||||||
Usage: "Set this flag to prevent fetch of remote branches",
|
Usage: "Set this flag to prevent fetch of remote branches",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "no-amend-message",
|
Name: "no-amend-message",
|
||||||
Usage: "Set this flag to prevent automatic amendment of the commit message",
|
Usage: "Set this flag to prevent automatic amendment of the commit message",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "no-push",
|
Name: "no-push",
|
||||||
Usage: "Set this flag to prevent pushing the backport up to your fork",
|
Usage: "Set this flag to prevent pushing the backport up to your fork",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "no-xdg-open",
|
Name: "no-xdg-open",
|
||||||
Usage: "Set this flag to not use xdg-open to open the PR URL",
|
Usage: "Set this flag to not use xdg-open to open the PR URL",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "continue",
|
Name: "continue",
|
||||||
Usage: "Set this flag to continue from a git cherry-pick that has broken",
|
Usage: "Set this flag to continue from a git cherry-pick that has broken",
|
||||||
},
|
},
|
||||||
@@ -151,7 +151,7 @@ func runBackport(c *cli.Context) error {
|
|||||||
|
|
||||||
localReleaseBranch := path.Join(upstream, upstreamReleaseBranch)
|
localReleaseBranch := path.Join(upstream, upstreamReleaseBranch)
|
||||||
|
|
||||||
args := c.Args().Slice()
|
args := c.Args()
|
||||||
if len(args) == 0 && pr == "" {
|
if len(args) == 0 && pr == "" {
|
||||||
return fmt.Errorf("no PR number provided\nProvide a PR number to backport")
|
return fmt.Errorf("no PR number provided\nProvide a PR number to backport")
|
||||||
} else if len(args) != 1 && pr == "" {
|
} else if len(args) != 1 && pr == "" {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -46,29 +46,25 @@ func main() {
|
|||||||
and "GITEA__LOG_0x2E_CONSOLE__STDERR=false". Other examples can be found
|
and "GITEA__LOG_0x2E_CONSOLE__STDERR=false". Other examples can be found
|
||||||
on the configuration cheat sheet.`
|
on the configuration cheat sheet.`
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "custom-path",
|
Name: "custom-path, C",
|
||||||
Aliases: []string{"C"},
|
Value: setting.CustomPath,
|
||||||
Value: setting.CustomPath,
|
Usage: "Custom path file path",
|
||||||
Usage: "Custom path file path",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "config",
|
Name: "config, c",
|
||||||
Aliases: []string{"c"},
|
Value: setting.CustomConf,
|
||||||
Value: setting.CustomConf,
|
Usage: "Custom configuration file path",
|
||||||
Usage: "Custom configuration file path",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "work-path",
|
Name: "work-path, w",
|
||||||
Aliases: []string{"w"},
|
Value: setting.AppWorkPath,
|
||||||
Value: setting.AppWorkPath,
|
Usage: "Set the gitea working path",
|
||||||
Usage: "Set the gitea working path",
|
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "out",
|
Name: "out, o",
|
||||||
Aliases: []string{"o"},
|
Value: "",
|
||||||
Value: "",
|
Usage: "Destination file to write to",
|
||||||
Usage: "Destination file to write to",
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
app.Action = runEnvironmentToIni
|
app.Action = runEnvironmentToIni
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
dashboardTimezone: 'default',
|
dashboardTimezone: 'default',
|
||||||
dashboardRefresh: '1m',
|
dashboardRefresh: '1m',
|
||||||
|
|
||||||
// please see https://docs.gitea.com/administration/config-cheat-sheet#metrics-metrics
|
// please see https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics
|
||||||
// Show issue by repository metrics with format gitea_issues_by_repository{repository="org/repo"} 5.
|
// Show issue by repository metrics with format gitea_issues_by_repository{repository="org/repo"} 5.
|
||||||
// Requires Gitea 1.16.0 with ENABLED_ISSUE_BY_REPOSITORY set to true.
|
// Requires Gitea 1.16.0 with ENABLED_ISSUE_BY_REPOSITORY set to true.
|
||||||
showIssuesByRepository: true,
|
showIssuesByRepository: true,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
<h3>With your Consent</h3>
|
<h3>With your Consent</h3>
|
||||||
|
|
||||||
<p>We share your User Personal Information, if you consent, after letting you know what information will be shared, with whom, and why. For example, if you allow third party applications to access your Account using <a href="https://docs.gitea.com/development/oauth2-provider">OAuth2 providers</a>, we share all information associated with your Account, including private repos and organizations. You may also direct us through your action on Your Gitea Instance to share your User Personal Information, such as when joining an Organization.</p>
|
<p>We share your User Personal Information, if you consent, after letting you know what information will be shared, with whom, and why. For example, if you allow third party applications to access your Account using <a href="https://docs.gitea.io/en-us/oauth2-provider/">OAuth2 providers</a>, we share all information associated with your Account, including private repos and organizations. You may also direct us through your action on Your Gitea Instance to share your User Personal Information, such as when joining an Organization.</p>
|
||||||
|
|
||||||
<h3>With Service Providers</h3>
|
<h3>With Service Providers</h3>
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
<h3>Data Portability</h3>
|
<h3>Data Portability</h3>
|
||||||
|
|
||||||
<p>As a Your Gitea Instance User, you can always take your data with you. You can clone your repositories to your computer, or you can <a href="https://docs.gitea.com/development/migrations-interfaces">perform migrations using the provided interfaces</a>, for example.</p>
|
<p>As a Your Gitea Instance User, you can always take your data with you. You can clone your repositories to your computer, or you can <a href="https://docs.gitea.io/en-us/migrations-interfaces/">perform migrations using the provided interfaces</a>, for example.</p>
|
||||||
|
|
||||||
<h3>Data Retention and Deletion of Data</h3>
|
<h3>Data Retention and Deletion of Data</h3>
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
|
|
||||||
<h2>Changes to this Privacy Policy</h2>
|
<h2>Changes to this Privacy Policy</h2>
|
||||||
|
|
||||||
<p>Although most changes are likely to be minor, Your Gitea Instance may change our Privacy Statement from time to time. We will provide notification to Users of material changes to this Privacy Statement through our Website at least 30 days prior to the change taking effect by posting a notice on our home page or sending email to the primary email address specified in your account.</p>
|
<p>Although most changes are likely to be minor, Your Gitea Instance may change our Privacy Statement from time to time. We will provide notification to Users of material changes to this Privacy Statement through our Website at least 30 days prior to the change taking effect by posting a notice on our home page or sending email to the primary email address specified in your account.</p>
|
||||||
|
|
||||||
<h2>Contact</h2>
|
<h2>Contact</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
;; Do not copy the whole file as-is, as it contains some invalid sections for illustrative purposes.
|
;; Do not copy the whole file as-is, as it contains some invalid sections for illustrative purposes.
|
||||||
;; If you don't know what a setting is you should not set it.
|
;; If you don't know what a setting is you should not set it.
|
||||||
;;
|
;;
|
||||||
;; see https://docs.gitea.com/administration/config-cheat-sheet for additional documentation.
|
;; see https://docs.gitea.io/en-us/config-cheat-sheet/ for additional documentation.
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
;; These values are environment-dependent but form the basis of a lot of values. They will be
|
;; These values are environment-dependent but form the basis of a lot of values. They will be
|
||||||
;; reported as part of the default configuration when running `gitea help` or on start-up. The order they are emitted there is slightly different but we will list them here in the order they are set-up.
|
;; reported as part of the default configuration when running `gitea --help` or on start-up. The order they are emitted there is slightly different but we will list them here in the order they are set-up.
|
||||||
;;
|
;;
|
||||||
;; - _`AppPath`_: This is the absolute path of the running gitea binary.
|
;; - _`AppPath`_: This is the absolute path of the running gitea binary.
|
||||||
;; - _`AppWorkPath`_: This refers to "working path" of the `gitea` binary. It is determined by using the first set thing in the following hierarchy:
|
;; - _`AppWorkPath`_: This refers to "working path" of the `gitea` binary. It is determined by using the first set thing in the following hierarchy:
|
||||||
@@ -119,13 +119,10 @@ RUN_USER = ; git
|
|||||||
;; Permission for unix socket
|
;; Permission for unix socket
|
||||||
;UNIX_SOCKET_PERMISSION = 666
|
;UNIX_SOCKET_PERMISSION = 666
|
||||||
;;
|
;;
|
||||||
;; Local (DMZ) URL for Gitea workers (such as SSH update) accessing web service. In
|
;; Local (DMZ) URL for Gitea workers (such as SSH update) accessing web service.
|
||||||
;; most cases you do not need to change the default value. Alter it only if
|
;; In most cases you do not need to change the default value.
|
||||||
;; your SSH server node is not the same as HTTP node. For different protocol, the default
|
;; Alter it only if your SSH server node is not the same as HTTP node.
|
||||||
;; values are different. If `PROTOCOL` is `http+unix`, the default value is `http://unix/`.
|
;; Do not set this variable if PROTOCOL is set to 'unix'.
|
||||||
;; If `PROTOCOL` is `fcgi` or `fcgi+unix`, the default value is `%(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/`.
|
|
||||||
;; If listen on `0.0.0.0`, the default value is `%(PROTOCOL)s://localhost:%(HTTP_PORT)s/`, Otherwise the default
|
|
||||||
;; value is `%(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/`.
|
|
||||||
;LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/
|
;LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/
|
||||||
;;
|
;;
|
||||||
;; When making local connections pass the PROXY protocol header.
|
;; When making local connections pass the PROXY protocol header.
|
||||||
@@ -193,8 +190,8 @@ RUN_USER = ; git
|
|||||||
;; Use `ssh-keygen` to parse public SSH keys. The value is passed to the shell. By default, Gitea does the parsing itself.
|
;; Use `ssh-keygen` to parse public SSH keys. The value is passed to the shell. By default, Gitea does the parsing itself.
|
||||||
;SSH_KEYGEN_PATH =
|
;SSH_KEYGEN_PATH =
|
||||||
;;
|
;;
|
||||||
;; Enable SSH Authorized Key Backup when rewriting all keys, default is false
|
;; Enable SSH Authorized Key Backup when rewriting all keys, default is true
|
||||||
;SSH_AUTHORIZED_KEYS_BACKUP = false
|
;SSH_AUTHORIZED_KEYS_BACKUP = true
|
||||||
;;
|
;;
|
||||||
;; Determines which principals to allow
|
;; Determines which principals to allow
|
||||||
;; - empty: if SSH_TRUSTED_USER_CA_KEYS is empty this will default to off, otherwise will default to email, username.
|
;; - empty: if SSH_TRUSTED_USER_CA_KEYS is empty this will default to off, otherwise will default to email, username.
|
||||||
@@ -303,10 +300,7 @@ RUN_USER = ; git
|
|||||||
;;
|
;;
|
||||||
;;
|
;;
|
||||||
;; LFS authentication secret, change this yourself
|
;; LFS authentication secret, change this yourself
|
||||||
;LFS_JWT_SECRET =
|
LFS_JWT_SECRET =
|
||||||
;;
|
|
||||||
;; Alternative location to specify LFS authentication secret. You cannot specify both this and LFS_JWT_SECRET, and must pick one
|
|
||||||
;LFS_JWT_SECRET_URI = file:/etc/gitea/lfs_jwt_secret
|
|
||||||
;;
|
;;
|
||||||
;; LFS authentication validity period (in time.Duration), pushes taking longer than this may fail.
|
;; LFS authentication validity period (in time.Duration), pushes taking longer than this may fail.
|
||||||
;LFS_HTTP_AUTH_EXPIRY = 24h
|
;LFS_HTTP_AUTH_EXPIRY = 24h
|
||||||
@@ -350,6 +344,9 @@ NAME = gitea
|
|||||||
USER = root
|
USER = root
|
||||||
;PASSWD = ;Use PASSWD = `your password` for quoting if you use special characters in the password.
|
;PASSWD = ;Use PASSWD = `your password` for quoting if you use special characters in the password.
|
||||||
;SSL_MODE = false ; either "false" (default), "true", or "skip-verify"
|
;SSL_MODE = false ; either "false" (default), "true", or "skip-verify"
|
||||||
|
;CHARSET = utf8mb4 ;either "utf8" or "utf8mb4", default is "utf8mb4".
|
||||||
|
;;
|
||||||
|
;; NOTICE: for "utf8mb4" you must use MySQL InnoDB > 5.6. Gitea is unable to check this.
|
||||||
;;
|
;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;
|
;;
|
||||||
@@ -454,7 +451,7 @@ INTERNAL_TOKEN=
|
|||||||
;REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128
|
;REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128
|
||||||
;;
|
;;
|
||||||
;; The minimum password length for new Users
|
;; The minimum password length for new Users
|
||||||
;MIN_PASSWORD_LENGTH = 8
|
;MIN_PASSWORD_LENGTH = 6
|
||||||
;;
|
;;
|
||||||
;; Set to true to allow users to import local server paths
|
;; Set to true to allow users to import local server paths
|
||||||
;IMPORT_LOCAL_PATHS = false
|
;IMPORT_LOCAL_PATHS = false
|
||||||
@@ -491,11 +488,6 @@ INTERNAL_TOKEN=
|
|||||||
;; Cache successful token hashes. API tokens are stored in the DB as pbkdf2 hashes however, this means that there is a potentially significant hashing load when there are multiple API operations.
|
;; Cache successful token hashes. API tokens are stored in the DB as pbkdf2 hashes however, this means that there is a potentially significant hashing load when there are multiple API operations.
|
||||||
;; This cache will store the successfully hashed tokens in a LRU cache as a balance between performance and security.
|
;; This cache will store the successfully hashed tokens in a LRU cache as a balance between performance and security.
|
||||||
;SUCCESSFUL_TOKENS_CACHE_SIZE = 20
|
;SUCCESSFUL_TOKENS_CACHE_SIZE = 20
|
||||||
;;
|
|
||||||
;; Reject API tokens sent in URL query string (Accept Header-based API tokens only). This avoids security vulnerabilities
|
|
||||||
;; stemming from cached/logged plain-text API tokens.
|
|
||||||
;; In future releases, this will become the default behavior
|
|
||||||
;DISABLE_QUERY_AUTH_TOKEN = false
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -535,9 +527,6 @@ ENABLE = true
|
|||||||
;; This setting is only needed if JWT_SIGNING_ALGORITHM is set to HS256, HS384 or HS512.
|
;; This setting is only needed if JWT_SIGNING_ALGORITHM is set to HS256, HS384 or HS512.
|
||||||
;JWT_SECRET =
|
;JWT_SECRET =
|
||||||
;;
|
;;
|
||||||
;; Alternative location to specify OAuth2 authentication secret. You cannot specify both this and JWT_SECRET, and must pick one
|
|
||||||
;JWT_SECRET_URI = file:/etc/gitea/oauth2_jwt_secret
|
|
||||||
;;
|
|
||||||
;; Lifetime of an OAuth2 access token in seconds
|
;; Lifetime of an OAuth2 access token in seconds
|
||||||
;ACCESS_TOKEN_EXPIRATION_TIME = 3600
|
;ACCESS_TOKEN_EXPIRATION_TIME = 3600
|
||||||
;;
|
;;
|
||||||
@@ -549,11 +538,6 @@ ENABLE = true
|
|||||||
;;
|
;;
|
||||||
;; Maximum length of oauth2 token/cookie stored on server
|
;; Maximum length of oauth2 token/cookie stored on server
|
||||||
;MAX_TOKEN_LENGTH = 32767
|
;MAX_TOKEN_LENGTH = 32767
|
||||||
;;
|
|
||||||
;; Pre-register OAuth2 applications for some universally useful services
|
|
||||||
;; * https://github.com/hickford/git-credential-oauth
|
|
||||||
;; * https://github.com/git-ecosystem/git-credential-manager
|
|
||||||
;DEFAULT_APPLICATIONS = git-credential-oauth, git-credential-manager
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -764,8 +748,6 @@ LEVEL = Info
|
|||||||
;;
|
;;
|
||||||
;; More detail: https://github.com/gogits/gogs/issues/165
|
;; More detail: https://github.com/gogits/gogs/issues/165
|
||||||
;ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
;ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
||||||
; Enable this to allow reverse proxy authentication for API requests, the reverse proxy is responsible for ensuring that no CSRF is possible.
|
|
||||||
;ENABLE_REVERSE_PROXY_AUTHENTICATION_API = false
|
|
||||||
;ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
|
;ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
|
||||||
;ENABLE_REVERSE_PROXY_EMAIL = false
|
;ENABLE_REVERSE_PROXY_EMAIL = false
|
||||||
;ENABLE_REVERSE_PROXY_FULL_NAME = false
|
;ENABLE_REVERSE_PROXY_FULL_NAME = false
|
||||||
@@ -839,15 +821,6 @@ LEVEL = Info
|
|||||||
;; Dependencies can be added from any repository where the user is granted access or only from the current repository depending on this setting.
|
;; Dependencies can be added from any repository where the user is granted access or only from the current repository depending on this setting.
|
||||||
;ALLOW_CROSS_REPOSITORY_DEPENDENCIES = true
|
;ALLOW_CROSS_REPOSITORY_DEPENDENCIES = true
|
||||||
;;
|
;;
|
||||||
;; Default map service. No external API support has been included. A service has to allow
|
|
||||||
;; searching using URL parameters, the location will be appended to the URL as escaped query parameter.
|
|
||||||
;; Disabled by default, some example values are:
|
|
||||||
;; - OpenStreetMap: https://www.openstreetmap.org/search?query=
|
|
||||||
;; - Google Maps: https://www.google.com/maps/place/
|
|
||||||
;; - MapQuest: https://www.mapquest.com/search/
|
|
||||||
;; - Bing Maps: https://www.bing.com/maps?where1=
|
|
||||||
; USER_LOCATION_MAP_URL =
|
|
||||||
;;
|
|
||||||
;; Enable heatmap on users profiles.
|
;; Enable heatmap on users profiles.
|
||||||
;ENABLE_USER_HEATMAP = true
|
;ENABLE_USER_HEATMAP = true
|
||||||
;;
|
;;
|
||||||
@@ -1019,8 +992,8 @@ LEVEL = Info
|
|||||||
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||||
;ALLOWED_TYPES =
|
;ALLOWED_TYPES =
|
||||||
;;
|
;;
|
||||||
;; Max size of each file in megabytes. Defaults to 50MB
|
;; Max size of each file in megabytes. Defaults to 3MB
|
||||||
;FILE_MAX_SIZE = 50
|
;FILE_MAX_SIZE = 3
|
||||||
;;
|
;;
|
||||||
;; Max number of files per upload. Defaults to 5
|
;; Max number of files per upload. Defaults to 5
|
||||||
;MAX_FILES = 5
|
;MAX_FILES = 5
|
||||||
@@ -1210,9 +1183,6 @@ LEVEL = Info
|
|||||||
;; Max size of files to be displayed (default is 8MiB)
|
;; Max size of files to be displayed (default is 8MiB)
|
||||||
;MAX_DISPLAY_FILE_SIZE = 8388608
|
;MAX_DISPLAY_FILE_SIZE = 8388608
|
||||||
;;
|
;;
|
||||||
;; Detect ambiguous unicode characters in file contents and show warnings on the UI
|
|
||||||
;AMBIGUOUS_UNICODE_DETECTION = true
|
|
||||||
;;
|
|
||||||
;; Whether the email of the user should be shown in the Explore Users page
|
;; Whether the email of the user should be shown in the Explore Users page
|
||||||
;SHOW_USER_EMAIL = true
|
;SHOW_USER_EMAIL = true
|
||||||
;;
|
;;
|
||||||
@@ -1224,14 +1194,11 @@ LEVEL = Info
|
|||||||
;;
|
;;
|
||||||
;; All available reactions users can choose on issues/prs and comments.
|
;; All available reactions users can choose on issues/prs and comments.
|
||||||
;; Values can be emoji alias (:smile:) or a unicode emoji.
|
;; Values can be emoji alias (:smile:) or a unicode emoji.
|
||||||
;; For custom reactions, add a tightly cropped square image to public/assets/img/emoji/reaction_name.png
|
;; For custom reactions, add a tightly cropped square image to public/img/emoji/reaction_name.png
|
||||||
;REACTIONS = +1, -1, laugh, hooray, confused, heart, rocket, eyes
|
;REACTIONS = +1, -1, laugh, hooray, confused, heart, rocket, eyes
|
||||||
;;
|
;;
|
||||||
;; Change the number of users that are displayed in reactions tooltip (triggered by mouse hover).
|
|
||||||
;REACTION_MAX_USER_NUM = 10
|
|
||||||
;;
|
|
||||||
;; Additional Emojis not defined in the utf8 standard
|
;; Additional Emojis not defined in the utf8 standard
|
||||||
;; By default we support gitea (:gitea:), to add more copy them to public/assets/img/emoji/emoji_name.png and add it to this config.
|
;; By default we support gitea (:gitea:), to add more copy them to public/img/emoji/emoji_name.png and add it to this config.
|
||||||
;; Dont mistake it for Reactions.
|
;; Dont mistake it for Reactions.
|
||||||
;CUSTOM_EMOJIS = gitea, codeberg, gitlab, git, github, gogs
|
;CUSTOM_EMOJIS = gitea, codeberg, gitlab, git, github, gogs
|
||||||
;;
|
;;
|
||||||
@@ -1352,7 +1319,7 @@ LEVEL = Info
|
|||||||
;; Define allowed algorithms and their minimum key length (use -1 to disable a type)
|
;; Define allowed algorithms and their minimum key length (use -1 to disable a type)
|
||||||
;ED25519 = 256
|
;ED25519 = 256
|
||||||
;ECDSA = 256
|
;ECDSA = 256
|
||||||
;RSA = 3071 ; we allow 3071 here because an otherwise valid 3072 bit RSA key can be reported as having 3071 bit length
|
;RSA = 2047 ; we allow 2047 here because an otherwise valid 2048 bit RSA key can be reported as having 2047 bit length
|
||||||
;DSA = -1 ; set to 1024 to switch on
|
;DSA = -1 ; set to 1024 to switch on
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -1370,10 +1337,10 @@ LEVEL = Info
|
|||||||
;; Issue indexer storage path, available when ISSUE_INDEXER_TYPE is bleve
|
;; Issue indexer storage path, available when ISSUE_INDEXER_TYPE is bleve
|
||||||
;ISSUE_INDEXER_PATH = indexers/issues.bleve ; Relative paths will be made absolute against _`AppWorkPath`_.
|
;ISSUE_INDEXER_PATH = indexers/issues.bleve ; Relative paths will be made absolute against _`AppWorkPath`_.
|
||||||
;;
|
;;
|
||||||
;; Issue indexer connection string, available when ISSUE_INDEXER_TYPE is elasticsearch (e.g. http://elastic:password@localhost:9200) or meilisearch (e.g. http://:apikey@localhost:7700)
|
;; Issue indexer connection string, available when ISSUE_INDEXER_TYPE is elasticsearch or meilisearch
|
||||||
;ISSUE_INDEXER_CONN_STR =
|
;ISSUE_INDEXER_CONN_STR = http://elastic:changeme@localhost:9200
|
||||||
;;
|
;;
|
||||||
;; Issue indexer name, available when ISSUE_INDEXER_TYPE is elasticsearch or meilisearch.
|
;; Issue indexer name, available when ISSUE_INDEXER_TYPE is elasticsearch
|
||||||
;ISSUE_INDEXER_NAME = gitea_issues
|
;ISSUE_INDEXER_NAME = gitea_issues
|
||||||
;;
|
;;
|
||||||
;; Timeout the indexer if it takes longer than this to start.
|
;; Timeout the indexer if it takes longer than this to start.
|
||||||
@@ -1431,7 +1398,7 @@ LEVEL = Info
|
|||||||
;DATADIR = queues/ ; Relative paths will be made absolute against `%(APP_DATA_PATH)s`.
|
;DATADIR = queues/ ; Relative paths will be made absolute against `%(APP_DATA_PATH)s`.
|
||||||
;;
|
;;
|
||||||
;; Default queue length before a channel queue will block
|
;; Default queue length before a channel queue will block
|
||||||
;LENGTH = 100000
|
;LENGTH = 100
|
||||||
;;
|
;;
|
||||||
;; Batch size to send for batched queues
|
;; Batch size to send for batched queues
|
||||||
;BATCH_LENGTH = 20
|
;BATCH_LENGTH = 20
|
||||||
@@ -1447,8 +1414,8 @@ LEVEL = Info
|
|||||||
;; Provides the suffix of the default redis/disk unique queue set name - specific queues can be overridden within in their [queue.name] sections.
|
;; Provides the suffix of the default redis/disk unique queue set name - specific queues can be overridden within in their [queue.name] sections.
|
||||||
;SET_NAME = "_unique"
|
;SET_NAME = "_unique"
|
||||||
;;
|
;;
|
||||||
;; Maximum number of worker go-routines for the queue. Default value is "CpuNum/2" clipped to between 1 and 10.
|
;; Dynamically scale the worker pool to at this many workers
|
||||||
;MAX_WORKERS = ; (dynamic)
|
;MAX_WORKERS = 10
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -1757,8 +1724,8 @@ LEVEL = Info
|
|||||||
;; Session cookie name
|
;; Session cookie name
|
||||||
;COOKIE_NAME = i_like_gitea
|
;COOKIE_NAME = i_like_gitea
|
||||||
;;
|
;;
|
||||||
;; If you use session in https only: true or false. If not set, it defaults to `true` if the ROOT_URL is an HTTPS URL.
|
;; If you use session in https only, default is false
|
||||||
;COOKIE_SECURE =
|
;COOKIE_SECURE = false
|
||||||
;;
|
;;
|
||||||
;; Session GC time interval in seconds, default is 86400 (1 day)
|
;; Session GC time interval in seconds, default is 86400 (1 day)
|
||||||
;GC_INTERVAL_TIME = 86400
|
;GC_INTERVAL_TIME = 86400
|
||||||
@@ -1823,8 +1790,8 @@ LEVEL = Info
|
|||||||
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
|
||||||
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
|
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
|
||||||
;;
|
;;
|
||||||
;; Max size of each file. Defaults to 2048MB
|
;; Max size of each file. Defaults to 4MB
|
||||||
;MAX_SIZE = 2048
|
;MAX_SIZE = 4
|
||||||
;;
|
;;
|
||||||
;; Max number of files per upload. Defaults to 5
|
;; Max number of files per upload. Defaults to 5
|
||||||
;MAX_FILES = 5
|
;MAX_FILES = 5
|
||||||
@@ -1837,9 +1804,8 @@ LEVEL = Info
|
|||||||
;; Currently, only `minio` is supported.
|
;; Currently, only `minio` is supported.
|
||||||
;SERVE_DIRECT = false
|
;SERVE_DIRECT = false
|
||||||
;;
|
;;
|
||||||
;; Path for attachments. Defaults to `attachments`. Only available when STORAGE_TYPE is `local`
|
;; Path for attachments. Defaults to `data/attachments` only available when STORAGE_TYPE is `local`
|
||||||
;; Relative paths will be resolved to `${AppDataPath}/${attachment.PATH}`
|
;PATH = data/attachments
|
||||||
;PATH = attachments
|
|
||||||
;;
|
;;
|
||||||
;; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
|
;; Minio endpoint to connect only available when STORAGE_TYPE is `minio`
|
||||||
;MINIO_ENDPOINT = localhost:9000
|
;MINIO_ENDPOINT = localhost:9000
|
||||||
@@ -2573,18 +2539,10 @@ LEVEL = Info
|
|||||||
|
|
||||||
; [actions]
|
; [actions]
|
||||||
;; Enable/Disable actions capabilities
|
;; Enable/Disable actions capabilities
|
||||||
;ENABLED = true
|
;ENABLED = false
|
||||||
;;
|
;;
|
||||||
;; Default platform to get action plugins, `github` for `https://github.com`, `self` for the current Gitea instance.
|
;; Default platform to get action plugins, `github` for `https://github.com`, `self` for the current Gitea instance.
|
||||||
;DEFAULT_ACTIONS_URL = github
|
;DEFAULT_ACTIONS_URL = github
|
||||||
;; Default artifact retention time in days, default is 90 days
|
|
||||||
;ARTIFACT_RETENTION_DAYS = 90
|
|
||||||
;; Timeout to stop the task which have running status, but haven't been updated for a long time
|
|
||||||
;ZOMBIE_TASK_TIMEOUT = 10m
|
|
||||||
;; Timeout to stop the tasks which have running status and continuous updates, but don't end for a long time
|
|
||||||
;ENDLESS_TASK_TIMEOUT = 3h
|
|
||||||
;; Timeout to cancel the jobs which have waiting status, but haven't been picked by a runner for a long time
|
|
||||||
;ABANDONED_JOB_TIMEOUT = 24h
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ Dockerfile is found in root of repository.
|
|||||||
|
|
||||||
Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea)
|
Docker image can be found on [docker hub](https://hub.docker.com/r/gitea/gitea)
|
||||||
|
|
||||||
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.com/installation/install-with-docker-rootless)
|
Documentation on using docker image can be found on [Gitea Docs site](https://docs.gitea.io/en-us/install-with-docker/)
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-rootless
|
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}-rootless
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
{{#unless (contains "-rc" build.tag)}}
|
{{#unless (contains "-rc" build.tag)}}
|
||||||
{{#unless (contains "-dev" build.tag)}}
|
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}-rootless
|
- {{this}}-rootless
|
||||||
{{/each}}
|
{{/each}}
|
||||||
- "latest-rootless"
|
- "latest-rootless"
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{/unless}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
manifests:
|
manifests:
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}
|
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}{{#if (hasPrefix "refs/heads/release/v" build.ref)}}{{trimPrefix "refs/heads/release/v" build.ref}}-{{/if}}nightly{{/if}}
|
||||||
{{#if build.tags}}
|
{{#if build.tags}}
|
||||||
{{#unless (contains "-rc" build.tag)}}
|
{{#unless (contains "-rc" build.tag)}}
|
||||||
{{#unless (contains "-dev" build.tag)}}
|
|
||||||
tags:
|
tags:
|
||||||
{{#each build.tags}}
|
{{#each build.tags}}
|
||||||
- {{this}}
|
- {{this}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
- "latest"
|
- "latest"
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{/unless}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
manifests:
|
manifests:
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ fi
|
|||||||
|
|
||||||
if [ ! -f /data/ssh/ssh_host_rsa_key ]; then
|
if [ ! -f /data/ssh/ssh_host_rsa_key ]; then
|
||||||
echo "Generating /data/ssh/ssh_host_rsa_key..."
|
echo "Generating /data/ssh/ssh_host_rsa_key..."
|
||||||
ssh-keygen -t rsa -b 3072 -f /data/ssh/ssh_host_rsa_key -N "" > /dev/null
|
ssh-keygen -t rsa -b 2048 -f /data/ssh/ssh_host_rsa_key -N "" > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then
|
if [ ! -f /data/ssh/ssh_host_ecdsa_key ]; then
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ PATH = /data/gitea/attachments
|
|||||||
[log]
|
[log]
|
||||||
MODE = console
|
MODE = console
|
||||||
LEVEL = info
|
LEVEL = info
|
||||||
|
ROUTER = console
|
||||||
ROOT_PATH = /data/gitea/log
|
ROOT_PATH = /data/gitea/log
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ if [ ! -x /bin/sh ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${USER}" != "git" ]; then
|
if [ "${USER}" != "git" ]; then
|
||||||
# Rename user
|
# rename user
|
||||||
sed -i -e "s/^git\:/${USER}\:/g" /etc/passwd
|
sed -i -e "s/^git\:/${USER}\:/g" /etc/passwd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -19,13 +19,13 @@ if [ -z "${USER_UID}" ]; then
|
|||||||
USER_UID="`id -u ${USER}`"
|
USER_UID="`id -u ${USER}`"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change GID for USER?
|
## Change GID for USER?
|
||||||
if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
|
if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
|
||||||
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
|
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
|
||||||
sed -i -e "s/^${USER}:\([^:]*\):\([0-9]*\):[0-9]*/${USER}:\1:\2:${USER_GID}/" /etc/passwd
|
sed -i -e "s/^${USER}:\([^:]*\):\([0-9]*\):[0-9]*/${USER}:\1:\2:${USER_GID}/" /etc/passwd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change UID for USER?
|
## Change UID for USER?
|
||||||
if [ -n "${USER_UID}" ] && [ "${USER_UID}" != "`id -u ${USER}`" ]; then
|
if [ -n "${USER_UID}" ] && [ "${USER_UID}" != "`id -u ${USER}`" ]; then
|
||||||
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:\([0-9]*\)/${USER}:\1:${USER_UID}:\2/" /etc/passwd
|
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*:\([0-9]*\)/${USER}:\1:${USER_UID}:\2/" /etc/passwd
|
||||||
fi
|
fi
|
||||||
|
|||||||
36
docs/Makefile
Normal file
36
docs/Makefile
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
THEME := themes/gitea
|
||||||
|
PUBLIC := public
|
||||||
|
ARCHIVE := https://dl.gitea.com/theme/main.tar.gz
|
||||||
|
|
||||||
|
HUGO_PACKAGE := github.com/gohugoio/hugo@v0.111.3
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: build
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf $(PUBLIC) $(THEME)
|
||||||
|
|
||||||
|
.PHONY: trans-copy
|
||||||
|
trans-copy:
|
||||||
|
bash scripts/trans-copy.sh
|
||||||
|
|
||||||
|
.PHONY: server
|
||||||
|
server: $(THEME)
|
||||||
|
go run $(HUGO_PACKAGE) server
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: $(THEME)
|
||||||
|
go run $(HUGO_PACKAGE) --cleanDestinationDir
|
||||||
|
|
||||||
|
.PHONY: build-offline
|
||||||
|
build-offline: $(THEME)
|
||||||
|
go run $(HUGO_PACKAGE) --baseURL="/" --cleanDestinationDir
|
||||||
|
|
||||||
|
.PHONY: update
|
||||||
|
update: $(THEME)
|
||||||
|
|
||||||
|
$(THEME): $(THEME)/theme.toml
|
||||||
|
$(THEME)/theme.toml:
|
||||||
|
mkdir -p $$(dirname $@)
|
||||||
|
curl -L -s $(ARCHIVE) | tar xz -C $$(dirname $@)
|
||||||
@@ -3,7 +3,36 @@
|
|||||||
[](https://discord.gg/Gitea)
|
[](https://discord.gg/Gitea)
|
||||||
[](http://microbadger.com/images/gitea/docs "Get your own image badge on microbadger.com")
|
[](http://microbadger.com/images/gitea/docs "Get your own image badge on microbadger.com")
|
||||||
|
|
||||||
These docs are ingested by our [docs repo](https://gitea.com/gitea/gitea-docusaurus).
|
## Hosting
|
||||||
|
|
||||||
|
These pages are hosted using [netlifycms](https://www.netlifycms.org/) and get
|
||||||
|
automatically updated on every push to the `master` branch.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
The installation of Hugo is out of the scope of this document, so please take
|
||||||
|
the [official install instructions](https://gohugo.io/overview/installing/) to
|
||||||
|
get Hugo up and running.
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
To generate the website and serve it on [localhost:1313](http://localhost:1313)
|
||||||
|
just execute this command and stop it with `Ctrl+C`:
|
||||||
|
|
||||||
|
```
|
||||||
|
make server
|
||||||
|
```
|
||||||
|
|
||||||
|
When you are done with your changes just create a pull request, after merging
|
||||||
|
the pull request the website will be updated automatically.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Fork -> Patch -> Push -> Pull Request
|
||||||
|
|
||||||
## Authors
|
## Authors
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,27 @@
|
|||||||
[](https://discord.gg/Gitea)
|
[](https://discord.gg/Gitea)
|
||||||
[](http://microbadger.com/images/gitea/docs "Get your own image badge on microbadger.com")
|
[](http://microbadger.com/images/gitea/docs "Get your own image badge on microbadger.com")
|
||||||
|
|
||||||
https://gitea.com/gitea/gitea-docusaurus
|
## 关于托管方式
|
||||||
|
|
||||||
|
本页面托管在我们 Docker 容器内的基础设施上, 它会在每次推送到 `master` 分支的时候自动更新,如果你想自己管理这个页面,你可以从我们的 Docker 镜像 [gitea/docs](https://hub.docker.com/r/gitea/docs/) 中获取它。
|
||||||
|
|
||||||
|
## 安装 Hugo
|
||||||
|
|
||||||
|
本页面使用了 [Hugo](https://github.com/spf13/hugo) 静态页面生成工具,如果您有维护它的意愿,则需要在本地计算机上下载并安装 Hugo。Hugo 的安装教程不在本文档的讲述范围之内,详情请参见 [官方文档](https://gohugo.io/overview/installing/)。
|
||||||
|
|
||||||
|
## 如何部署
|
||||||
|
|
||||||
|
在 [localhost:1313](http://localhost:1313) 处构建和运行网站的命令如下,如果需要停止可以使用组合键 `Ctrl+C`:
|
||||||
|
|
||||||
|
```
|
||||||
|
make server
|
||||||
|
```
|
||||||
|
|
||||||
|
完成更改后,只需创建一个 Pull Request (PR),该 PR 一经合并网站将自动更新。
|
||||||
|
|
||||||
|
## 如何贡献您的代码
|
||||||
|
|
||||||
|
Fork -> Patch -> Push -> Pull Request
|
||||||
|
|
||||||
## 关于我们
|
## 关于我们
|
||||||
|
|
||||||
|
|||||||
174
docs/assets/js/search.js
Normal file
174
docs/assets/js/search.js
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
/* global Fuse, Mark */
|
||||||
|
|
||||||
|
function ready(fn) {
|
||||||
|
if (document.readyState !== 'loading') {
|
||||||
|
fn();
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', fn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ready(doSearch);
|
||||||
|
|
||||||
|
const summaryInclude = 60;
|
||||||
|
const fuseOptions = {
|
||||||
|
shouldSort: true,
|
||||||
|
includeMatches: true,
|
||||||
|
matchAllTokens: true,
|
||||||
|
threshold: 0, // for parsing diacritics
|
||||||
|
tokenize: true,
|
||||||
|
location: 0,
|
||||||
|
distance: 100,
|
||||||
|
maxPatternLength: 32,
|
||||||
|
minMatchCharLength: 1,
|
||||||
|
keys: [{
|
||||||
|
name: 'title',
|
||||||
|
weight: 0.8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'contents',
|
||||||
|
weight: 0.5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'tags',
|
||||||
|
weight: 0.3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'categories',
|
||||||
|
weight: 0.3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
function param(name) {
|
||||||
|
return decodeURIComponent((window.location.search.split(`${name}=`)[1] || '').split('&')[0]).replace(/\+/g, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
const searchQuery = param('s');
|
||||||
|
|
||||||
|
function doSearch() {
|
||||||
|
if (searchQuery) {
|
||||||
|
document.getElementById('search-query').value = searchQuery;
|
||||||
|
executeSearch(searchQuery);
|
||||||
|
} else {
|
||||||
|
const para = document.createElement('P');
|
||||||
|
para.textContent = 'Please enter a word or phrase above';
|
||||||
|
document.getElementById('search-results').append(para);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getJSON(url, fn) {
|
||||||
|
const request = new XMLHttpRequest();
|
||||||
|
request.open('GET', url, true);
|
||||||
|
request.addEventListener('load', () => {
|
||||||
|
if (request.status >= 200 && request.status < 400) {
|
||||||
|
const data = JSON.parse(request.responseText);
|
||||||
|
fn(data);
|
||||||
|
} else {
|
||||||
|
console.error(`Target reached on ${url} with error ${request.status}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
request.addEventListener('error', () => {
|
||||||
|
console.error(`Connection error ${request.status}`);
|
||||||
|
});
|
||||||
|
request.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
function executeSearch(searchQuery) {
|
||||||
|
getJSON(`/${document.LANG}/index.json`, (data) => {
|
||||||
|
const pages = data;
|
||||||
|
const fuse = new Fuse(pages, fuseOptions);
|
||||||
|
const result = fuse.search(searchQuery);
|
||||||
|
document.getElementById('search-results').innerHTML = '';
|
||||||
|
if (result.length > 0) {
|
||||||
|
populateResults(result);
|
||||||
|
} else {
|
||||||
|
const para = document.createElement('P');
|
||||||
|
para.textContent = 'No matches found';
|
||||||
|
document.getElementById('search-results').append(para);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function populateResults(result) {
|
||||||
|
for (const [key, value] of result.entries()) {
|
||||||
|
const content = value.item.contents;
|
||||||
|
let snippet = '';
|
||||||
|
const snippetHighlights = [];
|
||||||
|
if (fuseOptions.tokenize) {
|
||||||
|
snippetHighlights.push(searchQuery);
|
||||||
|
for (const mvalue of value.matches) {
|
||||||
|
if (mvalue.key === 'tags' || mvalue.key === 'categories') {
|
||||||
|
snippetHighlights.push(mvalue.value);
|
||||||
|
} else if (mvalue.key === 'contents') {
|
||||||
|
const ind = content.toLowerCase().indexOf(searchQuery.toLowerCase());
|
||||||
|
const start = ind - summaryInclude > 0 ? ind - summaryInclude : 0;
|
||||||
|
const end = ind + searchQuery.length + summaryInclude < content.length ? ind + searchQuery.length + summaryInclude : content.length;
|
||||||
|
snippet += content.substring(start, end);
|
||||||
|
if (ind > -1) {
|
||||||
|
snippetHighlights.push(content.substring(ind, ind + searchQuery.length));
|
||||||
|
} else {
|
||||||
|
snippetHighlights.push(mvalue.value.substring(mvalue.indices[0][0], mvalue.indices[0][1] - mvalue.indices[0][0] + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snippet.length < 1) {
|
||||||
|
snippet += content.substring(0, summaryInclude * 2);
|
||||||
|
}
|
||||||
|
// pull template from hugo template definition
|
||||||
|
const templateDefinition = document.getElementById('search-result-template').innerHTML;
|
||||||
|
// replace values
|
||||||
|
const output = render(templateDefinition, {
|
||||||
|
key,
|
||||||
|
title: value.item.title,
|
||||||
|
link: value.item.permalink,
|
||||||
|
tags: value.item.tags,
|
||||||
|
categories: value.item.categories,
|
||||||
|
snippet
|
||||||
|
});
|
||||||
|
document.getElementById('search-results').append(htmlToElement(output));
|
||||||
|
|
||||||
|
for (const snipvalue of snippetHighlights) {
|
||||||
|
new Mark(document.getElementById(`summary-${key}`)).mark(snipvalue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function render(templateString, data) {
|
||||||
|
let conditionalMatches, copy;
|
||||||
|
const conditionalPattern = /\$\{\s*isset ([a-zA-Z]*) \s*\}(.*)\$\{\s*end\s*\}/g;
|
||||||
|
// since loop below depends on re.lastIndex, we use a copy to capture any manipulations whilst inside the loop
|
||||||
|
copy = templateString;
|
||||||
|
while ((conditionalMatches = conditionalPattern.exec(templateString)) !== null) {
|
||||||
|
if (data[conditionalMatches[1]]) {
|
||||||
|
// valid key, remove conditionals, leave content.
|
||||||
|
copy = copy.replace(conditionalMatches[0], conditionalMatches[2]);
|
||||||
|
} else {
|
||||||
|
// not valid, remove entire section
|
||||||
|
copy = copy.replace(conditionalMatches[0], '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
templateString = copy;
|
||||||
|
// now any conditionals removed we can do simple substitution
|
||||||
|
let key, find, re;
|
||||||
|
for (key of Object.keys(data)) {
|
||||||
|
find = `\\$\\{\\s*${key}\\s*\\}`;
|
||||||
|
re = new RegExp(find, 'g');
|
||||||
|
templateString = templateString.replace(re, data[key]);
|
||||||
|
}
|
||||||
|
return templateString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By Mark Amery: https://stackoverflow.com/a/35385518
|
||||||
|
* @param {String} HTML representing a single element
|
||||||
|
* @return {Element}
|
||||||
|
*/
|
||||||
|
function htmlToElement(html) {
|
||||||
|
const template = document.createElement('template');
|
||||||
|
html = html.trim(); // Never return a text node of whitespace as the result
|
||||||
|
template.innerHTML = html;
|
||||||
|
return template.content.firstChild;
|
||||||
|
}
|
||||||
369
docs/config.yaml
Normal file
369
docs/config.yaml
Normal file
@@ -0,0 +1,369 @@
|
|||||||
|
baseurl: https://docs.gitea.io/
|
||||||
|
languageCode: en-us
|
||||||
|
title: Docs
|
||||||
|
theme: gitea
|
||||||
|
|
||||||
|
defaultContentLanguage: en-us
|
||||||
|
defaultContentLanguageInSubdir: true
|
||||||
|
enableMissingTranslationPlaceholders: true
|
||||||
|
enableEmoji: true
|
||||||
|
|
||||||
|
permalinks:
|
||||||
|
post: /:year/:month/:title/
|
||||||
|
doc: /:sections[1:]/:slug/
|
||||||
|
page: /:slug/
|
||||||
|
default: /:slug/
|
||||||
|
|
||||||
|
params:
|
||||||
|
description: Git with a cup of tea
|
||||||
|
author: The Gitea Authors
|
||||||
|
website: https://docs.gitea.io
|
||||||
|
version: 1.19.0 # FIXME: this version was used as "latest stable release", but it always gets outdated and doesn't make sense
|
||||||
|
minGoVersion: 1.20
|
||||||
|
goVersion: 1.20
|
||||||
|
minNodeVersion: 16
|
||||||
|
search: nav
|
||||||
|
repo: "https://github.com/go-gitea/gitea"
|
||||||
|
docContentPath: "docs/content"
|
||||||
|
|
||||||
|
markup:
|
||||||
|
tableOfContents:
|
||||||
|
startLevel: 1
|
||||||
|
endLevel: 9
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
home:
|
||||||
|
- HTML
|
||||||
|
- RSS
|
||||||
|
- JSON
|
||||||
|
|
||||||
|
menu:
|
||||||
|
page:
|
||||||
|
- name: Website
|
||||||
|
url: https://gitea.io/en-us/
|
||||||
|
weight: 10
|
||||||
|
pre: home
|
||||||
|
- name: Docs
|
||||||
|
url: /en-us/
|
||||||
|
weight: 20
|
||||||
|
pre: question
|
||||||
|
post: active
|
||||||
|
- name: API
|
||||||
|
url: https://try.gitea.io/api/swagger
|
||||||
|
weight: 45
|
||||||
|
pre: plug
|
||||||
|
- name: Blog
|
||||||
|
url: https://blog.gitea.io/
|
||||||
|
weight: 30
|
||||||
|
pre: rss
|
||||||
|
- name: Shop
|
||||||
|
url: https://shop.gitea.io/
|
||||||
|
weight: 40
|
||||||
|
pre: shopping-cart
|
||||||
|
- name: Translation
|
||||||
|
url: https://crowdin.com/project/gitea
|
||||||
|
weight: 41
|
||||||
|
pre: language
|
||||||
|
- name: Downloads
|
||||||
|
url: https://dl.gitea.io/
|
||||||
|
weight: 50
|
||||||
|
pre: download
|
||||||
|
- name: GitHub
|
||||||
|
url: https://github.com/go-gitea/
|
||||||
|
weight: 60
|
||||||
|
pre: github
|
||||||
|
- name: Discord Chat
|
||||||
|
url: https://discord.gg/Gitea
|
||||||
|
weight: 70
|
||||||
|
pre: comment
|
||||||
|
- name: Forum
|
||||||
|
url: https://discourse.gitea.io/
|
||||||
|
weight: 80
|
||||||
|
pre: group
|
||||||
|
|
||||||
|
languages:
|
||||||
|
en-us:
|
||||||
|
weight: 0
|
||||||
|
languageName: English
|
||||||
|
|
||||||
|
zh-cn:
|
||||||
|
weight: 1
|
||||||
|
languageName: 中文(简体)
|
||||||
|
menu:
|
||||||
|
page:
|
||||||
|
- name: 网站
|
||||||
|
url: https://gitea.io/zh-cn/
|
||||||
|
weight: 10
|
||||||
|
pre: home
|
||||||
|
- name: 文档
|
||||||
|
url: /zh-cn/
|
||||||
|
weight: 20
|
||||||
|
pre: question
|
||||||
|
post: active
|
||||||
|
- name: API
|
||||||
|
url: https://try.gitea.io/api/swagger
|
||||||
|
weight: 45
|
||||||
|
pre: plug
|
||||||
|
- name: 博客
|
||||||
|
url: https://blog.gitea.io/
|
||||||
|
weight: 30
|
||||||
|
pre: rss
|
||||||
|
- name: 导入
|
||||||
|
url: https://code.gitea.io/
|
||||||
|
weight: 40
|
||||||
|
pre: code
|
||||||
|
- name: 翻译
|
||||||
|
url: https://crowdin.com/project/gitea
|
||||||
|
weight: 41
|
||||||
|
pre: language
|
||||||
|
- name: 下载
|
||||||
|
url: https://dl.gitea.io/
|
||||||
|
weight: 50
|
||||||
|
pre: download
|
||||||
|
- name: GitHub
|
||||||
|
url: https://github.com/go-gitea/
|
||||||
|
weight: 60
|
||||||
|
pre: github
|
||||||
|
- name: Discord Chat
|
||||||
|
url: https://discord.gg/Gitea
|
||||||
|
weight: 70
|
||||||
|
pre: comment
|
||||||
|
- name: Forum
|
||||||
|
url: https://discourse.gitea.io/
|
||||||
|
weight: 80
|
||||||
|
pre: group
|
||||||
|
|
||||||
|
zh-tw:
|
||||||
|
weight: 2
|
||||||
|
languageName: 中文(繁體)
|
||||||
|
menu:
|
||||||
|
page:
|
||||||
|
- name: 網站
|
||||||
|
url: https://gitea.io/zh-tw/
|
||||||
|
weight: 10
|
||||||
|
pre: home
|
||||||
|
- name: 文件
|
||||||
|
url: /zh-tw/
|
||||||
|
weight: 20
|
||||||
|
pre: question
|
||||||
|
post: active
|
||||||
|
- name: API
|
||||||
|
url: https://try.gitea.io/api/swagger
|
||||||
|
weight: 45
|
||||||
|
pre: plug
|
||||||
|
- name: 部落格
|
||||||
|
url: https://blog.gitea.io/
|
||||||
|
weight: 30
|
||||||
|
pre: rss
|
||||||
|
- name: 商店
|
||||||
|
url: https://shop.gitea.io/
|
||||||
|
weight: 40
|
||||||
|
pre: shopping-cart
|
||||||
|
- name: 翻譯
|
||||||
|
url: https://crowdin.com/project/gitea
|
||||||
|
weight: 41
|
||||||
|
pre: language
|
||||||
|
- name: 下載
|
||||||
|
url: https://dl.gitea.io/
|
||||||
|
weight: 50
|
||||||
|
pre: download
|
||||||
|
- name: GitHub
|
||||||
|
url: https://github.com/go-gitea/
|
||||||
|
weight: 60
|
||||||
|
pre: github
|
||||||
|
- name: Discord 聊天室
|
||||||
|
url: https://discord.gg/Gitea
|
||||||
|
weight: 70
|
||||||
|
pre: comment
|
||||||
|
- name: 討論區
|
||||||
|
url: https://discourse.gitea.io/
|
||||||
|
weight: 80
|
||||||
|
pre: group
|
||||||
|
|
||||||
|
pt-br:
|
||||||
|
weight: 3
|
||||||
|
languageName: Português Brasileiro
|
||||||
|
menu:
|
||||||
|
page:
|
||||||
|
- name: Página inicial
|
||||||
|
url: https://gitea.io/pt-br/
|
||||||
|
weight: 10
|
||||||
|
pre: home
|
||||||
|
- name: Documentação
|
||||||
|
url: /pt-br/
|
||||||
|
weight: 20
|
||||||
|
pre: question
|
||||||
|
post: active
|
||||||
|
- name: API
|
||||||
|
url: https://try.gitea.io/api/swagger
|
||||||
|
weight: 45
|
||||||
|
pre: plug
|
||||||
|
- name: Blog
|
||||||
|
url: https://blog.gitea.io/
|
||||||
|
weight: 30
|
||||||
|
pre: rss
|
||||||
|
- name: Código-fonte
|
||||||
|
url: https://code.gitea.io/
|
||||||
|
weight: 40
|
||||||
|
pre: code
|
||||||
|
- name: Translation
|
||||||
|
url: https://crowdin.com/project/gitea
|
||||||
|
weight: 41
|
||||||
|
pre: language
|
||||||
|
- name: Downloads
|
||||||
|
url: https://dl.gitea.io/
|
||||||
|
weight: 50
|
||||||
|
pre: download
|
||||||
|
- name: GitHub
|
||||||
|
url: https://github.com/go-gitea/
|
||||||
|
weight: 60
|
||||||
|
pre: github
|
||||||
|
- name: Chat no Discord
|
||||||
|
url: https://discord.gg/Gitea
|
||||||
|
weight: 70
|
||||||
|
pre: comment
|
||||||
|
- name: Forum
|
||||||
|
url: https://discourse.gitea.io/
|
||||||
|
weight: 80
|
||||||
|
pre: group
|
||||||
|
|
||||||
|
nl-nl:
|
||||||
|
weight: 4
|
||||||
|
languageName: Nederlands
|
||||||
|
menu:
|
||||||
|
page:
|
||||||
|
- name: Website
|
||||||
|
url: https://gitea.io/nl-nl/
|
||||||
|
weight: 10
|
||||||
|
pre: home
|
||||||
|
- name: Docs
|
||||||
|
url: /nl-nl/
|
||||||
|
weight: 20
|
||||||
|
pre: question
|
||||||
|
post: active
|
||||||
|
- name: API
|
||||||
|
url: https://try.gitea.io/api/swagger
|
||||||
|
weight: 45
|
||||||
|
pre: plug
|
||||||
|
- name: Blog
|
||||||
|
url: https://blog.gitea.io/
|
||||||
|
weight: 30
|
||||||
|
pre: rss
|
||||||
|
- name: Code
|
||||||
|
url: https://code.gitea.io/
|
||||||
|
weight: 40
|
||||||
|
pre: code
|
||||||
|
- name: Translation
|
||||||
|
url: https://crowdin.com/project/gitea
|
||||||
|
weight: 41
|
||||||
|
pre: language
|
||||||
|
- name: Downloads
|
||||||
|
url: https://dl.gitea.io/
|
||||||
|
weight: 50
|
||||||
|
pre: download
|
||||||
|
- name: GitHub
|
||||||
|
url: https://github.com/go-gitea/
|
||||||
|
weight: 60
|
||||||
|
pre: github
|
||||||
|
- name: Discord Chat
|
||||||
|
url: https://discord.gg/Gitea
|
||||||
|
weight: 70
|
||||||
|
pre: comment
|
||||||
|
- name: Forum
|
||||||
|
url: https://discourse.gitea.io/
|
||||||
|
weight: 80
|
||||||
|
pre: group
|
||||||
|
|
||||||
|
fr-fr:
|
||||||
|
weight: 5
|
||||||
|
languageName: Français
|
||||||
|
menu:
|
||||||
|
page:
|
||||||
|
- name: Site
|
||||||
|
url: https://gitea.io/en-us/
|
||||||
|
weight: 10
|
||||||
|
pre: home
|
||||||
|
post: active
|
||||||
|
- name: Documentation
|
||||||
|
url: /fr-fr/
|
||||||
|
weight: 20
|
||||||
|
pre: question
|
||||||
|
- name: API
|
||||||
|
url: https://try.gitea.io/api/swagger
|
||||||
|
weight: 45
|
||||||
|
pre: plug
|
||||||
|
- name: Blog
|
||||||
|
url: https://blog.gitea.io/
|
||||||
|
weight: 30
|
||||||
|
pre: rss
|
||||||
|
- name: Code
|
||||||
|
url: https://code.gitea.io/
|
||||||
|
weight: 40
|
||||||
|
pre: code
|
||||||
|
- name: Translation
|
||||||
|
url: https://crowdin.com/project/gitea
|
||||||
|
weight: 41
|
||||||
|
pre: language
|
||||||
|
- name: Téléchargement
|
||||||
|
url: https://dl.gitea.io/
|
||||||
|
weight: 50
|
||||||
|
pre: download
|
||||||
|
- name: GitHub
|
||||||
|
url: https://github.com/go-gitea/
|
||||||
|
weight: 60
|
||||||
|
pre: github
|
||||||
|
- name: Discord Chat
|
||||||
|
url: https://discord.gg/Gitea
|
||||||
|
weight: 70
|
||||||
|
pre: comment
|
||||||
|
- name: Forum
|
||||||
|
url: https://discourse.gitea.io/
|
||||||
|
weight: 80
|
||||||
|
pre: group
|
||||||
|
|
||||||
|
de-de:
|
||||||
|
weight: 6
|
||||||
|
languageName: Deutsch
|
||||||
|
menu:
|
||||||
|
page:
|
||||||
|
- name: Webseite
|
||||||
|
url: https://gitea.io/en-us/
|
||||||
|
weight: 10
|
||||||
|
pre: home
|
||||||
|
post: active
|
||||||
|
- name: Dokumentation
|
||||||
|
url: /de-de/
|
||||||
|
weight: 20
|
||||||
|
pre: question
|
||||||
|
- name: API
|
||||||
|
url: https://try.gitea.io/api/swagger
|
||||||
|
weight: 45
|
||||||
|
pre: plug
|
||||||
|
- name: Blog
|
||||||
|
url: https://blog.gitea.io/
|
||||||
|
weight: 30
|
||||||
|
pre: rss
|
||||||
|
- name: Code
|
||||||
|
url: https://code.gitea.io/
|
||||||
|
weight: 40
|
||||||
|
pre: code
|
||||||
|
- name: Übersetzung
|
||||||
|
url: https://crowdin.com/project/gitea
|
||||||
|
weight: 41
|
||||||
|
pre: language
|
||||||
|
- name: Downloads
|
||||||
|
url: https://dl.gitea.io/
|
||||||
|
weight: 50
|
||||||
|
pre: download
|
||||||
|
- name: GitHub
|
||||||
|
url: https://github.com/go-gitea/
|
||||||
|
weight: 60
|
||||||
|
pre: github
|
||||||
|
- name: Discord Chat
|
||||||
|
url: https://discord.gg/Gitea
|
||||||
|
weight: 70
|
||||||
|
pre: comment
|
||||||
|
- name: Forum
|
||||||
|
url: https://discourse.gitea.io/
|
||||||
|
weight: 80
|
||||||
|
pre: group
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user