fastlane-plugin-sq_ci_tools 1.0.7 → 1.1.1
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_send_max_message_action.rb +1 -4
- data/lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_send_telegram_message_action.rb +1 -0
- 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/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 +25 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 257dbacc216995731d4d95ff7c652929ccbaad9d2b9839350c573b33e8297943
|
|
4
|
+
data.tar.gz: bd197f1d9b0fd417db3f12be458069c3e166b59fbd258e8de8511352d1db7aaf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01d9e207812753d9e793bdabf40ec927f0916ced2a1c50d130e7d30550c9a592f4441d76ded229c90ddba9a044e56140fbf363b8ccc204619948555f4b9bcf3f
|
|
7
|
+
data.tar.gz: ffc06b9fa4328c43cdb5678c5acfaa49c3b024dc3bfb49df1dd628801439d8a74960791ccccebe6eee785844898807af40bd8a28e7f54bc696ea0bab297d2b91
|
|
@@ -16,6 +16,7 @@ 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, {
|
|
@@ -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_FILE_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,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.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Semen Kologrivov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
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: []
|
|
@@ -159,7 +173,14 @@ files:
|
|
|
159
173
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_setup_ios_code_sign_action.rb
|
|
160
174
|
- lib/fastlane/plugin/sq_ci_tools/actions/sq_ci_tools_upload_aab_to_google_play_action.rb
|
|
161
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
|
|
162
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
|
|
163
184
|
- lib/fastlane/plugin/sq_ci_tools/options/android_app.rb
|
|
164
185
|
- lib/fastlane/plugin/sq_ci_tools/options/code_signing.rb
|
|
165
186
|
- lib/fastlane/plugin/sq_ci_tools/options/google_play.rb
|
|
@@ -169,6 +190,8 @@ files:
|
|
|
169
190
|
- lib/fastlane/plugin/sq_ci_tools/options/s3.rb
|
|
170
191
|
- lib/fastlane/plugin/sq_ci_tools/options/shared.rb
|
|
171
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
|
|
172
195
|
- lib/fastlane/plugin/sq_ci_tools/version.rb
|
|
173
196
|
homepage: https://github.com/sequenia/fastlane-plugin-sq_ci_tools
|
|
174
197
|
licenses:
|