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 withusername, and readable bygitbut 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 ishostorhost: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 issues
Related to #10244
How I checked it
- ChefSpec: all of
spec/chef/cookbooks/gitlab/recipes/gitlab-rails_spec.rbpasses, including new cases for the default (no block),urlonly, all four keys,token_hostsgiven as a string, and credentials withouturl(no block). - RuboCop on the changed Ruby files.
- A sample
gitlab.rbrendered 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.comAn 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-packagejobs have a green pipeline running against latest commit.- To debug QA failures, refer to the Investigate QA failures section.
- If
config/softwareorconfig/patchesdirectories are changed, make sure thebuild-package-on-all-osjob within theTrigger:ee-packagedownstream pipeline succeeded. Not applicable: neither directory changes. - If you are changing anything SSL related, then the
Trigger:package:fipsmanual job within theTrigger:ee-packagedownstream pipeline must succeed. Not applicable: nothing here is SSL related. - If CI configuration is changed, the branch must be pushed to
dev.gitlab.orgto 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.