diff options
author | Christopher Baines <mail@cbaines.net> | 2018-05-03 21:44:06 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2018-05-03 21:44:06 +0100 |
commit | fc1e5260603ff0f6030c4aed7874c8ea3b532e5c (patch) | |
tree | f2ae0482f4d60bb0a76328cee0c03dece172bb9d /app/jobs/govuk_guix/build_job.rb | |
parent | 807c10c5652423be96d125a502be222aa8d80119 (diff) | |
download | govuk-mini-environment-admin-fc1e5260603ff0f6030c4aed7874c8ea3b532e5c.tar govuk-mini-environment-admin-fc1e5260603ff0f6030c4aed7874c8ea3b532e5c.tar.gz |
Improve the AWS backend
This gets the AWS backend to the point where you can deploy the
backend, and then a mini environment without any actions outside of
the govuk-mini-environment-admin.
Diffstat (limited to 'app/jobs/govuk_guix/build_job.rb')
-rw-r--r-- | app/jobs/govuk_guix/build_job.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/app/jobs/govuk_guix/build_job.rb b/app/jobs/govuk_guix/build_job.rb index a74b928..fb5e256 100644 --- a/app/jobs/govuk_guix/build_job.rb +++ b/app/jobs/govuk_guix/build_job.rb @@ -27,22 +27,40 @@ class GovukGuix::BuildJob < GovukGuix::Job @retry_interval = 30 - def run(mini_environment_id, services, arguments) + def run(mini_environment_id, options) logger.info(self.class) do "Building mini environment #{mini_environment_id}" end mini_environment = MiniEnvironment.find(mini_environment_id) + remote_host = options[:run_remotely_on_host] + + if remote_host + ssh_command = ['ssh', remote_host] + + # Copy the revision to the remote host, to ensure it's available + # there + run_command( + 'guix', + 'copy', + "--to=#{remote_host}", + mini_environment.govuk_guix_revision.store_path + ) + else + ssh_command = [] + end + output = run_command( + *ssh_command, "#{mini_environment.govuk_guix_revision.store_path}/bin/govuk", 'system', 'build', *hash_to_arguments( - DEFAULT_ARGUMENTS.merge(arguments) + DEFAULT_ARGUMENTS.merge(options[:arguments]) ), *signon_user_arguments(mini_environment.signon_users), - *services + *options[:services] ) build_output = output.last.strip @@ -69,7 +87,7 @@ class GovukGuix::BuildJob < GovukGuix::Job def signon_user_arguments(signon_users) signon_users.map do |signon_user| - "--signon-user=#{signon_user_to_sexp(signon_user)}" + "--signon-user='#{signon_user_to_sexp(signon_user)}'" end end |