73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/cnvrg/files.rb', line 73
def upload_exec_file(absolute_path, image_name, commit_id)
file_name = File.basename absolute_path
file_size = File.size(absolute_path).to_f
content_type = "application/zip"
begin
upload_resp = Cnvrg::API.request("users/#{@owner}/images/" + "upload_config", 'POST_FILE', {relative_path: absolute_path,
file_name: file_name,
image_name: image_name,
file_size: file_size,
file_content_type: content_type,
project_slug: @project_slug,
commit_id: commit_id})
if Cnvrg::CLI.is_response_success(upload_resp, false)
if upload_resp["result"]["image"] == -1
return -1
end
path = upload_resp["result"]["path"]
s3_res = upload_small_files_s3(path, absolute_path, content_type)
end
if s3_res
return upload_resp["result"]["id"]
end
return false
rescue SignalException
say "\nAborting"
exit(1)
end
end
|