-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add uploading packages through the Web UI #26960
base: main
Are you sure you want to change the base?
Conversation
|
The Filename is only used by generic Packages. It's the filename under which the package is published later. I though it was a good idea to add this instead of using the name from the uploaded file, so nobody ends up with something like package_test4.zip. Maybe it would be a good idea to use something like "(leave empty to use the file name from the uploaded file)" for this field.
I will do that. |
What do those package filenames look like? I assume they are different per type of package? Maybe we can keep things simple and just auto-generate a filename from name and version only? |
Oh and the input placeholders in UI should show sample values, e.g. |
No. As I said, they only exists for generic packages.
That sounds more complex and not simpler. The Version filed exists (as far as I know) also only for generic packages. For other Formats, the Version is extracted from the package itself.
You can use whatever you want as version. There is no need to use somtehing like |
Just to note, there is filename related logic in other package types too (Conan, Maven, NuGet, ...) |
Just to note, there is filename related logic in other package types too Thanks. I will see that when I add those types. But for this PR, I think it's better to focus on those packages that can be uploaded with a simple PUT request. I also added support for RPM packages now. |
UI looks good, but I would replace "The Package:" with "File:" |
I had moved to upload code now to the specific service of each package rather than bundling all in one upload service |
Found this while working on #26960
I have now added support for Alpine Packages. I also consider this PR now as ready. There are package types missing, but they can be added in a later PR, as I don't want to grow his PR too big. I think those 4 package types are a good start. |
Is it ready for review? |
Yes, it is ready to review |
Can you add some unit test cases, if applicable? |
I don't know how to do this. We don't have something like Selenium to write real frontend tests (I think this should be introduced). The only thing I could do is making a POST request to the form endpoints. But everything I found in the Gitea test suite that does this for the frontend (Search for GetCSRF) uses only strings. But we have a multipart form with file uplo0ad here. Testing this would most likely require some changes in the test suite. Luckily the package upload code itself is already tested. So the only backend files that are not tested are those in |
no worries with playwright we can achieve that |
Its looks like playwright is not really used besides some examples |
I have function that might help to automatically get a response code in PR, it it is not finished, i am not sure about response codes. // Automatically get HTTP status from error.
func StatusFromError(err error) int {
switch {
case errors.Is(err, ErrNotExist):
return http.StatusNotFound
case errors.Is(err, ErrAlreadyExist) || errors.Is(err, ErrLimitExceeded):
return http.StatusConflict
case errors.Is(err, ErrPayloadTooLarge):
return http.StatusRequestEntityTooLarge
case errors.Is(err, ErrInvalidArgument) || errors.Is(err, io.EOF):
return http.StatusBadRequest
case errors.Is(err, ErrPermissionDenied):
return http.StatusForbidden
}
return http.StatusInternalServerError
} It might be possible to use this function to check, upload error is caused by user, and which type is it. Should be possible not to return |
Any new update on this @JakobDev ? |
@JakobDev would really love to see this feature merged ... been a year since it got any love though :( |
At the Moment you can upload Packages only through the API. So if you want to e.g. upload a Debian package that you have build, you need to lookup the command and maybe you also need to create a Token. This PR adds a easier way: Now you can upload packages through the Web UI with just a few clicks! This will of course not work with all package types. You can't expect to upload e.g. a Container Image this way. This PR aims at those Packages types, than can be uploaded using curl.
Currently supported types:
To-do:
Screenshots:
cc @KN4CK3R