Skip to content

Commit 78ab338

Browse files
authored
Merge branch 'master' into refactor-doctor
2 parents 1ea76a1 + 8a7101f commit 78ab338

File tree

492 files changed

+32972
-11162
lines changed

Some content is hidden

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

492 files changed

+32972
-11162
lines changed

.drone.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,28 @@ steps:
667667
exclude:
668668
- pull_request
669669

670+
- name: publish-rootless
671+
pull: always
672+
image: plugins/docker:linux-amd64
673+
settings:
674+
dockerfile: Dockerfile.rootless
675+
auto_tag: true
676+
auto_tag_suffix: linux-amd64-rootless
677+
repo: gitea/gitea
678+
build_args:
679+
- GOPROXY=off
680+
password:
681+
from_secret: docker_password
682+
username:
683+
from_secret: docker_username
684+
environment:
685+
PLUGIN_MIRROR:
686+
from_secret: plugin_mirror
687+
when:
688+
event:
689+
exclude:
690+
- pull_request
691+
670692
---
671693
kind: pipeline
672694
name: docker-linux-arm64-dry-run
@@ -696,6 +718,9 @@ steps:
696718
tags: linux-arm64
697719
build_args:
698720
- GOPROXY=off
721+
environment:
722+
PLUGIN_MIRROR:
723+
from_secret: plugin_mirror
699724
when:
700725
event:
701726
- pull_request
@@ -740,6 +765,31 @@ steps:
740765
from_secret: docker_password
741766
username:
742767
from_secret: docker_username
768+
environment:
769+
PLUGIN_MIRROR:
770+
from_secret: plugin_mirror
771+
when:
772+
event:
773+
exclude:
774+
- pull_request
775+
776+
- name: publish-rootless
777+
pull: always
778+
image: plugins/docker:linux-arm64
779+
settings:
780+
dockerfile: Dockerfile.rootless
781+
auto_tag: true
782+
auto_tag_suffix: linux-arm64-rootless
783+
repo: gitea/gitea
784+
build_args:
785+
- GOPROXY=off
786+
password:
787+
from_secret: docker_password
788+
username:
789+
from_secret: docker_username
790+
environment:
791+
PLUGIN_MIRROR:
792+
from_secret: plugin_mirror
743793
when:
744794
event:
745795
exclude:
@@ -754,6 +804,18 @@ platform:
754804
arch: amd64
755805

756806
steps:
807+
- name: manifest-rootless
808+
pull: always
809+
image: plugins/manifest
810+
settings:
811+
auto_tag: true
812+
ignore_missing: true
813+
spec: docker/manifest.rootless.tmpl
814+
password:
815+
from_secret: docker_password
816+
username:
817+
from_secret: docker_username
818+
757819
- name: manifest
758820
pull: always
759821
image: plugins/manifest

.eslintrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ parserOptions:
1111
plugins:
1212
- eslint-plugin-unicorn
1313
- eslint-plugin-import
14+
- eslint-plugin-vue
15+
16+
extends:
17+
- plugin:vue/recommended
1418

1519
env:
1620
es2021: true
@@ -24,7 +28,7 @@ globals:
2428
u2fApi: false
2529

2630
overrides:
27-
- files: ["web_src/**/*.js"]
31+
- files: ["web_src/**/*.js", "web_src/**/*.vue"]
2832
env:
2933
browser: true
3034
jquery: true
@@ -387,6 +391,11 @@ rules:
387391
use-isnan: [2]
388392
valid-typeof: [2, {requireStringLiterals: true}]
389393
vars-on-top: [0]
394+
vue/attributes-order: [0]
395+
vue/component-definition-name-casing: [0]
396+
vue/html-closing-bracket-spacing: [0]
397+
vue/max-attributes-per-line: [0]
398+
vue/one-component-per-file: [0]
390399
wrap-iife: [2, inside]
391400
wrap-regex: [0]
392401
yield-star-spacing: [2, after]

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ RUN apk --no-cache add \
3737
openssh \
3838
s6 \
3939
sqlite \
40-
socat \
4140
su-exec \
4241
gnupg
4342

Dockerfile.rootless

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
###################################
3+
#Build stage
4+
FROM golang:1.15-alpine3.12 AS build-env
5+
6+
ARG GOPROXY
7+
ENV GOPROXY ${GOPROXY:-direct}
8+
9+
ARG GITEA_VERSION
10+
ARG TAGS="sqlite sqlite_unlock_notify"
11+
ENV TAGS "bindata timetzdata $TAGS"
12+
ARG CGO_EXTRA_CFLAGS
13+
14+
#Build deps
15+
RUN apk --no-cache add build-base git nodejs npm
16+
17+
#Setup repo
18+
COPY . ${GOPATH}/src/code.gitea.io/gitea
19+
WORKDIR ${GOPATH}/src/code.gitea.io/gitea
20+
21+
#Checkout version if set
22+
RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
23+
&& make clean-all build
24+
25+
FROM alpine:3.12
26+
LABEL maintainer="[email protected]"
27+
28+
EXPOSE 2222 3000
29+
30+
RUN apk --no-cache add \
31+
bash \
32+
ca-certificates \
33+
gettext \
34+
git \
35+
gnupg
36+
37+
RUN addgroup \
38+
-S -g 1000 \
39+
git && \
40+
adduser \
41+
-S -H -D \
42+
-h /var/lib/gitea/git \
43+
-s /bin/bash \
44+
-u 1000 \
45+
-G git \
46+
git && \
47+
echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
48+
49+
RUN mkdir -p /var/lib/gitea /etc/gitea
50+
RUN chown git:git /var/lib/gitea /etc/gitea
51+
52+
COPY docker/rootless /
53+
COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /usr/local/bin/gitea
54+
RUN chown root:root /usr/local/bin/* && chmod 755 /usr/local/bin/*
55+
56+
USER git:git
57+
ENV GITEA_WORK_DIR /var/lib/gitea
58+
ENV GITEA_CUSTOM /var/lib/gitea/custom
59+
ENV GITEA_TEMP /tmp/gitea
60+
#TODO add to docs the ability to define the ini to load (usefull to test and revert a config)
61+
ENV GITEA_APP_INI /etc/gitea/app.ini
62+
ENV HOME "/var/lib/gitea/git"
63+
VOLUME ["/var/lib/gitea", "/etc/gitea"]
64+
WORKDIR /var/lib/gitea
65+
66+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
67+
CMD []
68+

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ lint: lint-frontend lint-backend
312312

313313
.PHONY: lint-frontend
314314
lint-frontend: node_modules
315-
npx eslint web_src/js build webpack.config.js
316-
npx stylelint web_src/less
315+
npx eslint --max-warnings=0 web_src/js build webpack.config.js
316+
npx stylelint --max-warnings=0 web_src/less
317317

318318
.PHONY: lint-backend
319319
lint-backend: golangci-lint revive vet

cmd/docs.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2020 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package cmd
6+
7+
import (
8+
"fmt"
9+
"os"
10+
"strings"
11+
12+
"github.com/urfave/cli"
13+
)
14+
15+
// CmdDocs represents the available docs sub-command.
16+
var CmdDocs = cli.Command{
17+
Name: "docs",
18+
Usage: "Output CLI documentation",
19+
Description: "A command to output Gitea's CLI documentation, optionally to a file.",
20+
Action: runDocs,
21+
Flags: []cli.Flag{
22+
&cli.BoolFlag{
23+
Name: "man",
24+
Usage: "Output man pages instead",
25+
},
26+
&cli.StringFlag{
27+
Name: "output, o",
28+
Usage: "Path to output to instead of stdout (will overwrite if exists)",
29+
},
30+
},
31+
}
32+
33+
func runDocs(ctx *cli.Context) error {
34+
docs, err := ctx.App.ToMarkdown()
35+
if ctx.Bool("man") {
36+
docs, err = ctx.App.ToMan()
37+
}
38+
if err != nil {
39+
return err
40+
}
41+
42+
if !ctx.Bool("man") {
43+
// Clean up markdown. The following bug was fixed in v2, but is present in v1.
44+
// It affects markdown output (even though the issue is referring to man pages)
45+
// https://github.com/urfave/cli/issues/1040
46+
docs = docs[strings.Index(docs, "#"):]
47+
}
48+
49+
out := os.Stdout
50+
if ctx.String("output") != "" {
51+
fi, err := os.Create(ctx.String("output"))
52+
if err != nil {
53+
return err
54+
}
55+
defer fi.Close()
56+
out = fi
57+
}
58+
59+
_, err = fmt.Fprintln(out, docs)
60+
return err
61+
}

docker/manifest.rootless.tmpl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}-rootless
2+
{{#if build.tags}}
3+
tags:
4+
{{#each build.tags}}
5+
- {{this}}-rootless
6+
{{/each}}
7+
{{/if}}
8+
manifests:
9+
-
10+
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64-rootless
11+
platform:
12+
architecture: amd64
13+
os: linux
14+
-
15+
image: gitea/gitea:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64-rootless
16+
platform:
17+
architecture: arm64
18+
os: linux
19+
variant: v8

docker/rootless/etc/templates/app.ini

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
APP_NAME = $APP_NAME
2+
RUN_USER = $RUN_USER
3+
RUN_MODE = $RUN_MODE
4+
5+
[repository]
6+
ROOT = $GITEA_WORK_DIR/git/repositories
7+
8+
[repository.local]
9+
LOCAL_COPY_PATH = $GITEA_TEMP/local-repo
10+
11+
[repository.upload]
12+
TEMP_PATH = $GITEA_TEMP/uploads
13+
14+
[server]
15+
APP_DATA_PATH = $GITEA_WORK_DIR
16+
SSH_DOMAIN = $SSH_DOMAIN
17+
HTTP_PORT = $HTTP_PORT
18+
ROOT_URL = $ROOT_URL
19+
DISABLE_SSH = $DISABLE_SSH
20+
; In rootless gitea container only internal ssh server is supported
21+
START_SSH_SERVER = true
22+
SSH_PORT = $SSH_PORT
23+
SSH_LISTEN_PORT = $SSH_LISTEN_PORT
24+
BUILTIN_SSH_SERVER_USER = $RUN_USER
25+
LFS_START_SERVER = $LFS_START_SERVER
26+
LFS_CONTENT_PATH = $GITEA_WORK_DIR/git/lfs
27+
28+
[database]
29+
PATH = $GITEA_WORK_DIR/data/gitea.db
30+
DB_TYPE = $DB_TYPE
31+
HOST = $DB_HOST
32+
NAME = $DB_NAME
33+
USER = $DB_USER
34+
PASSWD = $DB_PASSWD
35+
36+
[session]
37+
PROVIDER_CONFIG = $GITEA_WORK_DIR/data/sessions
38+
39+
[picture]
40+
AVATAR_UPLOAD_PATH = $GITEA_WORK_DIR/data/avatars
41+
REPOSITORY_AVATAR_UPLOAD_PATH = $GITEA_WORK_DIR/data/gitea/repo-avatars
42+
43+
[attachment]
44+
PATH = $GITEA_WORK_DIR/data/attachments
45+
46+
[log]
47+
ROOT_PATH = $GITEA_WORK_DIR/data/log
48+
49+
[security]
50+
INSTALL_LOCK = $INSTALL_LOCK
51+
SECRET_KEY = $SECRET_KEY
52+
53+
[service]
54+
DISABLE_REGISTRATION = $DISABLE_REGISTRATION
55+
REQUIRE_SIGNIN_VIEW = $REQUIRE_SIGNIN_VIEW
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
if [ -x /usr/local/bin/docker-setup.sh ]; then
4+
/usr/local/bin/docker-setup.sh || { echo 'docker setup failed' ; exit 1; }
5+
fi
6+
7+
if [ $# -gt 0 ]; then
8+
exec "$@"
9+
else
10+
exec /usr/local/bin/gitea -c ${GITEA_APP_INI} web
11+
fi

0 commit comments

Comments
 (0)