diff options
Diffstat (limited to 'app/models/backends/terraform_aws/backend_methods.rb')
-rw-r--r-- | app/models/backends/terraform_aws/backend_methods.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/models/backends/terraform_aws/backend_methods.rb b/app/models/backends/terraform_aws/backend_methods.rb index cc5ca62..d6665a1 100644 --- a/app/models/backends/terraform_aws/backend_methods.rb +++ b/app/models/backends/terraform_aws/backend_methods.rb @@ -80,6 +80,28 @@ module Backends::TerraformAws::BackendMethods end end + def in_use_store_paths + [ + GovukGuix::Revision.pluck(:store_path), + available_data_snapshots.pluck(:store_path), + mini_environments.pluck(:backend_data).map { |x| x&.dig('build_output') } + ].flatten.compact + end + + def update_guix_gcroots + GovukGuix::UpdateGcrootsDirectory.set_in_use_store_paths( + in_use_store_paths, + run_remotely_on_host: build_remote_host + ) + end + + def add_in_use_store_path(store_path) + GovukGuix::UpdateGcrootsDirectory.add_store_path( + store_path, + run_remotely_on_host: build_remote_host + ) + end + def within_backend_terraform_working_directory(&block) with_advisory_lock( "terraform" |