274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
# File 'lib/cnvrg/datafiles.rb', line 274
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
|