diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/source_context.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/source_context.rb index 437e4e1ec54cc774feac2ee14ad0733565731201..354f3068c7f463776ee6f69f4b92fd0ce96c501d 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/source_context.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/source_context.rb @@ -17,6 +17,60 @@ def backup_basedir # TODO: decouple from Rails codebase, load from gitlab.yml file Rails.root.join('tmp/backups') end + + # CI Builds basepath + def ci_builds_path + # TODO: Use configuration solver + Settings.gitlab_ci.builds_path + end + + # Job Artifacts basepath + def ci_job_artifacts_path + # TODO: Use configuration solver + JobArtifactUploader.root + end + + # CI Secure Files basepath + def ci_secure_files_path + # TODO: Use configuration solver + Settings.ci_secure_files.storage_path + end + + # CI LFS basepath + def ci_lfs_path + # TODO: Use configuration solver + Settings.lfs.storage_path + end + + # Packages basepath + def packages_path + # TODO: Use configuration solver + Settings.packages.storage_path + end + + # GitLab Pages basepath + def pages_path + # TODO: Use configuration solver + Gitlab.config.pages.path + end + + # Registry basepath + def registry_path + # TODO: Use configuration solver + Settings.registry.path + end + + # Terraform State basepath + def terraform_state_path + # TODO: Use configuration solver + Settings.terraform_state.storage_path + end + + # Upload basepath + def upload_path + # TODO: Use configuration solver + File.join(Gitlab.config.uploads.storage_path, 'uploads') + end end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/artifacts.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/artifacts.rb index 80620c536d42eae65eca10b32b3e585f57977f02..c3cf3d14dc63b492bd5a96a38973b246f4301f5a 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/artifacts.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/artifacts.rb @@ -17,10 +17,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options, excludes: ['tmp']) end - def storage_path - # TODO: Use configuration solver - JobArtifactUploader.root - end + def storage_path = context.ci_job_artifacts_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/builds.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/builds.rb index f2f75008fa974ca054931f54049d87b3ebe55fc1..b94f3848807199d6b44f531f2d41986faf67d5ba 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/builds.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/builds.rb @@ -17,10 +17,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options) end - def storage_path - # TODO: Use configuration solver - Settings.gitlab_ci.builds_path - end + def storage_path = context.ci_builds_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/ci_secure_files.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/ci_secure_files.rb index 7c4b7d8a2ca6a4d0c0bbe66187bc44d423b47f8a..55b7e44bf1dad802455d6aa38bd68c23b7facd2b 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/ci_secure_files.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/ci_secure_files.rb @@ -17,10 +17,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options, excludes: ['tmp']) end - def storage_path - # TODO: Use configuration solver - Settings.ci_secure_files.storage_path - end + def storage_path = context.ci_secure_files_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/lfs.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/lfs.rb index 3ed3d47baec5bd3f439d70e91265cd660dbb4f8c..256c43b71a37ad2a0920fd39ba21903dc75a1ff1 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/lfs.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/lfs.rb @@ -17,10 +17,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options) end - def storage_path - # TODO: Use configuration solver - Settings.lfs.storage_path - end + def storage_path = context.ci_lfs_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/packages.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/packages.rb index 398f93af0406d50f2777d0281fb9d2ea369d3200..227633ad90a398761da21367149a24633367b033 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/packages.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/packages.rb @@ -17,10 +17,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options, excludes: ['tmp']) end - def storage_path - # TODO: Use configuration solver - Settings.packages.storage_path - end + def storage_path = context.packages_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/pages.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/pages.rb index 4c44ab600b32eb3aa92015b097e93484ee4d0396..67816414f49c1b994facf46877904eea71fadd13 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/pages.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/pages.rb @@ -21,10 +21,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options, excludes: [LEGACY_PAGES_TMP_PATH]) end - def storage_path - # TODO: Use configuration solver - Gitlab.config.pages.path - end + def storage_path = context.pages_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/registry.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/registry.rb index ee90782ce54d400aba669a518278d88efe076ffa..60f77e2494cbdff3b69d5fc53d8184efa0a7094e 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/registry.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/registry.rb @@ -19,10 +19,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options) end - def storage_path - # TODO: Use configuration solver - Settings.registry.path - end + def storage_path = context.registry_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/terraform_state.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/terraform_state.rb index 8504fd19bd8ea54f00fc30a792c3ce0ffe2ed76d..f2eb31cd3de93e986aa6c557a16a85d21883ffe2 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/terraform_state.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/terraform_state.rb @@ -17,9 +17,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options, excludes: ['tmp']) end - def storage_path - Settings.terraform_state.storage_path - end + def storage_path = context.terraform_state_path end end end diff --git a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/uploads.rb b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/uploads.rb index 6ca765e3ad2d166b43bd5e1a1c34e2bd11e352c8..c081394a17b463cbdf049549f9a8b54aa5261b11 100644 --- a/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/uploads.rb +++ b/gems/gitlab-backup-cli/lib/gitlab/backup/cli/tasks/uploads.rb @@ -17,9 +17,7 @@ def target ::Backup::Targets::Files.new(nil, storage_path, options: options, excludes: ['tmp']) end - def storage_path - File.join(Gitlab.config.uploads.storage_path, 'uploads') - end + def storage_path = context.upload_path end end end