Class: Pindo::TaskSystem::UploadTask
- Defined in:
- lib/pindo/module/task/model/upload_task.rb
Overview
上传任务上传构建产物到测试平台(JPS)
Instance Attribute Summary collapse
-
#file_type ⇒ Object
readonly
Returns the value of attribute file_type.
-
#upload_file ⇒ Object
readonly
Returns the value of attribute upload_file.
-
#upload_path ⇒ Object
readonly
Returns the value of attribute upload_path.
Attributes inherited from PindoTask
#callbacks_setup, #context, #created_at, #dependencies, #error, #finished_at, #id, #max_retry_count, #metadata, #name, #priority, #result, #retry_count, #retry_delay, #retry_mode, #started_at, #status, #type
Class Method Summary collapse
- .default_retry_count ⇒ Object
- .default_retry_delay ⇒ Object
-
.default_retry_mode ⇒ Object
重试配置.
- .task_type ⇒ Object
Instance Method Summary collapse
-
#initialize(file_type, upload_path, upload_file, options = {}) ⇒ UploadTask
constructor
初始化上传任务.
- #validate ⇒ Object
Methods inherited from PindoTask
#before_retry, #cancel, #cancelled?, #check_cancelled!, #do_task, #execution_time, #finished?, #on, #reset_for_retry, #retryable?, #running?, #should_retry?
Constructor Details
#initialize(file_type, upload_path, upload_file, options = {}) ⇒ UploadTask
初始化上传任务
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 37 def initialize(file_type, upload_path, upload_file, = {}) @file_type = file_type # 'ipa' | 'apk' | 'html' | 'app' @upload_path = upload_path # 搜索文件的路径 @upload_file = upload_file # 要上传的文件(nil 表示自动查找) # 可选参数(如果为 nil,在 do_work 中延迟获取) @app_info_obj = [:app_info_obj] @workflow_info = [:workflow_info] @project_name = [:project_name] # 设置上传任务的优先级为 LOW,确保在构建任务之后执行 [:priority] ||= TaskPriority::LOW name = case file_type when 'ipa' "上传 IPA" when 'apk' "上传 APK" when 'html' "上传 WebGL" when 'app' "上传 macOS App" else "上传 #{file_type.upcase}" end super(name, ) end |
Instance Attribute Details
#file_type ⇒ Object (readonly)
Returns the value of attribute file_type.
10 11 12 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 10 def file_type @file_type end |
#upload_file ⇒ Object (readonly)
Returns the value of attribute upload_file.
10 11 12 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 10 def upload_file @upload_file end |
#upload_path ⇒ Object (readonly)
Returns the value of attribute upload_path.
10 11 12 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 10 def upload_path @upload_path end |
Class Method Details
.default_retry_count ⇒ Object
21 22 23 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 21 def self.default_retry_count 3 # 默认可以重试 3 次 end |
.default_retry_delay ⇒ Object
25 26 27 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 25 def self.default_retry_delay 10 # 默认延迟 10 秒 end |
.default_retry_mode ⇒ Object
重试配置
17 18 19 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 17 def self.default_retry_mode RetryMode::DELAYED # 延迟重试 end |
.task_type ⇒ Object
12 13 14 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 12 def self.task_type :upload end |
Instance Method Details
#validate ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/pindo/module/task/model/upload_task.rb', line 66 def validate # 验证基本参数 unless @file_type && !@file_type.empty? @error = "缺少必需参数: file_type" return false end unless @upload_path && !@upload_path.empty? @error = "缺少必需参数: upload_path" return false end # upload_path 可能在构建任务执行后才创建,这里不验证是否存在 # 实际文件查找会在 do_work 中进行 # app_info_obj 和 workflow_info 可以延迟获取,不在这里验证 true end |