From c2fcfe515ff2cd70af37863f9c8f487fed3c8338 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 13 Oct 2020 00:08:42 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- app/models/concerns/presentable.rb | 4 +- app/presenters/clusterable_presenter.rb | 2 +- .../instance_clusterable_presenter.rb | 2 +- .../sast_ui_schema.json | 6 +- doc/README.md | 4 +- .../geo/replication/datatypes.md | 1 + doc/administration/instance_limits.md | 3 + doc/administration/packages/index.md | 1 + doc/api/README.md | 1 + doc/development/packages.md | 19 +-- doc/install/installation.md | 65 ++++---- doc/user/packages/generic_packages/index.md | 139 ++++++++++++++++++ doc/user/packages/index.md | 1 + doc/user/packages/package_registry/index.md | 2 +- lib/api/helpers/presentable.rb | 2 +- lib/gitlab/view/presenter/factory.rb | 2 +- 16 files changed, 198 insertions(+), 56 deletions(-) create mode 100644 doc/user/packages/generic_packages/index.md diff --git a/app/models/concerns/presentable.rb b/app/models/concerns/presentable.rb index 06c300c2e41..1f05abff2f4 100644 --- a/app/models/concerns/presentable.rb +++ b/app/models/concerns/presentable.rb @@ -5,13 +5,13 @@ module Presentable class_methods do def present(attributes) - all.map { |klass_object| klass_object.present(attributes) } + all.map { |klass_object| klass_object.present(**attributes) } end end def present(**attributes) Gitlab::View::Presenter::Factory - .new(self, attributes) + .new(self, **attributes) .fabricate! end end diff --git a/app/presenters/clusterable_presenter.rb b/app/presenters/clusterable_presenter.rb index efb3cf7f348..62488465c24 100644 --- a/app/presenters/clusterable_presenter.rb +++ b/app/presenters/clusterable_presenter.rb @@ -8,7 +8,7 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated attributes_with_presenter_class = attributes.merge(presenter_class: presenter_class) Gitlab::View::Presenter::Factory - .new(clusterable, attributes_with_presenter_class) + .new(clusterable, **attributes_with_presenter_class) .fabricate! end diff --git a/app/presenters/instance_clusterable_presenter.rb b/app/presenters/instance_clusterable_presenter.rb index 7704e6b59c1..94c1195ed6a 100644 --- a/app/presenters/instance_clusterable_presenter.rb +++ b/app/presenters/instance_clusterable_presenter.rb @@ -8,7 +8,7 @@ class InstanceClusterablePresenter < ClusterablePresenter attributes_with_presenter_class = attributes.merge(presenter_class: InstanceClusterablePresenter) Gitlab::View::Presenter::Factory - .new(clusterable, attributes_with_presenter_class) + .new(clusterable, **attributes_with_presenter_class) .fabricate! end diff --git a/app/validators/json_schemas/security_ci_configuration_schemas/sast_ui_schema.json b/app/validators/json_schemas/security_ci_configuration_schemas/sast_ui_schema.json index 8fde92d6312..08442565931 100644 --- a/app/validators/json_schemas/security_ci_configuration_schemas/sast_ui_schema.json +++ b/app/validators/json_schemas/security_ci_configuration_schemas/sast_ui_schema.json @@ -6,8 +6,8 @@ "type": "string", "default_value": "", "value": "", - "size": "MEDIUM", - "description": "Analyzer image's registry prefix (or Name of the registry providing the analyzers' image)" + "size": "LARGE", + "description": "Analyzer image's registry prefix (or name of the registry providing the analyzers' image)" }, { "field" : "SAST_EXCLUDED_PATHS", @@ -15,7 +15,7 @@ "type": "string", "default_value": "", "value": "", - "size": "LARGE", + "size": "MEDIUM", "description": "Comma-separated list of paths to be excluded from analyzer output. Patterns can be globs, file paths, or folder paths." }, { diff --git a/doc/README.md b/doc/README.md index 47f6535e80e..615f3e2f5d9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -267,9 +267,7 @@ The following documentation relates to the DevOps **Package** stage: |:----------------------------------------------------------------|:-------------------------------------------------------| | [Container Registry](user/packages/container_registry/index.md) | The GitLab Container Registry enables every project in GitLab to have its own space to store [Docker](https://www.docker.com/) images. | | [Dependency Proxy](user/packages/dependency_proxy/index.md) **(PREMIUM)** | The GitLab Dependency Proxy sets up a local proxy for frequently used upstream images/packages. | -| [Conan Repository](user/packages/conan_repository/index.md) | The GitLab Conan Repository enables every project in GitLab to have its own space to store [Conan](https://conan.io/) packages. | -| [Maven Repository](user/packages/maven_repository/index.md) | The GitLab Maven Repository enables every project in GitLab to have its own space to store [Maven](https://maven.apache.org/) packages. | -| [NPM Registry](user/packages/npm_registry/index.md) | The GitLab NPM Registry enables every project in GitLab to have its own space to store [NPM](https://www.npmjs.com/) packages. | +| [Package Registry](user/packages/package_registry/index.md) | Use GitLab as a private or public registry for a variety of common package managers, including [NPM](user/packages/npm_registry/index.md), [Maven](user/packages/maven_repository/index.md), [PyPI](user/packages/pypi_repository/index.md), and others. You can also store generic files. |
diff --git a/doc/administration/geo/replication/datatypes.md b/doc/administration/geo/replication/datatypes.md index 18c788d63bc..2816eb778ce 100644 --- a/doc/administration/geo/replication/datatypes.md +++ b/doc/administration/geo/replication/datatypes.md @@ -183,6 +183,7 @@ successfully, you must replicate their data using some other means. | [NuGet Repository](../../../user/packages/nuget_repository/index.md) | **Yes** (13.2) | [No](https://gitlab.com/groups/gitlab-org/-/epics/1817) | Via Object Storage provider if supported. Native Geo support (Beta). | Behind feature flag `geo_package_file_replication`, enabled by default | | [PyPI Repository](../../../user/packages/pypi_repository/index.md) | **Yes** (13.2) | [No](https://gitlab.com/groups/gitlab-org/-/epics/1817) | Via Object Storage provider if supported. Native Geo support (Beta). | Behind feature flag `geo_package_file_replication`, enabled by default | | [Composer Repository](../../../user/packages/composer_repository/index.md) | **Yes** (13.2) | [No](https://gitlab.com/groups/gitlab-org/-/epics/1817) | Via Object Storage provider if supported. Native Geo support (Beta). | Behind feature flag `geo_package_file_replication`, enabled by default | +| [Generic packages](../../../user/packages/generic_packages/index.md) | **Yes** (13.5) | [No](https://gitlab.com/groups/gitlab-org/-/epics/1817) | Via Object Storage provider if supported. Native Geo support (Beta). | Behind feature flag `geo_package_file_replication`, enabled by default | | [Versioned Terraform State](../../terraform_state.md) | **Yes** (13.5) | No | Via Object Storage provider if supported. Native Geo support (Beta). | Behind feature flag `geo_terraform_state_version_replication`, enabled by default | | [External merge request diffs](../../merge_request_diffs.md) | [No](https://gitlab.com/gitlab-org/gitlab/-/issues/33817) | No | Via Object Storage provider if supported. Native Geo support (Beta). | | | [Versioned snippets](../../../user/snippets.md#versioned-snippets) | [No](https://gitlab.com/groups/gitlab-org/-/epics/2809) | [No](https://gitlab.com/groups/gitlab-org/-/epics/2810) | No | | diff --git a/doc/administration/instance_limits.md b/doc/administration/instance_limits.md index 162fb2068c1..c25390e5f98 100644 --- a/doc/administration/instance_limits.md +++ b/doc/administration/instance_limits.md @@ -556,6 +556,9 @@ Plan.default.actual_limits.update!(pypi_max_file_size: 100.megabytes) # For Debian Packages Plan.default.actual_limits.update!(debian_max_file_size: 100.megabytes) + +# For Generic Packages +Plan.default.actual_limits.update!(generic_packages_max_file_size: 100.megabytes) ``` Set the limit to `0` to allow any file size. diff --git a/doc/administration/packages/index.md b/doc/administration/packages/index.md index 6d841d47caf..0b3a7ae9fa5 100644 --- a/doc/administration/packages/index.md +++ b/doc/administration/packages/index.md @@ -21,6 +21,7 @@ The Packages feature allows GitLab to act as a repository for the following: | [Maven Repository](../../user/packages/maven_repository/index.md) | The GitLab Maven Repository enables every project in GitLab to have its own space to store [Maven](https://maven.apache.org/) packages. | 11.3+ | | [NPM Registry](../../user/packages/npm_registry/index.md) | The GitLab NPM Registry enables every project in GitLab to have its own space to store [NPM](https://www.npmjs.com/) packages. | 11.7+ | | [Go Proxy](../../user/packages/go_proxy/index.md) | The Go proxy for GitLab enables every project in GitLab to be fetched with the [Go proxy protocol](https://proxy.golang.org/). | 13.1+ | +| [Generic packages](../../user/packages/generic_packages/index.md) | Store arbitrary files, like release binaries. | 13.5+ | Don't you see your package management system supported yet? Please consider contributing diff --git a/doc/api/README.md b/doc/api/README.md index c3605db16eb..c501471ebc7 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -167,6 +167,7 @@ to authenticate with the API: - [NPM Repository](../user/packages/npm_registry/index.md#authenticating-with-a-ci-job-token) - [Nuget Repository](../user/packages/nuget_repository/index.md) - [PyPI Repository](../user/packages/pypi_repository/index.md#using-gitlab-ci-with-pypi-packages) + - [Generic packages](../user/packages/generic_packages/index.md#publish-a-generic-package-by-using-cicd) - [Get job artifacts](job_artifacts.md#get-job-artifacts) - [Pipeline triggers](pipeline_triggers.md) (via `token=` parameter) - [Release creation](releases/index.md#create-a-release) diff --git a/doc/development/packages.md b/doc/development/packages.md index 9504d5802c3..9eae99ff890 100644 --- a/doc/development/packages.md +++ b/doc/development/packages.md @@ -64,15 +64,16 @@ will have to be managed. Using instance level endpoints requires [stricter namin The current state of existing package registries availability is: -| Repository Type | Project Level | Group Level | Instance Level | -|-----------------|---------------|-------------|----------------| -| Maven | Yes | Yes | Yes | -| Conan | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/11679) | Yes | -| NPM | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/36853) | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/36853) | -| NuGet | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/36423) | No | -| PyPI | Yes | No | No | -| Go | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/213900) | No - [open-issue](https://gitlab.com/gitlab-org/gitlab/-/issues/213902) | -| Composer | Yes | Yes | No | +| Repository Type | Project Level | Group Level | Instance Level | +|------------------|---------------|-------------|----------------| +| Maven | Yes | Yes | Yes | +| Conan | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/11679) | Yes | +| NPM | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/36853) | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/36853) | +| NuGet | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/36423) | No | +| PyPI | Yes | No | No | +| Go | Yes | No - [open issue](https://gitlab.com/gitlab-org/gitlab/-/issues/213900) | No - [open-issue](https://gitlab.com/gitlab-org/gitlab/-/issues/213902) | +| Composer | Yes | Yes | No | +| Generic | Yes | No | No | NOTE: **Note:** NPM is currently a hybrid of the instance level and group level. diff --git a/doc/install/installation.md b/doc/install/installation.md index 7c202c0cdff..5421800ac39 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -69,7 +69,6 @@ of this page: maintained for all projects. **This area contains critical data for projects. [Keep a backup](../raketasks/backup_restore.md).** -NOTE: **Note:** The default locations for repositories can be configured in `config/gitlab.yml` of GitLab and `config.yml` of GitLab Shell. @@ -101,8 +100,9 @@ apt-get upgrade -y apt-get install sudo -y ``` -NOTE: **Note:** -During this installation, some files need to be edited manually. If you are familiar with vim, set it as default editor with the commands below. If you are not familiar with vim, skip this and keep using the default editor. +During this installation, some files need to be edited manually. If you are familiar +with vim, set it as default editor with the commands below. If you are not familiar +with vim, skip this and keep using the default editor: ```shell # Install vim and set as default editor @@ -122,15 +122,13 @@ sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdb Ubuntu 14.04 (Trusty Tahr) doesn't have the `libre2-dev` package available, but you can [install re2 manually](https://github.com/google/re2/wiki/Install). -If you want to use Kerberos for user authentication, install `libkrb5-dev`: +If you want to use Kerberos for user authentication, install `libkrb5-dev` +(if you don't know what Kerberos is, you can assume you don't need it): ```shell sudo apt-get install libkrb5-dev ``` -NOTE: **Note:** -If you don't know what Kerberos is, you can assume you don't need it. - Make sure you have the right version of Git installed: ```shell @@ -202,8 +200,11 @@ needs to be installed. sudo apt-get install -y graphicsmagick ``` -NOTE: **Note:** -In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 but this [has problems](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/12754) while Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with: +In order to receive mail notifications, make sure to install a mail server. +By default, Debian is shipped with `exim4` but this +[has problems](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/12754) while +Ubuntu does not ship with one. The recommended mail server is `postfix` and you +can install it with: ```shell sudo apt-get install -y postfix @@ -221,10 +222,8 @@ sudo apt-get install -y libimage-exiftool-perl ## 2. Ruby The Ruby interpreter is required to run GitLab. - -NOTE: **Note:** -The current supported Ruby (MRI) version is 2.6.x. GitLab 12.2 -dropped support for Ruby 2.5.x. +See the [requirements page](requirements.md#ruby-versions) for the minimum +Ruby requirements. The use of Ruby version managers such as [RVM](https://rvm.io/), [rbenv](https://github.com/rbenv/rbenv) or [chruby](https://github.com/postmodern/chruby) with GitLab in production, frequently leads to hard to diagnose problems. Version managers @@ -410,7 +409,6 @@ Starting from GitLab 12.1, only PostgreSQL is supported. Since GitLab 13.0, we [ ## 7. Redis -NOTE: **Note:** See the [requirements page](requirements.md#redis-versions) for the minimum Redis requirements. @@ -555,11 +553,9 @@ sudo -u git -H cp config/resque.yml.example config/resque.yml sudo -u git -H editor config/resque.yml ``` -CAUTION: **Caution:** Make sure to edit both `gitlab.yml` and `puma.rb` to match your setup. If you want to use the Unicorn web server, see [Using Unicorn](#using-unicorn) for the additional steps. -NOTE: **Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps. ### Configure GitLab DB Settings @@ -599,13 +595,13 @@ Make sure you have `bundle` (run `bundle -v`): - `>= 1.5.2`, because some [issues](https://devcenter.heroku.com/changelog-items/411) were [fixed](https://github.com/rubygems/bundler/pull/2817) in 1.5.2. - `< 2.x`. +Install the gems (if you want to use Kerberos for user authentication, omit +`kerberos` in the `--without` option below): + ```shell sudo -u git -H bundle install --deployment --without development test mysql aws kerberos ``` -NOTE: **Note:** -If you want to use Kerberos for user authentication, omit `kerberos` in the `--without` option above. - ### Install GitLab Shell GitLab Shell is an SSH access and repository management software developed specially for GitLab. @@ -619,10 +615,8 @@ sudo -u git -H bundle exec rake gitlab:shell:install RAILS_ENV=production sudo -u git -H editor /home/git/gitlab-shell/config.yml ``` -NOTE: **Note:** If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional steps. -NOTE: **Note:** Make sure your hostname can be resolved on the machine itself by either a proper DNS record or an additional line in `/etc/hosts` ("127.0.0.1 hostname"). This might be necessary, for example, if you set up GitLab behind a reverse proxy. If the hostname cannot be resolved, the final installation check fails with `Check GitLab API access: FAILED. code: 401` and pushing commits are rejected with `[remote rejected] master -> master (hook declined)`. ### Install GitLab Workhorse @@ -641,7 +635,7 @@ You can specify a different Git repository by providing it as an extra parameter sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse,https://example.com/gitlab-workhorse.git]" RAILS_ENV=production ``` -### Install GitLab-Elasticsearch-indexer on Enterprise Edition +### Install GitLab-Elasticsearch-indexer on Enterprise Edition **(STARTER ONLY)** GitLab-Elasticsearch-Indexer uses [GNU Make](https://www.gnu.org/software/make/). The following command-line installs GitLab-Elasticsearch-Indexer in `/home/git/gitlab-elasticsearch-indexer` @@ -660,9 +654,6 @@ sudo -u git -H bundle exec rake "gitlab:indexer:install[/home/git/gitlab-elastic The source code first is fetched to the path specified by the first parameter. Then a binary is built under its `bin` directory. You then need to update `gitlab.yml`'s `production -> elasticsearch -> indexer_path` setting to point to that binary. -NOTE: **Note:** -Elasticsearch is a feature of GitLab Enterprise Edition and isn't included in GitLab Community Edition. - ### Install GitLab Pages GitLab Pages uses [GNU Make](https://www.gnu.org/software/make/). This step is optional and only needed if you wish to host static sites from within GitLab. The following commands install GitLab Pages in `/home/git/gitlab-pages`. For additional setup steps, consult the [administration guide](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/administration/pages/source.md) for your version of GitLab as the GitLab Pages daemon can be run several different ways. @@ -729,8 +720,7 @@ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes # When done, you see 'Administrator account created:' ``` -NOTE: **Note:** -You can set the Administrator/root password and e-mail by supplying them in environmental variables, `GITLAB_ROOT_PASSWORD` and `GITLAB_ROOT_EMAIL` respectively, as seen below. If you don't set the password (and it is set to the default one), wait to expose GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login, you'll be forced to change the default password. An Enterprise Edition license may also be installed at this time by supplying a full path in the `GITLAB_LICENSE_FILE` environment variable. +You can set the Administrator/root password and email by supplying them in environmental variables, `GITLAB_ROOT_PASSWORD` and `GITLAB_ROOT_EMAIL` respectively, as seen below. If you don't set the password (and it is set to the default one), wait to expose GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login, you'll be forced to change the default password. An Enterprise Edition license may also be installed at this time by supplying a full path in the `GITLAB_LICENSE_FILE` environment variable. ```shell sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail GITLAB_LICENSE_FILE="/path/to/license" @@ -807,7 +797,6 @@ sudo /etc/init.d/gitlab restart ## 9. NGINX -NOTE: **Note:** NGINX is the officially supported web server for GitLab. If you cannot or do not want to use NGINX as your web server, see [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/). ### Installation @@ -844,7 +833,6 @@ If you intend to enable GitLab Pages, there is a separate NGINX config you need to use. Read all about the needed configuration at the [GitLab Pages administration guide](../administration/pages/index.md). -NOTE: **Note:** If you want to use HTTPS, replace the `gitlab` NGINX config with `gitlab-ssl`. See [Using HTTPS](#using-https) for HTTPS configuration details. ### Test Configuration @@ -857,10 +845,18 @@ sudo nginx -t You should receive `syntax is okay` and `test is successful` messages. If you receive errors check your `gitlab` or `gitlab-ssl` NGINX config file for typos, etc. as indicated in the error message given. -NOTE: **Note:** -Verify that the installed version is greater than 1.12.1 by running `nginx -v`. If it's lower, you may receive the error below: -`nginx: [emerg] unknown "start$temp=[filtered]$rest" variable -nginx: configuration file /etc/nginx/nginx.conf test failed` +Verify that the installed version is greater than 1.12.1: + +```shell +nginx -v +``` + +If it's lower, you may receive the error below: + +```plaintext +nginx: [emerg] unknown "start$temp=[filtered]$rest" variable +nginx: configuration file /etc/nginx/nginx.conf test failed +``` ### Restart @@ -880,7 +876,8 @@ sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production If all items are green, congratulations on successfully installing GitLab! -NOTE: Supply `SANITIZE=true` environment variable to `gitlab:check` to omit project names from the output of the check command. +TIP: **Tip:** +Supply the `SANITIZE=true` environment variable to `gitlab:check` to omit project names from the output of the check command. ### Initial Login diff --git a/doc/user/packages/generic_packages/index.md b/doc/user/packages/generic_packages/index.md new file mode 100644 index 00000000000..948c92fc2fc --- /dev/null +++ b/doc/user/packages/generic_packages/index.md @@ -0,0 +1,139 @@ +--- +stage: Package +group: Package +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers +--- + +# GitLab Generic Packages Repository **(CORE)** + +> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/4209) in GitLab 13.5. +> - It's [deployed behind a feature flag](../../../user/feature_flags.md), disabled by default. +> - It's disabled on GitLab.com. +> - It's able to be enabled or disabled per-project. +> - It's not recommended for production use. +> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-generic-packages-in-the-package-registry). + +CAUTION: **Warning:** +This feature might not be available to you. Check the **version history** note above for details. + +Publish generic files, like release binaries, in your project’s Package Registry. Then, install the packages whenever you need to use them as a dependency. + +## Authenticate to the Package Registry + +To authenticate to the Package Registry, you need either a [personal access token](../../../api/README.md#personalproject-access-tokens) +or [CI job token](../../../api/README.md#gitlab-ci-job-token). + +## Publish a package file + +When you publish a package file, if the package does not exist, it is created. + +Prerequisites: + +- You need to [authenticate with the API](../../../api/README.md#authentication). + +```plaintext +PUT /projects/:id/packages/generic/:package_name/:package_version/:file_name +``` + +| Attribute | Type | Required | Description | +| -------------------| --------------- | ---------| -------------------------------------------------------------------------------------------------------------------------------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../../../api/README.md#namespaced-path-encoding). | +| `package_name` | string | yes | The package name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), or underscores (`_`). +| `package_version` | string | yes | The package version. It can contain only numbers (`0-9`), and dots (`.`). Must be in the format of `X.Y.Z`, i.e. should match `/\A\d+\.\d+\.\d+\z/` regular expresion. +| `file_name` | string | yes | The file name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), or underscores (`_`). + +Provide the file context in the request body. + +Example request: + +```shell +curl --header "PRIVATE-TOKEN: " \ + --upload-file path/to/file.txt \ + https://gitlab.example.com/api/v4/projects/24/generic/my_package/0.0.1/file.txt +``` + +Example response: + +```json +{ + "message":"201 Created" +} +``` + +## Download package file + +Install a package file. + +Prerequisites: + +- You need to [authenticate with the API](../../../api/README.md#authentication). + +```plaintext +GET /projects/:id/packages/generic/:package_name/:package_version/:file_name +``` + +| Attribute | Type | Required | Description | +| -------------------| --------------- | ---------| ------------------------------------------------------------------------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../../../api/README.md#namespaced-path-encoding). | +| `package_name` | string | yes | The package name. | +| `package_version` | string | yes | The package version. | +| `file_name` | string | yes | The file name. | + +The file context is served in the response body. The response content type will be `application/octet-stream`. + +Example request that uses a personal access token: + +```shell +curl --header "PRIVATE-TOKEN: " \ + https://gitlab.example.com/api/v4/projects/24/generic/my_package/0.0.1/file.txt +``` + +## Publish a generic package by using CI/CD + +To work with generic packages in [GitLab CI/CD](./../../../ci/README.md), you can use +`CI_JOB_TOKEN` in place of the personal access token in your commands. + +For example: + +```yaml +image: curlimages/curl:latest + +stages: + - upload + - download + +upload: + stage: upload + script: + - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file path/to/file.txt ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt' + +download: + stage: download + script: + - 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt' +``` + +### Enable or disable generic packages in the Package Registry + +Support for generic packages is under development and not ready for production use. It is +deployed behind a feature flag that is **disabled by default**. +[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md) +can enable it. + +To enable it: + +```ruby +# For the instance +Feature.enable(:generic_packages) +# For a single project +Feature.enable(:generic_packages, Project.find()) +``` + +To disable it: + +```ruby +# For the instance +Feature.disable(:generic_packages) +# For a single project +Feature.disable(:generic_packages, Project.find()) +``` diff --git a/doc/user/packages/index.md b/doc/user/packages/index.md index 92d31c31986..53ba3d01b3e 100644 --- a/doc/user/packages/index.md +++ b/doc/user/packages/index.md @@ -23,6 +23,7 @@ The Package Registry supports the following formats: NPM11.7+ NuGet12.8+ PyPI12.10+ +Generic packages13.5+
diff --git a/doc/user/packages/package_registry/index.md b/doc/user/packages/package_registry/index.md index c4c00f39bae..ae9ca5b2333 100644 --- a/doc/user/packages/package_registry/index.md +++ b/doc/user/packages/package_registry/index.md @@ -31,7 +31,7 @@ authenticate with GitLab by using the `CI_JOB_TOKEN`. CI/CD templates, which you can use to get started, are in [this repo](https://gitlab.com/gitlab-org/gitlab/-/tree/master/lib/gitlab/ci/templates). -Learn more about [using CI/CD to build Maven packages](../maven_repository/index.md#creating-maven-packages-with-gitlab-cicd), [NPM packages](../npm_registry/index.md#publishing-a-package-with-cicd), [Composer packages](../composer_repository/index.md#publish-a-composer-package-by-using-cicd), [NuGet Packages](../nuget_repository/index.md#publishing-a-nuget-package-with-cicd), [Conan Packages](../conan_repository/index.md#publish-a-conan-package-by-using-cicd), and [PyPI packages](../pypi_repository/index.md#using-gitlab-ci-with-pypi-packages). +Learn more about [using CI/CD to build Maven packages](../maven_repository/index.md#creating-maven-packages-with-gitlab-cicd), [NPM packages](../npm_registry/index.md#publishing-a-package-with-cicd), [Composer packages](../composer_repository/index.md#publish-a-composer-package-by-using-cicd), [NuGet Packages](../nuget_repository/index.md#publishing-a-nuget-package-with-cicd), [Conan Packages](../conan_repository/index.md#publish-a-conan-package-by-using-cicd), [PyPI packages](../pypi_repository/index.md#using-gitlab-ci-with-pypi-packages), and [generic packages](../generic_packages/index.md#publish-a-generic-package-by-using-cicd). If you use CI/CD to build a package, extended activity information is displayed when you view the package details: diff --git a/lib/api/helpers/presentable.rb b/lib/api/helpers/presentable.rb index f05467ba40b..40e1b266df5 100644 --- a/lib/api/helpers/presentable.rb +++ b/lib/api/helpers/presentable.rb @@ -23,7 +23,7 @@ module API def initialize(object, options = {}) options = options.opts_hash if options.is_a?(Grape::Entity::Options) - super(object.present(options), **options) + super(object.present(**options), options) end end end diff --git a/lib/gitlab/view/presenter/factory.rb b/lib/gitlab/view/presenter/factory.rb index 302697ff8eb..5768bab03c6 100644 --- a/lib/gitlab/view/presenter/factory.rb +++ b/lib/gitlab/view/presenter/factory.rb @@ -10,7 +10,7 @@ module Gitlab end def fabricate! - presenter_class.new(subject, attributes) + presenter_class.new(subject, **attributes) end private