release_manager 0.8.2 → 0.9.3
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 +5 -5
- data/CHANGELOG.md +13 -1
- data/Gemfile +7 -3
- data/Gemfile.lock +45 -37
- data/README.md +30 -0
- data/lib/release_manager/changelog.rb +19 -0
- data/lib/release_manager/control_mod.rb +12 -3
- data/lib/release_manager/errors.rb +3 -1
- data/lib/release_manager/git/credentials.rb +0 -1
- data/lib/release_manager/git/utilites.rb +25 -4
- data/lib/release_manager/puppet_module.rb +7 -5
- data/lib/release_manager/r10k_deployer.rb +0 -1
- data/lib/release_manager/release.rb +17 -7
- data/lib/release_manager/version.rb +1 -1
- data/release_manager.gemspec +23 -22
- metadata +7 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4711f3474a2ef018068f10268dd3a89bab7da246713b800a0912901fc9b0a70c
|
|
4
|
+
data.tar.gz: 1f6ef1c783a37a09fa646f855fee88e36e058e9eef43f35101f68ee412606902
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc5ea77eb51f6753db50284ae1419f822908c5f1d7a02d2a0306211c50af2c33105b9d7d80b51d084e88a5f23ff98f212a156522e0fbbc60307605c92f6245f7
|
|
7
|
+
data.tar.gz: 5819cb50e9bd8c0c49d8b180e07577a9a1ca4b3fc7c614089e69ce57454ead371e822cf88b6d5c18fd68e86536157017179d33dd70e141a38bb9583b4101dfe5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Release Manager
|
|
2
|
+
## 0.9.3
|
|
3
|
+
* Fixes gh-17 - Hiera 5 environment layer support
|
|
2
4
|
|
|
3
|
-
##
|
|
5
|
+
## 0.9.2
|
|
6
|
+
* Removed slice_when in order to support older rubies.
|
|
7
|
+
|
|
8
|
+
## 0.9.1
|
|
9
|
+
* Adds ability to publish release notes when tagging remotely
|
|
10
|
+
|
|
11
|
+
## 0.9.0
|
|
12
|
+
* Adds ability to push a single tag
|
|
13
|
+
|
|
14
|
+
## 0.8.3
|
|
15
|
+
* Fixes issue when git urls with hypens not being found
|
|
4
16
|
|
|
5
17
|
## 0.8.2
|
|
6
18
|
* Fixes #7 - sandbox-create hangs when ssh does not have host id key
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
|
2
4
|
# Specify your gem's dependencies in release_manager.gemspec
|
|
3
5
|
gem 'gitlab'
|
|
4
6
|
gem 'rugged', '~> 0.26'
|
|
@@ -9,7 +11,9 @@ group :test do
|
|
|
9
11
|
gem 'rubocop'
|
|
10
12
|
gem 'rake'
|
|
11
13
|
gem 'rspec'
|
|
12
|
-
gem 'bundler'
|
|
14
|
+
gem 'bundler', '~> 2.1'
|
|
13
15
|
# when docker compiles this it cannot find release manager until we mount the volume
|
|
14
|
-
|
|
16
|
+
if File.exist?(File.join('release_manager.gemspec'))
|
|
17
|
+
gem 'release_manager', path: '.'
|
|
18
|
+
end
|
|
15
19
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
release_manager (0.
|
|
4
|
+
release_manager (0.9.3)
|
|
5
5
|
gitlab (~> 4.2.0)
|
|
6
6
|
highline (~> 1.7)
|
|
7
7
|
rugged (~> 0.26)
|
|
@@ -9,58 +9,66 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
ast (2.
|
|
13
|
-
coderay (1.1.
|
|
12
|
+
ast (2.4.1)
|
|
13
|
+
coderay (1.1.3)
|
|
14
14
|
diff-lcs (1.3)
|
|
15
15
|
gitlab (4.2.0)
|
|
16
16
|
httparty
|
|
17
17
|
terminal-table
|
|
18
|
-
highline (1.7.
|
|
19
|
-
httparty (0.
|
|
18
|
+
highline (1.7.10)
|
|
19
|
+
httparty (0.18.1)
|
|
20
|
+
mime-types (~> 3.0)
|
|
20
21
|
multi_xml (>= 0.5.2)
|
|
21
|
-
method_source (0.
|
|
22
|
+
method_source (1.0.0)
|
|
23
|
+
mime-types (3.3.1)
|
|
24
|
+
mime-types-data (~> 3.2015)
|
|
25
|
+
mime-types-data (3.2020.0512)
|
|
22
26
|
multi_xml (0.6.0)
|
|
23
|
-
parallel (1.
|
|
24
|
-
parser (2.
|
|
25
|
-
ast (~> 2.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rspec (3.
|
|
34
|
-
rspec-core (~> 3.
|
|
35
|
-
rspec-expectations (~> 3.
|
|
36
|
-
rspec-mocks (~> 3.
|
|
37
|
-
rspec-core (3.
|
|
38
|
-
rspec-support (~> 3.
|
|
39
|
-
rspec-expectations (3.
|
|
27
|
+
parallel (1.19.1)
|
|
28
|
+
parser (2.7.1.3)
|
|
29
|
+
ast (~> 2.4.0)
|
|
30
|
+
pry (0.13.1)
|
|
31
|
+
coderay (~> 1.1)
|
|
32
|
+
method_source (~> 1.0)
|
|
33
|
+
rainbow (3.0.0)
|
|
34
|
+
rake (13.0.1)
|
|
35
|
+
regexp_parser (1.7.1)
|
|
36
|
+
rexml (3.2.4)
|
|
37
|
+
rspec (3.9.0)
|
|
38
|
+
rspec-core (~> 3.9.0)
|
|
39
|
+
rspec-expectations (~> 3.9.0)
|
|
40
|
+
rspec-mocks (~> 3.9.0)
|
|
41
|
+
rspec-core (3.9.2)
|
|
42
|
+
rspec-support (~> 3.9.3)
|
|
43
|
+
rspec-expectations (3.9.2)
|
|
40
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
41
|
-
rspec-support (~> 3.
|
|
42
|
-
rspec-mocks (3.
|
|
45
|
+
rspec-support (~> 3.9.0)
|
|
46
|
+
rspec-mocks (3.9.1)
|
|
43
47
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
|
-
rspec-support (~> 3.
|
|
45
|
-
rspec-support (3.
|
|
46
|
-
rubocop (0.
|
|
48
|
+
rspec-support (~> 3.9.0)
|
|
49
|
+
rspec-support (3.9.3)
|
|
50
|
+
rubocop (0.85.1)
|
|
47
51
|
parallel (~> 1.10)
|
|
48
|
-
parser (>= 2.
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
parser (>= 2.7.0.1)
|
|
53
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
54
|
+
regexp_parser (>= 1.7)
|
|
55
|
+
rexml
|
|
56
|
+
rubocop-ast (>= 0.0.3)
|
|
51
57
|
ruby-progressbar (~> 1.7)
|
|
52
|
-
unicode-display_width (
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
59
|
+
rubocop-ast (0.0.3)
|
|
60
|
+
parser (>= 2.7.0.1)
|
|
61
|
+
ruby-progressbar (1.10.1)
|
|
62
|
+
rugged (0.99.0)
|
|
55
63
|
terminal-table (1.8.0)
|
|
56
64
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
|
57
|
-
unicode-display_width (1.
|
|
65
|
+
unicode-display_width (1.7.0)
|
|
58
66
|
|
|
59
67
|
PLATFORMS
|
|
60
68
|
ruby
|
|
61
69
|
|
|
62
70
|
DEPENDENCIES
|
|
63
|
-
bundler
|
|
71
|
+
bundler (~> 2.1)
|
|
64
72
|
gitlab
|
|
65
73
|
highline (~> 1.7)
|
|
66
74
|
pry
|
|
@@ -71,4 +79,4 @@ DEPENDENCIES
|
|
|
71
79
|
rugged (~> 0.26)
|
|
72
80
|
|
|
73
81
|
BUNDLED WITH
|
|
74
|
-
1.
|
|
82
|
+
2.1.4
|
data/README.md
CHANGED
|
@@ -407,6 +407,35 @@ ssh-add
|
|
|
407
407
|
|
|
408
408
|
```
|
|
409
409
|
|
|
410
|
+
### Unable to exchange encryption keys
|
|
411
|
+
If you see an error message related to `Unable to exchange encryption keys` you may be dealing with an issue on your git server openssh
|
|
412
|
+
does not support the key exchange that libssh2 supports. Libssh2 is used by release_manager so it is important they can negotiate on the same algorithm.
|
|
413
|
+
|
|
414
|
+
There are two possible fixes for this.
|
|
415
|
+
|
|
416
|
+
* Update libssh2 to 1.7.x+
|
|
417
|
+
|
|
418
|
+
You can grab the libssh2 library on your puppetserver with r10k should you not have access to libssh2-1.7.0+
|
|
419
|
+
|
|
420
|
+
`cp /opt/puppetlabs/server/apps/r10k/lib/libssh2.so.1.0.1 /usr/lib64/libssh2.so.1.0.1`
|
|
421
|
+
|
|
422
|
+
Note: you will actually want to copy the the library whereever release_manager is used. Additionally you need to recompile
|
|
423
|
+
the rugged gem, only after updating libssh2 in /usr/lib64
|
|
424
|
+
|
|
425
|
+
`gem uninstall rugged && gem install rugged `
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
If you don't want to update libssh2 you should add support more more algorithms on the git server.
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
# /etc/ssh/sshd_config
|
|
433
|
+
|
|
434
|
+
KexAlgorithms hmac-sha2-512
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Note: you should have more algorithms as that is an example only.
|
|
438
|
+
|
|
410
439
|
## Development
|
|
411
440
|
|
|
412
441
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
@@ -455,6 +484,7 @@ has wrong permission you will need to do the following:
|
|
|
455
484
|
|
|
456
485
|
If the sandbox create command freezes after the first output make sure you can connect
|
|
457
486
|
to the git server using git clone or running `ssh-add` to add your ssh key to the ssh agent.
|
|
487
|
+
|
|
458
488
|
## Contributing
|
|
459
489
|
|
|
460
490
|
Bug reports and pull requests are welcome on release_manager.
|
|
@@ -35,6 +35,7 @@ class Changelog < WorkflowAction
|
|
|
35
35
|
@root_dir
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
# Create the changelog entries and commit
|
|
38
39
|
# @param remote [Boolean] - if the commit is a remote git on the vcs server
|
|
39
40
|
# @return [String] - sha of the commit
|
|
40
41
|
def run(remote = false, branch = 'master')
|
|
@@ -79,6 +80,24 @@ class Changelog < WorkflowAction
|
|
|
79
80
|
!!changelog_lines.each_index.find {|index| changelog_lines[index] =~ /\A\s*\#{2}\s*Version #{version}/i }
|
|
80
81
|
end
|
|
81
82
|
|
|
83
|
+
# @return [Array] - array of lines of the unreleased content, text between unreleased and next version
|
|
84
|
+
def get_unreleased_content
|
|
85
|
+
start_content = changelog_lines.slice((unreleased_index + 1), changelog_lines.count)
|
|
86
|
+
end_index = start_content.find_index {|line| line.downcase.start_with?('## version')}
|
|
87
|
+
end_index ? start_content.slice(0, end_index) : start_content
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# @return [Array] - array of lines of the specified version content, text between specified version and next version
|
|
91
|
+
# @param [String] - the version of content you want
|
|
92
|
+
# @note - returns empty string if version is not found
|
|
93
|
+
def get_version_content(version)
|
|
94
|
+
start_index = changelog_lines.find_index {|line| line.downcase.include?("version #{version}") }
|
|
95
|
+
return nil unless start_index
|
|
96
|
+
start_content = changelog_lines.slice((start_index + 1), changelog_lines.count)
|
|
97
|
+
end_index = start_content.find_index {|line| line.downcase.start_with?('## version')}
|
|
98
|
+
end_index ? start_content.slice(0, end_index) : start_content
|
|
99
|
+
end
|
|
100
|
+
|
|
82
101
|
# @returns [Array[String]] - inserts the version header in the change log and returns the entire array of lines
|
|
83
102
|
def update_unreleased
|
|
84
103
|
time = Time.now.strftime("%B %d, %Y")
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
class ControlMod
|
|
2
4
|
attr_reader :name, :metadata, :repo
|
|
3
5
|
attr_accessor :version
|
|
4
6
|
|
|
5
7
|
def initialize(name, args)
|
|
6
8
|
@name = name
|
|
7
|
-
@metadata = args.
|
|
9
|
+
@metadata = args.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
|
|
8
10
|
end
|
|
9
11
|
|
|
10
12
|
def repo
|
|
@@ -25,22 +27,28 @@ class ControlMod
|
|
|
25
27
|
|
|
26
28
|
def to_s
|
|
27
29
|
name_line = "mod '#{name}',"
|
|
28
|
-
data = metadata.map
|
|
30
|
+
data = metadata.map do |k, v|
|
|
31
|
+
v == :control_branch ? ":#{k} => #{v.inspect}" : ":#{k} => '#{v}'"
|
|
32
|
+
end.join(",\n\ ")
|
|
29
33
|
"#{name_line}\n #{data}"
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
def bump_patch_version
|
|
33
37
|
return unless metadata[:tag]
|
|
38
|
+
|
|
34
39
|
pieces = metadata[:tag].split('.')
|
|
35
40
|
raise "invalid semver structure #{metadata[:tag]}" if pieces.count != 3
|
|
41
|
+
|
|
36
42
|
pieces[2] = pieces[2].next
|
|
37
43
|
pin_version(pieces.join('.'))
|
|
38
44
|
end
|
|
39
45
|
|
|
40
46
|
def bump_minor_version
|
|
41
47
|
return unless metadata[:tag]
|
|
48
|
+
|
|
42
49
|
pieces = metadata[:tag].split('.')
|
|
43
50
|
raise "invalid semver structure #{metadata[:tag]}" if pieces.count != 3
|
|
51
|
+
|
|
44
52
|
pieces[2] = '0'
|
|
45
53
|
pieces[1] = pieces[1].next
|
|
46
54
|
pin_version(pieces.join('.'))
|
|
@@ -48,8 +56,10 @@ class ControlMod
|
|
|
48
56
|
|
|
49
57
|
def bump_major_version
|
|
50
58
|
return unless metadata[:tag]
|
|
59
|
+
|
|
51
60
|
pieces = metadata[:tag].split('.')
|
|
52
61
|
raise "invalid semver structure #{metadata[:tag]}" if pieces.count != 3
|
|
62
|
+
|
|
53
63
|
pieces[2] = '0'
|
|
54
64
|
pieces[1] = '0'
|
|
55
65
|
pieces[0] = pieces[0].next
|
|
@@ -79,5 +89,4 @@ class ControlMod
|
|
|
79
89
|
def pin_url(src)
|
|
80
90
|
metadata[:git] = src
|
|
81
91
|
end
|
|
82
|
-
|
|
83
92
|
end
|
|
@@ -10,9 +10,11 @@ class GitError < Exception; end
|
|
|
10
10
|
class RepoNotFound < Exception; end
|
|
11
11
|
class InvalidModule < Exception; end
|
|
12
12
|
class InvalidToken < Exception; end
|
|
13
|
+
class RemoteNotFound < Exception; end
|
|
13
14
|
class InvalidSshkey < Exception; end
|
|
14
15
|
class InvalidBranchName < Exception; end
|
|
15
16
|
class PatchError < Exception; end
|
|
16
17
|
class AlreadyReleased < Exception; end
|
|
17
18
|
class AlreadyDeployed < Exception; end
|
|
18
|
-
class TagExists < Exception; end
|
|
19
|
+
class TagExists < Exception; end
|
|
20
|
+
class NoTagsExists < Exception; end
|
|
@@ -74,7 +74,6 @@ module ReleaseManager
|
|
|
74
74
|
# this method does currently now work
|
|
75
75
|
def ssh_key_credentials(url = nil)
|
|
76
76
|
logger.error("Must use ssh-agent, please run ssh-agent zsh, then ssh-add to load your ssh key")
|
|
77
|
-
exit 1
|
|
78
77
|
unless File.readable?(global_private_key)
|
|
79
78
|
raise Exception.new("Unable to use SSH key auth for %{url}: private key %{private_key} is missing or unreadable" % {url: url.inspect, private_key: global_private_key.inspect} )
|
|
80
79
|
end
|
|
@@ -47,7 +47,7 @@ module ReleaseManager
|
|
|
47
47
|
else
|
|
48
48
|
logger.info("Cloning repo with url: #{url} to #{path}")
|
|
49
49
|
r = Rugged::Repository.clone_at(url, path, {
|
|
50
|
-
#progress: lambda { |output|
|
|
50
|
+
#progress: lambda { |output| logger.debug output },
|
|
51
51
|
credentials: credentials.call(url)
|
|
52
52
|
})
|
|
53
53
|
r
|
|
@@ -130,6 +130,7 @@ module ReleaseManager
|
|
|
130
130
|
# @param [String] remote_name - the remote name to push the branch to
|
|
131
131
|
def push_branch(remote_name, branch, force = false)
|
|
132
132
|
remote = find_or_create_remote(remote_name)
|
|
133
|
+
raise RemoteNotFound, "Remote named: #{remote_name} was not found" unless remote
|
|
133
134
|
b = repo.branches[branch]
|
|
134
135
|
raise InvalidBranchName.new("Branch #{branch} does not exist locally, cannot push") unless b
|
|
135
136
|
refs = [b.canonical_name]
|
|
@@ -143,6 +144,16 @@ module ReleaseManager
|
|
|
143
144
|
repo.tags.map(&:name)
|
|
144
145
|
end
|
|
145
146
|
|
|
147
|
+
# @return [Rugged::Tag]
|
|
148
|
+
# @param id [String] - the tag name or oid
|
|
149
|
+
def find_tag(id)
|
|
150
|
+
if id.length >= 40
|
|
151
|
+
repo.tags.find {|t| t.target.oid == id }
|
|
152
|
+
else
|
|
153
|
+
repo.tags.find {|t| t.name == id }
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
146
157
|
# @param name [String] - the name of the tag to check for existence
|
|
147
158
|
# @return [Boolean] - return true if the tag exists
|
|
148
159
|
def tag_exists?(name)
|
|
@@ -151,9 +162,19 @@ module ReleaseManager
|
|
|
151
162
|
|
|
152
163
|
# push all the tags to the remote
|
|
153
164
|
# @param [String] remote_name - the remote name to push tags to
|
|
154
|
-
|
|
165
|
+
# @param id [String] - a ref spec to push, set to nil to push all
|
|
166
|
+
def push_tags(remote_name, id = nil)
|
|
155
167
|
remote = find_or_create_remote(remote_name)
|
|
156
|
-
|
|
168
|
+
raise RemoteNotFound, "Remote named: #{remote_name} was not found" unless remote
|
|
169
|
+
all_refs = repo.tags.map(&:canonical_name)
|
|
170
|
+
refs = if id
|
|
171
|
+
tag = find_tag(id)
|
|
172
|
+
tag.canonical_name if tag
|
|
173
|
+
else
|
|
174
|
+
all_refs
|
|
175
|
+
end
|
|
176
|
+
raise NoTagsExists, "No tags were pushed" if refs.empty?
|
|
177
|
+
logger.debug("Pushing refs #{refs}")
|
|
157
178
|
logger.info("Pushing tags to remote #{remote.url}")
|
|
158
179
|
remote.push(refs, credentials: credentials)
|
|
159
180
|
end
|
|
@@ -219,7 +240,7 @@ module ReleaseManager
|
|
|
219
240
|
# @return [MatchData] MatchData if the remote name is a url
|
|
220
241
|
# Is the name actually a url?
|
|
221
242
|
def git_url?(name)
|
|
222
|
-
/(
|
|
243
|
+
/(?:git|ssh|https?|git@[-\w.]+):(\/\/)?(.*?)(\.git)(\/?|\#[-\d\w._]+?)$/.match(name)
|
|
223
244
|
end
|
|
224
245
|
|
|
225
246
|
# @return [String] - the author name found in the config
|
|
@@ -140,12 +140,13 @@ class PuppetModule < WorkflowAction
|
|
|
140
140
|
|
|
141
141
|
# @param remote [Boolean] - create the tag remotely using the remote VCS
|
|
142
142
|
# @param id [String] - the commit id to tag to
|
|
143
|
-
|
|
143
|
+
# @param remote [Boolean] - use the vcs adapter instead of local tag
|
|
144
|
+
# @param release_notes [Boolean] - add release notes to the tag when remote is true
|
|
145
|
+
def tag_module(remote = false, id = nil, release_notes = nil)
|
|
144
146
|
id ||= repo.head.target_id
|
|
145
147
|
if remote
|
|
146
|
-
# TODO add release_notes as the last argument, currently nil
|
|
147
148
|
# where we get the latest from the changelog
|
|
148
|
-
create_tag(source, "v#{version}", id, "v#{version}",
|
|
149
|
+
create_tag(source, "v#{version}", id, "v#{version}", release_notes)
|
|
149
150
|
else
|
|
150
151
|
create_local_tag("v#{version}", id)
|
|
151
152
|
end
|
|
@@ -204,9 +205,10 @@ class PuppetModule < WorkflowAction
|
|
|
204
205
|
end
|
|
205
206
|
|
|
206
207
|
# pushes the source and tags
|
|
207
|
-
|
|
208
|
+
# @param id [String] - a ref spec to push
|
|
209
|
+
def push_to_upstream(id = nil)
|
|
208
210
|
push_branch(source, src_branch)
|
|
209
|
-
push_tags(source)
|
|
211
|
+
push_tags(source, id)
|
|
210
212
|
end
|
|
211
213
|
|
|
212
214
|
# @return [String] the oid of the commit that was created
|
|
@@ -34,12 +34,18 @@ class Release
|
|
|
34
34
|
puppet_module.next_version(level)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
def release_notes
|
|
38
|
+
notes = changelog.get_version_content(version) || changelog.get_unreleased_content || []
|
|
39
|
+
notes.join(" ")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @param id [String] - the commit id to tag to
|
|
37
43
|
def tag(id)
|
|
38
44
|
if dry_run?
|
|
39
45
|
logger.info "Would have just tagged the module to #{version}"
|
|
40
46
|
return
|
|
41
47
|
end
|
|
42
|
-
puppet_module.tag_module(options[:remote], id)
|
|
48
|
+
puppet_module.tag_module(options[:remote], id, release_notes)
|
|
43
49
|
end
|
|
44
50
|
|
|
45
51
|
def bump
|
|
@@ -55,22 +61,26 @@ class Release
|
|
|
55
61
|
puppet_module.commit_metadata(options[:remote])
|
|
56
62
|
end
|
|
57
63
|
|
|
64
|
+
def changelog
|
|
65
|
+
@changelog ||= Changelog.new(puppet_module.path, version, {:commit => true})
|
|
66
|
+
end
|
|
67
|
+
|
|
58
68
|
# @return [String] - sha of the commit
|
|
59
69
|
def bump_log
|
|
60
70
|
if dry_run?
|
|
61
71
|
logger.info "Would have just bumped the CHANGELOG to version #{version}"
|
|
62
72
|
return
|
|
63
73
|
end
|
|
64
|
-
|
|
65
|
-
log.run(options[:remote], puppet_module.src_branch)
|
|
74
|
+
changelog.run(options[:remote], puppet_module.src_branch)
|
|
66
75
|
end
|
|
67
76
|
|
|
68
|
-
|
|
77
|
+
# @param id [String] - a ref spec to push
|
|
78
|
+
def push(id = nil)
|
|
69
79
|
if dry_run?
|
|
70
80
|
logger.info "Would have just pushed the code and tag to #{puppet_module.source}"
|
|
71
81
|
return
|
|
72
82
|
end
|
|
73
|
-
puppet_module.push_to_upstream
|
|
83
|
+
puppet_module.push_to_upstream(id)
|
|
74
84
|
end
|
|
75
85
|
|
|
76
86
|
def dry_run?
|
|
@@ -125,13 +135,13 @@ class Release
|
|
|
125
135
|
tag(id)
|
|
126
136
|
# pushes the updated code and tags to the upstream repo
|
|
127
137
|
if auto_release?
|
|
128
|
-
push
|
|
138
|
+
push(id)
|
|
129
139
|
return
|
|
130
140
|
end
|
|
131
141
|
print "Ready to release version #{version} to #{puppet_module.source}\n and forever change history(y/n)?: ".yellow
|
|
132
142
|
answer = gets.downcase.chomp
|
|
133
143
|
if answer == 'y'
|
|
134
|
-
push
|
|
144
|
+
push(id)
|
|
135
145
|
$?.success?
|
|
136
146
|
else
|
|
137
147
|
puts "Nah, forget it, this release wasn't that cool anyways.".yellow
|
data/release_manager.gemspec
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
5
|
require 'release_manager/version'
|
|
5
6
|
|
|
6
7
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
8
|
+
spec.name = 'release_manager'
|
|
8
9
|
spec.version = ReleaseManager::VERSION
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email = [
|
|
10
|
+
spec.authors = ['Corey Osman']
|
|
11
|
+
spec.email = ['corey@nwops.io']
|
|
11
12
|
|
|
12
|
-
spec.summary =
|
|
13
|
-
spec.description =
|
|
14
|
-
spec.homepage =
|
|
15
|
-
spec.license =
|
|
13
|
+
spec.summary = 'Release tools for puppet code'
|
|
14
|
+
spec.description = 'Release management tools for releasing modules and r10k control repos'
|
|
15
|
+
spec.homepage = ''
|
|
16
|
+
spec.license = 'MIT'
|
|
16
17
|
|
|
17
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
19
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
20
|
if spec.respond_to?(:metadata)
|
|
20
|
-
#spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
22
|
else
|
|
22
|
-
raise
|
|
23
|
-
|
|
23
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
|
24
|
+
'public gem pushes.'
|
|
24
25
|
end
|
|
25
26
|
|
|
26
|
-
spec.files
|
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
28
|
f.match(%r{^(test|spec|features)/})
|
|
28
29
|
end
|
|
29
|
-
spec.bindir =
|
|
30
|
+
spec.bindir = 'exe'
|
|
30
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
-
spec.require_paths = [
|
|
32
|
-
spec.add_runtime_dependency
|
|
33
|
-
spec.add_runtime_dependency
|
|
34
|
-
spec.add_runtime_dependency
|
|
35
|
-
spec.add_development_dependency
|
|
36
|
-
spec.add_development_dependency
|
|
37
|
-
spec.add_development_dependency
|
|
38
|
-
spec.add_development_dependency
|
|
32
|
+
spec.require_paths = ['lib']
|
|
33
|
+
spec.add_runtime_dependency 'gitlab', '~> 4.2.0'
|
|
34
|
+
spec.add_runtime_dependency 'rugged', '~> 0.26'
|
|
35
|
+
spec.add_runtime_dependency 'highline', '~> 1.7'
|
|
36
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
|
37
|
+
spec.add_development_dependency 'pry'
|
|
38
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
39
40
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: release_manager
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Corey Osman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gitlab
|
|
@@ -58,14 +58,14 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '1
|
|
61
|
+
version: '2.1'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '1
|
|
68
|
+
version: '2.1'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: pry
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,14 +86,14 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
89
|
+
version: '13.0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
96
|
+
version: '13.0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: rspec
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -199,8 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
199
199
|
- !ruby/object:Gem::Version
|
|
200
200
|
version: '0'
|
|
201
201
|
requirements: []
|
|
202
|
-
|
|
203
|
-
rubygems_version: 2.6.11
|
|
202
|
+
rubygems_version: 3.0.3
|
|
204
203
|
signing_key:
|
|
205
204
|
specification_version: 4
|
|
206
205
|
summary: Release tools for puppet code
|