Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert PRD GPU Support #2095

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/travis/build/addons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
require 'travis/build/addons/hostname'
require 'travis/build/addons/hosts'
require 'travis/build/addons/mariadb'
require 'travis/build/addons/tensor_flow'
require 'travis/build/addons/blender'
require 'travis/build/addons/rethinkdb'
require 'travis/build/addons/postgresql'
require 'travis/build/addons/sauce_connect'
Expand Down
43 changes: 0 additions & 43 deletions lib/travis/build/addons/blender.rb

This file was deleted.

37 changes: 0 additions & 37 deletions lib/travis/build/addons/tensor_flow.rb

This file was deleted.

4 changes: 2 additions & 2 deletions lib/travis/build/data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def ssh_key?

def ssh_key
@ssh_key ||= if ssh_key = data[:ssh_key]
SshKey.new(ssh_key[:value], ssh_key[:source], ssh_key[:encoded])
SshKey.new(ssh_key[:value], ssh_key[:source], ssh_key[:encoded], ssh_key[:public_key])
elsif source_key = data[:config][:source_key]
SshKey.new(source_key, nil, true)
SshKey.new(source_key, nil, true, nil)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/travis/build/data/ssh_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Travis
module Build
class Data
class SshKey < Struct.new(:value, :source, :encoded)
class SshKey < Struct.new(:value, :source, :encoded, :public_key)
CUSTOM = %w(repository_settings travis_yaml)

def value
Expand Down
2 changes: 2 additions & 0 deletions lib/travis/vcs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def checkout(sh,data)

def defaults(server_type)
@provider_name = server_type
@provider_name = 'svn' if @provider_name == 'subversion'
"Travis::Vcs::#{provider_name.to_s.camelize}".constantize.defaults
rescue NameError
raise Travis::Build::UnknownServiceTypeError.new provider_name
Expand All @@ -57,6 +58,7 @@ def defaults(server_type)
private
def vcs(sh,data)
provider = data[:repository][:server_type] if data.key?(:repository)
provider = 'svn' if provider == 'subversion'
provider = provider_name unless provider
@provider_name = provider
"Travis::Vcs::#{provider.to_s.camelize}".constantize.new(sh,data)
Expand Down
9 changes: 0 additions & 9 deletions lib/travis/vcs/perforce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def self.defaults
def checkout
disable_interactive_auth
enable_longpaths if config[:os] == 'windows'
install_ssh_key if install_ssh_key?
write_netrc if write_netrc?
sh.newline

Expand All @@ -75,10 +74,6 @@ def enable_longpaths
#TODO ?
end

def install_ssh_key?
data.ssh_key?
end

def netrc
@netrc ||= Netrc.new(sh, data)
end
Expand All @@ -99,10 +94,6 @@ def delete_netrc
netrc.delete
end

def install_ssh_key
SshKey.new(sh, data).apply
end

def download_tarball
Tarball.new(sh, data).apply
end
Expand Down
35 changes: 31 additions & 4 deletions lib/travis/vcs/perforce/clone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,28 @@ def trace_command
def clone
sh.export 'P4USER', user, echo: true, assert: false
sh.export 'P4CHARSET', 'utf8', echo: false, assert: false
sh.export 'P4PASSWD', ticket, echo: false, assert: false
sh.export 'P4PORT', port, echo: false, assert: false
sh.export 'P4PORT', port, echo: false, assert: false
sh.cmd 'p4 trust -y'
if data[:repository][:vcs_type] == 'AssemblaRepository'
sh.cmd "echo $(p4 info | grep 'Server address:' | cut -d ' ' -f 3- 2>/dev/null)=#{user}:#{ticket} > /tmp/p4ticket", echo: false, assert: false
sh.export 'P4TICKETS', '/tmp/p4ticket', echo: false, assert: false
else
sh.export 'P4PASSWD', ticket, echo: false, assert: false
end

return clone_merge if vcs_pull_request?

sh.cmd "p4 #{p4_opt} client -S //#{dir}/#{checkout_ref} -o | p4 #{p4_opt} client -i"
sh.cmd "p4 #{p4_opt} sync -p"
end

def clone_merge
sh.cmd "p4 #{p4_opt} client -S //#{dir}/#{pull_request_base_branch} -o | p4 #{p4_opt} client -i"
sh.cmd "p4 #{p4_opt} sync -p"
sh.cmd "p4 #{p4_opt} merge //#{dir}/#{pull_request_head_branch}/... //#{dir}/#{pull_request_base_branch}/..."
sh.cmd "p4 #{p4_opt} resolve -am"
end

def p4_opt
'-v ssl.client.trust.name=1'
end
Expand Down Expand Up @@ -105,11 +120,11 @@ def port
end

def user
data[:sender_login]
data[:repository][:vcs_type] == 'AssemblaRepository' ? data.ssh_key.public_key : data[:sender_login]
end

def ticket
data[:build_token]
data[:build_token] || data.ssh_key.value
end

def config
Expand All @@ -119,6 +134,18 @@ def config
def assembla?
@assembla ||= data[:repository][:source_url].include? 'assembla'
end

def pull_request_head_branch
data.job[:pull_request_head_branch].shellescape if data.job[:pull_request_head_branch]
end

def pull_request_base_branch
data.job[:pull_request_base_ref].shellescape if data.job[:pull_request_base_ref]
end

def vcs_pull_request?
data.repository[:vcs_type].to_s == 'AssemblaRepository' && data.pull_request
end
end
end
end
Expand Down
38 changes: 38 additions & 0 deletions lib/travis/vcs/svn/clone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,37 @@ def trace_command
end

def clone
return clone_merge if vcs_pull_request?
sh.cmd "svn co #{source_url}#{clone_args} #{repository_name}", assert: false, retry: true
end

def checkout
return checkout_merge if vcs_pull_request?
sh.cmd "svn update -r #{checkout_ref}", timing: false
end

def clone_merge
target_args = ""
if pull_request_base_branch && pull_request_base_branch == 'trunk'
target_args << "/#{pull_request_base_branch}"
else
target_args << "/branches/#{pull_request_base_branch}" if pull_request_base_branch
end

sh.cmd "svn co #{source_url}#{target_args} #{repository_name}", assert: false, retry: true
end

def checkout_merge
source_args = ""
if pull_request_head_branch && pull_request_head_branch == 'trunk'
source_args << "/#{pull_request_head_branch}"
else
source_args << "/branches/#{pull_request_head_branch}" if pull_request_head_branch
end

sh.cmd "svn merge --non-interactive ^#{source_args}", timing: false
end

def checkout_ref
ref = if data.tag
tag
Expand All @@ -70,6 +94,8 @@ def clone_args
args = ""
if branch && branch == 'trunk'
args << "/#{branch}"
elsif data.tag
args << "/tags/#{tag}" if tag
else
args << "/branches/#{branch}" if branch
end
Expand All @@ -92,13 +118,25 @@ def tag
data.tag.shellescape if data.tag
end

def pull_request_head_branch
data.job[:pull_request_head_branch].shellescape if data.job[:pull_request_head_branch]
end

def pull_request_base_branch
data.job[:pull_request_base_ref].shellescape if data.job[:pull_request_base_ref]
end

def user
data[:sender_login]
end

def config
data.config
end

def vcs_pull_request?
data.repository[:vcs_type].to_s == 'AssemblaRepository' && data.pull_request
end
end
end
end
Expand Down
8 changes: 6 additions & 2 deletions lib/travis/vcs/svn/ssh_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ def apply
private

def key
data[:build_token]
data[:build_token] || data.ssh_key.value
end

def repository_name
repo_slug&.split('/').last
if assembla?
repo_slug&.gsub('/', '^')
else
repo_slug&.split('/').last
end
end

def repo_slug
Expand Down
29 changes: 0 additions & 29 deletions spec/build/addons/blender_spec.rb

This file was deleted.

25 changes: 0 additions & 25 deletions spec/build/addons/tensor_flow_spec.rb

This file was deleted.

9 changes: 9 additions & 0 deletions spec/build/data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
it { expect(data.ssh_key.source).to be_nil }
it { expect(data.ssh_key).to be_encoded }
it { expect(data.ssh_key.fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40') }
it { expect(data.ssh_key.public_key).to be_nil }
end

describe 'returns nil if there is no ssh_key' do
Expand All @@ -24,6 +25,14 @@
it { expect(data.ssh_key.fingerprint).to eq('57:78:65:c2:c9:c8:c9:f7:dd:2b:35:39:40:27:d2:40') }
end

context 'when public key is provided' do
let(:public_key) { 'ssh-rsa public-key' }
let(:data) { Travis::Build::Data.new(ssh_key: { value: TEST_PRIVATE_KEY, public_key: public_key, source: 'the source' }) }

it { expect(data.ssh_key.value).to eql(TEST_PRIVATE_KEY) }
it { expect(data.ssh_key.public_key).to eql(public_key) }
end

describe 'does not fail on an invalid key' do
let(:data) { Travis::Build::Data.new(config: { source_key: 'foo' }) }
it { expect { data }.to_not raise_error }
Expand Down
Loading