GitLab Package Registry administration

GitLab Package Registry administration

GitLab 软件包允许组织将 GitLab 用作各种常见软件包管理器的私有存储库. 用户能够构建和发布程序包,这些程序包可以很容易地作为下游项目中的依赖项使用.

软件包功能允许 GitLab 充当以下内容的存储库:

您没有看到您的包裹管理系统受支持吗? 请考虑为 GitLab 做贡献. 此将指导您完成该过程.

注意:启用”软件包”功能后,默认情况下,存储库可用于所有新项目. 要为现有项目启用它,用户将必须在项目的设置中明确启用它.

要启用包功能:

所有装置 GitLab

  1. 编辑并添加以下行:

  2. 保存文件并重新配置 GitLab,以使更改生效.

从源安装

    1. packages:
    2. enabled: true
  1. 以使更改生效.

Changing the storage path

默认情况下,程序包存储在本地,但是您可以更改默认的本地位置,甚至使用对象存储.

用于 Omnibus GitLab 安装的软件包存储在/var/opt/gitlab/gitlab-rails/shared/packages/而用于源安装的shared/packages/shared/packages/ (相对于 Git 主目录). 更改本地存储路径:

所有装置 GitLab

  1. 编辑/etc/gitlab/gitlab.rb并添加以下行:

从源安装

  1. 编辑config/gitlab.ymlpackages部分:

    1. packages:
    2. enabled: true
  2. 保存文件并以使更改生效.

Read more about using object storage with GitLab.

注意:我们建议使用 . 以下说明适用于原始配置格式.

Omnibus GitLab installations

  1. 编辑/etc/gitlab/gitlab.rb并添加以下行(必要时取消注释):

  2. 保存文件并重新配置 GitLab,以使更改生效.

从源安装

  1. 编辑config/gitlab.ymlpackages部分(必要时取消注释):

    1. packages:
    2. enabled: true
    3. ##
    4. ## The location where build packages are stored (default: shared/packages).
    5. ##
    6. #storage_path: shared/packages
    7. object_store:
    8. enabled: false
    9. remote_directory: packages # The bucket name.
    10. #direct_upload: false # Use Object Storage directly for uploads instead of background uploads if enabled (Default: false).
    11. connection:
    12. ##
    13. ## If the provider is AWS S3, uncomment the following
    14. ##
    15. #provider: AWS
    16. #region: us-east-1
    17. #aws_access_key_id: AWS_ACCESS_KEY_ID
    18. #aws_secret_access_key: AWS_SECRET_ACCESS_KEY
    19. ##
    20. ## If the provider is other than AWS (an S3-compatible one), uncomment the following
    21. ##
    22. #host: 's3.amazonaws.com' # default: s3.amazonaws.com.
    23. #aws_signature_version: 4 # For creation of signed URLs. Set to 2 if provider does not support v4.
    24. #endpoint: 'https://s3.amazonaws.com' # Useful for S3-compliant services such as DigitalOcean Spaces.
  2. 保存文件并以使更改生效.

配置对象存储后 ,您可以使用以下任务将现有程序包从本地存储迁移到远程存储. 该处理将在后台工作人员中完成, 无需停机 .

对于源安装:

  1. RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:packages:migrate