Skip to content

Commit

Permalink
Put workspace_settings on payload
Browse files Browse the repository at this point in the history
  • Loading branch information
BanzaiMan committed Jun 19, 2019
1 parent 6dcae98 commit 2ef8770
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/travis/scheduler/serialize/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions spec/travis/scheduler/serialize/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }
Expand Down Expand Up @@ -97,6 +97,7 @@ def encrypted(value)
log_silence: 20 * 60
},
cache_settings: s3,
workspace_settings: s3,
prefer_https: false,
enterprise: false
)
Expand Down Expand Up @@ -266,6 +267,7 @@ def encrypted(value)
log_silence: 20 * 60
},
cache_settings: s3,
workspace_settings: s3,
prefer_https: false,
enterprise: false
)
Expand Down Expand Up @@ -335,4 +337,3 @@ def encrypted(value)
end
end
end

0 comments on commit 2ef8770

Please sign in to comment.