From 1e324dfdcc47f83ecc613ec8faaf9e378a808bfb Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 1 Jul 2018 08:57:41 +0100 Subject: Fix the FetchRevisionJob to better handle remote hosts --- app/controllers/govuk_guix/revisions_controller.rb | 2 +- app/jobs/govuk_guix/fetch_revision_job.rb | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/govuk_guix/revisions_controller.rb b/app/controllers/govuk_guix/revisions_controller.rb index 17634dd..14a3161 100644 --- a/app/controllers/govuk_guix/revisions_controller.rb +++ b/app/controllers/govuk_guix/revisions_controller.rb @@ -34,7 +34,7 @@ class GovukGuix::RevisionsController < ApplicationController backend = Backends::TerraformAws.first options = { - run_remotely_on_host: backend.build_remote_host + backend_type_and_id: backend.type_and_id } end diff --git a/app/jobs/govuk_guix/fetch_revision_job.rb b/app/jobs/govuk_guix/fetch_revision_job.rb index 8d77761..63a1f04 100644 --- a/app/jobs/govuk_guix/fetch_revision_job.rb +++ b/app/jobs/govuk_guix/fetch_revision_job.rb @@ -25,9 +25,14 @@ class GovukGuix::FetchRevisionJob < Que::Job @retry_interval = 30 def run(commit_hash, options = {}) - remote_host = options[:run_remotely_on_host] + backend_type_and_id = options[:backend_type_and_id] + if backend_type_and_id + remote_host = Backends.find_by_type_and_id( + *backend_type_and_id.split('=') + ).build_remote_host + end - fetch_and_checkout(commit_hash, remote_host) + sha = fetch_and_checkout(commit_hash, remote_host) command = [ "#{@repository_directory}/guix-pre-inst-env", @@ -99,6 +104,8 @@ class GovukGuix::FetchRevisionJob < Que::Job repository.checkout(sha) end + + return sha end def available_services(store_path) -- cgit v1.2.3