Commit Graph

1344 Commits

Author SHA1 Message Date
Danila Fominykh
45c86cce58
Merge branch 'main' into pacman-packages 2023-10-31 20:39:42 -03:00
Danila Fominykh
73aef3a2c7
integration tests for databases with different architectures, versions and any packages 2023-10-31 19:16:31 -03:00
Danila Fominykh
8aeada8c30
additional validations for package metadata fields, split package metadata into file and version related structures, better test coverage and refactoring in metadata module 2023-10-30 21:53:14 -03:00
FuXiaoHei
ec0c6829d4
Fix/upload artifact error windows (#27802)
From issue https://github.com/go-gitea/gitea/issues/27314

When act_runner in `host` mode on Windows. `upload_artifact@v3` actions
use `path.join` to generate `itemPath` params when uploading artifact
chunk. `itemPath` is encoded as `${artifact_name}\${artifact_path}`.

<del>It's twice query escaped from ${artifact_name}/${artifact_path}
that joined by Windows slash \.</del>

**So we need convert Windows slash to linux**.

In https://github.com/go-gitea/gitea/issues/27314, runner shows logs
from `upload_artifact@v3` like with `%255C`:

```
[artifact-cases/test-artifact-cases]   | ::error::Unexpected response. Unable to upload chunk to http://192.168.31.230:3000/api/actions_pipeline/_apis/pipelines/workflows/6/artifacts/34d628a422db9367c869d3fb36be81f5/upload?itemPath=more-files%255Css.json
```

But in gitea server at the same time, But shows `%5C`

```
2023/10/27 19:29:51 ...eb/routing/logger.go:102:func1() [I] router: completed PUT /api/actions_pipeline/_apis/pipelines/workflows/6/artifacts/34d628a422db9367c869d3fb36be81f5/upload?itemPath=more-files%5Css.json for 192.168.31.230:55340, 400 Bad Request in 17.6ms @ <autogenerated>:1(actions.artifactRoutes.uploadArtifact-fm)
```

I found `%255C` is escaped by
`https://github.com/actions/upload-artifact/blob/main/dist/index.js#L2329`.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-30 10:40:05 +00:00
Jean-Baptiste Gomond
641e8165c7
Fix bad method call when deleting user secrets via API (#27829)
Fixed a little mistake when you deleting user secrets via the API. Found
it when working on #27725.
It should be backported to 1.21 I think.
2023-10-29 13:19:57 +01:00
Danila Fominykh
f8b78cba23
Merge branch 'main' into pacman-packages 2023-10-26 12:16:04 -03:00
merlleu
796ff26e0e
Do not force creation of _cargo-index repo on publish (#27266)
Hello there,
Cargo Index over HTTP is now prefered over git for package updates: we
should not force users who do not need the GIT repo to have the repo
created/updated on each publish (it can still be created in the packages
settings).

The current behavior when publishing is to check if the repo exist and
create it on the fly if not, then update it's content.
Cargo HTTP Index does not rely on the repo itself so this will be
useless for everyone not using the git protocol for cargo registry.

This PR only disable the creation on the fly of the repo when publishing
a crate.

This is linked to #26844 (error 500 when trying to publish a crate if
user is missing write access to the repo) because it's now optional.

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-10-24 03:26:38 +00:00
silverwind
ce83609ff6
Upgrade to golangci-lint@v1.55.0 (#27756)
https://github.com/golangci/golangci-lint/releases/tag/v1.55.0
2023-10-24 02:54:59 +00:00
Danila Fominykh
52a5c61e41
Merge branch 'main' into pacman-packages 2023-10-23 00:16:46 -03:00
Nanguan Lin
1859bbbf91
Fix org team endpoint (#27721)
Fix #27711
2023-10-22 01:40:59 +02:00
JakobDev
3dc0c962bf
Delete repos of org when purge delete user (#27273)
Fixes https://codeberg.org/forgejo/forgejo/issues/1514

I had to remove `RenameOrganization` to avoid circular import.

We should really add some foreign keys to the database.
2023-10-19 13:16:11 +00:00
Danila Fominykh
fe9086bc00
Merge branch 'main' into pacman-packages 2023-10-18 19:19:49 -03:00
Lunny Xiao
9852c92e9a
Remove unnecessary parameter (#27671) 2023-10-18 15:03:10 +00:00
Lunny Xiao
cddf245c12
Replace more db.DefaultContext (#27628)
Target #27065
2023-10-15 17:46:06 +02:00
JakobDev
76a85a4ce9
Final round of db.DefaultContext refactor (#27587)
Last part of #27065
2023-10-14 08:37:24 +00:00
Evan Tobin
ae419fa494
Fix permissions for Token DELETE endpoint to match GET and POST (#27610)
Fixes #27598

In #27080, the logic for the tokens endpoints were updated to allow
admins to create and view tokens in other accounts. However, the same
functionality was not added to the DELETE endpoint. This PR makes the
DELETE endpoint function the same as the other token endpoints and adds unit tests
2023-10-14 08:04:44 +00:00
Danila Fominykh
95a1df6dfc
import naming unification with other package types 2023-10-12 11:56:54 -03:00
Danila Fominykh
6052aea5f2
moved upload function to arch service 2023-10-12 11:43:33 -03:00
Danila Fominykh
54a9c8bdff
corrected response codes in push and remove operations 2023-10-12 09:15:49 -03:00
Danila Fominykh
99f856a4db
Merge branch 'main' into pacman-packages 2023-10-11 23:38:46 -03:00
JakobDev
ebe803e514
Penultimate round of db.DefaultContext refactor (#27414)
Part of #27065

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-10-11 04:24:07 +00:00
Nanguan Lin
5b6258a0b9
Fix the wrong HTTP response status code for duplicate packages (#27480)
fix #27470 
(hope there is nothing missing 😢 )

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-10-10 15:39:58 +02:00
Michael Santos
5283ce9650
api: GetPullRequestCommits: return file list (#27483)
Fixes https://github.com/go-gitea/gitea/issues/27481

----

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-09 11:22:12 +00:00
Danila Fominykh
b63af7e277
metadata tests, json struct tag unification with other linux packages, removed package backup files from metadata and arch package UI 2023-10-09 03:13:53 -03:00
Danila Fominykh
26e5f9e3a5
Merge branch 'main' into pacman-packages 2023-10-07 16:18:33 -03:00
Danila Fominykh
54c0816377
refactoring, better readability in arch package metadata module 2023-10-05 16:16:02 -03:00
JakobDev
f2b2608a86
Don't let API add 2 exclusive labels from same scope (#27433)
Fixes #27380
2023-10-05 03:37:36 +00:00
JakobDev
cc5df26680
Even more db.DefaultContext refactor (#27352)
Part of #27065

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2023-10-03 10:30:41 +00:00
Danila Fominykh
94f45f402f
change interface{} to any, move apiError function to bottom 2023-10-02 23:47:32 -03:00
Danila Fominykh
33ae3bd5ce
Merge branch 'main' into pacman-packages 2023-10-02 23:31:48 -03:00
Danila Fominykh
8974d27ba3
refactoring in metadata module, better readability
shorter function calls in arch service
fix - request now ends if unable to decode package signature from hex
fix - now package search continues to previous versions in package file for required architecture not found for current version
2023-10-02 19:12:06 -03:00
Danila Fominykh
f515f6ee7c
removed unnecessary filename from composite key 2023-10-02 14:33:37 -03:00
JakobDev
cf0df023be
More db.DefaultContext refactor (#27265)
Part of #27065

This PR touches functions used in templates. As templates are not static
typed, errors are harder to find, but I hope I catch it all. I think
some tests from other persons do not hurt.
2023-09-29 12:12:54 +00:00
Danila Fominykh
ba92fc54b7
pass context to package service methods 2023-09-28 17:25:22 -03:00
Danila Fominykh
a1ee2a0a96
Merge branch 'main' into pacman-packages 2023-09-28 17:14:23 -03:00
Danila Fominykh
c09da2a9e1
removed functionality related to automatic source code repository connection 2023-09-28 17:13:40 -03:00
Lunny Xiao
673cf6af76
make writing main test easier (#27270)
This PR removed `unittest.MainTest` the second parameter
`TestOptions.GiteaRoot`. Now it detects the root directory by current
working directory.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-09-28 01:38:53 +00:00
Lunny Xiao
3b2da7e4ae
Redefine the meaning of column is_active to make Actions Registration Token generation easier (#27143)
Partially Fix #25041

This PR redefined the meaning of column `is_active` in table
`action_runner_token`.
Before this PR, `is_active` means whether it has been used by any
runner. If it's true, other runner cannot use it to register again.

In this PR, `is_active` means whether it's validated to be used to
register runner. And if it's true, then it can be used to register
runners until it become false. When creating a new `is_active` register
token, any previous tokens will be set `is_active` to false.
2023-09-27 05:37:48 +00:00
Danila Fominykh
0dd3db2280
fixed user in package upload operation 2023-09-25 18:54:27 -03:00
Danila Fominykh
4656b3b958
replaced bytes.Buffer with packages.HashedBuffer to return working io.ReadSeeker implementation 2023-09-25 18:42:48 -03:00
JakobDev
7047df36d4
Another round of db.DefaultContext refactor (#27103)
Part of #27065

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2023-09-25 13:17:37 +00:00
Danila Fominykh
54fd84d83f
function to get package file property by composite key, refactoring function creating pacman database 2023-09-24 13:32:53 -03:00
Danila Fominykh
60052811ad
fix request permission access position for push/remove handlers 2023-09-23 18:05:36 -03:00
Danila Fominykh
8faea4236c
Merge branch 'main' into pacman-packages 2023-09-23 17:11:38 -03:00
JakobDev
28f9b313ba
Updates to the API for archived repos (#27149) 2023-09-21 23:43:29 +00:00
Dionysios Kakouris
e46274b5b4
Fix organization field being null in POST /orgs/{orgid}/teams (#27150)
Similarly to the fix in https://github.com/go-gitea/gitea/pull/24694,
this addresses the team creation not returning the organization
information in the response.

This fix is connected to the
[issue](https://gitea.com/gitea/terraform-provider-gitea/issues/27)
discovered in the terraform provider.
Moreover, the
[documentation](https://docs.gitea.com/api/1.20/#tag/organization/operation/orgCreateTeam)
suggests that the response body should include the `organization` field
(currently being `null`).
2023-09-21 08:09:59 +00:00
Danila Fominykh
a4d878c670
Merge branch 'go-gitea:main' into pacman-packages 2023-09-17 22:31:30 -03:00
CaiCandong
f93ee5937b
Fix token endpoints ignore specified account (#27080)
Fix #26234
close #26323
close #27040

---------

Co-authored-by: silverwind <me@silverwind.io>
2023-09-18 00:21:15 +00:00
wxiaoguang
8531ca0837
Make SSPI auth mockable (#27036)
Before, the SSPI auth is only complied for Windows, it's difficult to
test and it breaks a lot.

Now, make the SSPI auth mockable and testable.
2023-09-17 23:32:56 +00:00
KN4CK3R
c766140dad
Add RemoteAddress to mirrors (#26952)
This PR adds a new field `RemoteAddress` to both mirror types which
contains the sanitized remote address for easier (database) access to
that information. Will be used in the audit PR if merged.
2023-09-16 16:03:02 +00:00