Commit Graph

1244 Commits

Author SHA1 Message Date
Danila Fominykh
e86bdfcb0e
metadata and signature are stored in package properties instead of object storage 2023-08-08 16:21:17 +03:00
Danila Fominykh
28712bc91e
refactoring 2023-08-04 14:52:36 +03:00
Danila Fominykh
0c7aa7f63e
refactoring 2023-08-03 20:43:13 +03:00
Danila Fominykh
3c6dd37019
Merge branch 'main' into pacman-packages 2023-07-31 10:14:41 +03:00
Jason Song
1e76a824bc
Refactor and enhance issue indexer to support both searching, filtering and paging (#26012)
Fix #24662.

Replace #24822 and #25708 (although it has been merged)


## Background

In the past, Gitea supported issue searching with a keyword and
conditions in a less efficient way. It worked by searching for issues
with the keyword and obtaining limited IDs (as it is heavy to get all)
on the indexer (bleve/elasticsearch/meilisearch), and then querying with
conditions on the database to find a subset of the found IDs. This is
why the results could be incomplete.

To solve this issue, we need to store all fields that could be used as
conditions in the indexer and support both keyword and additional
conditions when searching with the indexer.

## Major changes

- Redefine `IndexerData` to include all fields that could be used as
filter conditions.
- Refactor `Search(ctx context.Context, kw string, repoIDs []int64,
limit, start int, state string)` to `Search(ctx context.Context, options
*SearchOptions)`, so it supports more conditions now.
- Change the data type stored in `issueIndexerQueue`. Use
`IndexerMetadata` instead of `IndexerData` in case the data has been
updated while it is in the queue. This also reduces the storage size of
the queue.
- Enhance searching with Bleve/Elasticsearch/Meilisearch, make them
fully support `SearchOptions`. Also, update the data versions.
- Keep most logic of database indexer, but remove
`issues.SearchIssueIDsByKeyword` in `models` to avoid confusion where is
the entry point to search issues.
- Start a Meilisearch instance to test it in unit tests.
- Add unit tests with almost full coverage to test
Bleve/Elasticsearch/Meilisearch indexer.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-07-31 06:28:53 +00:00
Danila Fominykh
5e4c582976
Merge branch 'main' into pacman-packages 2023-07-30 19:21:13 +03:00
Danila Fominykh
3df8d52fb8
changed pacman database creation mechanics, storing package desc as file in object storage, metadata structure update 2023-07-28 16:32:01 +03:00
Danila Fominykh
8b06f76360
replaced HTTP headers with url params 2023-07-27 13:21:11 +03:00
Danila Fominykh
1e33f61375
Update routers/api/packages/arch/arch.go
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-07-27 12:50:44 +03:00
Danila Fominykh
524a2a01c1
Update routers/api/packages/arch/arch.go
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-07-27 12:35:35 +03:00
Danila Fominykh
7b92529bc4
Update routers/api/packages/arch/arch.go
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-07-27 12:35:17 +03:00
KN4CK3R
2d7fe4cc1e
Fix handling of plenty Nuget package versions (#26075)
Fixes #25953

- Do not load full version information (v3)
- Add pagination support (v2)
2023-07-26 19:43:21 +00:00
Danila Fominykh
ab1a9a1587
changed context doer to context user, fixed package config setting 2023-07-26 17:26:16 +03:00
Danila Fominykh
b13e3d3efd
Merge branch 'main' into pacman-packages 2023-07-26 12:37:30 +03:00
wxiaoguang
915cdf8f87
Remove "misc" scope check from public API endpoints (#26134)
Fix #26035
2023-07-26 02:53:31 +00:00
Danila Fominykh
523e8269f7
Merge branch 'main' into pacman-packages 2023-07-25 21:53:07 +03:00
JakobDev
6598d0291c
Allow Organisations to have a E-Mail (#25082)
Resolves #25057

This adds a E-Mail field to Organisations. The E-Mail is just shown on
the Profile when it is visited by a logged in User. The E-mail is not
used for something else.

**Screenshots:**

![grafik](https://github.com/go-gitea/gitea/assets/15185051/a8d622b3-7278-4c08-984b-9c5ebfdb5471)

![grafik](https://github.com/go-gitea/gitea/assets/15185051/6dcb1dd7-d04b-49eb-bc96-6582cfe9757b)

---------

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: Denys Konovalov <privat@denyskon.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-07-25 08:26:27 +00:00
silverwind
672b00b542
Merge branch 'main' into pacman-packages 2023-07-25 00:02:26 +02:00
KN4CK3R
6aa30af724
Fix handling of Debian files with trailing slash (#26087)
Fixes #26022

- Fix handling of files with trailing slash
- Fix handling of duplicate package file errors
- Added test for both
2023-07-24 16:19:44 +02:00
Danila Fominykh
e22a3c7bb1
Merge branch 'main' into pacman-packages 2023-07-24 15:38:58 +03:00
Danila Fominykh
23f1ba193d
replaced base domain variable in metadata with registry host variable in similarly with container registry 2023-07-24 13:33:45 +03:00
caicandong
4211efe8b7
fix Missing 404 swagger response docs for /admin/users/{username} (#26086)
close #26079
2023-07-24 10:48:44 +02:00
sillyguodong
f5c7d4cfdd
Reduce unnecessary DB queries for Actions tasks (#25199)
Close #24544

Changes:

- Create `action_tasks_version` table to store the latest version of
each scope (global, org and repo).
- When a job with the status of `waiting` is created, the tasks version
of the scopes it belongs to will increase.
- When the status of a job already in the database is updated to
`waiting`, the tasks version of the scopes it belongs to will increase.
- On Gitea side, in `FeatchTask()`, will try to query the
`action_tasks_version` record of the scope of the runner that call
`FetchTask()`. If the record does not exist, will insert a row. Then,
Gitea will compare the version passed from runner to Gitea with the
version in database, if inconsistent, try pick task. Gitea always
returns the latest version from database to the runner.

Related:

- Protocol: https://gitea.com/gitea/actions-proto-def/pulls/10
- Runner: https://gitea.com/gitea/act_runner/pulls/219
2023-07-24 06:11:27 +00:00
delvh
f3d41c61eb
Remove db.DefaultContext in routers/ and cmd/ (#26076)
Now, the only remaining usages of `models.db.DefaultContext` are in
  - `modules`
  - `models`
  - `services`
2023-07-23 23:47:27 -04:00
Danila Fominykh
597a948e33
replaced custom auth with existing methods 2023-07-23 15:42:52 +03:00
Danila Fominykh
245a54532f
Merge branch 'main' into pacman-packages 2023-07-22 20:34:30 +03:00
Lunny Xiao
b167f35113
Add context parameter to some database functions (#26055)
To avoid deadlock problem, almost database related functions should be
have ctx as the first parameter.
This PR do a refactor for some of these functions.
2023-07-22 22:14:27 +08:00
Lunny Xiao
037c9895a7
Support copy protected branch from template repository (#25889)
Fix #14303
2023-07-21 12:32:47 +08:00
FuXiaoHei
f3d293d2bb
Actions Artifacts support uploading multiple files and directories (#24874)
current actions artifacts implementation only support single file
artifact. To support multiple files uploading, it needs:

- save each file to each db record with same run-id, same artifact-name
and proper artifact-path
- need change artifact uploading url without artifact-id, multiple files
creates multiple artifact-ids
- support `path` in download-artifact action. artifact should download
to `{path}/{artifact-path}`.
- in repo action view, it provides zip download link in artifacts list
in summary page, no matter this artifact contains single or multiple
files.
2023-07-21 10:42:01 +08:00
wxiaoguang
9b25bfa8f4
Remove redundant "RouteMethods" method (#26024)
The `RouteMethods` is mainly an alias for `Methods` with different
argument order.

Remove it to keep the "route.go" code clear
2023-07-21 00:43:49 +02:00
wxiaoguang
236c645bf1
Refactor "Content" for file uploading (#25851)
Before: the concept "Content string" is used everywhere. It has some
problems:

1. Sometimes it means "base64 encoded content", sometimes it means "raw
binary content"
2. It doesn't work with large files, eg: uploading a 1G LFS file would
make Gitea process OOM

This PR does the refactoring: use "ContentReader" / "ContentBase64"
instead of "Content"

This PR is not breaking because the key in API JSON is still "content":
`` ContentBase64 string `json:"content"` ``
2023-07-18 18:14:47 +00:00
Danila Fominykh
faff9d9c57 getting storage object instead of reading bytes 2023-07-17 20:30:36 +03:00
Danila Fominykh
1ea4d48b39 fixed package version owner in metadata update operation 2023-07-17 14:19:54 +03:00
Danila Fominykh
9e7c6ef5e9 updated documentation about metadata update function 2023-07-17 00:03:24 +03:00
Danila Fominykh
1a082903d7
Merge branch 'main' into pacman-packages 2023-07-16 13:09:54 +03:00
KN4CK3R
bd82d8974e
Add support for different Maven POM encoding (#25873)
Fixes #25853

- Maven POM files aren't always UTF-8 encoded.
- Reject the upload of unparsable POM files
2023-07-14 09:39:15 +00:00
dancheg97
f3841f0777 fixed response status code for metadata update operation 2023-07-12 11:41:20 +03:00
Dancheg97
73fe874862
Merge branch 'go-gitea:main' into pacman-packages 2023-07-10 20:24:55 +03:00
Lunny Xiao
0fd1672ae4
For API attachments, use API URL (#25639)
Fix #25257

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-07-10 09:31:19 +00:00
dancheg97
1df0a1d252 fixed file size for mock and scope of time patch 2023-07-09 18:26:01 +03:00
silverwind
2685f1a307
Merge branch 'main' into pacman-packages 2023-07-09 14:27:52 +02:00
silverwind
887a683af9
Update tool dependencies, lock govulncheck and actionlint (#25655)
- Update all tool dependencies
- Lock `govulncheck` and `actionlint` to their latest tags

---------

Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-07-09 11:58:06 +00:00
KN4CK3R
115f40e433
Test if container blob is accessible before mounting (#22759)
related #16865

This PR adds an accessibility check before mounting container blobs.

---------

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
2023-07-09 11:24:43 +00:00
dancheg97
364c33b0ad fixed pacman database creation error for case with multiple architectures and distributions 2023-07-09 11:48:46 +03:00
Dancheg97
f0d569c06e
Merge branch 'go-gitea:main' into pacman-packages 2023-07-08 06:10:21 +03:00
Zettat123
a42a838843
Fix ref for workflows triggered by pull_request_target (#25743)
Follow #25229

At present, when the trigger event is `pull_request_target`, the `ref`
and `sha` of `ActionRun` are set according to the base branch of the
pull request. This makes it impossible for us to find the head branch of
the `ActionRun` directly. In this PR, the `ref` and `sha` will always be
set to the head branch and they will be changed to the base branch when
generating the task context.
2023-07-07 19:22:03 +00:00
techknowlogick
cb01b8691d
Add open/closed field support for issue index (#25708)
A couple of notes:
* Future changes should refactor arguments into a struct
* This filtering only is supported by meilisearch right now
* Issue index number is bumped which will cause a re-index
2023-07-07 17:10:13 +00:00
6543
8995046110
Less naked returns (#25713)
just a step towards  #25655

and some related refactoring
2023-07-07 05:31:56 +00:00
silverwind
b5db5b89e8
Merge branch 'main' into pacman-packages 2023-07-04 20:43:36 +02:00
silverwind
88f835192d
Replace interface{} with any (#25686)
Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`.

Basically the same [as golang did](2580d0e08d).
2023-07-04 18:36:08 +00:00