fastlane-plugin-apadmi_grout 1.2.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac24d03d0373738dffc98532e4b3ea50ee479995a70aeb3e40d2d1593c10ff25
4
- data.tar.gz: 480f7215601eb77112b327065db85bf5aab1501ea468ca3b5ea6832e451c000c
3
+ metadata.gz: d02eac3252dcc39f75565411836b996092e96e83d7b6cc94fcfa7468205b2d40
4
+ data.tar.gz: 8631889511eaa1bcccf8fc43e3f678117bbb30667eab8e0c86a823f3b2850d83
5
5
  SHA512:
6
- metadata.gz: ad61c7daca59c15050a638dd832002d164162eb5f496b2a9052a6dc03a6bff3c9911f52b5e6ee16415a43234222cbc47ccab95f4cc5b4841a4a3cff6bba3b5a3
7
- data.tar.gz: dacd6738d17ed4fc07505faeedf2d4d21cb3e21314164c38b4594a3b6f6a4d1dbc7d0326ae77c4f852cd152bc81558ba7dfcd940423d2fe11ca347e44e1b6990
6
+ metadata.gz: aa0a969899d469ffbca92b37ba597509bf2a4d26d3c80cf5e5da3e72430d9cbe821b96a46caa3014c4246e8a47ca06bff7d7914c8f00af4ac3eab0e5ee1e9faf
7
+ data.tar.gz: 4b5809d27c8b2a35afa5d1f150efc00ae1c6fa1a3c499ba5b314eec54072b4d4010ced6d4fc4c863e85da99c90f554c1bd9c24a92d0f2143569be761797c03fe
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Fastlane Plugin Changelog
2
2
 
3
+ ## [2.0.0] - 2022-05-25
4
+ * Implement ADO support for all relevant existing actions
5
+
3
6
  ## [1.2.0] - 2022-05-17
4
7
  * Automatically save generated release notes to a file on disk.
5
8
 
@@ -12,18 +12,11 @@ module Fastlane
12
12
  logger = FastLane::FastlaneLogger.new
13
13
  logger.message("Finding tickets to move")
14
14
 
15
- build_tools = Apadmi::Grout::DependencyInjector.new(
16
- params[:jira_username],
17
- params[:jira_api_token],
18
- params[:jira_base_url],
19
- params[:jira_context_path],
20
- params[:jira_project_key],
21
- logger
22
- )
15
+ build_tools = Apadmi::Grout::DIWrapper.di(params, logger)
23
16
 
24
17
  build_tools.find_tickets_to_move_action.run(
25
- params[:jira_component_name],
26
- params[:jira_status_from],
18
+ params[:board_component_name],
19
+ params[:board_status_from],
27
20
  [],
28
21
  params[:custom_flag_messages],
29
22
  params[:options]
@@ -39,62 +32,21 @@ module Fastlane
39
32
  end
40
33
 
41
34
  def self.available_options
42
- [
43
- ########## JIRA Auth ##########
44
- FastlaneCore::ConfigItem.new(key: :jira_username,
45
- description: "JIRA username for authentication with JIRA",
46
- env_name: "JIRA_USERNAME",
47
- type: String,
48
- verify_block: proc do |value|
49
- UI.user_error!("Didn't pass a valid JIRA username") unless value
50
- end,
51
- optional: false),
52
- FastlaneCore::ConfigItem.new(key: :jira_api_token,
53
- description: "JIRA api token for authentication with JIRA",
54
- env_name: "JIRA_API_TOKEN",
55
- type: String,
56
- verify_block: proc do |value|
57
- UI.user_error!("Didn't pass a valid JIRA api token") unless value
58
- end,
59
- optional: false),
60
- FastlaneCore::ConfigItem.new(key: :jira_project_key,
61
- description: "JIRA project key",
62
- env_name: "JIRA_PROJECT_KEY",
63
- type: String,
64
- verify_block: proc do |value|
65
- UI.user_error!("Didn't pass a valid JIRA project key, e.g PPT") unless value
66
- end,
67
- optional: false),
68
- FastlaneCore::ConfigItem.new(key: :jira_base_url,
69
- description: "JIRA base url for the organisation",
70
- env_name: "JIRA_BASE_URL",
71
- type: String,
72
- verify_block: proc do |value|
73
- UI.user_error!("Didn't pass a valid JIRA base url") unless value
74
- end,
75
- optional: false),
76
- FastlaneCore::ConfigItem.new(key: :jira_context_path,
77
- description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
78
- env_name: "JIRA_CONTEXT_PATH",
79
- default_value: "",
80
- type: String,
81
- optional: true),
82
-
83
- ########## Action Specific ##########
84
- FastlaneCore::ConfigItem.new(key: :jira_component_name,
85
- description: "The JIRA component by which to filter tickets",
86
- env_name: "JIRA_COMPONENT_NAME",
35
+ Apadmi::Grout::CommonOptions.board_options + [
36
+ FastlaneCore::ConfigItem.new(key: :board_component_name,
37
+ description: "The component by which to filter tickets",
38
+ env_name: "BOARD_COMPONENT_NAME",
87
39
  type: String,
88
40
  verify_block: proc do |value|
89
- UI.user_error!("Didn't pass a valid JIRA component") unless value
41
+ UI.user_error!("Didn't pass a valid component") unless value
90
42
  end,
91
43
  optional: false),
92
- FastlaneCore::ConfigItem.new(key: :jira_status_from,
93
- description: "The JIRA status to filter by to find tickets",
94
- env_name: "JIRA_STATUS_FROM",
44
+ FastlaneCore::ConfigItem.new(key: :board_status_from,
45
+ description: "The status to filter by to find tickets",
46
+ env_name: "BOARD_STATUS_FROM",
95
47
  type: String,
96
48
  verify_block: proc do |value|
97
- UI.user_error!("Didn't pass a valid JIRA status") unless value
49
+ UI.user_error!("Didn't pass a valid status") unless value
98
50
  end,
99
51
  optional: false),
100
52
  FastlaneCore::ConfigItem.new(key: :custom_flag_messages,
@@ -13,14 +13,7 @@ module Fastlane
13
13
  logger = FastLane::FastlaneLogger.new
14
14
  logger.message("Generating Release Notes")
15
15
 
16
- build_tools = Apadmi::Grout::DependencyInjector.new(
17
- params[:jira_username],
18
- params[:jira_api_token],
19
- params[:jira_base_url],
20
- params[:jira_context_path],
21
- params[:jira_project_key],
22
- logger
23
- )
16
+ build_tools = Apadmi::Grout::DIWrapper.di(params, logger)
24
17
 
25
18
  logger.message("Finding changelog between #{params[:oldest_ref]} and #{params[:latest_ref]}")
26
19
  changelog = Fastlane::Actions::ChangelogFromGitCommitsAction.run(
@@ -63,54 +56,13 @@ module Fastlane
63
56
  end
64
57
 
65
58
  def self.return_value
66
- "The full release notes generated as one String"
59
+ "Array of two items: [release_notes_as_string, path_to_file_on_disk]"
67
60
  end
68
61
 
69
62
  def self.available_options
70
- [
71
- ########## JIRA Auth ##########
72
- FastlaneCore::ConfigItem.new(key: :jira_username,
73
- description: "JIRA username for authentication with JIRA",
74
- env_name: "JIRA_USERNAME",
75
- type: String,
76
- verify_block: proc do |value|
77
- UI.user_error!("Didn't pass a valid JIRA username") unless value
78
- end,
79
- optional: false),
80
- FastlaneCore::ConfigItem.new(key: :jira_api_token,
81
- description: "JIRA api token for authentication with JIRA",
82
- env_name: "JIRA_API_TOKEN",
83
- type: String,
84
- verify_block: proc do |value|
85
- UI.user_error!("Didn't pass a valid JIRA api token") unless value
86
- end,
87
- optional: false),
88
- FastlaneCore::ConfigItem.new(key: :jira_project_key,
89
- description: "JIRA project key",
90
- env_name: "JIRA_PROJECT_KEY",
91
- type: String,
92
- verify_block: proc do |value|
93
- UI.user_error!("Didn't pass a valid JIRA project key, e.g PPT") unless value
94
- end,
95
- optional: false),
96
- FastlaneCore::ConfigItem.new(key: :jira_base_url,
97
- description: "JIRA base url for the organisation",
98
- env_name: "JIRA_BASE_URL",
99
- type: String,
100
- verify_block: proc do |value|
101
- UI.user_error!("Didn't pass a valid JIRA base url") unless value
102
- end,
103
- optional: false),
104
- FastlaneCore::ConfigItem.new(key: :jira_context_path,
105
- description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
106
- env_name: "JIRA_CONTEXT_PATH",
107
- default_value: "",
108
- type: String,
109
- optional: true),
110
-
111
- ########## Action Specific ##########
63
+ Apadmi::Grout::CommonOptions.board_options + [
112
64
  FastlaneCore::ConfigItem.new(key: :tickets_moved_by_build,
113
- description: "Any JIRA tickets who's state was moved by this build",
65
+ description: "Any tickets who's state was moved by this build",
114
66
  default_value: [],
115
67
  type: Array,
116
68
  optional: true),
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fastlane/action"
4
+ require "apadmi_grout"
5
+ require_relative "../utils/fastlane_logger"
6
+
7
+ module Fastlane
8
+ module Actions
9
+ # Move JIRA tickets and generate release notes
10
+ class MoveTicketsAction < Action
11
+ def self.run(params)
12
+ logger = FastLane::FastlaneLogger.new
13
+ logger.message("Moving #{params[:board_provider]} tickets")
14
+
15
+ build_tools = Apadmi::Grout::DIWrapper.di(params, logger)
16
+
17
+ build_tools.move_tickets_action.run(
18
+ params[:versions],
19
+ params[:issues],
20
+ params[:board_status_to]
21
+ )
22
+ end
23
+
24
+ def self.description
25
+ "Convenience lane that moves all supplied jira tickets to new status and assigns versions."
26
+ end
27
+
28
+ def self.authors
29
+ ["samdc@apadmi.com"]
30
+ end
31
+
32
+ def self.available_options
33
+ Apadmi::Grout::CommonOptions.board_options + [
34
+ FastlaneCore::ConfigItem.new(key: :board_status_to,
35
+ description: "The JIRA status to move the tickets to",
36
+ env_name: "BOARD_STATUS_TO",
37
+ type: String,
38
+ verify_block: proc do |value|
39
+ UI.user_error!("Didn't pass a valid JIRA status") unless value
40
+ end,
41
+ optional: false),
42
+ FastlaneCore::ConfigItem.new(key: :versions,
43
+ description: "The versions to add to the jira ticket",
44
+ type: Array,
45
+ verify_block: proc do |value|
46
+ UI.user_error!("Didn't pass a valid array of versions") unless value || value.empty
47
+ end,
48
+ optional: false),
49
+ FastlaneCore::ConfigItem.new(key: :issues,
50
+ description: "The issues to be moved",
51
+ type: Array,
52
+ verify_block: proc do |value|
53
+ UI.user_error!("Didn't pass a valid array of issues") unless value
54
+ end,
55
+ optional: false)
56
+ ]
57
+ end
58
+
59
+ def self.is_supported?(_platform)
60
+ true
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Apadmi
4
+ module Grout
5
+ # Common options used to setup ADO and JIRA integration
6
+ class CommonOptions
7
+ def self.board_options
8
+ [
9
+ FastlaneCore::ConfigItem.new(key: :board_base_url,
10
+ description: "Base url for the organisation",
11
+ env_name: "BOARD_BASE_URL",
12
+ type: String,
13
+ verify_block: proc do |value|
14
+ UI.user_error!("Didn't pass a valid base url") unless value
15
+ end,
16
+ optional: false),
17
+ FastlaneCore::ConfigItem.new(key: :board_provider,
18
+ description: "The board provider, valid values: ADO|JIRA",
19
+ env_name: "BOARD_PROVIDER",
20
+ type: String,
21
+ default_value: "JIRA",
22
+ verify_block: proc do |value|
23
+ UI.user_error!("Didn't pass a valid board provider") unless value
24
+ end,
25
+ optional: false)
26
+ ] + ado_options + jira_options
27
+ end
28
+
29
+ def self.ado_options
30
+ [
31
+ FastlaneCore::ConfigItem.new(key: :ado_pat,
32
+ description: "ADO personal access token for authentication",
33
+ env_name: "ADO_PAT",
34
+ type: String,
35
+ verify_block: proc do |value|
36
+ UI.user_error!("Didn't pass a valid personal access token") unless value
37
+ end,
38
+ optional: true)
39
+ ]
40
+ end
41
+
42
+ def self.jira_options
43
+ [
44
+ FastlaneCore::ConfigItem.new(key: :jira_username,
45
+ description: "JIRA username for authentication with JIRA",
46
+ env_name: "JIRA_USERNAME",
47
+ type: String,
48
+ optional: true),
49
+ FastlaneCore::ConfigItem.new(key: :jira_api_token,
50
+ description: "JIRA api token for authentication with JIRA",
51
+ env_name: "JIRA_API_TOKEN",
52
+ type: String,
53
+ optional: true),
54
+ FastlaneCore::ConfigItem.new(key: :jira_project_key,
55
+ description: "JIRA project key",
56
+ env_name: "JIRA_PROJECT_KEY",
57
+ type: String,
58
+ optional: true),
59
+
60
+ FastlaneCore::ConfigItem.new(key: :jira_context_path,
61
+ description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
62
+ env_name: "JIRA_CONTEXT_PATH",
63
+ default_value: "",
64
+ type: String,
65
+ optional: true)
66
+ ]
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Apadmi
4
+ module Grout
5
+ # Helper function for constructing the DI from params
6
+ class DIWrapper
7
+ def self.di(params, logger)
8
+ case params[:board_provider]
9
+ when "ADO"
10
+ raise "Invalid ADO personal access token" if params[:ado_pat].blank?
11
+
12
+ Apadmi::Grout::DependencyInjector.init_for_ado(
13
+ params[:ado_pat],
14
+ params[:board_base_url],
15
+ logger
16
+ )
17
+ when "JIRA"
18
+ raise "Invalid jira username" if params[:jira_username].blank?
19
+ raise "Invalid jira_api_token" if params[:jira_api_token].blank?
20
+ raise "Invalid jira_project_key" if params[:jira_project_key].blank?
21
+
22
+ Apadmi::Grout::DependencyInjector.init_for_jira(
23
+ params[:jira_username],
24
+ params[:jira_api_token],
25
+ params[:board_base_url],
26
+ params[:jira_context_path],
27
+ params[:jira_project_key],
28
+ logger
29
+ )
30
+ else
31
+ raise "Unsupported board provider: #{params[:board_provider]}"
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module ApadmiGrout
5
- VERSION = "1.2.0"
5
+ VERSION = "2.0.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-apadmi_grout
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apadmi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-17 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apadmi_grout
@@ -164,7 +164,9 @@ files:
164
164
  - lib/fastlane/plugin/apadmi_grout/actions/find_tickets_to_move_action.rb
165
165
  - lib/fastlane/plugin/apadmi_grout/actions/generate_release_notes_action.rb
166
166
  - lib/fastlane/plugin/apadmi_grout/actions/get_deployment_target_action.rb
167
- - lib/fastlane/plugin/apadmi_grout/actions/move_jira_tickets_action.rb
167
+ - lib/fastlane/plugin/apadmi_grout/actions/move_tickets_action.rb
168
+ - lib/fastlane/plugin/apadmi_grout/utils/common_options.rb
169
+ - lib/fastlane/plugin/apadmi_grout/utils/di_wrapper.rb
168
170
  - lib/fastlane/plugin/apadmi_grout/utils/fastlane_logger.rb
169
171
  - lib/fastlane/plugin/apadmi_grout/version.rb
170
172
  homepage: https://bitbucket.org/apadmi/apadmi-grout-ruby/
@@ -1,112 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "fastlane/action"
4
- require "apadmi_grout"
5
- require_relative "../utils/fastlane_logger"
6
-
7
- module Fastlane
8
- module Actions
9
- # Move JIRA tickets and generate release notes
10
- class MoveJiraTicketsAction < Action
11
- def self.run(params)
12
- logger = FastLane::FastlaneLogger.new
13
- logger.message("Moving Jira tickets")
14
-
15
- build_tools = Apadmi::Grout::DependencyInjector.new(
16
- params[:jira_username],
17
- params[:jira_api_token],
18
- params[:jira_base_url],
19
- params[:jira_context_path],
20
- params[:jira_project_key],
21
- logger
22
- )
23
-
24
- build_tools.move_jira_tickets_action.run(
25
- params[:versions],
26
- params[:issues],
27
- params[:jira_status_to]
28
- )
29
- end
30
-
31
- def self.description
32
- "Convenience lane that moves all supplied jira tickets to new status and assigns versions."
33
- end
34
-
35
- def self.authors
36
- ["samdc@apadmi.com"]
37
- end
38
-
39
- def self.available_options
40
- [
41
- ########## JIRA Auth ##########
42
- FastlaneCore::ConfigItem.new(key: :jira_username,
43
- description: "JIRA username for authentication with JIRA",
44
- env_name: "JIRA_USERNAME",
45
- type: String,
46
- verify_block: proc do |value|
47
- UI.user_error!("Didn't pass a valid JIRA username") unless value
48
- end,
49
- optional: false),
50
- FastlaneCore::ConfigItem.new(key: :jira_api_token,
51
- description: "JIRA api token for authentication with JIRA",
52
- env_name: "JIRA_API_TOKEN",
53
- type: String,
54
- verify_block: proc do |value|
55
- UI.user_error!("Didn't pass a valid JIRA api token") unless value
56
- end,
57
- optional: false),
58
- FastlaneCore::ConfigItem.new(key: :jira_project_key,
59
- description: "JIRA project key",
60
- env_name: "JIRA_PROJECT_KEY",
61
- type: String,
62
- verify_block: proc do |value|
63
- UI.user_error!("Didn't pass a valid JIRA project key, e.g PPT") unless value
64
- end,
65
- optional: false),
66
- FastlaneCore::ConfigItem.new(key: :jira_base_url,
67
- description: "JIRA base url for the organisation",
68
- env_name: "JIRA_BASE_URL",
69
- type: String,
70
- verify_block: proc do |value|
71
- UI.user_error!("Didn't pass a valid JIRA base url") unless value
72
- end,
73
- optional: false),
74
- FastlaneCore::ConfigItem.new(key: :jira_context_path,
75
- description: "JIRA context path whatever that is ¯\\_(ツ)_/¯",
76
- env_name: "JIRA_CONTEXT_PATH",
77
- default_value: "",
78
- type: String,
79
- optional: true),
80
-
81
- ########## Action Specific ##########
82
- FastlaneCore::ConfigItem.new(key: :jira_status_to,
83
- description: "The JIRA status to move the tickets to",
84
- env_name: "JIRA_STATUS_TO",
85
- type: String,
86
- verify_block: proc do |value|
87
- UI.user_error!("Didn't pass a valid JIRA status") unless value
88
- end,
89
- optional: false),
90
- FastlaneCore::ConfigItem.new(key: :versions,
91
- description: "The versions to add to the jira ticket",
92
- type: Array,
93
- verify_block: proc do |value|
94
- UI.user_error!("Didn't pass a valid array of versions") unless value || value.empty
95
- end,
96
- optional: false),
97
- FastlaneCore::ConfigItem.new(key: :issues,
98
- description: "The issues to be moved",
99
- type: Array,
100
- verify_block: proc do |value|
101
- UI.user_error!("Didn't pass a valid array of issues") unless value
102
- end,
103
- optional: false)
104
- ]
105
- end
106
-
107
- def self.is_supported?(_platform)
108
- true
109
- end
110
- end
111
- end
112
- end