Unified Backups: Load SourceContext from configuration data
What does this MR do and why?
This Merge Request decouple the following entries in SourceContext
from the main rails codebase:
-
gitlab_version
-
backup_basedir
-
ci_builds_path
-
ci_job_artifact_path
-
ci_secure_files_path
-
ci_lfs_path
-
packages_path
-
pages_path
-
registry_path
-
terraform_state_path
-
upload_path
-
env
Context
The gitlab.yml
configuration files includes a lot of deprecated (yet still supported) ways to configure things. Some of the defaults (when missing) or some of the fallbacks are implemented via config/initializers/1_settings.rb
file.
Here is an example of the Builds Artifacts: https://gitlab.com/gitlab-org/gitlab/-/blob/454530-unified-backups-load-rails-context-from-data/config/initializers/1_settings.rb#L295-304
Settings.artifacts['storage_path'] = Settings.absolute(Settings.artifacts.values_at('path', 'storage_path').compact.first || File.join(Settings.shared['path'], "artifacts"))
# Settings.artifact['path'] is deprecated, use `storage_path` instead
It claims to prefer storage_path
but it will use path
if present, and still have the shared/artifacts
fallback.
While in the case of CI secure_files we have storage_path
as the preferred value, a fallback to shared
folder without a path
fallback:
Settings.ci_secure_files['storage_path'] = Settings.absolute(Settings.ci_secure_files['storage_path'] || File.join(Settings.shared['path'], "ci_secure_files"))
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Related to #454530 (closed)