jira-auto-tool 1.2.4 → 1.3.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/.ruby-version +1 -0
- data/CHANGELOG.md +250 -2
- data/features/configure_environment.feature +1 -1
- data/features/control_http_request_rate_limit.feature +9 -3
- data/lib/jira/auto/tool/project/ticket_fields.rb +6 -6
- data/lib/jira/auto/tool/rate_limited_jira_client.rb +3 -3
- data/lib/jira/auto/tool/ticket.rb +18 -3
- data/lib/jira/auto/tool/version.rb +1 -1
- data/lib/jira/auto/tool.rb +1 -2
- data/lib/tasks/version.rake +9 -0
- data/spec/jira/auto/tool/ticket_fields_spec.rb +63 -0
- data/spec/jira/auto/tool_spec.rb +1 -3
- data/spec/spec_helper.rb +2 -2
- metadata +19 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10216d00bff952b0f764be5150489605b0835257b5cf2a7bc3e6bc0527ae5df2
|
|
4
|
+
data.tar.gz: 0bff2827284487e193514144646217815d5d179edf992b36267d3527585678e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 318110a62382739e49b26fbab45218dec7c7df8df9dfdb2504799edbaf1b4f4c9e5aecc43aec21c1f5df3a72454614f7f863895b80978336e2768be398342d20
|
|
7
|
+
data.tar.gz: 72dad5846292a289e58a5ae9990d876a7739024d0bcc70c6b5695dad4d842aee8ae8936f8b3cbf30db25bb3741c14ecc24e16f8f2aea2e0d13711e8101f0cd56
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.8
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,253 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
-
## [
|
|
3
|
+
## [1.3.0] - 2026-01-01 - Adding support for Jira API v3
|
|
4
|
+
|
|
5
|
+
- chore(dependencies): remove explicit Ruby version declaration in Gemfile
|
|
6
|
+
- chore(dependencies): update `Gemfile.lock` to include Ruby 3.4.8
|
|
7
|
+
- chore: add `.ruby-version` file with Ruby 3.4.8
|
|
8
|
+
- chore(build): make Ruby version dynamic based on `.ruby-version` file
|
|
9
|
+
- chore(gemspec): update required Ruby version to >= 3.4.8
|
|
10
|
+
- Bump jira-auto-tool to 1.3.0
|
|
11
|
+
- chore(dependencies): update `Gemfile.lock` to include `cgi` dependency for `jira-auto-tool`
|
|
12
|
+
- refactor(jira): enhance field handling, simplify method signatures, and add tests for improved API compatibility
|
|
13
|
+
- test(rate-limit): made the test more robust with data to query
|
|
14
|
+
- refactor(jira): improve compatibility across Jira API versions to support V3
|
|
15
|
+
- chore(gemspec): update required Ruby version to >= 3.4.7
|
|
16
|
+
|
|
17
|
+
## [1.2.2] - 2025-06-14
|
|
18
|
+
|
|
19
|
+
- Updated the gem versions
|
|
20
|
+
|
|
21
|
+
## [1.2.1] - 2025-05-10
|
|
22
|
+
|
|
23
|
+
- Update README and refine gemspec and code structure
|
|
24
|
+
- Add support for identifying and masking secret environment values
|
|
25
|
+
- Prevent creation of duplicate or anterior sprints.
|
|
26
|
+
- Update README with fixes and new example for sprint updates
|
|
27
|
+
- Improve error handling in EnvironmentLoader configuration parsing
|
|
28
|
+
|
|
29
|
+
## [1.2.0] - 2025-05-08
|
|
30
|
+
|
|
31
|
+
- Added support for in-process based Jira HTTP rate limiting to remove the need to setup Redis
|
|
32
|
+
- Rename rate limit environment variable for clarity
|
|
33
|
+
- Refactor README and example configs for clarity and consistency
|
|
34
|
+
- Refactor to rename and update rate-limited Jira client
|
|
35
|
+
|
|
36
|
+
## [1.1.3] - 2025-05-05
|
|
37
|
+
|
|
38
|
+
- Implementing disabling wrapper generation on Windows
|
|
39
|
+
- Updated the env example setting to reflect the dev environment setup
|
|
40
|
+
- Make sure the env values are set as strings
|
|
41
|
+
- Exclude .bat files from gem executables
|
|
42
|
+
- Preventing the concurrent feature scenarios execution
|
|
43
|
+
- Fixed sprint filtering expectations
|
|
44
|
+
|
|
45
|
+
## [1.1.2] - 2025-05-04
|
|
46
|
+
|
|
47
|
+
- Add version bump task to streamline version management
|
|
48
|
+
|
|
49
|
+
## [1.1.1] - 2025-05-04
|
|
50
|
+
|
|
51
|
+
- Refactor and standardize environment variable handling
|
|
52
|
+
- Bumped the Gemfile.lock spec to jira-auto-tool (1.1.0)
|
|
53
|
+
|
|
54
|
+
## [1.1.0] - 2025-05-03
|
|
55
|
+
|
|
56
|
+
- Implemented the ability to configure the environment via a YAML.ERB file.
|
|
57
|
+
|
|
58
|
+
## [1.0.0] - 2025-05-02
|
|
59
|
+
|
|
60
|
+
- Bump jira-auto-tool to 1.0.0
|
|
61
|
+
- Update README with correct gem name for 1.0.0 installation
|
|
62
|
+
- Made checking --board-list output expectations more robust
|
|
63
|
+
- Remove @wip tag from rename_sprints feature file
|
|
64
|
+
- Update jira-auto-tool to v0.1.1 and downgrade Bundler version
|
|
65
|
+
- Update gemspec with valid push host and include spec and features folders
|
|
66
|
+
|
|
67
|
+
## [0.1.1] - 2025-05-02
|
|
68
|
+
|
|
69
|
+
- Add detailed instructions and usage examples to README
|
|
70
|
+
- Improved integrated help (--help) with examples and more visible sections.
|
|
71
|
+
- Update board cache expiry period from one hour to one day
|
|
72
|
+
- Add `rb-readline` dependency and more robust Windows-specific gems handling
|
|
73
|
+
- Add `rb-readline` dependency and more robust Windows-specific gems handling
|
|
74
|
+
- Update non rate limited example expectation to cope with longer execution times
|
|
75
|
+
- Refactor option handling and add HTTP debugging functionality.
|
|
76
|
+
- Refactor options handling into a dedicated module
|
|
77
|
+
- Fixing Rubocop warnings with the Gems not being in alphabetical order in the Gemfile
|
|
78
|
+
- Allow camelCase or snake_case parameters for request pagination.
|
|
79
|
+
- Handle duplicate sprint names during renaming process
|
|
80
|
+
- Improve Rakefile task configuration and annotate failing tests
|
|
81
|
+
- Add support for quarterly and general sprint renaming
|
|
82
|
+
- Refactor Jira client initialization to use helper method
|
|
83
|
+
- Update Gemfile.lock with new dependencies and platform adjustments
|
|
84
|
+
- Add `workflow_dispatch` trigger to GitHub Actions
|
|
85
|
+
- Update Gemfile.lock dependencies to latest compatible versions
|
|
86
|
+
- Refactor Jira sprint fetching to use reusable pagination helper.
|
|
87
|
+
- JAT-60 - Add `--quarterly-sprint-rename` to replace `--sprint-rename`
|
|
88
|
+
- JAT-60 - Refactor sprint methods to use quarterly-specific naming
|
|
89
|
+
- Upgraded all gems including uri to fix CVE-2025-27221
|
|
90
|
+
- JAT-56 - Caching all board attributes to avoid request them one by one
|
|
91
|
+
- JAT-55 - Made sure aruba is setup before using it in a hook
|
|
92
|
+
- JAT-55 - Aruba tests are running in the sandbox (no more HOME pollution)
|
|
93
|
+
- JAT-52 - Moved the cache to be stored in the config directory.
|
|
94
|
+
- JAT-49 - Implemented persisting configuration to a file
|
|
95
|
+
- Added sub sections in the command line help for readibility
|
|
96
|
+
- JAT-46 - Implemented filtered board caching
|
|
97
|
+
- GitHub Actions - Limiting execution to Ruby 3.4.2
|
|
98
|
+
- GitrHub Action - Fixing incorrect ruby matrix syntax
|
|
99
|
+
- JAT-38 - Implemented --sprint-add=25.3.1,4
|
|
100
|
+
- Gem package can build successfully
|
|
101
|
+
- Gem package can build successfully
|
|
102
|
+
- JAT-32 - Adjust the end date of a sprint
|
|
103
|
+
- Handling missing team and generating a warning when no sprint prefix associated to a team
|
|
104
|
+
- Fixed missed test due to terminal-table behavior change
|
|
105
|
+
- Updated the gem versions
|
|
106
|
+
- Add pre-push hook to run rake tasks
|
|
107
|
+
- Now using the team names/values associated to the tickets to map
|
|
108
|
+
- Fixed improper timezone specification
|
|
109
|
+
- Attempting to fix differing encoding while executing sprint_spec.rb tests
|
|
110
|
+
- Configured RSpec to use UTF-8 for internal and external encoding
|
|
111
|
+
- Attempting to fix differing encoding while executing sprint_spec.rb tests
|
|
112
|
+
- Attempting to fix differing encoding while executing sprint_spec.rb tests
|
|
113
|
+
- Add UTF-8 encoding to sprint_spec.rb
|
|
114
|
+
- Dealing with sprints missing dates while aligning time in dates
|
|
115
|
+
- Implemented aligning time in sprints having start and end dates
|
|
116
|
+
- Fixing syntax error in GitHub Action workflow
|
|
117
|
+
- Added missing JIRA_PROJECT_KEY
|
|
118
|
+
- Fixing syntax error in GitHub workflow
|
|
119
|
+
- Dynamically setting environment variables
|
|
120
|
+
- Implemented --project-field-list
|
|
121
|
+
- Adjustted the rate limiter maximal time
|
|
122
|
+
- Fixed the logic of NextNameGenerator#pulling_sprint_into_previous_planning_interval?
|
|
123
|
+
- Added KeepSameNameGenerator to further simplify the renaming logic
|
|
124
|
+
- Refactoring to simplify next name generation
|
|
125
|
+
- Adjusted rate limiting expectations
|
|
126
|
+
- Added more NextNameGenerator tests
|
|
127
|
+
- Removed TODO which was done in previous commit
|
|
128
|
+
- Refactored to simplify the renamer next name generation
|
|
129
|
+
- SprintRenamer: more scenarios and fixed saving name issue
|
|
130
|
+
- Implemented the SprintRenamer logic.
|
|
131
|
+
- Now accepting methods up to 20 lines
|
|
132
|
+
- --sprint-list now expects the sprints to be sorted
|
|
133
|
+
- Fixed matching the output of --sprint-prefix-list
|
|
134
|
+
- Request rate limiting environment variable driven and disabled by default.
|
|
135
|
+
- Added renaming sprint feature early draft
|
|
136
|
+
- Mocking board when testing the Tool class.
|
|
137
|
+
- Sprints appearing on several boards are only listed once.
|
|
138
|
+
- Fixed rate limiting by properly tracking each API call.
|
|
139
|
+
- Handling non convention compliant names for comparisons.
|
|
140
|
+
- project_ticket_creation_metadata_fetcher.rb Added an AI Assistant suggestion as commented out code
|
|
141
|
+
- Made the table header matching regex based
|
|
142
|
+
- Made sure that ./bin is the executable directory for the gem
|
|
143
|
+
- SprintController#sprints no longer returns sprint duplicates that could appear when the same sprint is visible on several boards
|
|
144
|
+
- Fixed running jira-auto-tool from another folder than the gem root
|
|
145
|
+
- Removed unnecessary JIRA::HttpClient patch
|
|
146
|
+
- Fix GitHub Actions misaligned expected board name and board name regex values
|
|
147
|
+
- Switched to using RateLimitedJiraClient
|
|
148
|
+
- Made the check of expected out --xx-list commands more robust
|
|
149
|
+
- Removed the duplicated board loading
|
|
150
|
+
- Fixed sprint filtering testing and ignoring closed ones
|
|
151
|
+
- Listing only unclosed sprints
|
|
152
|
+
- Added Sprint Id output when listing sprints
|
|
153
|
+
- HTTP rate limit to 1 request every 4 seconds
|
|
154
|
+
- Adjusted the JIRA board name to use in the GitHub Action
|
|
155
|
+
- Added the missing redis ports
|
|
156
|
+
- Waiting for redis to start
|
|
157
|
+
- Added the installation of the redis-cli
|
|
158
|
+
- Removed the explicit redis port information
|
|
159
|
+
- Redis values are defined at the global environment level
|
|
160
|
+
- Fixing the redis port variable use
|
|
161
|
+
- Fixed misalignment in GitHub Action definition
|
|
162
|
+
- Ignoring with a warning sprints not comforming to a format like ART_Team_25.1.2
|
|
163
|
+
- Rate limited the HTTP requests to one every other second
|
|
164
|
+
- Added the needed redis service in the GitHub Actions
|
|
165
|
+
- Added support for optional/missing sprint dates and missing boards
|
|
166
|
+
- All the sprints that are matched are removed
|
|
167
|
+
- XSRevert "Updated the needed Gem versions"
|
|
168
|
+
- Updated the needed Gem versions
|
|
169
|
+
- Catching exceptions to add more context in case of error
|
|
170
|
+
- Request rate limiting using redis and ratelimit gems
|
|
171
|
+
- GitHub Actions Board adjusted and jira instance boards filtered accordingly.
|
|
172
|
+
- Switching GitHub Action board to a Scrum Board
|
|
173
|
+
- Tweaked the logging
|
|
174
|
+
- Implemented --sprint-prefix-list and replaced CRLF with LF in files
|
|
175
|
+
- Fixed --sprint-list to only used sprint based boards
|
|
176
|
+
- Fixed RequestBuilder and subclassed to use the context_path
|
|
177
|
+
- --board-list the Jira instance board using a board_name_regex when defined
|
|
178
|
+
- Fixed broken xxx_when_defined_else
|
|
179
|
+
- Enabling the HttpClient patch so that context_path works as expected.
|
|
180
|
+
- Implemented --board-list and JIRA_PROJECT_KEY
|
|
181
|
+
- Added JIRA_CONTEXT_PATH
|
|
182
|
+
- Ruby load path to include scrip_path/../lib
|
|
183
|
+
- Bumped Aruba timeout to 300 seconds
|
|
184
|
+
- Added sprint filtering using an ART_SPRINT_REGEX environment variable
|
|
185
|
+
- Ignoring rerun_failures.txt used for Cucumber failure reruns
|
|
186
|
+
- The originBoardId is used to create sprints following an existing instead of a single board id.
|
|
187
|
+
- guard cucumber tor rerun failed features first if any
|
|
188
|
+
- Finalized team tickets dispatching on sprints according to expected start dates
|
|
189
|
+
- Ticket dispatching is now assigning a sprint to a ticket
|
|
190
|
+
- Added the matching of sprint to the corresponding prefix sprint
|
|
191
|
+
- Implemented creating tickets with custom fields and fetching the actual ticket values.
|
|
192
|
+
- Specifying the badge labels
|
|
193
|
+
- GitHub Actions - Updated to monitor all branches
|
|
194
|
+
- Cleaned TeamSprintPrefixMapper spec further
|
|
195
|
+
- Simplified TeamSprintPrefixMapper
|
|
196
|
+
- Ignoring /log directory
|
|
197
|
+
- Implemented mapping sprints to team names
|
|
198
|
+
- Implemented fetching field options
|
|
199
|
+
- JAT-15 - Implemented the ability to find the implementation_team and expected_start_date fields.
|
|
200
|
+
- Implemented jira_resource_double to centrally deal with rubocop:disable RSpec/VerifiedDoubles
|
|
201
|
+
- More robust sprint comparison using start_date, end_date and parsed_name
|
|
202
|
+
- Removed unused class
|
|
203
|
+
- Fixed broken --board-name=
|
|
204
|
+
- Fixed Rubocop warnings
|
|
205
|
+
- Updated the gem dependencies
|
|
206
|
+
- Finalized --sprint-add-until={current,coming}_quarter with current date time overridding
|
|
207
|
+
- Fixed 4-day sprint infinite loop issue where 24.4.10 was not > 24.4.9.
|
|
208
|
+
- Added logging statement and writing logs to a log directory.
|
|
209
|
+
- Incorrect UntilDate format should throw an error
|
|
210
|
+
- Implemented UntilDate and sprint loading pagination
|
|
211
|
+
- Create the next sprint using Sprint::Prefix#last_sprint
|
|
212
|
+
- Confirming that --sprint-add-one can handle multiple sprints
|
|
213
|
+
- Implemented --sprint-add-one when a single unclosed sprint exists
|
|
214
|
+
- Updating to Ruby 3.4.1
|
|
215
|
+
- Switching to Ruby 3.4 version in GitHub Actions
|
|
216
|
+
- Ruby 3.4. Using `#Thread::Backtrace::Location#base_label` to only get the method name
|
|
217
|
+
- Fixed typo in GitHub Actions file
|
|
218
|
+
- Configured the JIRA environment variables for GitHub Actions
|
|
219
|
+
- Renamed Jira::Sprint::Tool to Jira::Auto::Tool
|
|
220
|
+
- Renamed jira-sprint-tool command to jira-auto-tool
|
|
221
|
+
- Fixed an English typo.
|
|
222
|
+
- rubocop:disable RSpec/MultipleExpectations for Tool#create_sprint
|
|
223
|
+
- Added tests for SprintCreator
|
|
224
|
+
- Migrated tests for RequestBuilder and SprintStateUpdater
|
|
225
|
+
- Made RequestBuilder logging quieter
|
|
226
|
+
- Disabled Cucumber.io report publishing banner
|
|
227
|
+
- Removed unused code due to refactoring
|
|
228
|
+
- Moved RequestBuilder and subclasses in separate files
|
|
229
|
+
- Removed request handling duplication
|
|
230
|
+
- Refactoring request code
|
|
231
|
+
- Reducing the length of methods
|
|
232
|
+
- Fixed broken #create_sprint and #update_sprint_state tests
|
|
233
|
+
- Warning displayed when no unclosed sprint exist
|
|
234
|
+
- Dynamically creating closed sprints
|
|
235
|
+
- Removed duplication by using Jira::Sprint::Tool instead of the Jira client
|
|
236
|
+
- Handling the case where no sprint exist on the board
|
|
237
|
+
- Intermediate state to switch to Windows based development
|
|
238
|
+
- Create dependabot.yml
|
|
239
|
+
- Added guard for continuous local testing
|
|
240
|
+
- Adjusting GitAction badge URL
|
|
241
|
+
- Updated bundler dependencies
|
|
242
|
+
- Made the GitHub Action status visible on the README
|
|
243
|
+
- Removing 3.4.0 from the build matrix since that fails
|
|
244
|
+
- Added cucumber as part of the default rake target
|
|
245
|
+
- Turn of matrix fail-fast to know which versions are failing
|
|
246
|
+
- Added 3.4.0 in the build matrix
|
|
247
|
+
- Configure Rubocop and corrected warnings
|
|
248
|
+
- Switching to ruby 3.3.6
|
|
249
|
+
- Implemented basic --help
|
|
250
|
+
- Remove rspec initial failing test
|
|
251
|
+
- Initial commit after 'bundle gem ...'
|
|
252
|
+
|
|
4
253
|
|
|
5
|
-
- Initial release
|
|
@@ -205,7 +205,7 @@ Feature: Environment Configuration Management
|
|
|
205
205
|
When I run `jira-auto-tool --env-list`
|
|
206
206
|
Then it should fail with:
|
|
207
207
|
"""
|
|
208
|
-
ERROR Jira::Auto::Tool::EnvironmentLoader : ./jira-auto-tool.env.yaml.erb:6: failed to load with the following error:
|
|
208
|
+
ERROR Jira::Auto::Tool::EnvironmentLoader : ./jira-auto-tool.env.yaml.erb:6: failed to load with the following error: (RuntimeError)
|
|
209
209
|
This is meant to fail while loading!
|
|
210
210
|
"""
|
|
211
211
|
|
|
@@ -4,7 +4,13 @@ Feature: Control the HTTP request rate limit
|
|
|
4
4
|
I need the ability to control the HTTP request limit
|
|
5
5
|
|
|
6
6
|
Scenario Outline: Limiting the request rate
|
|
7
|
-
Given
|
|
7
|
+
Given a Jira Scrum board
|
|
8
|
+
And the board only has the following sprints:
|
|
9
|
+
| name | length | start_date | state |
|
|
10
|
+
| ART-16_CRM_24.4.1 | 2-week | 2024-12-01 11:00:00 UTC | closed |
|
|
11
|
+
| ART-16_E2E-Test_24.4.2 | 4-day | 2024-12-05 11:00:00 UTC | future |
|
|
12
|
+
| ART-32_Platform_24.4.7 | 3-week | 2024-10-07 11:00:00 UTC | future |
|
|
13
|
+
And the following environment variables are set:
|
|
8
14
|
| name | value |
|
|
9
15
|
| JAT_RATE_INTERVAL_IN_SECONDS | <rate_interval_in_seconds> |
|
|
10
16
|
| JAT_RATE_LIMIT_IMPLEMENTATION | <jat_rate_limit_implementation> |
|
|
@@ -13,8 +19,8 @@ Feature: Control the HTTP request rate limit
|
|
|
13
19
|
|
|
14
20
|
Examples:
|
|
15
21
|
| jat_rate_limit_implementation | rate_limit_per_interval | rate_interval_in_seconds | minimal_time | maximal_time |
|
|
16
|
-
| | 0 | 0 | 0 |
|
|
17
|
-
| in_process | 1 |
|
|
22
|
+
| | 0 | 0 | 0 | 7 |
|
|
23
|
+
| in_process | 1 | 1 | 1 | 20 |
|
|
18
24
|
| redis | 1 | 2 | 1 | 20 |
|
|
19
25
|
| redis | 1 | 10 | 18 | 120 |
|
|
20
26
|
|
|
@@ -39,12 +39,12 @@ module Jira
|
|
|
39
39
|
def each_issue_type_field
|
|
40
40
|
tool.jira_client.Createmeta.all({ projectKeys: project.key, "expand" => "projects.issuetypes.fields" })
|
|
41
41
|
.each do |createmeta|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
createmeta.attrs["issuetypes"].each do |issue_type|
|
|
43
|
+
issue_type_name = issue_type["name"]
|
|
44
|
+
issue_type["fields"].each_value do |field|
|
|
45
|
+
yield(issue_type_name, field)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -33,11 +33,11 @@ module Jira
|
|
|
33
33
|
|
|
34
34
|
alias original_request request
|
|
35
35
|
|
|
36
|
-
def request(*
|
|
36
|
+
def request(*)
|
|
37
37
|
if rate_limit_per_interval == NO_RATE_LIMIT_PER_INTERVAL
|
|
38
|
-
original_request(*
|
|
38
|
+
original_request(*)
|
|
39
39
|
else
|
|
40
|
-
rate_limit { original_request(*
|
|
40
|
+
rate_limit { original_request(*) }
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -42,8 +42,23 @@ module Jira
|
|
|
42
42
|
%i[key summary sprint implementation_team expected_start_date]
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
# Compatibility helper to access Issue fields across Jira API versions
|
|
46
|
+
# - jira-ruby v2: JIRA::Resource::Issue responds to #fields
|
|
47
|
+
# - jira-ruby v3: fields are nested under #attrs['fields']
|
|
48
|
+
def ticket_fields
|
|
49
|
+
if jira_ticket.respond_to?(:fields)
|
|
50
|
+
jira_ticket.fields
|
|
51
|
+
else
|
|
52
|
+
raise "attrs not found in #{jira_ticket}!" unless jira_ticket.respond_to?(:attrs)
|
|
53
|
+
|
|
54
|
+
attrs = jira_ticket.attrs
|
|
55
|
+
attrs["fields"] || attrs[:fields] ||
|
|
56
|
+
raise("fields not found in #{attrs} from #{jira_ticket}!")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
45
60
|
def sprint
|
|
46
|
-
|
|
61
|
+
ticket_fields.fetch(tool.jira_sprint_field.id)
|
|
47
62
|
end
|
|
48
63
|
|
|
49
64
|
def jira_client
|
|
@@ -96,8 +111,8 @@ module Jira
|
|
|
96
111
|
def jira_field_value(field_id = caller_locations(1, 1).first.base_label)
|
|
97
112
|
log.debug { "jira_field_value(#{field_id})" }
|
|
98
113
|
|
|
99
|
-
field =
|
|
100
|
-
raise "#{id}: value not found in #{
|
|
114
|
+
field = ticket_fields.fetch(field_id) do |id|
|
|
115
|
+
raise "#{id}: value not found in #{ticket_fields}"
|
|
101
116
|
end
|
|
102
117
|
|
|
103
118
|
log.debug { "jira_field_value(#{field_id}), field: #{field}" }
|
data/lib/jira/auto/tool.rb
CHANGED
|
@@ -160,7 +160,6 @@ module Jira
|
|
|
160
160
|
].collect { |value_name| [value_name, !HOLDS_A_SECRET] }).freeze
|
|
161
161
|
|
|
162
162
|
ENVIRONMENT_BASED_VALUE_SYMBOLS.each do |method_name, holds_a_secret|
|
|
163
|
-
holds_a_secret ||= false
|
|
164
163
|
define_overridable_environment_based_value(method_name, holds_a_secret)
|
|
165
164
|
end
|
|
166
165
|
|
|
@@ -209,7 +208,7 @@ module Jira
|
|
|
209
208
|
end
|
|
210
209
|
|
|
211
210
|
def tickets(jql = "project = #{project.key}")
|
|
212
|
-
jira_client.Issue.jql(jql).collect { |jira_ticket| Ticket.new(self, jira_ticket) }
|
|
211
|
+
jira_client.Issue.jql(jql, fields: ["*all"]).collect { |jira_ticket| Ticket.new(self, jira_ticket) }
|
|
213
212
|
rescue StandardError => e
|
|
214
213
|
raise <<~EOEM
|
|
215
214
|
Error fetching project tickets: Something went wrong:
|
data/lib/tasks/version.rake
CHANGED
|
@@ -53,3 +53,12 @@ end
|
|
|
53
53
|
|
|
54
54
|
desc "Alias for version:bump"
|
|
55
55
|
task :bump, [:type] => ["version:bump"]
|
|
56
|
+
|
|
57
|
+
desc "Upgrade gems, including bundler and gem"
|
|
58
|
+
task :upgrade do
|
|
59
|
+
sh "gem update --system"
|
|
60
|
+
sh "gem update"
|
|
61
|
+
sh "bundle update --bundler"
|
|
62
|
+
sh "bundle update --all"
|
|
63
|
+
sh "bundle audit"
|
|
64
|
+
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# //wsl.localhost/Ubuntu/home/cbroult/work/ruby/jira-auto-tool/features/ticket_fields_spec.rb
|
|
4
|
+
|
|
5
|
+
require "spec_helper"
|
|
6
|
+
require "jira/auto/tool/ticket"
|
|
7
|
+
|
|
8
|
+
module Jira
|
|
9
|
+
module Auto
|
|
10
|
+
class Tool
|
|
11
|
+
RSpec.describe Jira::Auto::Tool::Ticket do
|
|
12
|
+
let(:tool) { instance_double(Tool) }
|
|
13
|
+
|
|
14
|
+
describe "#ticket_fields" do
|
|
15
|
+
context "when JIRA API V2, jira_ticket responds to #fields" do
|
|
16
|
+
let(:jira_ticket_with_fields) do
|
|
17
|
+
jira_resource_double(JIRA::Resource::Issue, fields: { "example_field" => "value" })
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "returns the fields hash" do
|
|
21
|
+
ticket = described_class.new(tool, jira_ticket_with_fields)
|
|
22
|
+
expect(ticket.ticket_fields).to eq({ "example_field" => "value" })
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
context "when JIRA API V3, jira_ticket does not respond to #fields but responds to #attrs" do
|
|
27
|
+
let(:jira_ticket_with_attrs) do
|
|
28
|
+
jira_resource_double(JIRA::Resource::Issue, attrs: { "fields" => { "example_field" => "value" } })
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
let(:jira_ticket_with_invalid_attrs) do
|
|
32
|
+
jira_resource_double(JIRA::Resource::Issue, attrs: { "invalid" => "data" })
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "returns the fields hash from attrs" do
|
|
36
|
+
ticket = described_class.new(tool, jira_ticket_with_attrs)
|
|
37
|
+
expect(ticket.ticket_fields).to eq({ "example_field" => "value" })
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "raises an error if fields are not found in attrs" do
|
|
41
|
+
ticket = described_class.new(tool, jira_ticket_with_invalid_attrs)
|
|
42
|
+
expect do
|
|
43
|
+
ticket.ticket_fields
|
|
44
|
+
end
|
|
45
|
+
.to raise_error("fields not found in {\"invalid\" => \"data\"} from #{jira_ticket_with_invalid_attrs}!")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context "when jira_ticket does not respond to #fields or #attrs" do
|
|
50
|
+
let(:jira_ticket_without_fields_or_attrs) { jira_resource_double(JIRA::Resource::Issue) }
|
|
51
|
+
|
|
52
|
+
it "raises an error indicating attrs are not found" do
|
|
53
|
+
ticket = described_class.new(tool, jira_ticket_without_fields_or_attrs)
|
|
54
|
+
expect do
|
|
55
|
+
ticket.ticket_fields
|
|
56
|
+
end.to raise_error("attrs not found in #{jira_ticket_without_fields_or_attrs}!")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
data/spec/jira/auto/tool_spec.rb
CHANGED
|
@@ -230,8 +230,6 @@ module Jira
|
|
|
230
230
|
end
|
|
231
231
|
|
|
232
232
|
described_class::ENVIRONMENT_BASED_VALUE_SYMBOLS.each do |method_name, holds_a_secret|
|
|
233
|
-
holds_a_secret ||= false
|
|
234
|
-
|
|
235
233
|
describe "environment based values - #{method_name} - holds_a_secret = #{holds_a_secret}}" do
|
|
236
234
|
let(:object_with_overridable_value) { tool }
|
|
237
235
|
|
|
@@ -435,7 +433,7 @@ module Jira
|
|
|
435
433
|
allow(tool)
|
|
436
434
|
.to receive_messages(project: jira_resource_double(JIRA::Resource::Project, key: "project_key"))
|
|
437
435
|
|
|
438
|
-
allow(query).to receive(:jql).with(expected_jql).and_return([instance_double(JIRA::Resource::Issue)])
|
|
436
|
+
allow(query).to receive(:jql).with(expected_jql, fields: ["*all"]).and_return([instance_double(JIRA::Resource::Issue)])
|
|
439
437
|
end
|
|
440
438
|
|
|
441
439
|
context "without arguments" do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -33,9 +33,9 @@ RSpec.configure do |config|
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
config.include(Module.new do
|
|
36
|
-
def jira_resource_double(*
|
|
36
|
+
def jira_resource_double(*)
|
|
37
37
|
# rubocop:disable RSpec/VerifiedDoubles
|
|
38
|
-
double(*
|
|
38
|
+
double(*)
|
|
39
39
|
# rubocop:enable RSpec/VerifiedDoubles
|
|
40
40
|
end
|
|
41
41
|
end)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jira-auto-tool
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christophe Broult
|
|
@@ -23,6 +23,20 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: cgi
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
41
|
name: http_logger
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -214,6 +228,7 @@ extra_rdoc_files: []
|
|
|
214
228
|
files:
|
|
215
229
|
- ".rspec"
|
|
216
230
|
- ".rubocop.yml"
|
|
231
|
+
- ".ruby-version"
|
|
217
232
|
- CHANGELOG.md
|
|
218
233
|
- CODE_OF_CONDUCT.md
|
|
219
234
|
- Guardfile
|
|
@@ -357,6 +372,7 @@ files:
|
|
|
357
372
|
- spec/jira/auto/tool/team_spec.rb
|
|
358
373
|
- spec/jira/auto/tool/team_sprint_prefix_mapper_spec.rb
|
|
359
374
|
- spec/jira/auto/tool/team_sprint_ticket_dispatcher_spec.rb
|
|
375
|
+
- spec/jira/auto/tool/ticket_fields_spec.rb
|
|
360
376
|
- spec/jira/auto/tool/ticket_spec.rb
|
|
361
377
|
- spec/jira/auto/tool/until_date_spec.rb
|
|
362
378
|
- spec/jira/auto/tool_spec.rb
|
|
@@ -377,14 +393,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
377
393
|
requirements:
|
|
378
394
|
- - ">="
|
|
379
395
|
- !ruby/object:Gem::Version
|
|
380
|
-
version: 3.
|
|
396
|
+
version: 3.4.8
|
|
381
397
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
382
398
|
requirements:
|
|
383
399
|
- - ">="
|
|
384
400
|
- !ruby/object:Gem::Version
|
|
385
401
|
version: '0'
|
|
386
402
|
requirements: []
|
|
387
|
-
rubygems_version:
|
|
403
|
+
rubygems_version: 4.0.3
|
|
388
404
|
specification_version: 4
|
|
389
405
|
summary: Automate making adjustments to Jira sprints for multiple teams following
|
|
390
406
|
some naming conventions.
|