Skip to content

Commit 1c0401f

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents df255a0 + c2fb27b commit 1c0401f

File tree

260 files changed

+3900
-2041
lines changed

Some content is hidden

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

260 files changed

+3900
-2041
lines changed

.drone.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ steps:
3939
- make lint-frontend
4040
depends_on: [deps-frontend]
4141

42-
- name: security-check
43-
image: golang:1.19
44-
pull: always
45-
commands:
46-
- make security-check
47-
depends_on: [deps-backend]
48-
volumes:
49-
- name: deps
50-
path: /go
51-
5242
- name: lint-backend
5343
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
5444
pull: always

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ rules:
199199
newline-per-chained-call: [0]
200200
no-alert: [0]
201201
no-array-constructor: [2]
202-
no-async-promise-executor: [2]
202+
no-async-promise-executor: [0]
203203
no-await-in-loop: [0]
204204
no-bitwise: [0]
205205
no-buffer-constructor: [0]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ checks: checks-frontend checks-backend
333333
checks-frontend: lockfile-check svg-check
334334

335335
.PHONY: checks-backend
336-
checks-backend: tidy-check swagger-check fmt-check misspell-check swagger-validate
336+
checks-backend: tidy-check swagger-check fmt-check misspell-check swagger-validate security-check
337337

338338
.PHONY: lint
339339
lint: lint-frontend lint-backend
@@ -745,7 +745,7 @@ generate-go: $(TAGS_PREREQ)
745745

746746
.PHONY: security-check
747747
security-check:
748-
govulncheck -v ./...
748+
go run $(GOVULNCHECK_PACKAGE) -v ./...
749749

750750
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
751751
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@

cmd/admin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ func runRepoSyncReleases(_ *cli.Context) error {
727727

728728
log.Trace("Synchronizing repository releases (this may take a while)")
729729
for page := 1; ; page++ {
730-
repos, count, err := repo_model.SearchRepositoryByName(&repo_model.SearchRepoOptions{
730+
repos, count, err := repo_model.SearchRepositoryByName(ctx, &repo_model.SearchRepoOptions{
731731
ListOptions: db.ListOptions{
732732
PageSize: repo_model.RepositoryListDefaultPageSize,
733733
Page: page,

custom/conf/app.example.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,9 @@ ROUTER = console
22342234
;; Show template execution time in the footer
22352235
;SHOW_FOOTER_TEMPLATE_LOAD_TIME = true
22362236
;; Generate sitemap. Defaults to `true`.
2237-
; ENABLE_SITEMAP = true
2237+
;ENABLE_SITEMAP = true
2238+
;; Enable/Disable RSS/Atom feed
2239+
;ENABLE_FEED = true
22382240

22392241
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22402242
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,13 @@ The following configuration set `Content-Type: application/vnd.android.package-a
289289
This includes CSS files, images, JS files and web fonts.
290290
Avatar images are dynamic resources and still served by Gitea.
291291
The option can be just a different path, as in `/static`, or another domain, as in `https://cdn.example.com`.
292-
Requests are then made as `%(ROOT_URL)s/static/css/index.css` and `https://cdn.example.com/css/index.css` respective.
292+
Requests are then made as `%(ROOT_URL)s/static/assets/css/index.css` or `https://cdn.example.com/assets/css/index.css` respectively.
293293
The static files are located in the `public/` directory of the Gitea source repository.
294+
You can proxy the STATIC_URL_PREFIX requests to Gitea server to serve the static
295+
assets, or copy the manually built Gitea assets from `$GITEA_BUILD/public` to
296+
the assets location, eg: `/var/www/assets`, make sure `$STATIC_URL_PREFIX/assets/css/index.css`
297+
points to `/var/www/assets/css/index.css`.
298+
294299
- `HTTP_ADDR`: **0.0.0.0**: HTTP listen address.
295300
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
296301
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
@@ -1283,3 +1288,4 @@ PROXY_HOSTS = *.github.com
12831288
- `SHOW_FOOTER_VERSION`: **true**: Show Gitea and Go version information in the footer.
12841289
- `SHOW_FOOTER_TEMPLATE_LOAD_TIME`: **true**: Show time of template execution in the footer.
12851290
- `ENABLE_SITEMAP`: **true**: Generate sitemap.
1291+
- `ENABLE_FEED`: **true**: Enable/Disable RSS/Atom feed.

docs/content/doc/advanced/repo-mirror.en-us.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ For an existing remote repository, you can set up pull mirroring as follows:
4141

4242
The repository now gets mirrored periodically from the remote repository. You can force a sync by selecting **Synchronize Now** in the repository settings.
4343

44+
:exclamation::exclamation: **NOTE:** You can only set up pull mirroring for repos that don't exist yet on your instance. Once the repo is created, you can't convert it into a pull mirror anymore. :exclamation::exclamation:
45+
4446
## Pushing to a remote repository
4547

4648
For an existing repository, you can set up push mirroring as follows:
4749

4850
1. In your repository, go to **Settings** > **Repository**, and then the **Mirror Settings** section.
4951
2. Enter a repository URL.
50-
3. If the repository needs authentication expand the **Authorization** section and fill in your authentication information.
52+
3. If the repository needs authentication expand the **Authorization** section and fill in your authentication information. Note that the requested **password** can also be your access token.
5153
4. Select **Add Push Mirror** to save the configuration.
5254

5355
The repository now gets mirrored periodically to the remote repository. You can force a sync by selecting **Synchronize Now**. In case of an error a message displayed to help you resolve it.
@@ -59,9 +61,11 @@ The repository now gets mirrored periodically to the remote repository. You can
5961
To set up a mirror from Gitea to GitHub, you need to follow these steps:
6062

6163
1. Create a [GitHub personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the *public_repo* box checked.
62-
2. Fill in the **Git Remote Repository URL**: `https://github.com/<your_github_group>/<your_github_project>.git`.
63-
3. Fill in the **Authorization** fields with your GitHub username and the personal access token.
64-
4. Select **Add Push Mirror** to save the configuration.
64+
2. Create a repository with that name on GitHub. Unlike Gitea, GitHub does not support creating repositories by pushing to the remote. You can also use an existing remote repo if it has the same commit history as your Gitea repo.
65+
3. In the settings of your Gitea repo, fill in the **Git Remote Repository URL**: `https://github.com/<your_github_group>/<your_github_project>.git`.
66+
4. Fill in the **Authorization** fields with your GitHub username and the personal access token as **Password**.
67+
5. (Optional, available on Gitea 1.18+) Select `Sync when new commits are pushed` so that the mirror will be updated as well as soon as there are changes. You can also disable the periodic sync if you like.
68+
6. Select **Add Push Mirror** to save the configuration.
6569

6670
The repository pushes shortly thereafter. To force a push, select the **Synchronize Now** button.
6771

docs/content/doc/features/authentication.en-us.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,47 @@ Uses the following fields:
166166

167167
## PAM (Pluggable Authentication Module)
168168

169-
To configure PAM, set the 'PAM Service Name' to a filename in `/etc/pam.d/`. To
170-
work with normal Linux passwords, the user running Gitea must have read access
171-
to `/etc/shadow`.
172-
173-
**Note**: PAM support is added via [build-time flags](https://docs.gitea.io/en-us/install-from-source/#build), and the official binaries provided do not have this enabled.
169+
This procedure enables PAM authentication. Users may still be added to the
170+
system manually using the user administration. PAM provides a mechanism to
171+
automatically add users to the current database by testing them against PAM
172+
authentication. To work with normal Linux passwords, the user running Gitea
173+
must also have read access to `/etc/shadow` in order to check the validity of
174+
the account when logging in using a public key.
175+
176+
**Note**: If a user has added SSH public keys into Gitea, the use of these
177+
keys _may_ bypass the login check system. Therefore, if you wish to disable a user who
178+
authenticates with PAM, you _should_ also manually disable the account in Gitea using the
179+
built-in user manager.
180+
181+
1. Configure and prepare the installation.
182+
- It is recommended that you create an administrative user.
183+
- Deselecting automatic sign-up may also be desired.
184+
1. Once the database has been initialized, log in as the newly created
185+
administrative user.
186+
1. Navigate to the user setting (icon in top-right corner), and select
187+
`Site Administration` -> `Authentication Sources`, and select
188+
`Add Authentication Source`.
189+
1. Fill out the field as follows:
190+
- `Authentication Type` : `PAM`
191+
- `Name` : Any value should be valid here, use "System Authentication" if
192+
you'd like.
193+
- `PAM Service Name` : Select the appropriate file listed under `/etc/pam.d/`
194+
that performs the authentication desired.[^1]
195+
- `PAM Email Domain` : The e-mail suffix to append to user authentication.
196+
For example, if the login system expects a user called `gituser`, and this
197+
field is set to `mail.com`, then Gitea will expect the `user email` field
198+
for an authenticated GIT instance to be `gituser@mail.com`.[^2]
199+
200+
**Note**: PAM support is added via [build-time flags](https://docs.gitea.io/en-us/install-from-source/#build),
201+
and the official binaries provided do not have this enabled. PAM requires that
202+
the necessary libpam dynamic library be available and the necessary PAM
203+
development headers be accessible to the compiler.
204+
205+
[^1]: For example, using standard Linux log-in on Debian "Bullseye" use
206+
`common-session-noninteractive` - this value may be valid for other flavors of
207+
Debian including Ubuntu and Mint, consult your distribution's documentation.
208+
[^2]: **This is a required field for PAM**. Be aware: In the above example, the
209+
user will log into the Gitea web interface as `gituser` and not `gituser@mail.com`
174210

175211
## SMTP (Simple Mail Transfer Protocol)
176212

docs/content/doc/installation/from-source.en-us.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ are provided to keep the build process as simple as possible.
9494

9595
Depending on requirements, the following build tags can be included.
9696

97-
- `bindata`: Build a single monolithic binary, with all assets included.
97+
- `bindata`: Build a single monolithic binary, with all assets included. Required for production build.
9898
- `sqlite sqlite_unlock_notify`: Enable support for a
9999
[SQLite3](https://sqlite.org/) database. Suggested only for tiny
100100
installations.
@@ -103,11 +103,10 @@ Depending on requirements, the following build tags can be included.
103103
available to PAM.
104104
- `gogit`: (EXPERIMENTAL) Use go-git variants of Git commands.
105105

106-
Bundling assets into the binary using the `bindata` build tag is recommended for
107-
production deployments. It is possible to serve the static assets directly via a reverse proxy,
108-
but in most cases it is not necessary, and assets should still be bundled in the binary.
109-
You may want to exclude bindata while developing/testing Gitea.
110-
To include assets, add the `bindata` tag:
106+
Bundling all assets (JS/CSS/templates, etc) into the binary. Using the `bindata` build tag is required for
107+
production deployments. You could exclude `bindata` when you are developing/testing Gitea or able to separate the assets correctly.
108+
109+
To include all assets, use the `bindata` tag:
111110

112111
```bash
113112
TAGS="bindata" make build
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
date: "2022-11-01T00:00:00+00:00"
3+
title: "Storage"
4+
slug: "packages/storage"
5+
draft: false
6+
toc: false
7+
menu:
8+
sidebar:
9+
parent: "packages"
10+
name: "storage"
11+
weight: 5
12+
identifier: "storage"
13+
---
14+
15+
# Storage
16+
17+
This document describes the storage of the package registry and how it can be managed.
18+
19+
**Table of Contents**
20+
21+
{{< toc >}}
22+
23+
## Deduplication
24+
25+
The package registry has a build-in deduplication of uploaded blobs.
26+
If two identical files are uploaded only one blob is saved on the filesystem.
27+
This ensures no space is wasted for duplicated files.
28+
29+
If two packages are uploaded with identical files, both packages will display the same size but on the filesystem they require only half of the size.
30+
Whenever a package gets deleted only the references to the underlaying blobs are removed.
31+
The blobs get not removed at this moment, so they still require space on the filesystem.
32+
When a new package gets uploaded the existing blobs may get referenced again.
33+
34+
These unreferenced blobs get deleted by a [clean up job]({{< relref "doc/advanced/config-cheat-sheet.en-us.md#cron---cleanup-expired-packages-croncleanup_packages" >}}).
35+
The config setting `OLDER_THAN` configures how long unreferenced blobs are kept before they get deleted.
36+
37+
## Cleanup Rules
38+
39+
Package registries can become large over time without cleanup.
40+
It's recommended to delete unnecessary packages and set up cleanup rules to automatically manage the package registry usage.
41+
Every package owner (user or organization) manages the cleanup rules which are applied to their packages.
42+
43+
|Setting|Description|
44+
|-|-|
45+
|Enabled|Turn the cleanup rule on or off.|
46+
|Type|Every rule manages a specific package type.|
47+
|Apply pattern to full package name|If enabled, the patterns below are applied to the full package name (`package/version`). Otherwise only the version (`version`) is used.|
48+
|Keep the most recent|How many versions to *always* keep for each package.|
49+
|Keep versions matching|The regex pattern that determines which versions to keep. An empty pattern keeps no version while `.+` keeps all versions. The container registry will always keep the `latest` version even if not configured.|
50+
|Remove versions older than|Remove only versions older than the selected days.|
51+
|Remove versions matching|The regex pattern that determines which versions to remove. An empty pattern or `.+` leads to the removal of every package if no other setting tells otherwise.|
52+
53+
Every cleanup rule can show a preview of the affected packages.
54+
This can be used to check if the cleanup rules is proper configured.
55+
56+
### Regex examples
57+
58+
Regex patterns are automatically surrounded with `\A` and `\z` anchors.
59+
Do not include any `\A`, `\z`, `^` or `$` token in the regex patterns as they are not necessary.
60+
The patterns are case-insensitive which matches the behaviour of the package registry in Gitea.
61+
62+
|Pattern|Description|
63+
|-|-|
64+
|`.*`|Match every possible version.|
65+
|`v.+`|Match versions that start with `v`.|
66+
|`release`|Match only the version `release`.|
67+
|`release.*`|Match versions that are either named or start with `release`.|
68+
|`.+-temp-.+`|Match versions that contain `-temp-`.|
69+
|`v.+\|release`|Match versions that either start with `v` or are named `release`.|
70+
|`package/v.+\|other/release`|Match versions of the package `package` that start with `v` or the version `release` of the package `other`. This needs the setting *Apply pattern to full package name* enabled.|
71+
72+
### How the cleanup rules work
73+
74+
The cleanup rules are part of the [clean up job]({{< relref "doc/advanced/config-cheat-sheet.en-us.md#cron---cleanup-expired-packages-croncleanup_packages" >}}) and run periodicly.
75+
76+
The cleanup rule:
77+
78+
1. Collects all packages of the package type for the owners registry.
79+
1. For every package it collects all versions.
80+
1. Excludes from the list the # versions based on the *Keep the most recent* value.
81+
1. Excludes from the list any versions matching the *Keep versions matching* value.
82+
1. Excludes from the list the versions more recent than the *Remove versions older than* value.
83+
1. Excludes from the list any versions not matching the *Remove versions matching* value.
84+
1. Deletes the remaining versions.

0 commit comments

Comments
 (0)