gct 0.5.0 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gct/command.rb +3 -0
- data/lib/gct/command/autotag.rb +21 -4
- data/lib/gct/command/init/gitlab-ci.rb +2 -2
- data/lib/gct/command/repo/push.rb +13 -2
- data/lib/gct/command/robot.rb +0 -1
- data/lib/gct/command/skip.rb +14 -0
- data/lib/gct/command/skip/modular.rb +31 -0
- data/lib/gct/command/skip/tag.rb +42 -0
- data/lib/gct/command/unskip.rb +14 -0
- data/lib/gct/command/unskip/modular.rb +31 -0
- data/lib/gct/command/unskip/tag.rb +42 -0
- data/lib/gct/command/update/next.rb +1 -1
- data/lib/gct/command/update/podfile.rb +16 -2
- data/lib/gct/command/update/tag.rb +1 -6
- data/lib/gct/gct_version.rb +1 -1
- metadata +8 -3
- data/lib/gct/command/robot/summary.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95e191b1ed5ae2ce3b7cb3c7801ed0902d300ee77a19cfcc1ce455630a1f47b8
|
4
|
+
data.tar.gz: 4c6d74e11b168ebe5a5629ff6ea647f23fb7c28a26442224ef05c27e3b83e7d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3049ea6bc870721c728a226f8e07465ffe7b7d919a9a2aa1cfeab750d7f6aabf0eb6fd38a9b630962988a7acdb0beb0c973d90319d50ca7818ca16fb12deb351
|
7
|
+
data.tar.gz: ab44e1b3569ec632f1da15c3d904eff2f50eab20104ac1219d6665e322d91fae4ac828e7331d21f149a10c376dcebdc164d915be7682e8bf49c7a3d746bb38aa
|
data/lib/gct/command.rb
CHANGED
@@ -28,6 +28,8 @@ module Gct
|
|
28
28
|
require 'gct/command/update'
|
29
29
|
require 'gct/command/robot'
|
30
30
|
require 'gct/command/clean'
|
31
|
+
require 'gct/command/skip'
|
32
|
+
require 'gct/command/unskip'
|
31
33
|
|
32
34
|
self.abstract_command = true
|
33
35
|
self.command = 'gct'
|
@@ -92,6 +94,7 @@ module Gct
|
|
92
94
|
end
|
93
95
|
|
94
96
|
def auto_add_tag(tag)
|
97
|
+
puts "current tag = #{tag}"
|
95
98
|
tag_points = tag.to_s.split('.')
|
96
99
|
index = tag_points.length - 1
|
97
100
|
need_add_point = tag_points[index].to_i + 1
|
data/lib/gct/command/autotag.rb
CHANGED
@@ -47,6 +47,13 @@ module Gct
|
|
47
47
|
|
48
48
|
def run
|
49
49
|
FileBase.root_err
|
50
|
+
|
51
|
+
# 检查远端是否存在分支
|
52
|
+
is_exist_branch = check_remote_branch
|
53
|
+
if !is_exist_branch
|
54
|
+
raise "远端未找到 #{@branch} 分支".red
|
55
|
+
end
|
56
|
+
|
50
57
|
puts "开始分析podfile文件".green
|
51
58
|
puts ""
|
52
59
|
where_statement = "and is_pre = #{@pre ? 1 : 0}"
|
@@ -78,9 +85,16 @@ module Gct
|
|
78
85
|
end
|
79
86
|
end
|
80
87
|
|
81
|
-
def
|
82
|
-
|
83
|
-
|
88
|
+
def check_remote_branch
|
89
|
+
remote_branches = Gitlab.branches(@project_id, per_page: 1000)
|
90
|
+
branches = Array.new()
|
91
|
+
remote_branches.each do |item|
|
92
|
+
hash_branch = item.to_hash
|
93
|
+
branch_name = hash_branch["name"]
|
94
|
+
branches.push(branch_name)
|
95
|
+
end
|
96
|
+
is_exist_branch = branches.include?(@branch)
|
97
|
+
is_exist_branch
|
84
98
|
end
|
85
99
|
|
86
100
|
def podfile
|
@@ -249,7 +263,7 @@ module Gct
|
|
249
263
|
db = Database::Data.new
|
250
264
|
# 查询优先级最高的为完成打tag的数据
|
251
265
|
where_statement = "and is_pre = " + (@pre ? "1" : "0")
|
252
|
-
sql = "select * from tag where priority = (select MAX(priority) from tag
|
266
|
+
sql = "select * from tag where priority = (select MAX(priority) from tag where tag_status != '#{SpecPublishStatus::SUCCESS}' #{where_statement}) and project_version = '#{@version}'"
|
253
267
|
result = db.query(sql)
|
254
268
|
vals = ""
|
255
269
|
ins = ""
|
@@ -258,8 +272,11 @@ module Gct
|
|
258
272
|
if row["tag_status"].eql?(SpecPublishStatus::WAITING) || row["tag_status"].eql?(SpecPublishStatus::CANCELED) || row["tag_status"].eql?(SpecPublishStatus::FAILED)
|
259
273
|
status = SpecPublishStatus::PENDING
|
260
274
|
name = row["pod_name"]
|
275
|
+
puts "pod name is " + name
|
261
276
|
vals.concat("when pod_name = '#{name}' then '#{status}' ")
|
277
|
+
puts vals
|
262
278
|
ins.concat("'#{name}',")
|
279
|
+
puts ins
|
263
280
|
system "gct update dependency #{name} tag_status #{status}"
|
264
281
|
skip_tag = ""
|
265
282
|
if row["is_tag"].to_i == 1
|
@@ -8,8 +8,8 @@ push_pod:
|
|
8
8
|
- echo "开始lint 和 push podspec"
|
9
9
|
- gct update dependency $CI_PROJECT_NAME "tag_status" "deploying"
|
10
10
|
- gct clean lint $CI_PROJECT_NAME
|
11
|
-
- gct repo update
|
12
|
-
- gct repo push
|
11
|
+
- gct repo update
|
12
|
+
- gct repo push $CI_PROJECT_NAME
|
13
13
|
- gct update dependency $CI_PROJECT_NAME "tag_version" $CI_COMMIT_REF_NAME
|
14
14
|
- gct update next
|
15
15
|
only:
|
@@ -9,9 +9,11 @@ module Gct
|
|
9
9
|
DESC
|
10
10
|
|
11
11
|
self.arguments = [
|
12
|
+
CLAide::Argument.new('POD_NAME', true),
|
12
13
|
]
|
13
14
|
|
14
15
|
def initialize(argv)
|
16
|
+
@pod_name = argv.shift_argument
|
15
17
|
super
|
16
18
|
end
|
17
19
|
|
@@ -24,9 +26,18 @@ module Gct
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def pushRepo
|
27
|
-
|
29
|
+
db = Database::Data.new
|
30
|
+
sql = "select * from modular_headers where pod_name = '#{@pod_name}'"
|
31
|
+
res = db.query(sql)
|
32
|
+
modular_code = "--use-modular-headers"
|
33
|
+
if !res.nil? && res.count > 0
|
34
|
+
modular_code = ""
|
35
|
+
end
|
36
|
+
command_code = "pod repo push iOSCRGTPodSource --sources=#{Constant.GitURL}iOSCRGTPodSource.git --verbose --skip-import-validation --use-libraries --allow-warnings #{modular_code}"
|
37
|
+
|
38
|
+
puts "pod 命令为:#{command_code}".green
|
28
39
|
# exception: ruby 2.6 以上生效
|
29
|
-
system "
|
40
|
+
system "#{command_code}", exception: true
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
data/lib/gct/command/robot.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Skip < Command
|
7
|
+
class Modular < Skip
|
8
|
+
|
9
|
+
self.summary = '跳过modular_headers 验证的pod'
|
10
|
+
self.description = <<-DESC
|
11
|
+
跳过modular_headers 验证的pod
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('POD_NAME', true),
|
16
|
+
]
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
@pod_name = argv.shift_argument
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
db = Database::Data.new
|
25
|
+
sql = "insert into modular_headers (pod_name) values ('#{@pod_name}')"
|
26
|
+
res = db.query(sql)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Skip < Command
|
7
|
+
class Tag < Skip
|
8
|
+
|
9
|
+
self.summary = '跳过打tag'
|
10
|
+
self.description = <<-DESC
|
11
|
+
跳过打tag
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('PROJECT_VERSION', true),
|
16
|
+
CLAide::Argument.new('POD_NAME', true),
|
17
|
+
CLAide::Argument.new('Tag', false),
|
18
|
+
]
|
19
|
+
|
20
|
+
def self.options
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
@project_version = argv.shift_argument
|
25
|
+
@pod_name = argv.shift_argument
|
26
|
+
@tag = argv.shift_argument
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
db = Database::Data.new
|
32
|
+
if !@tag.nil?
|
33
|
+
tag_set = ", tag_version = '#{@tag}'"
|
34
|
+
end
|
35
|
+
update_code = "is_skip_tag = 1, tag_status = 'success'#{tag_set}"
|
36
|
+
sql = "update tag set #{update_code} where pod_name = '#{@pod_name}' and project_version = '#{@project_version}'"
|
37
|
+
res = db.query(sql)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'gct/command/unskip/modular'
|
2
|
+
require 'gct/command/unskip/tag'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Unskip < Command
|
7
|
+
self.abstract_command = true
|
8
|
+
self.summary = '初始化'
|
9
|
+
self.description = <<-DESC
|
10
|
+
移除跳过modular或跳过tag
|
11
|
+
DESC
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Unskip < Command
|
7
|
+
class Modular < Unskip
|
8
|
+
|
9
|
+
self.summary = '移除跳过modular_headers 验证'
|
10
|
+
self.description = <<-DESC
|
11
|
+
移除跳过modular_headers 验证
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('POD_NAME', true),
|
16
|
+
]
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
@pod_name = argv.shift_argument
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
db = Database::Data.new
|
25
|
+
sql = "delete from modular_headers where pod_name = '#{@pod_name}'"
|
26
|
+
res = db.query(sql)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Gct
|
5
|
+
class Command
|
6
|
+
class Unskip < Command
|
7
|
+
class Tag < Unskip
|
8
|
+
|
9
|
+
self.summary = '移除跳过打tag'
|
10
|
+
self.description = <<-DESC
|
11
|
+
移除跳过打tag
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('PROJECT_VERSION', true),
|
16
|
+
CLAide::Argument.new('POD_NAME', true),
|
17
|
+
CLAide::Argument.new('Tag', false),
|
18
|
+
]
|
19
|
+
|
20
|
+
def self.options
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
@project_version = argv.shift_argument
|
25
|
+
@pod_name = argv.shift_argument
|
26
|
+
@tag = argv.shift_argument
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
db = Database::Data.new
|
32
|
+
if !@tag.nil?
|
33
|
+
tag_set = ", tag_version = '#{@tag}'"
|
34
|
+
end
|
35
|
+
update_code = "is_skip_tag = 0, tag_status = 'waiting'#{tag_set}"
|
36
|
+
sql = "update tag set #{update_code} where pod_name = '#{@pod_name}' and project_version = '#{@project_version}'"
|
37
|
+
res = db.query(sql)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -34,7 +34,7 @@ module Gct
|
|
34
34
|
db = Database::Data.new
|
35
35
|
# 查询优先级最高的为完成打tag的数据
|
36
36
|
where_statement = "and is_pre = " + (@pre ? "1" : "0")
|
37
|
-
sql = "select * from tag where priority = (select MAX(priority) from tag where
|
37
|
+
sql = "select * from tag where priority = (select MAX(priority) from tag where tag_status != '#{SpecPublishStatus::SUCCESS}' #{where_statement}) and project_version = '#{@version}'"
|
38
38
|
result = db.query(sql)
|
39
39
|
puts result.count
|
40
40
|
if result.count == 0
|
@@ -39,6 +39,13 @@ module Gct
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
def skip_modular_headers_pods
|
43
|
+
db = Database::Data.new
|
44
|
+
sql = "select * from modular_headers"
|
45
|
+
result = db.query(sql)
|
46
|
+
return result
|
47
|
+
end
|
48
|
+
|
42
49
|
def update_podfile
|
43
50
|
podspec_content = file_contents(@name, @file, @branch)
|
44
51
|
remove_regex = /dev_pod .*/
|
@@ -51,12 +58,20 @@ module Gct
|
|
51
58
|
puts "ERROR: 没有tag库".red
|
52
59
|
return
|
53
60
|
end
|
61
|
+
|
62
|
+
skip_pods = Array.new()
|
63
|
+
skip_modular_headers_pods.each do |row|
|
64
|
+
skip_pods.push(row["pod_name"])
|
65
|
+
end
|
66
|
+
|
54
67
|
result.each do |row|
|
55
68
|
name = row["pod_name"]
|
56
69
|
tag = row["tag_version"]
|
70
|
+
is_skip_modular_headers = skip_pods.include?(name)
|
71
|
+
modular_headers = is_skip_modular_headers ? ", :modular_headers => false" : ""
|
57
72
|
update_regex = /.*#{name}.*/
|
58
73
|
update_match = update_regex.match(podspec_content).to_s
|
59
|
-
update_str = " pod '#{name}', '#{tag}'"
|
74
|
+
update_str = " pod '#{name}', '#{tag}'#{modular_headers}"
|
60
75
|
if update_match.empty?
|
61
76
|
empty_match = "# Pods for iLife"
|
62
77
|
podspec_content = podspec_content.gsub!(empty_match, "#{empty_match} \n#{update_str}") # Pods for iLife
|
@@ -72,7 +87,6 @@ module Gct
|
|
72
87
|
u_db.query(u_sql)
|
73
88
|
|
74
89
|
system "gct robot podfile"
|
75
|
-
system "gct robot summary"
|
76
90
|
end
|
77
91
|
|
78
92
|
def edit_file(content)
|
@@ -51,12 +51,6 @@ module Gct
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def skip_tag_method
|
54
|
-
if !@update_ci
|
55
|
-
isEmptyMR = mr_to_master
|
56
|
-
if !isEmptyMR
|
57
|
-
accept_merge_request
|
58
|
-
end
|
59
|
-
|
60
54
|
isEmptyMR = mr_to_master
|
61
55
|
if !isEmptyMR
|
62
56
|
accept_merge_request
|
@@ -119,6 +113,7 @@ module Gct
|
|
119
113
|
create_file('.gitlab-ci.yml', ci_content, 'init ci')
|
120
114
|
mr_to_master_if_need
|
121
115
|
end
|
116
|
+
|
122
117
|
end
|
123
118
|
|
124
119
|
def mr_to_master_if_need
|
data/lib/gct/gct_version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jieming
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -192,10 +192,15 @@ files:
|
|
192
192
|
- lib/gct/command/robot/finish.rb
|
193
193
|
- lib/gct/command/robot/podfile.rb
|
194
194
|
- lib/gct/command/robot/start.rb
|
195
|
-
- lib/gct/command/robot/summary.rb
|
196
195
|
- lib/gct/command/setup.rb
|
196
|
+
- lib/gct/command/skip.rb
|
197
|
+
- lib/gct/command/skip/modular.rb
|
198
|
+
- lib/gct/command/skip/tag.rb
|
197
199
|
- lib/gct/command/spec.rb
|
198
200
|
- lib/gct/command/spec/lint.rb
|
201
|
+
- lib/gct/command/unskip.rb
|
202
|
+
- lib/gct/command/unskip/modular.rb
|
203
|
+
- lib/gct/command/unskip/tag.rb
|
199
204
|
- lib/gct/command/update.rb
|
200
205
|
- lib/gct/command/update/analyze.rb
|
201
206
|
- lib/gct/command/update/dependency.rb
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'net/https'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module Gct
|
5
|
-
class Command
|
6
|
-
class Robot < Command
|
7
|
-
class Summary < Robot
|
8
|
-
|
9
|
-
self.summary = '汇总'
|
10
|
-
self.description = <<-DESC
|
11
|
-
汇总
|
12
|
-
DESC
|
13
|
-
|
14
|
-
self.arguments = [
|
15
|
-
]
|
16
|
-
|
17
|
-
def self.options
|
18
|
-
[
|
19
|
-
['--test', '测试机器人,测试webhook'],
|
20
|
-
].concat(super)
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(argv)
|
24
|
-
@test = argv.flag?('test', false)
|
25
|
-
super
|
26
|
-
end
|
27
|
-
|
28
|
-
def run
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|