From cb64852d903acd36ea2efbd098df2e74a5c17dd1 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Fri, 6 Oct 2023 21:23:02 +0800 Subject: [PATCH 01/14] fix wrong http status about package and align the docs --- docs/content/usage/packages/cargo.en-us.md | 8 ++++++++ docs/content/usage/packages/chef.en-us.md | 8 ++++++++ docs/content/usage/packages/composer.en-us.md | 5 +++-- docs/content/usage/packages/conan.en-us.md | 10 ++++++++++ docs/content/usage/packages/conda.en-us.md | 9 +++++++++ docs/content/usage/packages/container.en-us.md | 10 ++++++++++ docs/content/usage/packages/cran.en-us.md | 9 +++++++++ docs/content/usage/packages/debian.en-us.md | 2 +- docs/content/usage/packages/generic.en-us.md | 3 ++- docs/content/usage/packages/go.en-us.md | 1 + docs/content/usage/packages/helm.en-us.md | 10 ++++++++++ docs/content/usage/packages/maven.en-us.md | 8 ++++++++ docs/content/usage/packages/npm.en-us.md | 8 ++++++++ docs/content/usage/packages/nuget.en-us.md | 8 ++++++++ docs/content/usage/packages/pub.en-us.md | 8 ++++++++ docs/content/usage/packages/pypi.en-us.md | 8 ++++++++ docs/content/usage/packages/rpm.en-us.md | 2 +- docs/content/usage/packages/rubygems.en-us.md | 8 ++++++++ docs/content/usage/packages/swift.en-us.md | 8 ++++++++ docs/content/usage/packages/vagrant.en-us.md | 9 +++++++++ routers/api/packages/alpine/alpine.go | 2 +- routers/api/packages/chef/chef.go | 2 +- routers/api/packages/composer/composer.go | 2 +- routers/api/packages/conan/conan.go | 2 +- routers/api/packages/debian/debian.go | 2 +- routers/api/packages/maven/maven.go | 2 +- routers/api/packages/npm/npm.go | 2 +- routers/api/packages/pub/pub.go | 2 +- routers/api/packages/pypi/pypi.go | 2 +- routers/api/packages/rubygems/rubygems.go | 2 +- 30 files changed, 147 insertions(+), 15 deletions(-) diff --git a/docs/content/usage/packages/cargo.en-us.md b/docs/content/usage/packages/cargo.en-us.md index 356e7ff0b9bef..392d34bc02d42 100644 --- a/docs/content/usage/packages/cargo.en-us.md +++ b/docs/content/usage/packages/cargo.en-us.md @@ -89,6 +89,14 @@ cargo publish You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a package from the package registry, execute the following command: diff --git a/docs/content/usage/packages/chef.en-us.md b/docs/content/usage/packages/chef.en-us.md index 9f23b9eac8051..32af9dc65e7ed 100644 --- a/docs/content/usage/packages/chef.en-us.md +++ b/docs/content/usage/packages/chef.en-us.md @@ -54,6 +54,14 @@ knife supermarket share {package_name} You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a package from the package registry, execute the following command: diff --git a/docs/content/usage/packages/composer.en-us.md b/docs/content/usage/packages/composer.en-us.md index 7fbd77ef5d73f..b5a2c45678ba0 100644 --- a/docs/content/usage/packages/composer.en-us.md +++ b/docs/content/usage/packages/composer.en-us.md @@ -25,7 +25,6 @@ To work with the Composer package registry, you can use [Composer](https://getco To publish a Composer package perform a HTTP PUT operation with the package content in the request body. The package content must be the zipped PHP project with the `composer.json` file. -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. ``` PUT https://gitea.example.com/api/packages/{owner}/composer @@ -58,13 +57,15 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. | HTTP Status Code | Meaning | | ----------------- | ------- | | `201 Created` | The package has been published. | -| `400 Bad Request` | The package name and/or version are invalid or a package with the same name and version already exist. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | ## Configuring the package registry diff --git a/docs/content/usage/packages/conan.en-us.md b/docs/content/usage/packages/conan.en-us.md index 24c7077a88dcd..e295b7f2ce30a 100644 --- a/docs/content/usage/packages/conan.en-us.md +++ b/docs/content/usage/packages/conan.en-us.md @@ -63,6 +63,16 @@ For example: conan upload --remote=gitea ConanPackage/1.2@gitea/final ``` +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. + +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + The Gitea Conan package registry has full [revision](https://docs.conan.io/en/latest/versioning/revisions.html) support. ## Install a package diff --git a/docs/content/usage/packages/conda.en-us.md b/docs/content/usage/packages/conda.en-us.md index 5b6f97679c1d1..0973587e99740 100644 --- a/docs/content/usage/packages/conda.en-us.md +++ b/docs/content/usage/packages/conda.en-us.md @@ -63,8 +63,17 @@ curl --user your_username:your_password_or_token \ https://gitea.example.com/api/packages/testuser/conda/package-1.0.conda ``` +If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a package from the package registry, execute one of the following commands: diff --git a/docs/content/usage/packages/container.en-us.md b/docs/content/usage/packages/container.en-us.md index 6be21c2b276f4..fa767951c6cbb 100644 --- a/docs/content/usage/packages/container.en-us.md +++ b/docs/content/usage/packages/container.en-us.md @@ -69,6 +69,16 @@ For example: docker push gitea.example.com/testuser/myimage:latest ``` +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. + +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Pull an image Pull an image by executing the following command: diff --git a/docs/content/usage/packages/cran.en-us.md b/docs/content/usage/packages/cran.en-us.md index 68de425d2167e..138958f34d1dd 100644 --- a/docs/content/usage/packages/cran.en-us.md +++ b/docs/content/usage/packages/cran.en-us.md @@ -68,8 +68,17 @@ curl --user your_username:your_password_or_token \ https://gitea.example.com/api/packages/testuser/cran/bin?platform=windows&rversion=4.2 ``` +If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a R package from the package registry, execute the following command: diff --git a/docs/content/usage/packages/debian.en-us.md b/docs/content/usage/packages/debian.en-us.md index 6bd7475dd6411..01fac87d57a62 100644 --- a/docs/content/usage/packages/debian.en-us.md +++ b/docs/content/usage/packages/debian.en-us.md @@ -77,7 +77,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a file with the same name twice to a package. You must delete the existing package version first. +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/generic.en-us.md b/docs/content/usage/packages/generic.en-us.md index 04be6e3597ce4..50c608c8c4ad1 100644 --- a/docs/content/usage/packages/generic.en-us.md +++ b/docs/content/usage/packages/generic.en-us.md @@ -24,7 +24,7 @@ To authenticate to the Package Registry, you need to provide [custom HTTP header ## Publish a package To publish a generic package perform a HTTP PUT operation with the package content in the request body. -You cannot publish a file with the same name twice to a package. You must delete the existing package version first. +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. ``` PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name} @@ -46,6 +46,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/go.en-us.md b/docs/content/usage/packages/go.en-us.md index 7c4069248ea6e..7078673cab6ba 100644 --- a/docs/content/usage/packages/go.en-us.md +++ b/docs/content/usage/packages/go.en-us.md @@ -40,6 +40,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/helm.en-us.md b/docs/content/usage/packages/helm.en-us.md index a9fe6be89d8ea..f3595c0238acc 100644 --- a/docs/content/usage/packages/helm.en-us.md +++ b/docs/content/usage/packages/helm.en-us.md @@ -44,6 +44,16 @@ helm cm-push ./{chart_file}.tgz {repo} | `chart_file` | The Helm Chart archive. | | `owner` | The owner of the package. | +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. + +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package is invalid. | +| `409 Conflict` | A package with the same name exist already. | + ## Install a package To install a Helm char from the registry, execute the following command: diff --git a/docs/content/usage/packages/maven.en-us.md b/docs/content/usage/packages/maven.en-us.md index 59e71c87ccfbd..2ab5ec5e8eb12 100644 --- a/docs/content/usage/packages/maven.en-us.md +++ b/docs/content/usage/packages/maven.en-us.md @@ -130,6 +130,14 @@ mvn deploy:deploy-file -Durl=https://gitea.example.com/api/packages/{owner}/mave You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a Maven package from the package registry, add a new dependency to your project `pom.xml` file: diff --git a/docs/content/usage/packages/npm.en-us.md b/docs/content/usage/packages/npm.en-us.md index 1590b9623a0cd..5ffbad3d27513 100644 --- a/docs/content/usage/packages/npm.en-us.md +++ b/docs/content/usage/packages/npm.en-us.md @@ -64,6 +64,14 @@ npm publish You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Unpublish a package Delete a package by running the following command: diff --git a/docs/content/usage/packages/nuget.en-us.md b/docs/content/usage/packages/nuget.en-us.md index 8cd88e06371e9..19ba39756e040 100644 --- a/docs/content/usage/packages/nuget.en-us.md +++ b/docs/content/usage/packages/nuget.en-us.md @@ -67,6 +67,14 @@ dotnet nuget push --source gitea test_package.1.0.0.nupkg You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ### Symbol Packages The NuGet package registry has build support for a symbol server. The PDB files embedded in a symbol package (`.snupkg`) can get requested by clients. diff --git a/docs/content/usage/packages/pub.en-us.md b/docs/content/usage/packages/pub.en-us.md index e5e12de34495e..4c7ce7a91205b 100644 --- a/docs/content/usage/packages/pub.en-us.md +++ b/docs/content/usage/packages/pub.en-us.md @@ -57,6 +57,14 @@ dart pub publish You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a Pub package from the package registry, execute the following command: diff --git a/docs/content/usage/packages/pypi.en-us.md b/docs/content/usage/packages/pypi.en-us.md index be59df0762796..9803aa36615bd 100644 --- a/docs/content/usage/packages/pypi.en-us.md +++ b/docs/content/usage/packages/pypi.en-us.md @@ -53,6 +53,14 @@ The package files have the extensions `.tar.gz` and `.whl`. You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a PyPI package from the package registry, execute the following command: diff --git a/docs/content/usage/packages/rpm.en-us.md b/docs/content/usage/packages/rpm.en-us.md index 5a4a31ee39dfe..030ba3ce74d11 100644 --- a/docs/content/usage/packages/rpm.en-us.md +++ b/docs/content/usage/packages/rpm.en-us.md @@ -63,7 +63,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a file with the same name twice to a package. You must delete the existing package version first. +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/rubygems.en-us.md b/docs/content/usage/packages/rubygems.en-us.md index cb1a225bc67f6..ec392cd4ea849 100644 --- a/docs/content/usage/packages/rubygems.en-us.md +++ b/docs/content/usage/packages/rubygems.en-us.md @@ -63,6 +63,14 @@ gem push --host https://gitea.example.com/api/packages/testuser/rubygems test_pa You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a package from the package registry you can use [Bundler](https://bundler.io) or `gem`. diff --git a/docs/content/usage/packages/swift.en-us.md b/docs/content/usage/packages/swift.en-us.md index 1bc271ddaef3d..275ad722c2f49 100644 --- a/docs/content/usage/packages/swift.en-us.md +++ b/docs/content/usage/packages/swift.en-us.md @@ -67,6 +67,14 @@ curl -X PUT --user {username}:{password} \ You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a Swift package from the package registry, add it in the `Package.swift` file dependencies list: diff --git a/docs/content/usage/packages/vagrant.en-us.md b/docs/content/usage/packages/vagrant.en-us.md index 93cf5e3e78a10..496bc2b5523bb 100644 --- a/docs/content/usage/packages/vagrant.en-us.md +++ b/docs/content/usage/packages/vagrant.en-us.md @@ -44,8 +44,17 @@ curl --user your_username:your_password_or_token \ https://gitea.example.com/api/packages/testuser/vagrant/test_system/1.0.0/hyperv.box ``` +If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. You cannot publish a box if a box of the same name, version and provider already exists. You must delete the existing package first. +The server responds with the following HTTP Status codes. + +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | + ## Install a package To install a box from the package registry, execute the following command: diff --git a/routers/api/packages/alpine/alpine.go b/routers/api/packages/alpine/alpine.go index c261eee2d22a7..bb14c5163a436 100644 --- a/routers/api/packages/alpine/alpine.go +++ b/routers/api/packages/alpine/alpine.go @@ -164,7 +164,7 @@ func UploadPackageFile(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageVersion, packages_model.ErrDuplicatePackageFile: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/chef/chef.go b/routers/api/packages/chef/chef.go index a1f5f49bd8aae..f1e9ae12d816c 100644 --- a/routers/api/packages/chef/chef.go +++ b/routers/api/packages/chef/chef.go @@ -310,7 +310,7 @@ func UploadPackage(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageVersion: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/composer/composer.go b/routers/api/packages/composer/composer.go index 313631d7d77d1..0551093cd19f2 100644 --- a/routers/api/packages/composer/composer.go +++ b/routers/api/packages/composer/composer.go @@ -247,7 +247,7 @@ func UploadPackage(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageVersion: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/conan/conan.go b/routers/api/packages/conan/conan.go index f440f83b243f6..4bf13222dc793 100644 --- a/routers/api/packages/conan/conan.go +++ b/routers/api/packages/conan/conan.go @@ -415,7 +415,7 @@ func uploadFile(ctx *context.Context, fileFilter container.Set[string], fileKey if err != nil { switch err { case packages_model.ErrDuplicatePackageFile: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/debian/debian.go b/routers/api/packages/debian/debian.go index dc7ebab09687b..379137e87eb9c 100644 --- a/routers/api/packages/debian/debian.go +++ b/routers/api/packages/debian/debian.go @@ -189,7 +189,7 @@ func UploadPackageFile(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageVersion, packages_model.ErrDuplicatePackageFile: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/maven/maven.go b/routers/api/packages/maven/maven.go index 52e31e80338d6..0b93382b01177 100644 --- a/routers/api/packages/maven/maven.go +++ b/routers/api/packages/maven/maven.go @@ -363,7 +363,7 @@ func UploadPackageFile(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageFile: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/npm/npm.go b/routers/api/packages/npm/npm.go index dd6b3f148b51b..170edfbe11cc1 100644 --- a/routers/api/packages/npm/npm.go +++ b/routers/api/packages/npm/npm.go @@ -214,7 +214,7 @@ func UploadPackage(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageVersion: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/pub/pub.go b/routers/api/packages/pub/pub.go index 8460f861cb7e5..1f605c6c9f432 100644 --- a/routers/api/packages/pub/pub.go +++ b/routers/api/packages/pub/pub.go @@ -213,7 +213,7 @@ func UploadPackageFile(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageVersion: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/pypi/pypi.go b/routers/api/packages/pypi/pypi.go index 8c7f9bbf38b56..5718b1203b48b 100644 --- a/routers/api/packages/pypi/pypi.go +++ b/routers/api/packages/pypi/pypi.go @@ -177,7 +177,7 @@ func UploadPackageFile(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageFile: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: diff --git a/routers/api/packages/rubygems/rubygems.go b/routers/api/packages/rubygems/rubygems.go index 061fb0871b180..01fd4dad66915 100644 --- a/routers/api/packages/rubygems/rubygems.go +++ b/routers/api/packages/rubygems/rubygems.go @@ -258,7 +258,7 @@ func UploadPackageFile(ctx *context.Context) { if err != nil { switch err { case packages_model.ErrDuplicatePackageVersion: - apiError(ctx, http.StatusBadRequest, err) + apiError(ctx, http.StatusConflict, err) case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize: apiError(ctx, http.StatusForbidden, err) default: From 6d726975a72eb5bbe488ee4e535515a2f9722d84 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Fri, 6 Oct 2023 22:14:37 +0800 Subject: [PATCH 02/14] fix api tests --- tests/integration/api_packages_chef_test.go | 2 +- tests/integration/api_packages_composer_test.go | 2 +- tests/integration/api_packages_debian_test.go | 2 +- tests/integration/api_packages_maven_test.go | 2 +- tests/integration/api_packages_npm_test.go | 2 +- tests/integration/api_packages_pub_test.go | 2 +- tests/integration/api_packages_pypi_test.go | 4 ++-- tests/integration/api_packages_rubygems_test.go | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/integration/api_packages_chef_test.go b/tests/integration/api_packages_chef_test.go index 4a1fe2607e4cd..7f55a84f09198 100644 --- a/tests/integration/api_packages_chef_test.go +++ b/tests/integration/api_packages_chef_test.go @@ -322,7 +322,7 @@ nwIDAQAB assert.Equal(t, fmt.Sprintf("%s.tar.gz", packageVersion), pfs[0].Name) assert.True(t, pfs[0].IsLead) - uploadPackage(t, packageVersion, http.StatusBadRequest) + uploadPackage(t, packageVersion, http.StatusConflict) }) t.Run("Download", func(t *testing.T) { diff --git a/tests/integration/api_packages_composer_test.go b/tests/integration/api_packages_composer_test.go index ac125905619b7..896462d9a9fd0 100644 --- a/tests/integration/api_packages_composer_test.go +++ b/tests/integration/api_packages_composer_test.go @@ -112,7 +112,7 @@ func TestPackageComposer(t *testing.T) { req = NewRequestWithBody(t, "PUT", uploadURL, bytes.NewReader(content)) req = AddBasicAuthHeader(req, user.Name) - MakeRequest(t, req, http.StatusBadRequest) + MakeRequest(t, req, http.StatusConflict) }) }) diff --git a/tests/integration/api_packages_debian_test.go b/tests/integration/api_packages_debian_test.go index 2d92b93159943..f796d617db9c4 100644 --- a/tests/integration/api_packages_debian_test.go +++ b/tests/integration/api_packages_debian_test.go @@ -147,7 +147,7 @@ func TestPackageDebian(t *testing.T) { req = NewRequestWithBody(t, "PUT", uploadURL, createArchive(packageName, packageVersion, architecture)) AddBasicAuthHeader(req, user.Name) - MakeRequest(t, req, http.StatusBadRequest) + MakeRequest(t, req, http.StatusConflict) }) t.Run("Download", func(t *testing.T) { diff --git a/tests/integration/api_packages_maven_test.go b/tests/integration/api_packages_maven_test.go index 81112f305a62e..746e8c5ab8ff9 100644 --- a/tests/integration/api_packages_maven_test.go +++ b/tests/integration/api_packages_maven_test.go @@ -78,7 +78,7 @@ func TestPackageMaven(t *testing.T) { t.Run("UploadExists", func(t *testing.T) { defer tests.PrintCurrentTest(t)() - putFile(t, fmt.Sprintf("/%s/%s", packageVersion, filename), "test", http.StatusBadRequest) + putFile(t, fmt.Sprintf("/%s/%s", packageVersion, filename), "test", http.StatusConflict) }) t.Run("Download", func(t *testing.T) { diff --git a/tests/integration/api_packages_npm_test.go b/tests/integration/api_packages_npm_test.go index 433b183c295c9..bd3bfeeff067c 100644 --- a/tests/integration/api_packages_npm_test.go +++ b/tests/integration/api_packages_npm_test.go @@ -121,7 +121,7 @@ func TestPackageNpm(t *testing.T) { req := NewRequestWithBody(t, "PUT", root, strings.NewReader(buildUpload(packageVersion))) req = addTokenAuthHeader(req, token) - MakeRequest(t, req, http.StatusBadRequest) + MakeRequest(t, req, http.StatusConflict) }) t.Run("Download", func(t *testing.T) { diff --git a/tests/integration/api_packages_pub_test.go b/tests/integration/api_packages_pub_test.go index cae280c0ec6f3..6e9d8742f472d 100644 --- a/tests/integration/api_packages_pub_test.go +++ b/tests/integration/api_packages_pub_test.go @@ -121,7 +121,7 @@ description: ` + packageDescription assert.NoError(t, err) assert.Equal(t, int64(len(content)), pb.Size) - _ = uploadFile(t, result.URL, content, http.StatusBadRequest) + _ = uploadFile(t, result.URL, content, http.StatusConflict) }) t.Run("Download", func(t *testing.T) { diff --git a/tests/integration/api_packages_pypi_test.go b/tests/integration/api_packages_pypi_test.go index c7c466e730834..76013b79c840f 100644 --- a/tests/integration/api_packages_pypi_test.go +++ b/tests/integration/api_packages_pypi_test.go @@ -129,8 +129,8 @@ func TestPackagePyPI(t *testing.T) { t.Run("UploadExists", func(t *testing.T) { defer tests.PrintCurrentTest(t)() - uploadFile(t, "test.whl", content, http.StatusBadRequest) - uploadFile(t, "test.tar.gz", content, http.StatusBadRequest) + uploadFile(t, "test.whl", content, http.StatusConflict) + uploadFile(t, "test.tar.gz", content, http.StatusConflict) }) t.Run("Download", func(t *testing.T) { diff --git a/tests/integration/api_packages_rubygems_test.go b/tests/integration/api_packages_rubygems_test.go index 2099357cbb777..a3df143209a5c 100644 --- a/tests/integration/api_packages_rubygems_test.go +++ b/tests/integration/api_packages_rubygems_test.go @@ -150,7 +150,7 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA`) t.Run("UploadExists", func(t *testing.T) { defer tests.PrintCurrentTest(t)() - uploadFile(t, http.StatusBadRequest) + uploadFile(t, http.StatusConflict) }) t.Run("Download", func(t *testing.T) { From ee553772138a61c547675ae52f2ea78bce510195 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Fri, 6 Oct 2023 23:47:44 +0800 Subject: [PATCH 03/14] fix test: --- tests/integration/api_packages_maven_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/api_packages_maven_test.go b/tests/integration/api_packages_maven_test.go index 746e8c5ab8ff9..c78024563f4df 100644 --- a/tests/integration/api_packages_maven_test.go +++ b/tests/integration/api_packages_maven_test.go @@ -50,7 +50,7 @@ func TestPackageMaven(t *testing.T) { defer tests.PrintCurrentTest(t)() putFile(t, fmt.Sprintf("/%s/%s", packageVersion, filename), "test", http.StatusCreated) - putFile(t, fmt.Sprintf("/%s/%s", packageVersion, filename), "test", http.StatusBadRequest) + putFile(t, fmt.Sprintf("/%s/%s", packageVersion, filename), "test", http.StatusConflict) putFile(t, "/maven-metadata.xml", "test", http.StatusOK) pvs, err := packages.GetVersionsByPackageType(db.DefaultContext, user.ID, packages.TypeMaven) From 2177559343e5a0c9c11944edcc82319e6c270dec Mon Sep 17 00:00:00 2001 From: lng2020 Date: Sun, 8 Oct 2023 10:37:36 +0800 Subject: [PATCH 04/14] fix docs --- docs/content/usage/packages/alpine.en-us.md | 48 +++++++++---------- docs/content/usage/packages/cargo.en-us.md | 25 ++++------ docs/content/usage/packages/chef.en-us.md | 31 +++++------- docs/content/usage/packages/composer.en-us.md | 29 ++++++----- docs/content/usage/packages/conan.en-us.md | 37 ++++++-------- docs/content/usage/packages/conda.en-us.md | 2 +- .../content/usage/packages/container.en-us.md | 29 ++++------- docs/content/usage/packages/cran.en-us.md | 2 +- docs/content/usage/packages/debian.en-us.md | 2 +- docs/content/usage/packages/helm.en-us.md | 37 ++++++-------- docs/content/usage/packages/maven.en-us.md | 23 +++------ docs/content/usage/packages/npm.en-us.md | 37 ++++++-------- docs/content/usage/packages/nuget.en-us.md | 41 +++++++--------- docs/content/usage/packages/pub.en-us.md | 29 ++++------- docs/content/usage/packages/pypi.en-us.md | 31 +++++------- docs/content/usage/packages/rubygems.en-us.md | 39 ++++++--------- docs/content/usage/packages/swift.en-us.md | 2 +- docs/content/usage/packages/vagrant.en-us.md | 29 ++++++----- 18 files changed, 186 insertions(+), 287 deletions(-) diff --git a/docs/content/usage/packages/alpine.en-us.md b/docs/content/usage/packages/alpine.en-us.md index 1fcbe848537a3..cf65d226b061a 100644 --- a/docs/content/usage/packages/alpine.en-us.md +++ b/docs/content/usage/packages/alpine.en-us.md @@ -11,7 +11,6 @@ menu: sidebar_position: 4 identifier: "alpine" --- - # Alpine Package Registry Publish [Alpine](https://pkgs.alpinelinux.org/) packages for your user or organization. @@ -30,11 +29,11 @@ To register the Alpine registry add the url to the list of known apk sources (`/ https://gitea.example.com/api/packages/{owner}/alpine// ``` -| Placeholder | Description | -| ------------ | ----------- | +| Placeholder | Description | +| -------------- | -------------------------- | | `owner` | The owner of the packages. | -| `branch` | The branch to use. | -| `repository` | The repository to use. | +| `branch` | The branch to use. | +| `repository` | The repository to use. | If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication): @@ -62,11 +61,11 @@ To publish an Alpine package (`*.apk`), perform a HTTP `PUT` operation with the PUT https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository} ``` -| Parameter | Description | -| ------------ | ----------- | -| `owner` | The owner of the package. | -| `branch` | The branch may match the release version of the OS, ex: `v3.17`. | -| `repository` | The repository can be used [to group packages](https://wiki.alpinelinux.org/wiki/Repositories) or just `main` or similar. | +| Parameter | Description | +| -------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `owner` | The owner of the package. | +| `branch` | The branch may match the release version of the OS, ex:`v3.17`. | +| `repository` | The repository can be used[to group packages](https://wiki.alpinelinux.org/wiki/Repositories) or just `main` or similar. | Example request using HTTP Basic authentication: @@ -77,14 +76,15 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a file with the same name twice to a package. You must delete the existing package file first. + +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, branch, repository or architecture are invalid. | +| HTTP Status Code | Meaning | +| ------------------- | ------------------------------------------------------------------------------------ | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package is invalid. | | `409 Conflict` | A package file with the same combination of parameters exist already in the package. | ## Delete a package @@ -95,13 +95,13 @@ To delete an Alpine package perform a HTTP `DELETE` operation. This will delete DELETE https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository}/{architecture}/{filename} ``` -| Parameter | Description | -| -------------- | ----------- | +| Parameter | Description | +| ---------------- | ------------------------- | | `owner` | The owner of the package. | -| `branch` | The branch to use. | -| `repository` | The repository to use. | +| `branch` | The branch to use. | +| `repository` | The repository to use. | | `architecture` | The package architecture. | -| `filename` | The file to delete. +| `filename` | The file to delete. | Example request using HTTP Basic authentication: @@ -112,10 +112,10 @@ curl --user your_username:your_token_or_password -X DELETE \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `204 No Content` | Success | -| `404 Not Found` | The package or file was not found. | +| HTTP Status Code | Meaning | +| ------------------ | ---------------------------------- | +| `204 No Content` | Success | +| `404 Not Found` | The package or file was not found. | ## Install a package diff --git a/docs/content/usage/packages/cargo.en-us.md b/docs/content/usage/packages/cargo.en-us.md index 392d34bc02d42..a2b4e14687a94 100644 --- a/docs/content/usage/packages/cargo.en-us.md +++ b/docs/content/usage/packages/cargo.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 5 identifier: "cargo" --- - # Cargo Package Registry Publish [Cargo](https://doc.rust-lang.org/stable/cargo/) packages for your user or organization. @@ -57,9 +56,9 @@ index = "sparse+https://gitea.example.com/api/packages/{owner}/cargo/" # Sparse # git-fetch-with-cli = true ``` -| Parameter | Description | -| --------- | ----------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| --------- | ------------------------- | +| `owner` | The owner of the package. | If the registry is private or you want to publish new packages, you have to configure your credentials. Add the credentials section to the credentials file located in the current users home directory (for example `~/.cargo/credentials.toml`): @@ -69,9 +68,9 @@ Add the credentials section to the credentials file located in the current users token = "Bearer {token}" ``` -| Parameter | Description | -| --------- | ----------- | -| `token` | Your [personal access token](development/api-usage.md#authentication) | +| Parameter | Description | +| --------- | ----------------------------------------------------------------- | +| `token` | Your[personal access token](development/api-usage.md#authentication) | ## Git vs Sparse @@ -89,14 +88,6 @@ cargo publish You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Install a package To install a package from the package registry, execute the following command: @@ -105,8 +96,8 @@ To install a package from the package registry, execute the following command: cargo add {package_name} ``` -| Parameter | Description | -| -------------- | ----------- | +| Parameter | Description | +| ---------------- | ----------------- | | `package_name` | The package name. | ## Supported commands diff --git a/docs/content/usage/packages/chef.en-us.md b/docs/content/usage/packages/chef.en-us.md index 32af9dc65e7ed..0f3c927a966a6 100644 --- a/docs/content/usage/packages/chef.en-us.md +++ b/docs/content/usage/packages/chef.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 5 identifier: "chef" --- - # Chef Package Registry Publish [Chef](https://chef.io/) cookbooks for your user or organization. @@ -36,9 +35,9 @@ To [configure `knife`](https://docs.chef.io/workstation/knife_setup/) to use the knife[:supermarket_site] = 'https://gitea.example.com/api/packages/{owner}/chef' ``` -| Parameter | Description | -| --------- | ----------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| --------- | ------------------------- | +| `owner` | The owner of the package. | ## Publish a package @@ -48,20 +47,12 @@ To publish a Chef package execute the following command: knife supermarket share {package_name} ``` -| Parameter | Description | -| -------------- | ----------- | +| Parameter | Description | +| ---------------- | ----------------- | | `package_name` | The package name. | You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Install a package To install a package from the package registry, execute the following command: @@ -76,9 +67,9 @@ Optional you can specify the package version: knife supermarket install {package_name} {package_version} ``` -| Parameter | Description | -| ----------------- | ----------- | -| `package_name` | The package name. | +| Parameter | Description | +| ------------------- | -------------------- | +| `package_name` | The package name. | | `package_version` | The package version. | ## Delete a package @@ -95,7 +86,7 @@ Optional you can specify the package version: knife supermarket unshare {package_name}/versions/{package_version} ``` -| Parameter | Description | -| ----------------- | ----------- | -| `package_name` | The package name. | +| Parameter | Description | +| ------------------- | -------------------- | +| `package_name` | The package name. | | `package_version` | The package version. | diff --git a/docs/content/usage/packages/composer.en-us.md b/docs/content/usage/packages/composer.en-us.md index b5a2c45678ba0..541db2737ee81 100644 --- a/docs/content/usage/packages/composer.en-us.md +++ b/docs/content/usage/packages/composer.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 10 identifier: "composer" --- - # Composer Package Registry Publish [Composer](https://getcomposer.org/) packages for your user or organization. @@ -30,9 +29,9 @@ The package content must be the zipped PHP project with the `composer.json` file PUT https://gitea.example.com/api/packages/{owner}/composer ``` -| Parameter | Description | -| ---------- | ----------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| --------- | ------------------------- | +| `owner` | The owner of the package. | If the `composer.json` file does not contain a `version` property, you must provide it as a query parameter: @@ -61,10 +60,10 @@ You cannot publish a package if a package of the same name and version already e The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| HTTP Status Code | Meaning | +| ------------------- | ---------------------------------------------------------------------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package is invalid. | | `409 Conflict` | A package file with the same combination of parameters exists already. | ## Configuring the package registry @@ -94,10 +93,10 @@ To access the package registry using credentials, you must specify them in the ` } ``` -| Parameter | Description | -| ---------- | ----------- | -| `owner` | The owner of the package. | -| `username` | Your Gitea username. | +| Parameter | Description | +| ------------ | ----------------------------------------------- | +| `owner` | The owner of the package. | +| `username` | Your Gitea username. | | `password` | Your Gitea password or a personal access token. | ## Install a package @@ -114,7 +113,7 @@ Optional you can specify the package version: composer require {package_name}:{package_version} ``` -| Parameter | Description | -| ----------------- | ----------- | -| `package_name` | The package name. | +| Parameter | Description | +| ------------------- | -------------------- | +| `package_name` | The package name. | | `package_version` | The package version. | diff --git a/docs/content/usage/packages/conan.en-us.md b/docs/content/usage/packages/conan.en-us.md index e295b7f2ce30a..b89dc292f308b 100644 --- a/docs/content/usage/packages/conan.en-us.md +++ b/docs/content/usage/packages/conan.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 20 identifier: "conan" --- - # Conan Package Registry Publish [Conan](https://conan.io/) packages for your user or organization. @@ -30,12 +29,12 @@ conan remote add {remote} https://gitea.example.com/api/packages/{owner}/conan conan user --remote {remote} --password {password} {username} ``` -| Parameter | Description | -| -----------| ----------- | -| `remote` | The remote name. | -| `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | -| `owner` | The owner of the package. | +| Parameter | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `remote` | The remote name. | +| `username` | Your Gitea username. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | +| `owner` | The owner of the package. | For example: @@ -52,10 +51,10 @@ Publish a Conan package by running the following command: conan upload --remote={remote} {recipe} ``` -| Parameter | Description | -| ----------| ----------- | -| `remote` | The remote name. | -| `recipe` | The recipe to upload. | +| Parameter | Description | +| ---------- | --------------------- | +| `remote` | The remote name. | +| `recipe` | The recipe to upload. | For example: @@ -65,14 +64,6 @@ conan upload --remote=gitea ConanPackage/1.2@gitea/final You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - The Gitea Conan package registry has full [revision](https://docs.conan.io/en/latest/versioning/revisions.html) support. ## Install a package @@ -83,10 +74,10 @@ To install a Conan package from the package registry, execute the following comm conan install --remote={remote} {recipe} ``` -| Parameter | Description | -| ----------| ----------- | -| `remote` | The remote name. | -| `recipe` | The recipe to download. | +| Parameter | Description | +| ---------- | ----------------------- | +| `remote` | The remote name. | +| `recipe` | The recipe to download. | For example: diff --git a/docs/content/usage/packages/conda.en-us.md b/docs/content/usage/packages/conda.en-us.md index 0973587e99740..5288fcae511a6 100644 --- a/docs/content/usage/packages/conda.en-us.md +++ b/docs/content/usage/packages/conda.en-us.md @@ -71,7 +71,7 @@ The server responds with the following HTTP Status codes. | HTTP Status Code | Meaning | | ----------------- | ------- | | `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `400 Bad Request` | The package is invalid. | | `409 Conflict` | A package file with the same combination of parameters exists already. | ## Install a package diff --git a/docs/content/usage/packages/container.en-us.md b/docs/content/usage/packages/container.en-us.md index fa767951c6cbb..cb9ae58a1c343 100644 --- a/docs/content/usage/packages/container.en-us.md +++ b/docs/content/usage/packages/container.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 30 identifier: "container" --- - # Container Registry Publish [Open Container Initiative](https://opencontainers.org/) compliant images for your user or organization. @@ -57,11 +56,11 @@ Push an image by executing the following command: docker push gitea.example.com/{owner}/{image}:{tag} ``` -| Parameter | Description | -| ----------| ----------- | -| `owner` | The owner of the image. | -| `image` | The name of the image. | -| `tag` | The tag of the image. | +| Parameter | Description | +| --------- | ----------------------- | +| `owner` | The owner of the image. | +| `image` | The name of the image. | +| `tag` | The tag of the image. | For example: @@ -71,14 +70,6 @@ docker push gitea.example.com/testuser/myimage:latest You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Pull an image Pull an image by executing the following command: @@ -87,11 +78,11 @@ Pull an image by executing the following command: docker pull gitea.example.com/{owner}/{image}:{tag} ``` -| Parameter | Description | -| ----------| ----------- | -| `owner` | The owner of the image. | -| `image` | The name of the image. | -| `tag` | The tag of the image. | +| Parameter | Description | +| --------- | ----------------------- | +| `owner` | The owner of the image. | +| `image` | The name of the image. | +| `tag` | The tag of the image. | For example: diff --git a/docs/content/usage/packages/cran.en-us.md b/docs/content/usage/packages/cran.en-us.md index 138958f34d1dd..fb403df8c95c8 100644 --- a/docs/content/usage/packages/cran.en-us.md +++ b/docs/content/usage/packages/cran.en-us.md @@ -76,7 +76,7 @@ The server responds with the following HTTP Status codes. | HTTP Status Code | Meaning | | ----------------- | ------- | | `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `400 Bad Request` | The package is invalid. | | `409 Conflict` | A package file with the same combination of parameters exists already. | ## Install a package diff --git a/docs/content/usage/packages/debian.en-us.md b/docs/content/usage/packages/debian.en-us.md index 01fac87d57a62..67bcfc81490a4 100644 --- a/docs/content/usage/packages/debian.en-us.md +++ b/docs/content/usage/packages/debian.en-us.md @@ -84,7 +84,7 @@ The server responds with the following HTTP Status codes. | HTTP Status Code | Meaning | | ----------------- | ------- | | `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `400 Bad Request` | The package is invalid. | | `409 Conflict` | A package file with the same combination of parameters exists already. | ## Delete a package diff --git a/docs/content/usage/packages/helm.en-us.md b/docs/content/usage/packages/helm.en-us.md index f3595c0238acc..1e030067628a8 100644 --- a/docs/content/usage/packages/helm.en-us.md +++ b/docs/content/usage/packages/helm.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 50 identifier: "helm" --- - # Helm Chart Registry Publish [Helm](https://helm.sh/) charts for your user or organization. @@ -36,24 +35,16 @@ helm repo add --username {username} --password {password} {repo} https://gitea. helm cm-push ./{chart_file}.tgz {repo} ``` -| Parameter | Description | -| ------------ | ----------- | -| `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | -| `repo` | The name for the repository. | -| `chart_file` | The Helm Chart archive. | -| `owner` | The owner of the package. | +| Parameter | Description | +| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `username` | Your Gitea username. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | +| `repo` | The name for the repository. | +| `chart_file` | The Helm Chart archive. | +| `owner` | The owner of the package. | You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package is invalid. | -| `409 Conflict` | A package with the same name exist already. | - ## Install a package To install a Helm char from the registry, execute the following command: @@ -64,11 +55,11 @@ helm repo update helm install {name} {repo}/{chart} ``` -| Parameter | Description | -| ---------- | ----------- | -| `username` | Your Gitea username. | +| Parameter | Description | +| ------------ | ----------------------------------------------- | +| `username` | Your Gitea username. | | `password` | Your Gitea password or a personal access token. | -| `repo` | The name for the repository. | -| `owner` | The owner of the package. | -| `name` | The local name. | -| `chart` | The name Helm Chart. | +| `repo` | The name for the repository. | +| `owner` | The owner of the package. | +| `name` | The local name. | +| `chart` | The name Helm Chart. | diff --git a/docs/content/usage/packages/maven.en-us.md b/docs/content/usage/packages/maven.en-us.md index 2ab5ec5e8eb12..585e4c9d5f490 100644 --- a/docs/content/usage/packages/maven.en-us.md +++ b/docs/content/usage/packages/maven.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 60 identifier: "maven" --- - # Maven Package Registry Publish [Maven](https://maven.apache.org) packages for your user or organization. @@ -65,10 +64,10 @@ Afterwards add the following sections to your project `pom.xml` file: ``` -| Parameter | Description | -| -------------- | ----------- | -| `access_token` | Your [personal access token](development/api-usage.md#authentication). | -| `owner` | The owner of the package. | +| Parameter | Description | +| ---------------- | ------------------------------------------------------------------ | +| `access_token` | Your[personal access token](development/api-usage.md#authentication). | +| `owner` | The owner of the package. | ### Gradle variant @@ -124,20 +123,12 @@ If you want to publish a prebuild package to the registry, you can use [`mvn dep mvn deploy:deploy-file -Durl=https://gitea.example.com/api/packages/{owner}/maven -DrepositoryId=gitea -Dfile=/path/to/package.jar ``` -| Parameter | Description | -| -------------- | ----------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| --------- | ------------------------- | +| `owner` | The owner of the package. | You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Install a package To install a Maven package from the package registry, add a new dependency to your project `pom.xml` file: diff --git a/docs/content/usage/packages/npm.en-us.md b/docs/content/usage/packages/npm.en-us.md index 5ffbad3d27513..42ce3d10adc5d 100644 --- a/docs/content/usage/packages/npm.en-us.md +++ b/docs/content/usage/packages/npm.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 70 identifier: "npm" --- - # npm Package Registry Publish [npm](https://www.npmjs.com/) packages for your user or organization. @@ -34,11 +33,11 @@ npm config set {scope}:registry https://gitea.example.com/api/packages/{owner}/n npm config set -- '//gitea.example.com/api/packages/{owner}/npm/:_authToken' "{token}" ``` -| Parameter | Description | -| ------------ | ----------- | -| `scope` | The scope of the packages. | -| `owner` | The owner of the package. | -| `token` | Your [personal access token](development/api-usage.md#authentication). | +| Parameter | Description | +| --------- | ------------------------------------------------------------------ | +| `scope` | The scope of the packages. | +| `owner` | The owner of the package. | +| `token` | Your[personal access token](development/api-usage.md#authentication). | For example: @@ -64,14 +63,6 @@ npm publish You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Unpublish a package Delete a package by running the following command: @@ -80,9 +71,9 @@ Delete a package by running the following command: npm unpublish {package_name}[@{package_version}] ``` -| Parameter | Description | -| ----------------- | ----------- | -| `package_name` | The package name. | +| Parameter | Description | +| ------------------- | -------------------- | +| `package_name` | The package name. | | `package_version` | The package version. | For example: @@ -100,8 +91,8 @@ To install a package from the package registry, execute the following command: npm install {package_name} ``` -| Parameter | Description | -| -------------- | ----------- | +| Parameter | Description | +| ---------------- | ----------------- | | `package_name` | The package name. | For example: @@ -118,11 +109,11 @@ The registry supports [version tags](https://docs.npmjs.com/adding-dist-tags-to- npm dist-tag add {package_name}@{version} {tag} ``` -| Parameter | Description | -| -------------- | ----------- | -| `package_name` | The package name. | +| Parameter | Description | +| ---------------- | --------------------------- | +| `package_name` | The package name. | | `version` | The version of the package. | -| `tag` | The tag name. | +| `tag` | The tag name. | For example: diff --git a/docs/content/usage/packages/nuget.en-us.md b/docs/content/usage/packages/nuget.en-us.md index 19ba39756e040..4196775593163 100644 --- a/docs/content/usage/packages/nuget.en-us.md +++ b/docs/content/usage/packages/nuget.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 80 identifier: "nuget" --- - # NuGet Package Registry Publish [NuGet](https://www.nuget.org/) packages for your user or organization. The package registry supports the V2 and V3 API protocol and you can work with [NuGet Symbol Packages](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) too. @@ -31,12 +30,12 @@ To register the package registry you need to configure a new NuGet feed source: dotnet nuget add source --name {source_name} --username {username} --password {password} https://gitea.example.com/api/packages/{owner}/nuget/index.json ``` -| Parameter | Description | -| ------------- | ----------- | -| `source_name` | The desired source name. | -| `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | -| `owner` | The owner of the package. | +| Parameter | Description | +| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `source_name` | The desired source name. | +| `username` | Your Gitea username. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | +| `owner` | The owner of the package. | For example: @@ -54,9 +53,9 @@ Publish a package by running the following command: dotnet nuget push --source {source_name} {package_file} ``` -| Parameter | Description | -| -------------- | ----------- | -| `source_name` | The desired source name. | +| Parameter | Description | +| ---------------- | ------------------------------------ | +| `source_name` | The desired source name. | | `package_file` | Path to the package `.nupkg` file. | For example: @@ -67,14 +66,6 @@ dotnet nuget push --source gitea test_package.1.0.0.nupkg You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ### Symbol Packages The NuGet package registry has build support for a symbol server. The PDB files embedded in a symbol package (`.snupkg`) can get requested by clients. @@ -84,9 +75,9 @@ To do so, register the NuGet package registry as symbol source: https://gitea.example.com/api/packages/{owner}/nuget/symbols ``` -| Parameter | Description | -| --------- | ----------- | -| `owner` | The owner of the package registry. | +| Parameter | Description | +| --------- | ---------------------------------- | +| `owner` | The owner of the package registry. | For example: @@ -102,11 +93,11 @@ To install a NuGet package from the package registry, execute the following comm dotnet add package --source {source_name} --version {package_version} {package_name} ``` -| Parameter | Description | -| ----------------- | ----------- | +| Parameter | Description | +| ------------------- | ------------------------ | | `source_name` | The desired source name. | -| `package_name` | The package name. | -| `package_version` | The package version. | +| `package_name` | The package name. | +| `package_version` | The package version. | For example: diff --git a/docs/content/usage/packages/pub.en-us.md b/docs/content/usage/packages/pub.en-us.md index 4c7ce7a91205b..703050019318e 100644 --- a/docs/content/usage/packages/pub.en-us.md +++ b/docs/content/usage/packages/pub.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 90 identifier: "pub" --- - # Pub Package Registry Publish [Pub](https://dart.dev/guides/packages) packages for your user or organization. @@ -31,9 +30,9 @@ To register the package registry and provide credentials, execute: dart pub token add https://gitea.example.com/api/packages/{owner}/pub ``` -| Placeholder | Description | -| ------------ | ----------- | -| `owner` | The owner of the package. | +| Placeholder | Description | +| ----------- | ------------------------- | +| `owner` | The owner of the package. | You need to provide your [personal access token](development/api-usage.md#authentication). @@ -45,9 +44,9 @@ To publish a package, edit the `pubspec.yaml` and add the following line: publish_to: https://gitea.example.com/api/packages/{owner}/pub ``` -| Placeholder | Description | -| ------------ | ----------- | -| `owner` | The owner of the package. | +| Placeholder | Description | +| ----------- | ------------------------- | +| `owner` | The owner of the package. | Now you can publish the package by running the following command: @@ -57,14 +56,6 @@ dart pub publish You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Install a package To install a Pub package from the package registry, execute the following command: @@ -73,10 +64,10 @@ To install a Pub package from the package registry, execute the following comman dart pub add {package_name} --hosted-url=https://gitea.example.com/api/packages/{owner}/pub/ ``` -| Parameter | Description | -| ----------------- | ----------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ---------------- | ------------------------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: diff --git a/docs/content/usage/packages/pypi.en-us.md b/docs/content/usage/packages/pypi.en-us.md index 9803aa36615bd..534bf540e4e66 100644 --- a/docs/content/usage/packages/pypi.en-us.md +++ b/docs/content/usage/packages/pypi.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 100 identifier: "pypi" --- - # PyPI Package Registry Publish [PyPI](https://pypi.org/) packages for your user or organization. @@ -35,11 +34,11 @@ username = {username} password = {password} ``` -| Placeholder | Description | -| ------------ | ----------- | -| `owner` | The owner of the package. | -| `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | +| Placeholder | Description | +| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `owner` | The owner of the package. | +| `username` | Your Gitea username. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | ## Publish a package @@ -53,14 +52,6 @@ The package files have the extensions `.tar.gz` and `.whl`. You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Install a package To install a PyPI package from the package registry, execute the following command: @@ -69,12 +60,12 @@ To install a PyPI package from the package registry, execute the following comma pip install --index-url https://{username}:{password}@gitea.example.com/api/packages/{owner}/pypi/simple --no-deps {package_name} ``` -| Parameter | Description | -| ----------------- | ----------- | -| `username` | Your Gitea username. | -| `password` | Your Gitea password or a personal access token. | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ---------------- | ----------------------------------------------- | +| `username` | Your Gitea username. | +| `password` | Your Gitea password or a personal access token. | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: diff --git a/docs/content/usage/packages/rubygems.en-us.md b/docs/content/usage/packages/rubygems.en-us.md index ec392cd4ea849..ee9ff0dec485e 100644 --- a/docs/content/usage/packages/rubygems.en-us.md +++ b/docs/content/usage/packages/rubygems.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 110 identifier: "rubygems" --- - # RubyGems Package Registry Publish [RubyGems](https://guides.rubygems.org/) packages for your user or organization. @@ -30,10 +29,10 @@ To register the package registry edit the `~/.gem/credentials` file and add: https://gitea.example.com/api/packages/{owner}/rubygems: Bearer {token} ``` -| Parameter | Description | -| ------------- | ----------- | -| `owner` | The owner of the package. | -| `token` | Your [personal access token](development/api-usage.md#authentication). | +| Parameter | Description | +| --------- | ------------------------------------------------------------------ | +| `owner` | The owner of the package. | +| `token` | Your[personal access token](development/api-usage.md#authentication). | For example: @@ -50,9 +49,9 @@ Publish a package by running the following command: gem push --host {host} {package_file} ``` -| Parameter | Description | -| -------------- | ----------- | -| `host` | URL to the package registry. | +| Parameter | Description | +| ---------------- | ---------------------------------- | +| `host` | URL to the package registry. | | `package_file` | Path to the package `.gem` file. | For example: @@ -63,14 +62,6 @@ gem push --host https://gitea.example.com/api/packages/testuser/rubygems test_pa You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. -The server responds with the following HTTP Status codes. - -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | - ## Install a package To install a package from the package registry you can use [Bundler](https://bundler.io) or `gem`. @@ -85,10 +76,10 @@ source "https://gitea.example.com/api/packages/{owner}/rubygems" do end ``` -| Parameter | Description | -| ----------------- | ----------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ---------------- | ------------------------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: @@ -112,10 +103,10 @@ Execute the following command: gem install --host https://gitea.example.com/api/packages/{owner}/rubygems {package_name} ``` -| Parameter | Description | -| ----------------- | ----------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ---------------- | ------------------------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: diff --git a/docs/content/usage/packages/swift.en-us.md b/docs/content/usage/packages/swift.en-us.md index 275ad722c2f49..606fa20b362a8 100644 --- a/docs/content/usage/packages/swift.en-us.md +++ b/docs/content/usage/packages/swift.en-us.md @@ -72,7 +72,7 @@ The server responds with the following HTTP Status codes. | HTTP Status Code | Meaning | | ----------------- | ------- | | `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | +| `400 Bad Request` | The package is invalid. | | `409 Conflict` | A package file with the same combination of parameters exists already. | ## Install a package diff --git a/docs/content/usage/packages/vagrant.en-us.md b/docs/content/usage/packages/vagrant.en-us.md index 496bc2b5523bb..0a0703e0e3530 100644 --- a/docs/content/usage/packages/vagrant.en-us.md +++ b/docs/content/usage/packages/vagrant.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 120 identifier: "vagrant" --- - # Vagrant Package Registry Publish [Vagrant](https://www.vagrantup.com/) packages for your user or organization. @@ -29,12 +28,12 @@ Publish a Vagrant box by performing a HTTP PUT request to the registry: PUT https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}/{package_version}/{provider}.box ``` -| Parameter | Description | -| ----------------- | ----------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version, semver compatible. | -| `provider` | One of the [supported provider names](https://www.vagrantup.com/docs/providers). | +| Parameter | Description | +| ------------------- | ---------------------------------------------------------------------------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | +| `package_version` | The package version, semver compatible. | +| `provider` | One of the[supported provider names](https://www.vagrantup.com/docs/providers). | Example for uploading a Hyper-V box: @@ -49,11 +48,11 @@ You cannot publish a box if a box of the same name, version and provider already The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name, version, distribution, component or architecture are invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | +| HTTP Status Code | Meaning | +| ------------------- | ------------------------------------------------------------------------------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package is invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | ## Install a package @@ -63,10 +62,10 @@ To install a box from the package registry, execute the following command: vagrant box add "https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}" ``` -| Parameter | Description | -| -------------- | ----------- | +| Parameter | Description | +| ---------------- | ------------------------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | +| `package_name` | The package name. | For example: From c5761b72bc7494224d882858cc9045ff9fefb6da Mon Sep 17 00:00:00 2001 From: lng2020 Date: Sun, 8 Oct 2023 10:42:46 +0800 Subject: [PATCH 05/14] fix docs --- docs/content/usage/packages/generic.en-us.md | 71 ++++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/docs/content/usage/packages/generic.en-us.md b/docs/content/usage/packages/generic.en-us.md index 50c608c8c4ad1..6535d1f71c23a 100644 --- a/docs/content/usage/packages/generic.en-us.md +++ b/docs/content/usage/packages/generic.en-us.md @@ -12,7 +12,6 @@ menu: sidebar_position: 40 identifier: "generic" --- - # Generic Package Registry Publish generic files, like release binaries or other output, for your user or organization. @@ -30,12 +29,12 @@ You cannot publish a package if a package of the same name and version already e PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name} ``` -| Parameter | Description | -| ----------------- | ----------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `owner` | The owner of the package. | | `package_name` | The package name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). | -| `package_version` | The package version, a non-empty string without trailing or leading whitespaces. | -| `file_name` | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). | +| `package_version` | The package version, a non-empty string without trailing or leading whitespaces. | +| `file_name` | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). | Example request using HTTP Basic authentication: @@ -50,10 +49,10 @@ You cannot publish a package if a package of the same name and version already e The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package name and/or version and/or file name are invalid. | +| HTTP Status Code | Meaning | +| ------------------- | ------------------------------------------------------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package is invalid. | | `409 Conflict` | A file with the same name exist already in the package. | ## Download a package @@ -64,12 +63,12 @@ To download a generic package perform a HTTP GET operation. GET https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name} ``` -| Parameter | Description | -| ----------------- | ----------- | +| Parameter | Description | +| ------------------- | ------------------------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version. | -| `file_name` | The filename. | +| `package_name` | The package name. | +| `package_version` | The package version. | +| `file_name` | The filename. | The file content is served in the response body. The response content type is `application/octet-stream`. @@ -82,10 +81,10 @@ curl --user your_username:your_token_or_password \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `200 OK` | Success | -| `404 Not Found` | The package or file was not found. | +| HTTP Status Code | Meaning | +| ----------------- | ---------------------------------- | +| `200 OK` | Success | +| `404 Not Found` | The package or file was not found. | ## Delete a package @@ -95,11 +94,11 @@ To delete a generic package perform a HTTP DELETE operation. This will delete al DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version} ``` -| Parameter | Description | -| ----------------- | ----------- | +| Parameter | Description | +| ------------------- | ------------------------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version. | +| `package_name` | The package name. | +| `package_version` | The package version. | Example request using HTTP Basic authentication: @@ -110,10 +109,10 @@ curl --user your_username:your_token_or_password -X DELETE \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `204 No Content` | Success | -| `404 Not Found` | The package was not found. | +| HTTP Status Code | Meaning | +| ------------------ | -------------------------- | +| `204 No Content` | Success | +| `404 Not Found` | The package was not found. | ## Delete a package file @@ -123,12 +122,12 @@ To delete a file of a generic package perform a HTTP DELETE operation. This will DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{filename} ``` -| Parameter | Description | -| ----------------- | ----------- | +| Parameter | Description | +| ------------------- | ------------------------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version. | -| `filename` | The filename. | +| `package_name` | The package name. | +| `package_version` | The package version. | +| `filename` | The filename. | Example request using HTTP Basic authentication: @@ -139,7 +138,7 @@ curl --user your_username:your_token_or_password -X DELETE \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ------- | -| `204 No Content` | Success | -| `404 Not Found` | The package or file was not found. | +| HTTP Status Code | Meaning | +| ------------------ | ---------------------------------- | +| `204 No Content` | Success | +| `404 Not Found` | The package or file was not found. | From 28fe5a8ddb01e22be50c2073b5bbfe5b4a71c6b7 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Mon, 9 Oct 2023 13:23:10 +0800 Subject: [PATCH 06/14] fix --- docs/content/usage/packages/alpine.en-us.md | 4 ++-- docs/content/usage/packages/cargo.en-us.md | 2 +- docs/content/usage/packages/conan.en-us.md | 4 ++-- docs/content/usage/packages/conda.en-us.md | 1 + docs/content/usage/packages/container.en-us.md | 2 -- docs/content/usage/packages/cran.en-us.md | 1 + docs/content/usage/packages/debian.en-us.md | 3 ++- docs/content/usage/packages/generic.en-us.md | 3 ++- docs/content/usage/packages/go.en-us.md | 1 + docs/content/usage/packages/helm.en-us.md | 2 +- docs/content/usage/packages/maven.en-us.md | 2 +- docs/content/usage/packages/nuget.en-us.md | 2 +- docs/content/usage/packages/pypi.en-us.md | 2 +- docs/content/usage/packages/rpm.en-us.md | 3 ++- docs/content/usage/packages/vagrant.en-us.md | 3 ++- 15 files changed, 20 insertions(+), 15 deletions(-) diff --git a/docs/content/usage/packages/alpine.en-us.md b/docs/content/usage/packages/alpine.en-us.md index cf65d226b061a..10c2a7d61cd2c 100644 --- a/docs/content/usage/packages/alpine.en-us.md +++ b/docs/content/usage/packages/alpine.en-us.md @@ -65,7 +65,7 @@ PUT https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository} | -------------- | ----------------------------------------------------------------------------------------------------------------------- | | `owner` | The owner of the package. | | `branch` | The branch may match the release version of the OS, ex:`v3.17`. | -| `repository` | The repository can be used[to group packages](https://wiki.alpinelinux.org/wiki/Repositories) or just `main` or similar. | +| `repository` | The repository can be used [to group packages](https://wiki.alpinelinux.org/wiki/Repositories) or just `main` or similar. | Example request using HTTP Basic authentication: @@ -77,7 +77,7 @@ curl --user your_username:your_password_or_token \ If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +You cannot publish a package if a package of the same name, version, branch, repository and architecture already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/cargo.en-us.md b/docs/content/usage/packages/cargo.en-us.md index a2b4e14687a94..859ad9b297f1f 100644 --- a/docs/content/usage/packages/cargo.en-us.md +++ b/docs/content/usage/packages/cargo.en-us.md @@ -70,7 +70,7 @@ token = "Bearer {token}" | Parameter | Description | | --------- | ----------------------------------------------------------------- | -| `token` | Your[personal access token](development/api-usage.md#authentication) | +| `token` | Your [personal access token](development/api-usage.md#authentication) | ## Git vs Sparse diff --git a/docs/content/usage/packages/conan.en-us.md b/docs/content/usage/packages/conan.en-us.md index b89dc292f308b..c93ffbc8415fd 100644 --- a/docs/content/usage/packages/conan.en-us.md +++ b/docs/content/usage/packages/conan.en-us.md @@ -33,7 +33,7 @@ conan user --remote {remote} --password {password} {username} | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `remote` | The remote name. | | `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | | `owner` | The owner of the package. | For example: @@ -62,7 +62,7 @@ For example: conan upload --remote=gitea ConanPackage/1.2@gitea/final ``` -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +You cannot publish a file with the same name twice to a package. You must delete the existing package or file first. The Gitea Conan package registry has full [revision](https://docs.conan.io/en/latest/versioning/revisions.html) support. diff --git a/docs/content/usage/packages/conda.en-us.md b/docs/content/usage/packages/conda.en-us.md index 5288fcae511a6..a256dca51cb38 100644 --- a/docs/content/usage/packages/conda.en-us.md +++ b/docs/content/usage/packages/conda.en-us.md @@ -64,6 +64,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. + You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/container.en-us.md b/docs/content/usage/packages/container.en-us.md index cb9ae58a1c343..14f07647dcaa8 100644 --- a/docs/content/usage/packages/container.en-us.md +++ b/docs/content/usage/packages/container.en-us.md @@ -68,8 +68,6 @@ For example: docker push gitea.example.com/testuser/myimage:latest ``` -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. - ## Pull an image Pull an image by executing the following command: diff --git a/docs/content/usage/packages/cran.en-us.md b/docs/content/usage/packages/cran.en-us.md index fb403df8c95c8..a6b0d31856de0 100644 --- a/docs/content/usage/packages/cran.en-us.md +++ b/docs/content/usage/packages/cran.en-us.md @@ -69,6 +69,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. + You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/debian.en-us.md b/docs/content/usage/packages/debian.en-us.md index 67bcfc81490a4..9ae1dc15c0431 100644 --- a/docs/content/usage/packages/debian.en-us.md +++ b/docs/content/usage/packages/debian.en-us.md @@ -77,7 +77,8 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. + +You cannot publish a package if a package of the same name, version, distribution, component and architecture already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/generic.en-us.md b/docs/content/usage/packages/generic.en-us.md index 6535d1f71c23a..5be79dbfbb259 100644 --- a/docs/content/usage/packages/generic.en-us.md +++ b/docs/content/usage/packages/generic.en-us.md @@ -45,7 +45,8 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. + +You cannot publish a file with the same name twice to a package. You must delete the existing package or file first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/go.en-us.md b/docs/content/usage/packages/go.en-us.md index 7078673cab6ba..ed3c1a87e9ae1 100644 --- a/docs/content/usage/packages/go.en-us.md +++ b/docs/content/usage/packages/go.en-us.md @@ -40,6 +40,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. + You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/helm.en-us.md b/docs/content/usage/packages/helm.en-us.md index 1e030067628a8..7f1136ea42f7c 100644 --- a/docs/content/usage/packages/helm.en-us.md +++ b/docs/content/usage/packages/helm.en-us.md @@ -38,7 +38,7 @@ helm cm-push ./{chart_file}.tgz {repo} | Parameter | Description | | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | | `repo` | The name for the repository. | | `chart_file` | The Helm Chart archive. | | `owner` | The owner of the package. | diff --git a/docs/content/usage/packages/maven.en-us.md b/docs/content/usage/packages/maven.en-us.md index 585e4c9d5f490..59e8a03ffbeb6 100644 --- a/docs/content/usage/packages/maven.en-us.md +++ b/docs/content/usage/packages/maven.en-us.md @@ -66,7 +66,7 @@ Afterwards add the following sections to your project `pom.xml` file: | Parameter | Description | | ---------------- | ------------------------------------------------------------------ | -| `access_token` | Your[personal access token](development/api-usage.md#authentication). | +| `access_token` | Your [personal access token](development/api-usage.md#authentication). | | `owner` | The owner of the package. | ### Gradle variant diff --git a/docs/content/usage/packages/nuget.en-us.md b/docs/content/usage/packages/nuget.en-us.md index 4196775593163..c218d01d2fbf0 100644 --- a/docs/content/usage/packages/nuget.en-us.md +++ b/docs/content/usage/packages/nuget.en-us.md @@ -34,7 +34,7 @@ dotnet nuget add source --name {source_name} --username {username} --password {p | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `source_name` | The desired source name. | | `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | | `owner` | The owner of the package. | For example: diff --git a/docs/content/usage/packages/pypi.en-us.md b/docs/content/usage/packages/pypi.en-us.md index 534bf540e4e66..d02388246b87f 100644 --- a/docs/content/usage/packages/pypi.en-us.md +++ b/docs/content/usage/packages/pypi.en-us.md @@ -38,7 +38,7 @@ password = {password} | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `owner` | The owner of the package. | | `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a[personal access token](development/api-usage.md#authentication) instead of the password. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | ## Publish a package diff --git a/docs/content/usage/packages/rpm.en-us.md b/docs/content/usage/packages/rpm.en-us.md index 030ba3ce74d11..c0a07a77ced0d 100644 --- a/docs/content/usage/packages/rpm.en-us.md +++ b/docs/content/usage/packages/rpm.en-us.md @@ -63,7 +63,8 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. + +You cannot publish a package if a package of the same name, version and architecture already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/vagrant.en-us.md b/docs/content/usage/packages/vagrant.en-us.md index 0a0703e0e3530..ad89a1dfce734 100644 --- a/docs/content/usage/packages/vagrant.en-us.md +++ b/docs/content/usage/packages/vagrant.en-us.md @@ -33,7 +33,7 @@ PUT https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}/{packa | `owner` | The owner of the package. | | `package_name` | The package name. | | `package_version` | The package version, semver compatible. | -| `provider` | One of the[supported provider names](https://www.vagrantup.com/docs/providers). | +| `provider` | One of the [supported provider names](https://www.vagrantup.com/docs/providers). | Example for uploading a Hyper-V box: @@ -44,6 +44,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. + You cannot publish a box if a box of the same name, version and provider already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. From 99e757ea7277e7a396cf3479c90c98bfc26d5530 Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Mon, 9 Oct 2023 13:31:08 +0800 Subject: [PATCH 07/14] Update docs/content/usage/packages/generic.en-us.md Co-authored-by: KN4CK3R --- docs/content/usage/packages/generic.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/usage/packages/generic.en-us.md b/docs/content/usage/packages/generic.en-us.md index 5be79dbfbb259..70ce33880191a 100644 --- a/docs/content/usage/packages/generic.en-us.md +++ b/docs/content/usage/packages/generic.en-us.md @@ -23,7 +23,7 @@ To authenticate to the Package Registry, you need to provide [custom HTTP header ## Publish a package To publish a generic package perform a HTTP PUT operation with the package content in the request body. -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +You cannot publish a file with the same name twice to a package. You must delete the existing package or file first. ``` PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name} From 6447aa2ba16b16edb2f3541a849bb8afaf5441e2 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Tue, 10 Oct 2023 10:29:58 +0800 Subject: [PATCH 08/14] revert table change --- docs/content/usage/packages/alpine.en-us.md | 46 ++++++++++----------- docs/content/usage/packages/cargo.en-us.md | 17 ++++---- docs/content/usage/packages/chef.en-us.md | 23 ++++++----- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/docs/content/usage/packages/alpine.en-us.md b/docs/content/usage/packages/alpine.en-us.md index 10c2a7d61cd2c..1fcbe848537a3 100644 --- a/docs/content/usage/packages/alpine.en-us.md +++ b/docs/content/usage/packages/alpine.en-us.md @@ -11,6 +11,7 @@ menu: sidebar_position: 4 identifier: "alpine" --- + # Alpine Package Registry Publish [Alpine](https://pkgs.alpinelinux.org/) packages for your user or organization. @@ -29,11 +30,11 @@ To register the Alpine registry add the url to the list of known apk sources (`/ https://gitea.example.com/api/packages/{owner}/alpine// ``` -| Placeholder | Description | -| -------------- | -------------------------- | +| Placeholder | Description | +| ------------ | ----------- | | `owner` | The owner of the packages. | -| `branch` | The branch to use. | -| `repository` | The repository to use. | +| `branch` | The branch to use. | +| `repository` | The repository to use. | If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication): @@ -61,10 +62,10 @@ To publish an Alpine package (`*.apk`), perform a HTTP `PUT` operation with the PUT https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository} ``` -| Parameter | Description | -| -------------- | ----------------------------------------------------------------------------------------------------------------------- | -| `owner` | The owner of the package. | -| `branch` | The branch may match the release version of the OS, ex:`v3.17`. | +| Parameter | Description | +| ------------ | ----------- | +| `owner` | The owner of the package. | +| `branch` | The branch may match the release version of the OS, ex: `v3.17`. | | `repository` | The repository can be used [to group packages](https://wiki.alpinelinux.org/wiki/Repositories) or just `main` or similar. | Example request using HTTP Basic authentication: @@ -76,15 +77,14 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. - -You cannot publish a package if a package of the same name, version, branch, repository and architecture already exists. You must delete the existing package first. +You cannot publish a file with the same name twice to a package. You must delete the existing package file first. The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ------------------- | ------------------------------------------------------------------------------------ | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package is invalid. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name, version, branch, repository or architecture are invalid. | | `409 Conflict` | A package file with the same combination of parameters exist already in the package. | ## Delete a package @@ -95,13 +95,13 @@ To delete an Alpine package perform a HTTP `DELETE` operation. This will delete DELETE https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository}/{architecture}/{filename} ``` -| Parameter | Description | -| ---------------- | ------------------------- | +| Parameter | Description | +| -------------- | ----------- | | `owner` | The owner of the package. | -| `branch` | The branch to use. | -| `repository` | The repository to use. | +| `branch` | The branch to use. | +| `repository` | The repository to use. | | `architecture` | The package architecture. | -| `filename` | The file to delete. | +| `filename` | The file to delete. Example request using HTTP Basic authentication: @@ -112,10 +112,10 @@ curl --user your_username:your_token_or_password -X DELETE \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ------------------ | ---------------------------------- | -| `204 No Content` | Success | -| `404 Not Found` | The package or file was not found. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `204 No Content` | Success | +| `404 Not Found` | The package or file was not found. | ## Install a package diff --git a/docs/content/usage/packages/cargo.en-us.md b/docs/content/usage/packages/cargo.en-us.md index 859ad9b297f1f..356e7ff0b9bef 100644 --- a/docs/content/usage/packages/cargo.en-us.md +++ b/docs/content/usage/packages/cargo.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 5 identifier: "cargo" --- + # Cargo Package Registry Publish [Cargo](https://doc.rust-lang.org/stable/cargo/) packages for your user or organization. @@ -56,9 +57,9 @@ index = "sparse+https://gitea.example.com/api/packages/{owner}/cargo/" # Sparse # git-fetch-with-cli = true ``` -| Parameter | Description | -| --------- | ------------------------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| --------- | ----------- | +| `owner` | The owner of the package. | If the registry is private or you want to publish new packages, you have to configure your credentials. Add the credentials section to the credentials file located in the current users home directory (for example `~/.cargo/credentials.toml`): @@ -68,9 +69,9 @@ Add the credentials section to the credentials file located in the current users token = "Bearer {token}" ``` -| Parameter | Description | -| --------- | ----------------------------------------------------------------- | -| `token` | Your [personal access token](development/api-usage.md#authentication) | +| Parameter | Description | +| --------- | ----------- | +| `token` | Your [personal access token](development/api-usage.md#authentication) | ## Git vs Sparse @@ -96,8 +97,8 @@ To install a package from the package registry, execute the following command: cargo add {package_name} ``` -| Parameter | Description | -| ---------------- | ----------------- | +| Parameter | Description | +| -------------- | ----------- | | `package_name` | The package name. | ## Supported commands diff --git a/docs/content/usage/packages/chef.en-us.md b/docs/content/usage/packages/chef.en-us.md index 0f3c927a966a6..9f23b9eac8051 100644 --- a/docs/content/usage/packages/chef.en-us.md +++ b/docs/content/usage/packages/chef.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 5 identifier: "chef" --- + # Chef Package Registry Publish [Chef](https://chef.io/) cookbooks for your user or organization. @@ -35,9 +36,9 @@ To [configure `knife`](https://docs.chef.io/workstation/knife_setup/) to use the knife[:supermarket_site] = 'https://gitea.example.com/api/packages/{owner}/chef' ``` -| Parameter | Description | -| --------- | ------------------------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| --------- | ----------- | +| `owner` | The owner of the package. | ## Publish a package @@ -47,8 +48,8 @@ To publish a Chef package execute the following command: knife supermarket share {package_name} ``` -| Parameter | Description | -| ---------------- | ----------------- | +| Parameter | Description | +| -------------- | ----------- | | `package_name` | The package name. | You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. @@ -67,9 +68,9 @@ Optional you can specify the package version: knife supermarket install {package_name} {package_version} ``` -| Parameter | Description | -| ------------------- | -------------------- | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `package_name` | The package name. | | `package_version` | The package version. | ## Delete a package @@ -86,7 +87,7 @@ Optional you can specify the package version: knife supermarket unshare {package_name}/versions/{package_version} ``` -| Parameter | Description | -| ------------------- | -------------------- | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `package_name` | The package name. | | `package_version` | The package version. | From 6436f1821ddda15b54819d4a77e7b644acbd062d Mon Sep 17 00:00:00 2001 From: lng2020 Date: Tue, 10 Oct 2023 10:44:31 +0800 Subject: [PATCH 09/14] revert table change --- docs/content/usage/packages/composer.en-us.md | 32 ++++---- docs/content/usage/packages/conan.en-us.md | 27 +++---- .../content/usage/packages/container.en-us.md | 21 +++--- docs/content/usage/packages/generic.en-us.md | 75 +++++++++---------- docs/content/usage/packages/helm.en-us.md | 29 ++++--- docs/content/usage/packages/maven.en-us.md | 13 ++-- docs/content/usage/packages/npm.en-us.md | 29 +++---- docs/content/usage/packages/nuget.en-us.md | 31 ++++---- docs/content/usage/packages/pub.en-us.md | 21 +++--- docs/content/usage/packages/pypi.en-us.md | 23 +++--- docs/content/usage/packages/rpm.en-us.md | 3 +- docs/content/usage/packages/rubygems.en-us.md | 31 ++++---- docs/content/usage/packages/vagrant.en-us.md | 17 +++-- 13 files changed, 179 insertions(+), 173 deletions(-) diff --git a/docs/content/usage/packages/composer.en-us.md b/docs/content/usage/packages/composer.en-us.md index 541db2737ee81..7fbd77ef5d73f 100644 --- a/docs/content/usage/packages/composer.en-us.md +++ b/docs/content/usage/packages/composer.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 10 identifier: "composer" --- + # Composer Package Registry Publish [Composer](https://getcomposer.org/) packages for your user or organization. @@ -24,14 +25,15 @@ To work with the Composer package registry, you can use [Composer](https://getco To publish a Composer package perform a HTTP PUT operation with the package content in the request body. The package content must be the zipped PHP project with the `composer.json` file. +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. ``` PUT https://gitea.example.com/api/packages/{owner}/composer ``` -| Parameter | Description | -| --------- | ------------------------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| ---------- | ----------- | +| `owner` | The owner of the package. | If the `composer.json` file does not contain a `version` property, you must provide it as a query parameter: @@ -56,15 +58,13 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ------------------- | ---------------------------------------------------------------------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package is invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name and/or version are invalid or a package with the same name and version already exist. | ## Configuring the package registry @@ -93,10 +93,10 @@ To access the package registry using credentials, you must specify them in the ` } ``` -| Parameter | Description | -| ------------ | ----------------------------------------------- | -| `owner` | The owner of the package. | -| `username` | Your Gitea username. | +| Parameter | Description | +| ---------- | ----------- | +| `owner` | The owner of the package. | +| `username` | Your Gitea username. | | `password` | Your Gitea password or a personal access token. | ## Install a package @@ -113,7 +113,7 @@ Optional you can specify the package version: composer require {package_name}:{package_version} ``` -| Parameter | Description | -| ------------------- | -------------------- | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `package_name` | The package name. | | `package_version` | The package version. | diff --git a/docs/content/usage/packages/conan.en-us.md b/docs/content/usage/packages/conan.en-us.md index c93ffbc8415fd..505460b31904b 100644 --- a/docs/content/usage/packages/conan.en-us.md +++ b/docs/content/usage/packages/conan.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 20 identifier: "conan" --- + # Conan Package Registry Publish [Conan](https://conan.io/) packages for your user or organization. @@ -29,12 +30,12 @@ conan remote add {remote} https://gitea.example.com/api/packages/{owner}/conan conan user --remote {remote} --password {password} {username} ``` -| Parameter | Description | -| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `remote` | The remote name. | -| `username` | Your Gitea username. | +| Parameter | Description | +| -----------| ----------- | +| `remote` | The remote name. | +| `username` | Your Gitea username. | | `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | -| `owner` | The owner of the package. | +| `owner` | The owner of the package. | For example: @@ -51,10 +52,10 @@ Publish a Conan package by running the following command: conan upload --remote={remote} {recipe} ``` -| Parameter | Description | -| ---------- | --------------------- | -| `remote` | The remote name. | -| `recipe` | The recipe to upload. | +| Parameter | Description | +| ----------| ----------- | +| `remote` | The remote name. | +| `recipe` | The recipe to upload. | For example: @@ -74,10 +75,10 @@ To install a Conan package from the package registry, execute the following comm conan install --remote={remote} {recipe} ``` -| Parameter | Description | -| ---------- | ----------------------- | -| `remote` | The remote name. | -| `recipe` | The recipe to download. | +| Parameter | Description | +| ----------| ----------- | +| `remote` | The remote name. | +| `recipe` | The recipe to download. | For example: diff --git a/docs/content/usage/packages/container.en-us.md b/docs/content/usage/packages/container.en-us.md index 14f07647dcaa8..6be21c2b276f4 100644 --- a/docs/content/usage/packages/container.en-us.md +++ b/docs/content/usage/packages/container.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 30 identifier: "container" --- + # Container Registry Publish [Open Container Initiative](https://opencontainers.org/) compliant images for your user or organization. @@ -56,11 +57,11 @@ Push an image by executing the following command: docker push gitea.example.com/{owner}/{image}:{tag} ``` -| Parameter | Description | -| --------- | ----------------------- | -| `owner` | The owner of the image. | -| `image` | The name of the image. | -| `tag` | The tag of the image. | +| Parameter | Description | +| ----------| ----------- | +| `owner` | The owner of the image. | +| `image` | The name of the image. | +| `tag` | The tag of the image. | For example: @@ -76,11 +77,11 @@ Pull an image by executing the following command: docker pull gitea.example.com/{owner}/{image}:{tag} ``` -| Parameter | Description | -| --------- | ----------------------- | -| `owner` | The owner of the image. | -| `image` | The name of the image. | -| `tag` | The tag of the image. | +| Parameter | Description | +| ----------| ----------- | +| `owner` | The owner of the image. | +| `image` | The name of the image. | +| `tag` | The tag of the image. | For example: diff --git a/docs/content/usage/packages/generic.en-us.md b/docs/content/usage/packages/generic.en-us.md index 70ce33880191a..04be6e3597ce4 100644 --- a/docs/content/usage/packages/generic.en-us.md +++ b/docs/content/usage/packages/generic.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 40 identifier: "generic" --- + # Generic Package Registry Publish generic files, like release binaries or other output, for your user or organization. @@ -23,18 +24,18 @@ To authenticate to the Package Registry, you need to provide [custom HTTP header ## Publish a package To publish a generic package perform a HTTP PUT operation with the package content in the request body. -You cannot publish a file with the same name twice to a package. You must delete the existing package or file first. +You cannot publish a file with the same name twice to a package. You must delete the existing package version first. ``` PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name} ``` -| Parameter | Description | -| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| ----------------- | ----------- | +| `owner` | The owner of the package. | | `package_name` | The package name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). | -| `package_version` | The package version, a non-empty string without trailing or leading whitespaces. | -| `file_name` | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). | +| `package_version` | The package version, a non-empty string without trailing or leading whitespaces. | +| `file_name` | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). | Example request using HTTP Basic authentication: @@ -46,14 +47,12 @@ curl --user your_username:your_password_or_token \ If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. -You cannot publish a file with the same name twice to a package. You must delete the existing package or file first. - The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ------------------- | ------------------------------------------------------- | -| `201 Created` | The package has been published. | -| `400 Bad Request` | The package is invalid. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | +| `400 Bad Request` | The package name and/or version and/or file name are invalid. | | `409 Conflict` | A file with the same name exist already in the package. | ## Download a package @@ -64,12 +63,12 @@ To download a generic package perform a HTTP GET operation. GET https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name} ``` -| Parameter | Description | -| ------------------- | ------------------------- | +| Parameter | Description | +| ----------------- | ----------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version. | -| `file_name` | The filename. | +| `package_name` | The package name. | +| `package_version` | The package version. | +| `file_name` | The filename. | The file content is served in the response body. The response content type is `application/octet-stream`. @@ -82,10 +81,10 @@ curl --user your_username:your_token_or_password \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ----------------- | ---------------------------------- | -| `200 OK` | Success | -| `404 Not Found` | The package or file was not found. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `200 OK` | Success | +| `404 Not Found` | The package or file was not found. | ## Delete a package @@ -95,11 +94,11 @@ To delete a generic package perform a HTTP DELETE operation. This will delete al DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version} ``` -| Parameter | Description | -| ------------------- | ------------------------- | +| Parameter | Description | +| ----------------- | ----------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version. | +| `package_name` | The package name. | +| `package_version` | The package version. | Example request using HTTP Basic authentication: @@ -110,10 +109,10 @@ curl --user your_username:your_token_or_password -X DELETE \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ------------------ | -------------------------- | -| `204 No Content` | Success | -| `404 Not Found` | The package was not found. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `204 No Content` | Success | +| `404 Not Found` | The package was not found. | ## Delete a package file @@ -123,12 +122,12 @@ To delete a file of a generic package perform a HTTP DELETE operation. This will DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{filename} ``` -| Parameter | Description | -| ------------------- | ------------------------- | +| Parameter | Description | +| ----------------- | ----------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version. | -| `filename` | The filename. | +| `package_name` | The package name. | +| `package_version` | The package version. | +| `filename` | The filename. | Example request using HTTP Basic authentication: @@ -139,7 +138,7 @@ curl --user your_username:your_token_or_password -X DELETE \ The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ------------------ | ---------------------------------- | -| `204 No Content` | Success | -| `404 Not Found` | The package or file was not found. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `204 No Content` | Success | +| `404 Not Found` | The package or file was not found. | diff --git a/docs/content/usage/packages/helm.en-us.md b/docs/content/usage/packages/helm.en-us.md index 7f1136ea42f7c..a9fe6be89d8ea 100644 --- a/docs/content/usage/packages/helm.en-us.md +++ b/docs/content/usage/packages/helm.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 50 identifier: "helm" --- + # Helm Chart Registry Publish [Helm](https://helm.sh/) charts for your user or organization. @@ -35,15 +36,13 @@ helm repo add --username {username} --password {password} {repo} https://gitea. helm cm-push ./{chart_file}.tgz {repo} ``` -| Parameter | Description | -| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `username` | Your Gitea username. | +| Parameter | Description | +| ------------ | ----------- | +| `username` | Your Gitea username. | | `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | -| `repo` | The name for the repository. | -| `chart_file` | The Helm Chart archive. | -| `owner` | The owner of the package. | - -You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. +| `repo` | The name for the repository. | +| `chart_file` | The Helm Chart archive. | +| `owner` | The owner of the package. | ## Install a package @@ -55,11 +54,11 @@ helm repo update helm install {name} {repo}/{chart} ``` -| Parameter | Description | -| ------------ | ----------------------------------------------- | -| `username` | Your Gitea username. | +| Parameter | Description | +| ---------- | ----------- | +| `username` | Your Gitea username. | | `password` | Your Gitea password or a personal access token. | -| `repo` | The name for the repository. | -| `owner` | The owner of the package. | -| `name` | The local name. | -| `chart` | The name Helm Chart. | +| `repo` | The name for the repository. | +| `owner` | The owner of the package. | +| `name` | The local name. | +| `chart` | The name Helm Chart. | diff --git a/docs/content/usage/packages/maven.en-us.md b/docs/content/usage/packages/maven.en-us.md index 59e8a03ffbeb6..59e71c87ccfbd 100644 --- a/docs/content/usage/packages/maven.en-us.md +++ b/docs/content/usage/packages/maven.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 60 identifier: "maven" --- + # Maven Package Registry Publish [Maven](https://maven.apache.org) packages for your user or organization. @@ -64,10 +65,10 @@ Afterwards add the following sections to your project `pom.xml` file: ``` -| Parameter | Description | -| ---------------- | ------------------------------------------------------------------ | +| Parameter | Description | +| -------------- | ----------- | | `access_token` | Your [personal access token](development/api-usage.md#authentication). | -| `owner` | The owner of the package. | +| `owner` | The owner of the package. | ### Gradle variant @@ -123,9 +124,9 @@ If you want to publish a prebuild package to the registry, you can use [`mvn dep mvn deploy:deploy-file -Durl=https://gitea.example.com/api/packages/{owner}/maven -DrepositoryId=gitea -Dfile=/path/to/package.jar ``` -| Parameter | Description | -| --------- | ------------------------- | -| `owner` | The owner of the package. | +| Parameter | Description | +| -------------- | ----------- | +| `owner` | The owner of the package. | You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. diff --git a/docs/content/usage/packages/npm.en-us.md b/docs/content/usage/packages/npm.en-us.md index 42ce3d10adc5d..1590b9623a0cd 100644 --- a/docs/content/usage/packages/npm.en-us.md +++ b/docs/content/usage/packages/npm.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 70 identifier: "npm" --- + # npm Package Registry Publish [npm](https://www.npmjs.com/) packages for your user or organization. @@ -33,11 +34,11 @@ npm config set {scope}:registry https://gitea.example.com/api/packages/{owner}/n npm config set -- '//gitea.example.com/api/packages/{owner}/npm/:_authToken' "{token}" ``` -| Parameter | Description | -| --------- | ------------------------------------------------------------------ | -| `scope` | The scope of the packages. | -| `owner` | The owner of the package. | -| `token` | Your[personal access token](development/api-usage.md#authentication). | +| Parameter | Description | +| ------------ | ----------- | +| `scope` | The scope of the packages. | +| `owner` | The owner of the package. | +| `token` | Your [personal access token](development/api-usage.md#authentication). | For example: @@ -71,9 +72,9 @@ Delete a package by running the following command: npm unpublish {package_name}[@{package_version}] ``` -| Parameter | Description | -| ------------------- | -------------------- | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `package_name` | The package name. | | `package_version` | The package version. | For example: @@ -91,8 +92,8 @@ To install a package from the package registry, execute the following command: npm install {package_name} ``` -| Parameter | Description | -| ---------------- | ----------------- | +| Parameter | Description | +| -------------- | ----------- | | `package_name` | The package name. | For example: @@ -109,11 +110,11 @@ The registry supports [version tags](https://docs.npmjs.com/adding-dist-tags-to- npm dist-tag add {package_name}@{version} {tag} ``` -| Parameter | Description | -| ---------------- | --------------------------- | -| `package_name` | The package name. | +| Parameter | Description | +| -------------- | ----------- | +| `package_name` | The package name. | | `version` | The version of the package. | -| `tag` | The tag name. | +| `tag` | The tag name. | For example: diff --git a/docs/content/usage/packages/nuget.en-us.md b/docs/content/usage/packages/nuget.en-us.md index c218d01d2fbf0..8cd88e06371e9 100644 --- a/docs/content/usage/packages/nuget.en-us.md +++ b/docs/content/usage/packages/nuget.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 80 identifier: "nuget" --- + # NuGet Package Registry Publish [NuGet](https://www.nuget.org/) packages for your user or organization. The package registry supports the V2 and V3 API protocol and you can work with [NuGet Symbol Packages](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) too. @@ -30,12 +31,12 @@ To register the package registry you need to configure a new NuGet feed source: dotnet nuget add source --name {source_name} --username {username} --password {password} https://gitea.example.com/api/packages/{owner}/nuget/index.json ``` -| Parameter | Description | -| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `source_name` | The desired source name. | -| `username` | Your Gitea username. | +| Parameter | Description | +| ------------- | ----------- | +| `source_name` | The desired source name. | +| `username` | Your Gitea username. | | `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | -| `owner` | The owner of the package. | +| `owner` | The owner of the package. | For example: @@ -53,9 +54,9 @@ Publish a package by running the following command: dotnet nuget push --source {source_name} {package_file} ``` -| Parameter | Description | -| ---------------- | ------------------------------------ | -| `source_name` | The desired source name. | +| Parameter | Description | +| -------------- | ----------- | +| `source_name` | The desired source name. | | `package_file` | Path to the package `.nupkg` file. | For example: @@ -75,9 +76,9 @@ To do so, register the NuGet package registry as symbol source: https://gitea.example.com/api/packages/{owner}/nuget/symbols ``` -| Parameter | Description | -| --------- | ---------------------------------- | -| `owner` | The owner of the package registry. | +| Parameter | Description | +| --------- | ----------- | +| `owner` | The owner of the package registry. | For example: @@ -93,11 +94,11 @@ To install a NuGet package from the package registry, execute the following comm dotnet add package --source {source_name} --version {package_version} {package_name} ``` -| Parameter | Description | -| ------------------- | ------------------------ | +| Parameter | Description | +| ----------------- | ----------- | | `source_name` | The desired source name. | -| `package_name` | The package name. | -| `package_version` | The package version. | +| `package_name` | The package name. | +| `package_version` | The package version. | For example: diff --git a/docs/content/usage/packages/pub.en-us.md b/docs/content/usage/packages/pub.en-us.md index 703050019318e..e5e12de34495e 100644 --- a/docs/content/usage/packages/pub.en-us.md +++ b/docs/content/usage/packages/pub.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 90 identifier: "pub" --- + # Pub Package Registry Publish [Pub](https://dart.dev/guides/packages) packages for your user or organization. @@ -30,9 +31,9 @@ To register the package registry and provide credentials, execute: dart pub token add https://gitea.example.com/api/packages/{owner}/pub ``` -| Placeholder | Description | -| ----------- | ------------------------- | -| `owner` | The owner of the package. | +| Placeholder | Description | +| ------------ | ----------- | +| `owner` | The owner of the package. | You need to provide your [personal access token](development/api-usage.md#authentication). @@ -44,9 +45,9 @@ To publish a package, edit the `pubspec.yaml` and add the following line: publish_to: https://gitea.example.com/api/packages/{owner}/pub ``` -| Placeholder | Description | -| ----------- | ------------------------- | -| `owner` | The owner of the package. | +| Placeholder | Description | +| ------------ | ----------- | +| `owner` | The owner of the package. | Now you can publish the package by running the following command: @@ -64,10 +65,10 @@ To install a Pub package from the package registry, execute the following comman dart pub add {package_name} --hosted-url=https://gitea.example.com/api/packages/{owner}/pub/ ``` -| Parameter | Description | -| ---------------- | ------------------------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: diff --git a/docs/content/usage/packages/pypi.en-us.md b/docs/content/usage/packages/pypi.en-us.md index d02388246b87f..be59df0762796 100644 --- a/docs/content/usage/packages/pypi.en-us.md +++ b/docs/content/usage/packages/pypi.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 100 identifier: "pypi" --- + # PyPI Package Registry Publish [PyPI](https://pypi.org/) packages for your user or organization. @@ -34,11 +35,11 @@ username = {username} password = {password} ``` -| Placeholder | Description | -| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `owner` | The owner of the package. | -| `username` | Your Gitea username. | -| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | +| Placeholder | Description | +| ------------ | ----------- | +| `owner` | The owner of the package. | +| `username` | Your Gitea username. | +| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. | ## Publish a package @@ -60,12 +61,12 @@ To install a PyPI package from the package registry, execute the following comma pip install --index-url https://{username}:{password}@gitea.example.com/api/packages/{owner}/pypi/simple --no-deps {package_name} ``` -| Parameter | Description | -| ---------------- | ----------------------------------------------- | -| `username` | Your Gitea username. | -| `password` | Your Gitea password or a personal access token. | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `username` | Your Gitea username. | +| `password` | Your Gitea password or a personal access token. | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: diff --git a/docs/content/usage/packages/rpm.en-us.md b/docs/content/usage/packages/rpm.en-us.md index c0a07a77ced0d..5a4a31ee39dfe 100644 --- a/docs/content/usage/packages/rpm.en-us.md +++ b/docs/content/usage/packages/rpm.en-us.md @@ -63,8 +63,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. - -You cannot publish a package if a package of the same name, version and architecture already exists. You must delete the existing package first. +You cannot publish a file with the same name twice to a package. You must delete the existing package version first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/rubygems.en-us.md b/docs/content/usage/packages/rubygems.en-us.md index ee9ff0dec485e..cb1a225bc67f6 100644 --- a/docs/content/usage/packages/rubygems.en-us.md +++ b/docs/content/usage/packages/rubygems.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 110 identifier: "rubygems" --- + # RubyGems Package Registry Publish [RubyGems](https://guides.rubygems.org/) packages for your user or organization. @@ -29,10 +30,10 @@ To register the package registry edit the `~/.gem/credentials` file and add: https://gitea.example.com/api/packages/{owner}/rubygems: Bearer {token} ``` -| Parameter | Description | -| --------- | ------------------------------------------------------------------ | -| `owner` | The owner of the package. | -| `token` | Your[personal access token](development/api-usage.md#authentication). | +| Parameter | Description | +| ------------- | ----------- | +| `owner` | The owner of the package. | +| `token` | Your [personal access token](development/api-usage.md#authentication). | For example: @@ -49,9 +50,9 @@ Publish a package by running the following command: gem push --host {host} {package_file} ``` -| Parameter | Description | -| ---------------- | ---------------------------------- | -| `host` | URL to the package registry. | +| Parameter | Description | +| -------------- | ----------- | +| `host` | URL to the package registry. | | `package_file` | Path to the package `.gem` file. | For example: @@ -76,10 +77,10 @@ source "https://gitea.example.com/api/packages/{owner}/rubygems" do end ``` -| Parameter | Description | -| ---------------- | ------------------------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: @@ -103,10 +104,10 @@ Execute the following command: gem install --host https://gitea.example.com/api/packages/{owner}/rubygems {package_name} ``` -| Parameter | Description | -| ---------------- | ------------------------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | +| Parameter | Description | +| ----------------- | ----------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | For example: diff --git a/docs/content/usage/packages/vagrant.en-us.md b/docs/content/usage/packages/vagrant.en-us.md index ad89a1dfce734..c771069a1a927 100644 --- a/docs/content/usage/packages/vagrant.en-us.md +++ b/docs/content/usage/packages/vagrant.en-us.md @@ -12,6 +12,7 @@ menu: sidebar_position: 120 identifier: "vagrant" --- + # Vagrant Package Registry Publish [Vagrant](https://www.vagrantup.com/) packages for your user or organization. @@ -28,11 +29,11 @@ Publish a Vagrant box by performing a HTTP PUT request to the registry: PUT https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}/{package_version}/{provider}.box ``` -| Parameter | Description | -| ------------------- | ---------------------------------------------------------------------------- | -| `owner` | The owner of the package. | -| `package_name` | The package name. | -| `package_version` | The package version, semver compatible. | +| Parameter | Description | +| ----------------- | ----------- | +| `owner` | The owner of the package. | +| `package_name` | The package name. | +| `package_version` | The package version, semver compatible. | | `provider` | One of the [supported provider names](https://www.vagrantup.com/docs/providers). | Example for uploading a Hyper-V box: @@ -63,10 +64,10 @@ To install a box from the package registry, execute the following command: vagrant box add "https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}" ``` -| Parameter | Description | -| ---------------- | ------------------------- | +| Parameter | Description | +| -------------- | ----------- | | `owner` | The owner of the package. | -| `package_name` | The package name. | +| `package_name` | The package name. | For example: From fa2996f19d13f468c2849b0df59bf989115bc129 Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:46:08 +0800 Subject: [PATCH 10/14] Update conda.en-us.md --- docs/content/usage/packages/conda.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/usage/packages/conda.en-us.md b/docs/content/usage/packages/conda.en-us.md index a256dca51cb38..6785c246967b6 100644 --- a/docs/content/usage/packages/conda.en-us.md +++ b/docs/content/usage/packages/conda.en-us.md @@ -73,7 +73,7 @@ The server responds with the following HTTP Status codes. | ----------------- | ------- | | `201 Created` | The package has been published. | | `400 Bad Request` | The package is invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | +| `409 Conflict` | A package with the same combination of parameters exists already. | ## Install a package From f96d10d2e60a489eba5907ff4da2e7899b438602 Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:47:10 +0800 Subject: [PATCH 11/14] Update vagrant.en-us.md --- docs/content/usage/packages/vagrant.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/usage/packages/vagrant.en-us.md b/docs/content/usage/packages/vagrant.en-us.md index c771069a1a927..60fb228d7a5b4 100644 --- a/docs/content/usage/packages/vagrant.en-us.md +++ b/docs/content/usage/packages/vagrant.en-us.md @@ -54,7 +54,7 @@ The server responds with the following HTTP Status codes. | ------------------- | ------------------------------------------------------------------------------- | | `201 Created` | The package has been published. | | `400 Bad Request` | The package is invalid. | -| `409 Conflict` | A package file with the same combination of parameters exists already. | +| `409 Conflict` | A package with the same combination of parameters exists already. | ## Install a package From 55af1a97998361caf133b4044996eefd880f61a1 Mon Sep 17 00:00:00 2001 From: lng2020 Date: Tue, 10 Oct 2023 10:56:36 +0800 Subject: [PATCH 12/14] fix --- docs/content/usage/packages/alpine.en-us.md | 1 + docs/content/usage/packages/composer.en-us.md | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/content/usage/packages/alpine.en-us.md b/docs/content/usage/packages/alpine.en-us.md index 1fcbe848537a3..00331f3bb1702 100644 --- a/docs/content/usage/packages/alpine.en-us.md +++ b/docs/content/usage/packages/alpine.en-us.md @@ -77,6 +77,7 @@ curl --user your_username:your_password_or_token \ ``` If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. + You cannot publish a file with the same name twice to a package. You must delete the existing package file first. The server responds with the following HTTP Status codes. diff --git a/docs/content/usage/packages/composer.en-us.md b/docs/content/usage/packages/composer.en-us.md index 7fbd77ef5d73f..60ad52ac2d442 100644 --- a/docs/content/usage/packages/composer.en-us.md +++ b/docs/content/usage/packages/composer.en-us.md @@ -25,6 +25,7 @@ To work with the Composer package registry, you can use [Composer](https://getco To publish a Composer package perform a HTTP PUT operation with the package content in the request body. The package content must be the zipped PHP project with the `composer.json` file. + You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. ``` @@ -64,7 +65,8 @@ The server responds with the following HTTP Status codes. | HTTP Status Code | Meaning | | ----------------- | ------- | | `201 Created` | The package has been published. | -| `400 Bad Request` | The package name and/or version are invalid or a package with the same name and version already exist. | +| `400 Bad Request` | The package is invalid. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | ## Configuring the package registry From 8d2064279557ea8ddbf791ab40659d23a04d853c Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:58:53 +0800 Subject: [PATCH 13/14] Update conda.en-us.md --- docs/content/usage/packages/conda.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/usage/packages/conda.en-us.md b/docs/content/usage/packages/conda.en-us.md index 6785c246967b6..a256dca51cb38 100644 --- a/docs/content/usage/packages/conda.en-us.md +++ b/docs/content/usage/packages/conda.en-us.md @@ -73,7 +73,7 @@ The server responds with the following HTTP Status codes. | ----------------- | ------- | | `201 Created` | The package has been published. | | `400 Bad Request` | The package is invalid. | -| `409 Conflict` | A package with the same combination of parameters exists already. | +| `409 Conflict` | A package file with the same combination of parameters exists already. | ## Install a package From 4bfa198c0119538e05bd80e263813ca91b46449b Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Tue, 10 Oct 2023 08:59:11 +0200 Subject: [PATCH 14/14] Update docs/content/usage/packages/vagrant.en-us.md --- docs/content/usage/packages/vagrant.en-us.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/content/usage/packages/vagrant.en-us.md b/docs/content/usage/packages/vagrant.en-us.md index 60fb228d7a5b4..baa9c2b83e487 100644 --- a/docs/content/usage/packages/vagrant.en-us.md +++ b/docs/content/usage/packages/vagrant.en-us.md @@ -50,11 +50,11 @@ You cannot publish a box if a box of the same name, version and provider already The server responds with the following HTTP Status codes. -| HTTP Status Code | Meaning | -| ------------------- | ------------------------------------------------------------------------------- | -| `201 Created` | The package has been published. | +| HTTP Status Code | Meaning | +| ----------------- | ------- | +| `201 Created` | The package has been published. | | `400 Bad Request` | The package is invalid. | -| `409 Conflict` | A package with the same combination of parameters exists already. | +| `409 Conflict` | A package with the same combination of parameters exists already. | ## Install a package