fastlane-plugin-sq_ci_tools 1.0.6 → 1.1.0
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/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_notify_action.rb +16 -3
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb +70 -0
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb +3 -2
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_api_get_iam_token_action.rb +58 -0
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_create_issue_action.rb +62 -0
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_find_issues_action.rb +63 -0
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_transit_issue_action.rb +61 -0
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_update_issue_action.rb +69 -0
- data/lib/fastlane/plugin/sq_ci_tools/helper/sq_ci_tools_helper.rb +0 -21
- data/lib/fastlane/plugin/sq_ci_tools/helper/sq_ci_tools_yandex_api_helper.rb +72 -0
- data/lib/fastlane/plugin/sq_ci_tools/helper/sq_ci_tools_yandex_tracker_helper.rb +117 -0
- data/lib/fastlane/plugin/sq_ci_tools/options/max.rb +39 -0
- data/lib/fastlane/plugin/sq_ci_tools/options/telegram.rb +1 -1
- data/lib/fastlane/plugin/sq_ci_tools/options/yandex_api.rb +25 -0
- data/lib/fastlane/plugin/sq_ci_tools/options/yandex_tracker.rb +23 -0
- data/lib/fastlane/plugin/sq_ci_tools/version.rb +1 -1
- metadata +28 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e94a751ebed1f7287d97f5c9fe0481fbe2e31f130e55cc8d7e50fb3272ab4a72
|
|
4
|
+
data.tar.gz: 1eb2dd1fc187bdbef361765e4e09085dabe42a7e79b64b48990cb73db74ee058
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 891de12dff383e9e135c6866e7edcb0d31380ba54c58f86edba4465e61d33096fbd570c4e8367fd49a0a4ec5942bbf12e5c3672900e6b9bfcf6f59e8fc5bcebc
|
|
7
|
+
data.tar.gz: a99bc9e1827cdb2379f86586437a8224bb40d98a2c615773818e844d0cc082fc13f559595612b645e1968f2e709800c9c643bc90a680233f1f4df7cf742ddfa6
|
|
@@ -11,9 +11,22 @@ module Fastlane
|
|
|
11
11
|
.map { |link| "#{link[:name] || 'Ссылка'}: #{link[:url]}" }
|
|
12
12
|
.join("\n\n")
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
full_message = "#{message}\n\n#{links_message}"
|
|
15
|
+
begin
|
|
16
|
+
other_action.sq_ci_tools_send_telegram_message(
|
|
17
|
+
message: full_message
|
|
18
|
+
)
|
|
19
|
+
rescue => e
|
|
20
|
+
puts "Send message via Telegram error: #{e.message}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
begin
|
|
24
|
+
other_action.sq_ci_tools_send_max_message(
|
|
25
|
+
message: full_message
|
|
26
|
+
)
|
|
27
|
+
rescue => e
|
|
28
|
+
puts "Send message via Max error: #{e.message}"
|
|
29
|
+
end
|
|
17
30
|
end
|
|
18
31
|
|
|
19
32
|
def self.description
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require 'net/http'
|
|
3
|
+
require 'json'
|
|
4
|
+
require_relative '../helper/sq_ci_tools_helper'
|
|
5
|
+
require_relative '../options/max'
|
|
6
|
+
|
|
7
|
+
module Fastlane
|
|
8
|
+
module Actions
|
|
9
|
+
class SqCiToolsSendMaxMessageAction < Action
|
|
10
|
+
def self.run(params)
|
|
11
|
+
access_token = params[:max_access_token]
|
|
12
|
+
chat_ids = params[:max_chat_ids]
|
|
13
|
+
if access_token.nil? || access_token == "" || chat_ids.nil? || chat_ids == ""
|
|
14
|
+
return
|
|
15
|
+
end
|
|
16
|
+
puts params
|
|
17
|
+
|
|
18
|
+
chat_ids.split(',').each do |chat_id|
|
|
19
|
+
uri = URI.parse("https://platform-api.max.ru")
|
|
20
|
+
|
|
21
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
22
|
+
http.use_ssl = true
|
|
23
|
+
http.set_debug_output($stdout)
|
|
24
|
+
|
|
25
|
+
request = Net::HTTP::Post.new("/messages?chat_id=#{chat_id}")
|
|
26
|
+
request.add_field('Content-Type', 'application/json')
|
|
27
|
+
request.add_field('Authorization', access_token)
|
|
28
|
+
request.body = {
|
|
29
|
+
"text" => params[:message],
|
|
30
|
+
"format" => params[:max_format]
|
|
31
|
+
}.to_json
|
|
32
|
+
|
|
33
|
+
http.request(request)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.description
|
|
38
|
+
'Send message via Max'
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.details
|
|
42
|
+
''
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.available_options
|
|
46
|
+
[
|
|
47
|
+
FastlaneCore::ConfigItem.new(
|
|
48
|
+
key: :message,
|
|
49
|
+
description: 'Message for send',
|
|
50
|
+
optional: false,
|
|
51
|
+
type: String
|
|
52
|
+
)
|
|
53
|
+
] +
|
|
54
|
+
Options::Max.options
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.return_value
|
|
58
|
+
''
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.authors
|
|
62
|
+
['Semen Kologrivov']
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.is_supported?(_)
|
|
66
|
+
true
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -16,12 +16,13 @@ module Fastlane
|
|
|
16
16
|
uri = URI.parse("https://api.telegram.org/bot#{access_token}/sendMessage")
|
|
17
17
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
18
18
|
http.use_ssl = true
|
|
19
|
+
http.set_debug_output($stdout)
|
|
19
20
|
|
|
20
21
|
chat_ids.split(',').each do |chat_id|
|
|
21
22
|
request = Net::HTTP::Post::Multipart.new(uri, {
|
|
22
23
|
"chat_id" => chat_id,
|
|
23
24
|
"text" => params[:message],
|
|
24
|
-
"parse_mode" => params[:
|
|
25
|
+
"parse_mode" => params[:telegram_parse_mode]
|
|
25
26
|
})
|
|
26
27
|
|
|
27
28
|
http.request(request)
|
|
@@ -29,7 +30,7 @@ module Fastlane
|
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def self.description
|
|
32
|
-
'Send message via
|
|
33
|
+
'Send message via Telegram'
|
|
33
34
|
end
|
|
34
35
|
|
|
35
36
|
def self.details
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/sq_ci_tools_yandex_api_helper'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
module Actions
|
|
6
|
+
module SharedValues
|
|
7
|
+
SQ_CI_YANDEX_API_IAM_TOKEN = :SQ_CI_YANDEX_API_IAM_TOKEN
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class SqCiToolsYandexApiGetIamTokenAction < Action
|
|
11
|
+
def self.run(params)
|
|
12
|
+
keys_file_path = params[:keys_file_path]
|
|
13
|
+
iam_token = Helper::SqCiToolsYandexApiHelper.get_iam_token(
|
|
14
|
+
keys_file_path: keys_file_path
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
lane_context[SharedValues::SQ_CI_YANDEX_API_IAM_TOKEN] = iam_token
|
|
18
|
+
return iam_token
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.description
|
|
22
|
+
'Fetch Yandex API IAM-token'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.details
|
|
26
|
+
''
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.available_options
|
|
30
|
+
[
|
|
31
|
+
FastlaneCore::ConfigItem.new(
|
|
32
|
+
key: :keys_file_path,
|
|
33
|
+
env_name: 'SQ_CI_YANDEX_API_KEY_FILES_PATH',
|
|
34
|
+
description: 'File with keys of Yandex\'s Service account',
|
|
35
|
+
optional: false,
|
|
36
|
+
type: String
|
|
37
|
+
)
|
|
38
|
+
]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.return_type
|
|
42
|
+
:string
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.return_value
|
|
46
|
+
'Yandex API IAM-token'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.authors
|
|
50
|
+
['Semen Kologrivov']
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.is_supported?(_)
|
|
54
|
+
true
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_create_issue_action.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/sq_ci_tools_yandex_tracker_helper'
|
|
3
|
+
require_relative '../options/yandex_api'
|
|
4
|
+
require_relative '../options/yandex_tracker'
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
|
|
9
|
+
class SqCiToolsYandexTrackerCreateIssueAction < Action
|
|
10
|
+
def self.run(params)
|
|
11
|
+
Helper::SqCiToolsYandexTrackerHelper.create_issue(
|
|
12
|
+
query: params[:query],
|
|
13
|
+
body: params[:body],
|
|
14
|
+
organization_id: params[:organization_id],
|
|
15
|
+
iam_token: params[:iam_token]
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.description
|
|
20
|
+
'Create new issue in Yandex Tracker'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.details
|
|
24
|
+
''
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.available_options
|
|
28
|
+
[
|
|
29
|
+
FastlaneCore::ConfigItem.new(
|
|
30
|
+
key: :query,
|
|
31
|
+
description: 'Query params for find issues',
|
|
32
|
+
optional: true,
|
|
33
|
+
default_value: {},
|
|
34
|
+
type: Hash,
|
|
35
|
+
),
|
|
36
|
+
FastlaneCore::ConfigItem.new(
|
|
37
|
+
key: :body,
|
|
38
|
+
description: 'Body for create issue',
|
|
39
|
+
optional: false,
|
|
40
|
+
type: Hash,
|
|
41
|
+
)
|
|
42
|
+
] + Options::YandexApi.options + Options::YandexTracker.options
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.return_type
|
|
46
|
+
:hash
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.return_value
|
|
50
|
+
'Created issue'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.authors
|
|
54
|
+
['Semen Kologrivov']
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.is_supported?(_)
|
|
58
|
+
true
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/sq_ci_tools_yandex_tracker_helper'
|
|
3
|
+
require_relative '../options/yandex_api'
|
|
4
|
+
require_relative '../options/yandex_tracker'
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
|
|
9
|
+
class SqCiToolsYandexTrackerFindIssuesAction < Action
|
|
10
|
+
def self.run(params)
|
|
11
|
+
Helper::SqCiToolsYandexTrackerHelper.find_issues(
|
|
12
|
+
query: params[:query],
|
|
13
|
+
body: params[:body],
|
|
14
|
+
organization_id: params[:organization_id],
|
|
15
|
+
iam_token: params[:iam_token]
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.description
|
|
20
|
+
'Fetch Yandex tracker issues by passed query'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.details
|
|
24
|
+
''
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.available_options
|
|
28
|
+
[
|
|
29
|
+
FastlaneCore::ConfigItem.new(
|
|
30
|
+
key: :query,
|
|
31
|
+
description: 'Query params for find issues',
|
|
32
|
+
optional: true,
|
|
33
|
+
default_value: {},
|
|
34
|
+
type: Hash,
|
|
35
|
+
),
|
|
36
|
+
FastlaneCore::ConfigItem.new(
|
|
37
|
+
key: :body,
|
|
38
|
+
description: 'Body for find issues request',
|
|
39
|
+
optional: true,
|
|
40
|
+
default_value: {},
|
|
41
|
+
type: Hash,
|
|
42
|
+
)
|
|
43
|
+
] + Options::YandexApi.options + Options::YandexTracker.options
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.return_type
|
|
47
|
+
:array
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.return_value
|
|
51
|
+
'Array of tasks'
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.authors
|
|
55
|
+
['Semen Kologrivov']
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.is_supported?(_)
|
|
59
|
+
true
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_transit_issue_action.rb
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/sq_ci_tools_yandex_tracker_helper'
|
|
3
|
+
require_relative '../options/yandex_api'
|
|
4
|
+
require_relative '../options/yandex_tracker'
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
|
|
9
|
+
class SqCiToolsYandexTrackerTransitIssueAction < Action
|
|
10
|
+
def self.run(params)
|
|
11
|
+
Helper::SqCiToolsYandexTrackerHelper.transit_issue(
|
|
12
|
+
issue_id: params[:issue_id],
|
|
13
|
+
transition_name: params[:transition_name],
|
|
14
|
+
organization_id: params[:organization_id],
|
|
15
|
+
iam_token: params[:iam_token]
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.description
|
|
20
|
+
'Transit issue to the new status'
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.details
|
|
24
|
+
''
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.available_options
|
|
28
|
+
[
|
|
29
|
+
FastlaneCore::ConfigItem.new(
|
|
30
|
+
key: :issue_id,
|
|
31
|
+
description: 'Id of issue',
|
|
32
|
+
optional: false,
|
|
33
|
+
type: String,
|
|
34
|
+
),
|
|
35
|
+
FastlaneCore::ConfigItem.new(
|
|
36
|
+
key: :transition_name,
|
|
37
|
+
description: 'Name of transition',
|
|
38
|
+
optional: false,
|
|
39
|
+
type: String,
|
|
40
|
+
)
|
|
41
|
+
] + Options::YandexApi.options + Options::YandexTracker.options
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.return_type
|
|
45
|
+
:hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.return_value
|
|
49
|
+
'Updated issue'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.authors
|
|
53
|
+
['Semen Kologrivov']
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.is_supported?(_)
|
|
57
|
+
true
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_update_issue_action.rb
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require_relative '../helper/sq_ci_tools_yandex_tracker_helper'
|
|
3
|
+
require_relative '../options/yandex_api'
|
|
4
|
+
require_relative '../options/yandex_tracker'
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
|
|
9
|
+
class SqCiToolsYandexTrackerUpdateIssueAction < Action
|
|
10
|
+
def self.run(params)
|
|
11
|
+
Helper::SqCiToolsYandexTrackerHelper.update_issue(
|
|
12
|
+
issue_id: params[:issue_id],
|
|
13
|
+
query: params[:query],
|
|
14
|
+
body: params[:body],
|
|
15
|
+
organization_id: params[:organization_id],
|
|
16
|
+
iam_token: params[:iam_token]
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.description
|
|
21
|
+
'Update issue in Yandex Tracker'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.details
|
|
25
|
+
''
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.available_options
|
|
29
|
+
[
|
|
30
|
+
FastlaneCore::ConfigItem.new(
|
|
31
|
+
key: :issue_id,
|
|
32
|
+
description: 'Is of edited issue',
|
|
33
|
+
optional: false,
|
|
34
|
+
type: String,
|
|
35
|
+
),
|
|
36
|
+
FastlaneCore::ConfigItem.new(
|
|
37
|
+
key: :query,
|
|
38
|
+
description: 'Query params for find issues',
|
|
39
|
+
optional: true,
|
|
40
|
+
default_value: {},
|
|
41
|
+
type: Hash,
|
|
42
|
+
),
|
|
43
|
+
FastlaneCore::ConfigItem.new(
|
|
44
|
+
key: :body,
|
|
45
|
+
description: 'Body for update issue',
|
|
46
|
+
optional: false,
|
|
47
|
+
type: Hash,
|
|
48
|
+
)
|
|
49
|
+
] + Options::YandexApi.options + Options::YandexTracker.options
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.return_type
|
|
53
|
+
:hash
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.return_value
|
|
57
|
+
'Updated issue'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def self.authors
|
|
61
|
+
['Semen Kologrivov']
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def self.is_supported?(_)
|
|
65
|
+
true
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -13,27 +13,6 @@ module Fastlane
|
|
|
13
13
|
class SqCiToolsHelper
|
|
14
14
|
GRADLE_FILE_TEST = "/tmp/fastlane/tests/versioning/app/build.gradle"
|
|
15
15
|
|
|
16
|
-
def self.notification_message(app_name:, app_version_string:, app_type:, links:)
|
|
17
|
-
if app_type == "beta"
|
|
18
|
-
message = "Коллеги, сборка приложения '#{app_name}' #{app_version_string} готова к тестированию!"
|
|
19
|
-
elsif app_type == "rc"
|
|
20
|
-
message = "Коллеги, предрелизная сборка приложения '#{app_name}' #{app_version_string} готова к тестированию!"
|
|
21
|
-
elsif app_type == "release"
|
|
22
|
-
message = "Коллеги, сборка приложения '#{app_name}' #{app_version_string} отправлена на ревью!"
|
|
23
|
-
else
|
|
24
|
-
return ""
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
return message if links.nil? || links.length == 0
|
|
28
|
-
|
|
29
|
-
links_message = links
|
|
30
|
-
.select { |link| !link[:url].nil? }
|
|
31
|
-
.map { |link| "#{link[:name] || 'Ссылка на установку'}: #{link[:url]}" }
|
|
32
|
-
.join("\n\n")
|
|
33
|
-
|
|
34
|
-
"#{message}\n\n#{links_message}"
|
|
35
|
-
end
|
|
36
|
-
|
|
37
16
|
def self.add_target_attributes(target_name:, project_path:)
|
|
38
17
|
project = Xcodeproj::Project.open(project_path)
|
|
39
18
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require 'fastlane_core/ui/ui'
|
|
3
|
+
|
|
4
|
+
require 'jwt'
|
|
5
|
+
require 'json'
|
|
6
|
+
require 'time'
|
|
7
|
+
|
|
8
|
+
module Fastlane
|
|
9
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
|
|
10
|
+
|
|
11
|
+
module Helper
|
|
12
|
+
class SqCiToolsYandexApiHelper
|
|
13
|
+
|
|
14
|
+
def self.get_iam_token(keys_file_path:)
|
|
15
|
+
uri = URI.parse("https://iam.api.cloud.yandex.net")
|
|
16
|
+
|
|
17
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
18
|
+
http.use_ssl = true
|
|
19
|
+
http.set_debug_output($stdout)
|
|
20
|
+
|
|
21
|
+
request = Net::HTTP::Post.new("/iam/v1/tokens")
|
|
22
|
+
request.add_field('Content-Type', 'application/json')
|
|
23
|
+
request.body = {
|
|
24
|
+
"jwt" => self.generate_jwt(keys_file_path)
|
|
25
|
+
}.to_json
|
|
26
|
+
response = http.request(request)
|
|
27
|
+
|
|
28
|
+
if response.kind_of? Net::HTTPSuccess
|
|
29
|
+
json_body = JSON.parse(response.body)
|
|
30
|
+
return json_body["iamToken"]
|
|
31
|
+
else
|
|
32
|
+
UI.user_error!("Unable to fetch Yandex API IAM Token: #{response.message}, #{response.body}")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def self.generate_jwt(keys_file_path)
|
|
39
|
+
key_file_content = JSON.parse(File.read(keys_file_path))
|
|
40
|
+
|
|
41
|
+
self.signed_token(key_file_content)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.signed_token(key_file_content)
|
|
45
|
+
service_account_id = key_file_content['service_account_id']
|
|
46
|
+
key_id = key_file_content['id']
|
|
47
|
+
|
|
48
|
+
payload = {
|
|
49
|
+
iss: service_account_id,
|
|
50
|
+
exp: Time.now.to_i + 3600,
|
|
51
|
+
iat: Time.now.to_i,
|
|
52
|
+
nbf: Time.now.to_i,
|
|
53
|
+
aud: "https://iam.api.cloud.yandex.net/iam/v1/tokens"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
header = {
|
|
57
|
+
kid: key_id
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private_key = self.load_private_key(key_file_content)
|
|
61
|
+
|
|
62
|
+
JWT.encode(payload, private_key, 'PS256', header)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.load_private_key(key_file_content)
|
|
66
|
+
OpenSSL::PKey::RSA.new(key_file_content['private_key'])
|
|
67
|
+
rescue IOError, JSON::ParserError, OpenSSL::PKey::RSAError => e
|
|
68
|
+
raise "Failed to load or parse private key: #{e.message}"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require 'fastlane_core/ui/ui'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
|
|
6
|
+
HOST = 'api.tracker.yandex.net'
|
|
7
|
+
|
|
8
|
+
module Helper
|
|
9
|
+
class SqCiToolsYandexTrackerHelper
|
|
10
|
+
|
|
11
|
+
def self.find_issues(query:, body:, iam_token:, organization_id:)
|
|
12
|
+
http = self.get_http
|
|
13
|
+
|
|
14
|
+
query_params = URI.encode_www_form(query)
|
|
15
|
+
request = Net::HTTP::Post.new("/v3/issues/_search?#{query_params}")
|
|
16
|
+
self.fill_headers(
|
|
17
|
+
request: request,
|
|
18
|
+
iam_token: iam_token,
|
|
19
|
+
organization_id: organization_id
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
request.body = body.to_json
|
|
23
|
+
response = http.request(request)
|
|
24
|
+
|
|
25
|
+
if response.kind_of? Net::HTTPSuccess
|
|
26
|
+
json_body = JSON.parse(response.body)
|
|
27
|
+
return json_body
|
|
28
|
+
else
|
|
29
|
+
UI.user_error!("Unable to fetch Yandex Tracker issues: #{response.message}, #{response.body}")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.create_issue(query:, body:, iam_token:, organization_id:)
|
|
34
|
+
http = self.get_http
|
|
35
|
+
|
|
36
|
+
query_params = URI.encode_www_form(query)
|
|
37
|
+
request = Net::HTTP::Post.new("/v3/issues?#{query_params}")
|
|
38
|
+
self.fill_headers(
|
|
39
|
+
request: request,
|
|
40
|
+
iam_token: iam_token,
|
|
41
|
+
organization_id: organization_id
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
request.body = body.to_json
|
|
45
|
+
response = http.request(request)
|
|
46
|
+
|
|
47
|
+
if response.kind_of? Net::HTTPSuccess
|
|
48
|
+
json_body = JSON.parse(response.body)
|
|
49
|
+
return json_body
|
|
50
|
+
else
|
|
51
|
+
UI.user_error!("Unable to fetch Yandex Tracker issues: #{response.message}, #{response.body}")
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def self.update_issue(query:, issue_id:, body:, iam_token:, organization_id:)
|
|
57
|
+
http = self.get_http
|
|
58
|
+
|
|
59
|
+
query_params = URI.encode_www_form(query)
|
|
60
|
+
request = Net::HTTP::Patch.new("/v3/issues/#{issue_id}?#{query_params}")
|
|
61
|
+
self.fill_headers(
|
|
62
|
+
request: request,
|
|
63
|
+
iam_token: iam_token,
|
|
64
|
+
organization_id: organization_id
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
request.body = body.to_json
|
|
68
|
+
response = http.request(request)
|
|
69
|
+
|
|
70
|
+
if response.kind_of? Net::HTTPSuccess
|
|
71
|
+
json_body = JSON.parse(response.body)
|
|
72
|
+
return json_body
|
|
73
|
+
else
|
|
74
|
+
UI.user_error!("Unable to fetch Yandex Tracker issues: #{response.message}, #{response.body}")
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.transit_issue(issue_id:, transition_name:, iam_token:, organization_id:)
|
|
79
|
+
http = self.get_http
|
|
80
|
+
|
|
81
|
+
request = Net::HTTP::Post.new("/v3/issues/#{issue_id}/transitions/#{transition_name}/_execute")
|
|
82
|
+
self.fill_headers(
|
|
83
|
+
request: request,
|
|
84
|
+
iam_token: iam_token,
|
|
85
|
+
organization_id: organization_id
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
response = http.request(request)
|
|
89
|
+
|
|
90
|
+
if response.kind_of? Net::HTTPSuccess
|
|
91
|
+
json_body = JSON.parse(response.body)
|
|
92
|
+
return json_body
|
|
93
|
+
else
|
|
94
|
+
UI.user_error!("Unable to fetch Yandex Tracker issues: #{response.message}, #{response.body}")
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
private
|
|
99
|
+
|
|
100
|
+
def self.get_http
|
|
101
|
+
uri = URI.parse("https://#{HOST}")
|
|
102
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
103
|
+
http.use_ssl = true
|
|
104
|
+
http.set_debug_output($stdout)
|
|
105
|
+
|
|
106
|
+
http
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def self.fill_headers(request:, iam_token:, organization_id:)
|
|
110
|
+
request.add_field('Content-Type', 'application/json')
|
|
111
|
+
request.add_field('Host', HOST)
|
|
112
|
+
request.add_field('Authorization', "Bearer #{iam_token}")
|
|
113
|
+
request.add_field('X-Cloud-Org-ID', organization_id)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require 'fastlane_core/ui/ui'
|
|
3
|
+
require 'fastlane_core/configuration/config_item'
|
|
4
|
+
require 'credentials_manager/appfile_config'
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
|
|
8
|
+
|
|
9
|
+
module Options
|
|
10
|
+
class Max
|
|
11
|
+
def self.options
|
|
12
|
+
[
|
|
13
|
+
FastlaneCore::ConfigItem.new(
|
|
14
|
+
key: :max_access_token,
|
|
15
|
+
env_name: 'SQ_CI_MAX_ACCESS_TOKEN',
|
|
16
|
+
description: 'Access token for Max bot',
|
|
17
|
+
optional: true,
|
|
18
|
+
type: String
|
|
19
|
+
),
|
|
20
|
+
FastlaneCore::ConfigItem.new(
|
|
21
|
+
key: :max_chat_ids,
|
|
22
|
+
env_name: 'SQ_CI_MAX_CHAT_IDS',
|
|
23
|
+
description: 'Max\'s chat ids for send message',
|
|
24
|
+
optional: true,
|
|
25
|
+
type: String
|
|
26
|
+
),
|
|
27
|
+
FastlaneCore::ConfigItem.new(
|
|
28
|
+
key: :max_format,
|
|
29
|
+
env_name: 'SQ_CI_MAX_FORMAT',
|
|
30
|
+
description: 'Max\'s format of message',
|
|
31
|
+
optional: true,
|
|
32
|
+
type: String,
|
|
33
|
+
default_value: "markdown"
|
|
34
|
+
)
|
|
35
|
+
]
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require 'fastlane_core/ui/ui'
|
|
3
|
+
require 'fastlane_core/configuration/config_item'
|
|
4
|
+
|
|
5
|
+
module Fastlane
|
|
6
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
|
|
7
|
+
|
|
8
|
+
module Options
|
|
9
|
+
class YandexApi
|
|
10
|
+
def self.options
|
|
11
|
+
[
|
|
12
|
+
FastlaneCore::ConfigItem.new(
|
|
13
|
+
key: :iam_token,
|
|
14
|
+
env_name: 'SQ_CI_YANDEX_API_IAM_TOKEN',
|
|
15
|
+
description: 'IAM token for Yandex API',
|
|
16
|
+
optional: false,
|
|
17
|
+
type: String,
|
|
18
|
+
default_value: Fastlane::Actions.lane_context[Fastlane::Actions::SharedValues::SQ_CI_YANDEX_API_IAM_TOKEN],
|
|
19
|
+
default_value_dynamic: true,
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'fastlane/action'
|
|
2
|
+
require 'fastlane_core/ui/ui'
|
|
3
|
+
require 'fastlane_core/configuration/config_item'
|
|
4
|
+
|
|
5
|
+
module Fastlane
|
|
6
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
|
|
7
|
+
|
|
8
|
+
module Options
|
|
9
|
+
class YandexTracker
|
|
10
|
+
def self.options
|
|
11
|
+
[
|
|
12
|
+
FastlaneCore::ConfigItem.new(
|
|
13
|
+
key: :organization_id,
|
|
14
|
+
env_name: 'SQ_CI_YANDEX_TRACKER_ORGANIZATION_ID',
|
|
15
|
+
description: 'Organization id in Yandex cloud',
|
|
16
|
+
optional: false,
|
|
17
|
+
type: String,
|
|
18
|
+
)
|
|
19
|
+
]
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastlane-plugin-sq_ci_tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Semen Kologrivov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-05-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: pry
|
|
@@ -136,6 +136,20 @@ dependencies:
|
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: 2.222.0
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: jwt
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
139
153
|
description:
|
|
140
154
|
email: semen@sequenia.com
|
|
141
155
|
executables: []
|
|
@@ -153,20 +167,31 @@ files:
|
|
|
153
167
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_get_team_identifier_action.rb
|
|
154
168
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_notify_action.rb
|
|
155
169
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_prepare_keychain_action.rb
|
|
170
|
+
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_max_message_action.rb
|
|
156
171
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb
|
|
157
172
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_set_version_code_action.rb
|
|
158
173
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_setup_ios_code_sign_action.rb
|
|
159
174
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_upload_aab_to_google_play_action.rb
|
|
160
175
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_upload_file_to_s3_action.rb
|
|
176
|
+
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_api_get_iam_token_action.rb
|
|
177
|
+
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_create_issue_action.rb
|
|
178
|
+
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_find_issues_action.rb
|
|
179
|
+
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_transit_issue_action.rb
|
|
180
|
+
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_yandex_tracker_update_issue_action.rb
|
|
161
181
|
- lib/fastlane/plugin/sq_ci_tools/helper/sq_ci_tools_helper.rb
|
|
182
|
+
- lib/fastlane/plugin/sq_ci_tools/helper/sq_ci_tools_yandex_api_helper.rb
|
|
183
|
+
- lib/fastlane/plugin/sq_ci_tools/helper/sq_ci_tools_yandex_tracker_helper.rb
|
|
162
184
|
- lib/fastlane/plugin/sq_ci_tools/options/android_app.rb
|
|
163
185
|
- lib/fastlane/plugin/sq_ci_tools/options/code_signing.rb
|
|
164
186
|
- lib/fastlane/plugin/sq_ci_tools/options/google_play.rb
|
|
165
187
|
- lib/fastlane/plugin/sq_ci_tools/options/ios_app.rb
|
|
166
188
|
- lib/fastlane/plugin/sq_ci_tools/options/keychain.rb
|
|
189
|
+
- lib/fastlane/plugin/sq_ci_tools/options/max.rb
|
|
167
190
|
- lib/fastlane/plugin/sq_ci_tools/options/s3.rb
|
|
168
191
|
- lib/fastlane/plugin/sq_ci_tools/options/shared.rb
|
|
169
192
|
- lib/fastlane/plugin/sq_ci_tools/options/telegram.rb
|
|
193
|
+
- lib/fastlane/plugin/sq_ci_tools/options/yandex_api.rb
|
|
194
|
+
- lib/fastlane/plugin/sq_ci_tools/options/yandex_tracker.rb
|
|
170
195
|
- lib/fastlane/plugin/sq_ci_tools/version.rb
|
|
171
196
|
homepage: https://github.com/sequenia/fastlane-plugin-sq_ci_tools
|
|
172
197
|
licenses:
|
|
@@ -188,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
188
213
|
- !ruby/object:Gem::Version
|
|
189
214
|
version: '0'
|
|
190
215
|
requirements: []
|
|
191
|
-
rubygems_version: 3.
|
|
216
|
+
rubygems_version: 3.5.22
|
|
192
217
|
signing_key:
|
|
193
218
|
specification_version: 4
|
|
194
219
|
summary: CI Library for sequenia's projects
|