Add package metadata OCI source settings

What does this MR do?

In GitLab 19.7 and later, GitLab can sync its package metadata from an OCI registry, such as a mirror inside an offline environment. The package_metadata.oci section of gitlab.yml configures it. gitlab!271771 adds the keys, and gitlab!271785 adds the connector that reads them, and gitlab!271788 switches the sync to it. The Linux package renders gitlab.yml from gitlab.rb and has no key for that section.

This MR adds gitlab_rails['package_metadata_oci'], a hash with four keys:

  • url: the registry address plus an optional repository prefix. Setting it turns the source on.
  • username: optional. Omit it to pull anonymously.
  • password_file: path to a file with the password. Needed with username, and readable by git but not world-readable. The package does not create the file.
  • token_hosts: optional list of other hosts that may receive the credentials, for a registry whose token service runs elsewhere. An entry is host or host:port, always over HTTPS, and the port defaults to 443.
gitlab_rails['package_metadata_oci'] = {
  'url' => 'https://registry.example.com/pmdb',
  'username' => 'pmdb-reader',
  'password_file' => '/etc/gitlab/package-metadata/oci-password',
  'token_hosts' => ['auth.example.com']
}

Without url, no package_metadata section is rendered. The wiring follows nats and artifact_registry. The setting has no effect until a GitLab release includes gitlab!271788. The chart equivalent is gitlab-org/charts/gitlab!5618.

Related to #10244

How I checked it

  • ChefSpec: all of spec/chef/cookbooks/gitlab/recipes/gitlab-rails_spec.rb passes, including new cases for the default (no block), url only, all four keys, token_hosts given as a string, and credentials without url (no block).
  • RuboCop on the changed Ruby files.
  • A sample gitlab.rb rendered through the template gives:
package_metadata:
  oci:
    url: https://registry.example.com/pmdb
    username: pmdb-reader
    password_file: /etc/gitlab/package-metadata/oci-password
    token_hosts:
    - auth.example.com

An AI coding assistant wrote this change. The assistant also checked each described behavior against the code in gitlab!271771 and gitlab!271788, ran the ChefSpec file and RuboCop on a test VM, rendered the sample gitlab.rb there, and ran Vale and markdownlint on the new documentation page.

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • MR title and description are up to date, accurate, and descriptive.
  • MR targeting the appropriate branch.
  • Latest Merge Result pipeline is green.
  • When ready for review, MR is marked as ready (not a draft) and a reviewer is requested. Pick the reviewer suggested by the reviewer roulette, or one of the project maintainers.

For GitLab team members

If you don't have access to this, the reviewer should trigger these jobs for you during the review process.

  • The manual Trigger:ee-package jobs have a green pipeline running against latest commit.
  • If config/software or config/patches directories are changed, make sure the build-package-on-all-os job within the Trigger:ee-package downstream pipeline succeeded. Not applicable: neither directory changes.
  • If you are changing anything SSL related, then the Trigger:package:fips manual job within the Trigger:ee-package downstream pipeline must succeed. Not applicable: nothing here is SSL related.
  • If CI configuration is changed, the branch must be pushed to dev.gitlab.org to confirm regular branch builds aren't broken. Not applicable: CI configuration does not change.

Expected (please provide an explanation if not completing)

  • Test plan indicating conditions for success has been posted and passes. See "How I checked it".
  • Documentation created/updated.
  • Tests added.
  • Integration tests added to GitLab QA. Not added: the change only renders configuration, and the ChefSpec cases cover the rendering.
  • Equivalent MR/issue for the GitLab Chart opened. gitlab-org/charts/gitlab!5618
  • Validate potential values for new configuration settings. The block renders as JSON, so URLs and paths need no quoting.

Reviewer checklist

  • As soon as you begin reviewing, select Start a review on your first comment so the MR shows Reviewer started review.
Edited by Andrew Dunn

Merge request reports

Loading
Loading