From 2ef8770b2b9dad8a7336e19c7997776a8c0cf6bf Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Wed, 19 Jun 2019 11:28:03 -0400 Subject: [PATCH] Put workspace_settings on payload --- lib/travis/scheduler/serialize/worker.rb | 7 +++++++ spec/travis/scheduler/serialize/worker_spec.rb | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/travis/scheduler/serialize/worker.rb b/lib/travis/scheduler/serialize/worker.rb index c2107d28..a1f095a5 100644 --- a/lib/travis/scheduler/serialize/worker.rb +++ b/lib/travis/scheduler/serialize/worker.rb @@ -25,6 +25,7 @@ def data ssh_key: ssh_key.data, timeouts: repo.timeouts, cache_settings: cache_settings, + workspace_settings: workspace_settings, enterprise: !!config[:enterprise], prefer_https: !!config[:prefer_https] } @@ -138,6 +139,12 @@ def cache_config config[:cache_settings] || {} end + def workspace_settings + if (ws_config = config[:workspace_settings] || {}) && ws_config.key?(job.queue) + config[:workspace_settings][job.queue].to_h + end + end + def format_date(date) date && date.strftime('%Y-%m-%dT%H:%M:%SZ') end diff --git a/spec/travis/scheduler/serialize/worker_spec.rb b/spec/travis/scheduler/serialize/worker_spec.rb index 97d4f199..012cae93 100644 --- a/spec/travis/scheduler/serialize/worker_spec.rb +++ b/spec/travis/scheduler/serialize/worker_spec.rb @@ -13,7 +13,7 @@ def encrypted(value) let(:repo) { FactoryGirl.create(:repo, default_branch: 'branch') } let(:owner) { repo.owner } let(:data) { described_class.new(job, config).data } - let(:config) { { cache_settings: { 'builds.gce' => s3 }, github: { source_host: 'github.com', api_url: 'https://api.github.com' }, vm_configs: {} } } + let(:config) { { cache_settings: { 'builds.gce' => s3 }, workspace_settings: { 'builds.gce' => s3 }, github: { source_host: 'github.com', api_url: 'https://api.github.com' }, vm_configs: {} } } let(:s3) { { access_key_id: 'ACCESS_KEY_ID', secret_access_key: 'SECRET_ACCESS_KEY', bucket_name: 'bucket' } } let(:event) { 'push' } let(:ref) { 'refs/tags/v1.2.3' } @@ -97,6 +97,7 @@ def encrypted(value) log_silence: 20 * 60 }, cache_settings: s3, + workspace_settings: s3, prefer_https: false, enterprise: false ) @@ -266,6 +267,7 @@ def encrypted(value) log_silence: 20 * 60 }, cache_settings: s3, + workspace_settings: s3, prefer_https: false, enterprise: false ) @@ -335,4 +337,3 @@ def encrypted(value) end end end -