gitlab-releases 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +26 -0
- data/CHANGELOG.md +22 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +23 -0
- data/Gemfile.lock +158 -0
- data/LICENSE.txt +21 -0
- data/README.md +80 -0
- data/Rakefile +12 -0
- data/lib/gitlab_releases/date_calculator.rb +54 -0
- data/lib/gitlab_releases/release_calculator.rb +48 -0
- data/lib/gitlab_releases/release_version.rb +82 -0
- data/lib/gitlab_releases/release_version_client.rb +24 -0
- data/lib/gitlab_releases/release_versions.rb +139 -0
- data/lib/gitlab_releases/version.rb +5 -0
- data/lib/gitlab_releases/version_calculator.rb +30 -0
- data/lib/gitlab_releases.rb +41 -0
- data/sig/release_dates.rbs +4 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6b714bf4ec97c53e2345b9e37ca6ebd80ad25b0ca2b2eca602565e912a0d8304
|
4
|
+
data.tar.gz: 595b3cf4d281e55b5b538a3e3d2c93f1cf93540043388bff53360e2ec730e4ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5a9fa9d47462aac1a1a4ade789bd852ff5e328efedddf20227ce4e7f63cdd5a4977687017c3909797107e0b31ddfa9f0ba7a74dc6495873dd8a97b75c35ec1a0
|
7
|
+
data.tar.gz: 36371646feb42520150c63983a1664c22697e6dcb387cbe3ba4cca6c7d96607c6d470a2269eb8209b1dc37a0e6a839fe981e32dd89a36b278e77c2cfe7eb050b
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 3.0
|
3
|
+
|
4
|
+
Style/StringLiterals:
|
5
|
+
Enabled: false
|
6
|
+
EnforcedStyle: double_quotes
|
7
|
+
|
8
|
+
Style/StringLiteralsInInterpolation:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Style/Documentation:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
17
|
+
|
18
|
+
Layout/MultilineMethodCallIndentation:
|
19
|
+
Enabled: true
|
20
|
+
EnforcedStyle: indented
|
21
|
+
|
22
|
+
Lint/MixedRegexpCaptureTypes:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/BlockLength:
|
26
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## [0.1.0] - 2023-08-01
|
4
|
+
|
5
|
+
- Initial release. Starting with 16.6, GitLab monthly release date will be moved from the 22nd to the 3rd Thursday of each month, this gem automatically calculates the release dates and the associated version for 12 months in advance.
|
6
|
+
|
7
|
+
## [0.1.1] - 2023-08-21
|
8
|
+
|
9
|
+
- Gem renamed to `releases` to account for new utility methods included (`active_version`, `current_version`, `next_versions`)
|
10
|
+
|
11
|
+
## [0.1.2] - 2023-08-22
|
12
|
+
|
13
|
+
- Yanked version
|
14
|
+
|
15
|
+
## [0.1.3] - 2023-08-22
|
16
|
+
|
17
|
+
- `version_for_date` and `previous_version` methods included.
|
18
|
+
|
19
|
+
## [0.2.0] - 2023-08-31
|
20
|
+
|
21
|
+
- Gem renamed to `gitlab-releases` to align with GitLab gem naming conventions
|
22
|
+
- PRODUCTION_TOKEN renamed to RELEASES_GITLAB_READ_TOKEN
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mcabrera@gitlab.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in gitlab-releases.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'activesupport', '~> 7.0.0'
|
9
|
+
gem 'gitlab', '~> 4.19.0'
|
10
|
+
gem 'http', '~> 5.1.0'
|
11
|
+
gem 'rake', '~> 13.0'
|
12
|
+
gem 'retriable', '~> 3.1.2'
|
13
|
+
gem 'version_sorter', '~> 2.3.0'
|
14
|
+
|
15
|
+
group :development, :test do
|
16
|
+
gem 'pry', '~> 0.14.0'
|
17
|
+
gem 'rspec', '~> 3.0'
|
18
|
+
gem 'rspec-parameterized', '>= 1.0.0'
|
19
|
+
gem 'rubocop', '~> 1.21'
|
20
|
+
gem 'timecop', '~> 0.9.0'
|
21
|
+
gem 'vcr', '~> 6.2.0'
|
22
|
+
gem 'webmock', '~> 3.18.0'
|
23
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gitlab-releases (0.2.0)
|
5
|
+
activesupport (~> 7.0.0)
|
6
|
+
gitlab (~> 4.19.0)
|
7
|
+
http (~> 5.1.0)
|
8
|
+
retriable (~> 3.1.2)
|
9
|
+
version_sorter (~> 2.3.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
activesupport (7.0.6)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
addressable (2.8.5)
|
20
|
+
public_suffix (>= 2.0.2, < 6.0)
|
21
|
+
ast (2.4.2)
|
22
|
+
binding_of_caller (1.0.0)
|
23
|
+
debug_inspector (>= 0.0.1)
|
24
|
+
coderay (1.1.3)
|
25
|
+
concurrent-ruby (1.2.2)
|
26
|
+
crack (0.4.5)
|
27
|
+
rexml
|
28
|
+
debug_inspector (1.1.0)
|
29
|
+
diff-lcs (1.5.0)
|
30
|
+
domain_name (0.5.20190701)
|
31
|
+
unf (>= 0.0.5, < 1.0.0)
|
32
|
+
ffi (1.15.5)
|
33
|
+
ffi-compiler (1.0.1)
|
34
|
+
ffi (>= 1.0.0)
|
35
|
+
rake
|
36
|
+
gitlab (4.19.0)
|
37
|
+
httparty (~> 0.20)
|
38
|
+
terminal-table (>= 1.5.1)
|
39
|
+
hashdiff (1.0.1)
|
40
|
+
http (5.1.1)
|
41
|
+
addressable (~> 2.8)
|
42
|
+
http-cookie (~> 1.0)
|
43
|
+
http-form_data (~> 2.2)
|
44
|
+
llhttp-ffi (~> 0.4.0)
|
45
|
+
http-cookie (1.0.5)
|
46
|
+
domain_name (~> 0.5)
|
47
|
+
http-form_data (2.3.0)
|
48
|
+
httparty (0.21.0)
|
49
|
+
mini_mime (>= 1.0.0)
|
50
|
+
multi_xml (>= 0.5.2)
|
51
|
+
i18n (1.14.1)
|
52
|
+
concurrent-ruby (~> 1.0)
|
53
|
+
json (2.6.3)
|
54
|
+
language_server-protocol (3.17.0.3)
|
55
|
+
llhttp-ffi (0.4.0)
|
56
|
+
ffi-compiler (~> 1.0)
|
57
|
+
rake (~> 13.0)
|
58
|
+
method_source (1.0.0)
|
59
|
+
mini_mime (1.1.2)
|
60
|
+
minitest (5.19.0)
|
61
|
+
multi_xml (0.6.0)
|
62
|
+
parallel (1.23.0)
|
63
|
+
parser (3.2.2.3)
|
64
|
+
ast (~> 2.4.1)
|
65
|
+
racc
|
66
|
+
proc_to_ast (0.1.0)
|
67
|
+
coderay
|
68
|
+
parser
|
69
|
+
unparser
|
70
|
+
pry (0.14.2)
|
71
|
+
coderay (~> 1.1)
|
72
|
+
method_source (~> 1.0)
|
73
|
+
public_suffix (5.0.3)
|
74
|
+
racc (1.7.1)
|
75
|
+
rainbow (3.1.1)
|
76
|
+
rake (13.0.6)
|
77
|
+
regexp_parser (2.8.1)
|
78
|
+
retriable (3.1.2)
|
79
|
+
rexml (3.2.6)
|
80
|
+
rspec (3.12.0)
|
81
|
+
rspec-core (~> 3.12.0)
|
82
|
+
rspec-expectations (~> 3.12.0)
|
83
|
+
rspec-mocks (~> 3.12.0)
|
84
|
+
rspec-core (3.12.2)
|
85
|
+
rspec-support (~> 3.12.0)
|
86
|
+
rspec-expectations (3.12.3)
|
87
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
88
|
+
rspec-support (~> 3.12.0)
|
89
|
+
rspec-mocks (3.12.6)
|
90
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
91
|
+
rspec-support (~> 3.12.0)
|
92
|
+
rspec-parameterized (1.0.0)
|
93
|
+
rspec-parameterized-core (< 2)
|
94
|
+
rspec-parameterized-table_syntax (< 2)
|
95
|
+
rspec-parameterized-core (1.0.0)
|
96
|
+
parser
|
97
|
+
proc_to_ast
|
98
|
+
rspec (>= 2.13, < 4)
|
99
|
+
unparser
|
100
|
+
rspec-parameterized-table_syntax (1.0.0)
|
101
|
+
binding_of_caller
|
102
|
+
rspec-parameterized-core (< 2)
|
103
|
+
rspec-support (3.12.1)
|
104
|
+
rubocop (1.55.1)
|
105
|
+
json (~> 2.3)
|
106
|
+
language_server-protocol (>= 3.17.0)
|
107
|
+
parallel (~> 1.10)
|
108
|
+
parser (>= 3.2.2.3)
|
109
|
+
rainbow (>= 2.2.2, < 4.0)
|
110
|
+
regexp_parser (>= 1.8, < 3.0)
|
111
|
+
rexml (>= 3.2.5, < 4.0)
|
112
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
113
|
+
ruby-progressbar (~> 1.7)
|
114
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
115
|
+
rubocop-ast (1.29.0)
|
116
|
+
parser (>= 3.2.1.0)
|
117
|
+
ruby-progressbar (1.13.0)
|
118
|
+
terminal-table (3.0.2)
|
119
|
+
unicode-display_width (>= 1.1.1, < 3)
|
120
|
+
timecop (0.9.8)
|
121
|
+
tzinfo (2.0.6)
|
122
|
+
concurrent-ruby (~> 1.0)
|
123
|
+
unf (0.1.4)
|
124
|
+
unf_ext
|
125
|
+
unf_ext (0.0.8.2)
|
126
|
+
unicode-display_width (2.4.2)
|
127
|
+
unparser (0.6.8)
|
128
|
+
diff-lcs (~> 1.3)
|
129
|
+
parser (>= 3.2.0)
|
130
|
+
vcr (6.2.0)
|
131
|
+
version_sorter (2.3.0)
|
132
|
+
webmock (3.18.1)
|
133
|
+
addressable (>= 2.8.0)
|
134
|
+
crack (>= 0.3.2)
|
135
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
136
|
+
|
137
|
+
PLATFORMS
|
138
|
+
arm64-darwin-21
|
139
|
+
x86_64-darwin-22
|
140
|
+
|
141
|
+
DEPENDENCIES
|
142
|
+
activesupport (~> 7.0.0)
|
143
|
+
gitlab (~> 4.19.0)
|
144
|
+
gitlab-releases!
|
145
|
+
http (~> 5.1.0)
|
146
|
+
pry (~> 0.14.0)
|
147
|
+
rake (~> 13.0)
|
148
|
+
retriable (~> 3.1.2)
|
149
|
+
rspec (~> 3.0)
|
150
|
+
rspec-parameterized (>= 1.0.0)
|
151
|
+
rubocop (~> 1.21)
|
152
|
+
timecop (~> 0.9.0)
|
153
|
+
vcr (~> 6.2.0)
|
154
|
+
version_sorter (~> 2.3.0)
|
155
|
+
webmock (~> 3.18.0)
|
156
|
+
|
157
|
+
BUNDLED WITH
|
158
|
+
2.3.25
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Mayra Cabrera
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/gitlab-releases.svg)](https://badge.fury.io/rb/gitlab-releases)
|
2
|
+
|
3
|
+
# Releases
|
4
|
+
|
5
|
+
Library to interact with GitLab releases and versions. The information is fetched from two sources:
|
6
|
+
|
7
|
+
1. [versions.gitlab.com](https://version.gitlab.com/)
|
8
|
+
1. [`releases.yml`](https://gitlab.com/gitlab-com/www-gitlab-com/-/blob/master/data/releases.yml)
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Gemfile:
|
13
|
+
|
14
|
+
```
|
15
|
+
gem 'gitlab-releases', '~> 0.2.0'
|
16
|
+
```
|
17
|
+
|
18
|
+
Install:
|
19
|
+
```
|
20
|
+
$ gem install gitlab-releases
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
There are different methods available:
|
26
|
+
|
27
|
+
* `upcoming_releases` - Returns the GitLab release date and the associated version for the next 12 months.
|
28
|
+
* `active_version` - Returns the active GitLab version.
|
29
|
+
* `current_version` - Returns the current GitLab version.
|
30
|
+
* `next_versions` - Returns the next GitLab patch versions (for patch and security releases).
|
31
|
+
* `previous_version` - Returns the n-1 GitLab version
|
32
|
+
|
33
|
+
To make use of it:
|
34
|
+
|
35
|
+
1. Create a personal access token with `read_api` scope.
|
36
|
+
1. Store it in an environment variable called `RELEASES_GITLAB_READ_TOKEN`.
|
37
|
+
1. Open up an irb session:
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
> require 'gitlab_releases'
|
41
|
+
> releases = GitlabReleases
|
42
|
+
> releases.upcoming_releases
|
43
|
+
=>
|
44
|
+
{"16.2"=>"2023-07-22",
|
45
|
+
"16.3"=>"2023-08-22",
|
46
|
+
"16.4"=>"2023-09-22",
|
47
|
+
"16.5"=>"2023-10-22",
|
48
|
+
"16.6"=>"2023-11-16",
|
49
|
+
"16.7"=>"2023-12-21",
|
50
|
+
"16.8"=>"2024-01-18",
|
51
|
+
"16.9"=>"2024-02-15",
|
52
|
+
"16.10"=>"2024-03-21",
|
53
|
+
"16.11"=>"2024-04-18",
|
54
|
+
"17.0"=>"2024-05-16",
|
55
|
+
"17.1"=>"2024-06-20",
|
56
|
+
"17.2"=>"2024-07-18"}
|
57
|
+
|
58
|
+
> releases.active_version
|
59
|
+
=> "16.3"
|
60
|
+
> releases.current_version
|
61
|
+
=> "16.2"
|
62
|
+
> releases.next_versions
|
63
|
+
=> ["16.2.5", "16.1.5", "16.0.9"]
|
64
|
+
> releases.previous_version
|
65
|
+
=> 16.2.4
|
66
|
+
```
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Bug reports and feature requests are welcome on the [Delivery team tracker]. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://gitlab.com/gitlab-org/delivery/gitlab-releases/blob/main/CODE_OF_CONDUCT.md).
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
75
|
+
|
76
|
+
## Code of Conduct
|
77
|
+
|
78
|
+
Everyone interacting in the Releases project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/gitlab-org/delivery/gitlab-releases/main/CODE_OF_CONDUCT.md).
|
79
|
+
|
80
|
+
[Delivery team tracker]: https://gitlab.com/gitlab-com/gl-infra/delivery
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/all'
|
4
|
+
|
5
|
+
class DateCalculator
|
6
|
+
# Represents the minimum version that uses the new release date
|
7
|
+
RELEASE_VERSION = '16.6'
|
8
|
+
|
9
|
+
# Represents the minimum date that uses the new release date
|
10
|
+
RELEASE_DATE = Date.parse('2023-11-16')
|
11
|
+
|
12
|
+
# @param version [ReleaseVersion]
|
13
|
+
# @param candidate_date [Date] - The month to calculate the release date. It should be
|
14
|
+
# the first day of the month.
|
15
|
+
def initialize(next_version:, candidate_date:)
|
16
|
+
@next_version = next_version
|
17
|
+
@candidate_date = candidate_date
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute
|
21
|
+
result_date = if before_new_release_date?
|
22
|
+
twenty_second_of_the_month
|
23
|
+
else
|
24
|
+
calculate_third_thursday_of_month
|
25
|
+
end
|
26
|
+
|
27
|
+
result_date.strftime('%Y-%m-%d')
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :next_version, :candidate_date
|
33
|
+
|
34
|
+
def before_new_release_date?
|
35
|
+
next_version.to_f < RELEASE_VERSION.to_f && candidate_date < RELEASE_DATE
|
36
|
+
end
|
37
|
+
|
38
|
+
def twenty_second_of_the_month
|
39
|
+
Date.parse("#{candidate_date.year}-#{candidate_date.month}-22")
|
40
|
+
end
|
41
|
+
|
42
|
+
# If the first day of the month is a Thursday, it fetches the subsequent Two thursdays,
|
43
|
+
# if not searches for the 3rd Thursday of the month.
|
44
|
+
def calculate_third_thursday_of_month
|
45
|
+
iterations = candidate_date.thursday? ? 2 : 3
|
46
|
+
third_thursday = candidate_date
|
47
|
+
|
48
|
+
iterations.times do
|
49
|
+
third_thursday = third_thursday.next_occurring(:thursday)
|
50
|
+
end
|
51
|
+
|
52
|
+
third_thursday
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'date_calculator'
|
4
|
+
require_relative 'version_calculator'
|
5
|
+
|
6
|
+
class ReleaseCalculator
|
7
|
+
def initialize(current_version:, release_date:)
|
8
|
+
@current_version = current_version
|
9
|
+
@release_date = release_date
|
10
|
+
@release_dates = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute
|
14
|
+
@release_dates[current_version] = release_date.strftime('%Y-%m-%d')
|
15
|
+
next_version = ReleaseVersion.new(current_version.next_minor)
|
16
|
+
|
17
|
+
period(release_date, release_date + 1.year).each do |candidate_date|
|
18
|
+
@release_dates[next_version] = calculate_release_date(next_version, candidate_date)
|
19
|
+
next_version = calculate_release_version(next_version, candidate_date)
|
20
|
+
end
|
21
|
+
|
22
|
+
@release_dates
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
attr_reader :current_version, :release_date, :release_dates
|
28
|
+
|
29
|
+
def period(start_date, end_date)
|
30
|
+
(start_date..end_date)
|
31
|
+
.select { |date| date.day == 1 }
|
32
|
+
.flatten
|
33
|
+
end
|
34
|
+
|
35
|
+
def calculate_release_date(next_version, candidate_date)
|
36
|
+
DateCalculator.new(
|
37
|
+
next_version: next_version,
|
38
|
+
candidate_date: candidate_date
|
39
|
+
).execute
|
40
|
+
end
|
41
|
+
|
42
|
+
def calculate_release_version(next_version, candidate_date)
|
43
|
+
VersionCalculator.new(
|
44
|
+
version: next_version,
|
45
|
+
candidate_date: candidate_date
|
46
|
+
).execute
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ReleaseVersion < String
|
4
|
+
VERSION_REGEX = /
|
5
|
+
\A(?<major>\d+)
|
6
|
+
\.(?<minor>\d+)
|
7
|
+
(\.(?<patch>\d+))?
|
8
|
+
(-(?<rc>rc(?<rc_number>\d*)))?
|
9
|
+
(-\h+\.\h+)?
|
10
|
+
(-ee|\.ee\.\d+)?\z
|
11
|
+
/x
|
12
|
+
|
13
|
+
def major
|
14
|
+
@major ||= extract_from_version(:major).to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
def minor
|
18
|
+
@minor ||= extract_from_version(:minor).to_i
|
19
|
+
end
|
20
|
+
|
21
|
+
def patch
|
22
|
+
@patch ||= extract_from_version(:patch).to_i
|
23
|
+
end
|
24
|
+
|
25
|
+
def next_minor
|
26
|
+
"#{major}.#{minor + 1}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def next_major
|
30
|
+
"#{major + 1}.0"
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_minor
|
34
|
+
"#{major}.#{minor}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def previous_minor
|
38
|
+
"#{major}.#{minor - 1}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def previous_patch
|
42
|
+
return unless patch?
|
43
|
+
|
44
|
+
new_patch = self.class.new("#{major}.#{minor}.#{patch - 1}")
|
45
|
+
|
46
|
+
ee? ? new_patch.to_ee : new_patch
|
47
|
+
end
|
48
|
+
|
49
|
+
def next_patch
|
50
|
+
new_patch = self.class.new("#{major}.#{minor}.#{patch + 1}")
|
51
|
+
|
52
|
+
ee? ? new_patch.to_ee : new_patch
|
53
|
+
end
|
54
|
+
|
55
|
+
def ee?
|
56
|
+
end_with?('-ee')
|
57
|
+
end
|
58
|
+
|
59
|
+
def patch?
|
60
|
+
patch.positive?
|
61
|
+
end
|
62
|
+
|
63
|
+
def to_ee
|
64
|
+
return self if ee?
|
65
|
+
|
66
|
+
self.class.new("#{self}-ee")
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# rubocop:disable Lint/SafeNavigation
|
72
|
+
def extract_from_version(part, fallback: 0)
|
73
|
+
match_data = self.class::VERSION_REGEX.match(self)
|
74
|
+
|
75
|
+
if match_data && match_data.names.include?(part.to_s) && match_data[part]
|
76
|
+
String.new(match_data[part])
|
77
|
+
else
|
78
|
+
fallback
|
79
|
+
end
|
80
|
+
end
|
81
|
+
# rubocop:enable Lint/SafeNavigation
|
82
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'gitlab/request'
|
4
|
+
require 'gitlab'
|
5
|
+
|
6
|
+
class ReleaseVersionClient < Gitlab::Request
|
7
|
+
base_uri 'https://version.gitlab.com'
|
8
|
+
headers 'Private-Token' => -> { api_token }
|
9
|
+
|
10
|
+
# Get the latest version information
|
11
|
+
#
|
12
|
+
# Returns an Array of Gitlab::ObjectifiedHash objects
|
13
|
+
def self.versions
|
14
|
+
get('/api/v1/versions', query: { per_page: 50 })
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.api_token
|
18
|
+
ENV.fetch('RELEASES_GITLAB_READ_TOKEN') do |name|
|
19
|
+
raise "Must specify `#{name}` environment variable!"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private_class_method :api_token
|
24
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'version_sorter'
|
4
|
+
require 'retriable'
|
5
|
+
require 'http'
|
6
|
+
require_relative 'release_version_client'
|
7
|
+
|
8
|
+
# Wrapper to interact with GitLab release versions. Versions are fetched
|
9
|
+
# from two sources:
|
10
|
+
#
|
11
|
+
# 1. versions.gitlab.com => Used to interact with previous GitLab versions
|
12
|
+
# 1. releases.yml => Used to interact with upcoming GitLab releases
|
13
|
+
class ReleaseVersions
|
14
|
+
# The base interval for retrying operations that failed, in seconds.
|
15
|
+
RETRY_INTERVAL = 5
|
16
|
+
|
17
|
+
# Releases.yml file.
|
18
|
+
RELEASES_YAML = 'https://gitlab.com/gitlab-com/www-gitlab-com/-/raw/master/data/releases.yml'
|
19
|
+
|
20
|
+
# Returns the list of versions from versions.gitlab.com
|
21
|
+
def self.current_list
|
22
|
+
raw_versions.collect(&:version)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Get the next three patch versions
|
26
|
+
def self.next_versions
|
27
|
+
self.next(latest(current_list, 3))
|
28
|
+
end
|
29
|
+
|
30
|
+
# Given an Array of version numbers, return the next patch versions
|
31
|
+
#
|
32
|
+
# Example:
|
33
|
+
#
|
34
|
+
# next(['1.0.0', '1.1.0', '1.1.1', '1.2.3'])
|
35
|
+
# => ['1.0.1', '1.1.1', '1.1.2', '1.2.4']
|
36
|
+
def self.next(versions)
|
37
|
+
versions.map do |version|
|
38
|
+
ReleaseVersion.new(version).next_patch
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Given an Array of version strings, find the `count` latest by minor number
|
43
|
+
#
|
44
|
+
# versions - Array of version strings
|
45
|
+
# count - Number of versions to return (default: 3)
|
46
|
+
#
|
47
|
+
# Example:
|
48
|
+
#
|
49
|
+
# latest(['1.0.0', '1.1.0', '1.1.1', '1.2.3'], 3)
|
50
|
+
# => ['1.2.3', '1.1.1', '1.0.0']
|
51
|
+
def self.latest(versions, count = 3)
|
52
|
+
::VersionSorter.rsort(versions).uniq do |version|
|
53
|
+
version.split('.').take(2)
|
54
|
+
end.take(count)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns the current GitLab minor version
|
58
|
+
def self.current_version
|
59
|
+
ReleaseVersion.new(next_versions.first.to_minor)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns the release date of the current version
|
63
|
+
def self.previous_release_date
|
64
|
+
date = raw_versions
|
65
|
+
.find { |version| version.version == "#{current_version}.0" }
|
66
|
+
.created_at
|
67
|
+
|
68
|
+
Date.parse(date)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns the active minor GitLab Version
|
72
|
+
def self.active_version
|
73
|
+
version_for_date(DateTime.now)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Returns the scheduled major.minor for the given date
|
77
|
+
def self.version_for_date(date)
|
78
|
+
# Returns the release associated with the date by calling `releases_yaml` and fetching the
|
79
|
+
# release whose date is greater than the given date.
|
80
|
+
#
|
81
|
+
# For example:
|
82
|
+
#
|
83
|
+
# | Version | Date |
|
84
|
+
# |:--------|:---------------|
|
85
|
+
# | 16.3 | August 22nd |
|
86
|
+
# | 16.4 | September 22nd |
|
87
|
+
# | 16.5 | October 22nd |
|
88
|
+
# | 16.6 | November 16th |
|
89
|
+
# | 16.7 | December 21st |
|
90
|
+
#
|
91
|
+
# * For August 21st, the release should be 16.3
|
92
|
+
# * For August 22nd, the release should be 16.4
|
93
|
+
# * For August 23rd, the release should be 16.4
|
94
|
+
# * For November 17th, the release should be 16.7
|
95
|
+
return nil if releases_yaml.empty?
|
96
|
+
|
97
|
+
row = releases_yaml.find { |release| release['date'] > date }
|
98
|
+
|
99
|
+
ReleaseVersion.new(row['version'])
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns the N-1 version supported based on the current_list
|
103
|
+
#
|
104
|
+
# For example:
|
105
|
+
# => current_list
|
106
|
+
# => ["16.3.0", "16.2.4", "16.1.4", "16.2.3"]
|
107
|
+
# => previous_version
|
108
|
+
# => ['16.2.4']
|
109
|
+
def self.previous_version
|
110
|
+
ReleaseVersion.new(sort(current_list).reverse[1])
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.sort(versions)
|
114
|
+
::VersionSorter.sort(versions).uniq
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.raw_versions
|
118
|
+
ReleaseVersionClient.versions
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.releases_yaml
|
122
|
+
@releases_yaml ||=
|
123
|
+
begin
|
124
|
+
data = YAML.safe_load(releases_information) || []
|
125
|
+
data.map { |release| release['date'] = Date.parse(release['date']) }
|
126
|
+
data.sort_by { |release| release['date'] }
|
127
|
+
rescue StandardError
|
128
|
+
[]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.releases_information
|
133
|
+
Retriable.retriable(base_interval: RETRY_INTERVAL) do
|
134
|
+
HTTP.get(RELEASES_YAML).to_s
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
private_class_method :raw_versions, :releases_yaml, :releases_information
|
139
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class VersionCalculator
|
4
|
+
MAJOR_RELEASE_MONTH = 5 # represents the month major releases are performed, in this case May
|
5
|
+
|
6
|
+
def initialize(version:, candidate_date:)
|
7
|
+
@version = version
|
8
|
+
@candidate_date = candidate_date
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute
|
12
|
+
if candidate_date.month == (MAJOR_RELEASE_MONTH - 1)
|
13
|
+
next_major
|
14
|
+
else
|
15
|
+
next_minor
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_reader :version, :candidate_date
|
22
|
+
|
23
|
+
def next_major
|
24
|
+
ReleaseVersion.new(version).next_major
|
25
|
+
end
|
26
|
+
|
27
|
+
def next_minor
|
28
|
+
ReleaseVersion.new(version).next_minor
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'gitlab_releases/version'
|
4
|
+
require_relative 'gitlab_releases/release_version'
|
5
|
+
require_relative 'gitlab_releases/release_versions'
|
6
|
+
require_relative 'gitlab_releases/release_calculator'
|
7
|
+
|
8
|
+
module GitlabReleases
|
9
|
+
def self.upcoming_releases
|
10
|
+
ReleaseCalculator.new(
|
11
|
+
current_version: current_version,
|
12
|
+
release_date: release_date
|
13
|
+
).execute
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.current_version
|
17
|
+
ReleaseVersions.current_version
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.active_version
|
21
|
+
ReleaseVersions.active_version
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.version_for_date(date)
|
25
|
+
ReleaseVersions.version_for_date(date)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.next_versions
|
29
|
+
ReleaseVersions.next_versions
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.previous_version
|
33
|
+
ReleaseVersions.previous_version
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.release_date
|
37
|
+
ReleaseVersions.previous_release_date
|
38
|
+
end
|
39
|
+
|
40
|
+
private_class_method :release_date
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitlab-releases
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mayra Cabrera
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 7.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 7.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gitlab
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.19.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.19.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: http
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 5.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 5.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: retriable
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.1.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: version_sorter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.3.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.3.0
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- mcabrera@gitlab.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".rspec"
|
91
|
+
- ".rubocop.yml"
|
92
|
+
- CHANGELOG.md
|
93
|
+
- CODE_OF_CONDUCT.md
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- lib/gitlab_releases.rb
|
100
|
+
- lib/gitlab_releases/date_calculator.rb
|
101
|
+
- lib/gitlab_releases/release_calculator.rb
|
102
|
+
- lib/gitlab_releases/release_version.rb
|
103
|
+
- lib/gitlab_releases/release_version_client.rb
|
104
|
+
- lib/gitlab_releases/release_versions.rb
|
105
|
+
- lib/gitlab_releases/version.rb
|
106
|
+
- lib/gitlab_releases/version_calculator.rb
|
107
|
+
- sig/release_dates.rbs
|
108
|
+
homepage: https://gitlab.com/gitlab-org/delivery/releases
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata:
|
112
|
+
homepage_uri: https://gitlab.com/gitlab-org/delivery/releases
|
113
|
+
source_code_uri: https://gitlab.com/gitlab-org/delivery/gitlab-releases
|
114
|
+
changelog_uri: https://gitlab.com/gitlab-org/delivery/gitlab-releases/CHANGELOG.md
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 3.0.0
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubygems_version: 3.3.13
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Utilities for GitLab releases and versions
|
134
|
+
test_files: []
|