pindo 5.20.2 → 5.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/pindo/base/git_handler.rb +102 -74
- data/lib/pindo/command/android/autobuild.rb +28 -19
- data/lib/pindo/command/ios/autobuild.rb +43 -42
- data/lib/pindo/command/jps/apptest.rb +8 -3
- data/lib/pindo/command/jps/media.rb +2 -1
- data/lib/pindo/command/unity/autobuild.rb +18 -7
- data/lib/pindo/command/web/autobuild.rb +28 -19
- data/lib/pindo/module/pgyer/pgyerhelper.rb +98 -52
- data/lib/pindo/module/task/model/git/git_commit_task.rb +6 -0
- data/lib/pindo/module/task/model/git/git_tag_task.rb +15 -3
- data/lib/pindo/module/task/model/git_task.rb +27 -2
- data/lib/pindo/module/task/model/jps/jps_bind_package_task.rb +65 -12
- data/lib/pindo/module/task/model/jps/jps_upload_media_task.rb +14 -5
- data/lib/pindo/module/task/model/jps/jps_workflow_message_task.rb +32 -14
- data/lib/pindo/module/task/model/jps_task.rb +20 -0
- data/lib/pindo/version.rb +1 -1
- metadata +3 -3
|
@@ -27,7 +27,7 @@ module Pindo
|
|
|
27
27
|
# @option options [String] :git_commit_desc Git commit 描述(可选)
|
|
28
28
|
# @option options [String] :project_id 项目 ID(可选,从 app_info_obj 获取)
|
|
29
29
|
# @option options [Integer] :workflow_id 工作流 ID(可选,从 workflow_info 获取)
|
|
30
|
-
# @option options [String] :branch
|
|
30
|
+
# @option options [String] :branch 分支名(可选,默认从依赖的 Git 任务取实际发布分支)
|
|
31
31
|
# @option options [Boolean] :single 是否单个提交(默认 true)
|
|
32
32
|
# @option options [Hash] :app_info_obj JPS 应用信息对象(可选,用于获取 project_id)
|
|
33
33
|
# @option options [Hash] :workflow_info 工作流信息(可选,用于获取 workflow_id)
|
|
@@ -37,7 +37,9 @@ module Pindo
|
|
|
37
37
|
@git_commit_desc = options[:git_commit_desc]
|
|
38
38
|
@project_id = options[:project_id]
|
|
39
39
|
@workflow_id = options[:workflow_id]
|
|
40
|
-
|
|
40
|
+
# 不在这里兜底成 master:仓库主干可能是 main 或其它分支,
|
|
41
|
+
# 未显式指定时统一从依赖的 Git 任务取 resolve 之后的真实发布分支
|
|
42
|
+
@branch = options[:branch]
|
|
41
43
|
@single = options.fetch(:single, true)
|
|
42
44
|
|
|
43
45
|
# 消息发送任务优先级为 LOW,确保在其他任务之后执行
|
|
@@ -63,7 +65,10 @@ module Pindo
|
|
|
63
65
|
# 2. 验证必需参数
|
|
64
66
|
validate_required_params!
|
|
65
67
|
|
|
66
|
-
# 3.
|
|
68
|
+
# 3. 确定分支(取不到则不带分支发送)
|
|
69
|
+
resolve_branch!
|
|
70
|
+
|
|
71
|
+
# 4. 发送消息
|
|
67
72
|
send_workflow_message
|
|
68
73
|
|
|
69
74
|
puts " ✅ JPS 工作流消息发送完成\n"
|
|
@@ -86,23 +91,24 @@ module Pindo
|
|
|
86
91
|
|
|
87
92
|
# 判断是否需要从依赖任务获取数据
|
|
88
93
|
def need_fetch_dependencies?
|
|
89
|
-
@git_commit_id.nil? || @project_id.nil? || @workflow_id.nil?
|
|
94
|
+
@git_commit_id.nil? || @project_id.nil? || @workflow_id.nil? || @branch.nil?
|
|
90
95
|
end
|
|
91
96
|
|
|
92
97
|
# 从依赖任务获取数据
|
|
93
98
|
def fetch_data_from_dependencies
|
|
94
|
-
# 1. 获取 commit
|
|
95
|
-
if @git_commit_id.nil?
|
|
96
|
-
|
|
97
|
-
git_data = get_data_param_by_key(:git_tag)
|
|
98
|
-
# 1.2 降级到 GitCommitTask
|
|
99
|
-
git_data = get_data_param_by_key(:git_commit) if git_data.nil? || git_data.empty?
|
|
99
|
+
# 1. 获取 commit 信息与发布分支(优先从 GitTagTask,降级到 GitCommitTask)
|
|
100
|
+
if @git_commit_id.nil? || @branch.nil?
|
|
101
|
+
git_data = git_commit_data_param
|
|
100
102
|
|
|
101
103
|
if git_data && git_data[:task_param]
|
|
102
104
|
param = git_data[:task_param]
|
|
103
|
-
|
|
104
|
-
@
|
|
105
|
-
@
|
|
105
|
+
# 一律只在调用方没给值时才填充,避免显式传入的 commit 信息被依赖任务覆盖
|
|
106
|
+
@git_commit_id = param[:git_commit_id] if @git_commit_id.nil? && param[:git_commit_id]
|
|
107
|
+
@git_commit_time = param[:git_commit_time] if @git_commit_time.nil? && param[:git_commit_time]
|
|
108
|
+
@git_commit_desc = param[:git_commit_desc] if @git_commit_desc.nil? && param[:git_commit_desc]
|
|
109
|
+
# release_branch 是 GitCommitTask/GitTagTask 用 resolve_release_branch
|
|
110
|
+
# 探测出来的真实分支(master > main > 唯一远程分支 > 当前分支)
|
|
111
|
+
@branch = param[:release_branch] if @branch.nil? && param[:release_branch]
|
|
106
112
|
end
|
|
107
113
|
end
|
|
108
114
|
|
|
@@ -152,13 +158,25 @@ module Pindo
|
|
|
152
158
|
end
|
|
153
159
|
end
|
|
154
160
|
|
|
161
|
+
# 确定要发送的分支
|
|
162
|
+
#
|
|
163
|
+
# 取不到时保持 nil 而不是兜底成 master:branches 在服务端是可选字段,不传即可,
|
|
164
|
+
# 但传一个错的分支名(detached HEAD、无 Git 依赖等场景)会让 commit 与分支
|
|
165
|
+
# 错误关联,比不传更糟。
|
|
166
|
+
def resolve_branch!
|
|
167
|
+
return unless @branch.to_s.strip.empty?
|
|
168
|
+
|
|
169
|
+
@branch = nil
|
|
170
|
+
Funlog.instance.fancyinfo_warning("未取到当前分支,工作流消息将不带分支信息发送")
|
|
171
|
+
end
|
|
172
|
+
|
|
155
173
|
# 发送工作流消息
|
|
156
174
|
def send_workflow_message
|
|
157
175
|
puts " 📨 发送工作流消息..."
|
|
158
176
|
puts " Project ID: #{@project_id}"
|
|
159
177
|
puts " Workflow ID: #{@workflow_id}"
|
|
160
178
|
puts " Commit ID: #{@git_commit_id[0..7]}" if @git_commit_id
|
|
161
|
-
puts " Branch: #{@branch}"
|
|
179
|
+
puts " Branch: #{@branch || '(不指定)'}"
|
|
162
180
|
puts ""
|
|
163
181
|
|
|
164
182
|
pgyer_helper = PgyerHelper.share_instace
|
|
@@ -37,6 +37,26 @@ module Pindo
|
|
|
37
37
|
def self.default_retry_delay
|
|
38
38
|
10 # 默认延迟 10 秒
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
protected
|
|
42
|
+
|
|
43
|
+
# 从依赖任务中取 Git commit 参数
|
|
44
|
+
#
|
|
45
|
+
# 优先 GitTagTask:它固化的是 tag 那一刻的 commit,构建注入文件的提交已包含在内;
|
|
46
|
+
# 没有 tag 任务(如 skip_without_tag)时再降级到 GitCommitTask。
|
|
47
|
+
#
|
|
48
|
+
# 注意判断的是 task_param 而不是 data_param 本身——data_param 外层始终带有
|
|
49
|
+
# task_id/task_key 等字段、永远不为空,只有 task_param 才反映任务是否真的产出了数据。
|
|
50
|
+
#
|
|
51
|
+
# @return [Hash, nil] 含有效 task_param 的数据参数,都取不到时返回 nil
|
|
52
|
+
def git_commit_data_param
|
|
53
|
+
[:git_tag, :git_commit].each do |task_key|
|
|
54
|
+
data = get_data_param_by_key(task_key)
|
|
55
|
+
param = data && data[:task_param]
|
|
56
|
+
return data if param && !param.empty?
|
|
57
|
+
end
|
|
58
|
+
nil
|
|
59
|
+
end
|
|
40
60
|
end
|
|
41
61
|
end
|
|
42
62
|
end
|
data/lib/pindo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pindo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.20.
|
|
4
|
+
version: 5.20.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- wade
|
|
@@ -112,7 +112,7 @@ dependencies:
|
|
|
112
112
|
version: '2.7'
|
|
113
113
|
- - ">="
|
|
114
114
|
- !ruby/object:Gem::Version
|
|
115
|
-
version: 2.7.
|
|
115
|
+
version: 2.7.1
|
|
116
116
|
type: :runtime
|
|
117
117
|
prerelease: false
|
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -122,7 +122,7 @@ dependencies:
|
|
|
122
122
|
version: '2.7'
|
|
123
123
|
- - ">="
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
|
-
version: 2.7.
|
|
125
|
+
version: 2.7.1
|
|
126
126
|
- !ruby/object:Gem::Dependency
|
|
127
127
|
name: rqrcode
|
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|