release_manager 0.8.3 → 0.9.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 +4 -4
- data/CHANGELOG.md +3 -2
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/release_manager/errors.rb +2 -1
- data/lib/release_manager/git/utilites.rb +23 -3
- data/lib/release_manager/puppet_module.rb +3 -2
- data/lib/release_manager/r10k_deployer.rb +0 -1
- data/lib/release_manager/release.rb +5 -4
- data/lib/release_manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1eb100282aec6a63243d57a5d99e057a16a6f72
|
4
|
+
data.tar.gz: 80945c3821447d4f1611dfaef6a79074073ee204
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1de851fb872828299abc3446836fcc0994b5e8ce35c6e8c26d3c507c7ca88085b38427e3bafe4ba0176228b3cce4ba7277fb9966075b77ba743d0f93aeb9721
|
7
|
+
data.tar.gz: 3003adc21f31b607ec98542dbf0e8f54516cfc82607689320b6293ef9cc411176ccfc62924e756d927a8e080edba7ff9b8d20a2dc0ff021a7aa584d784974eb2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -455,6 +455,7 @@ has wrong permission you will need to do the following:
|
|
455
455
|
|
456
456
|
If the sandbox create command freezes after the first output make sure you can connect
|
457
457
|
to the git server using git clone or running `ssh-add` to add your ssh key to the ssh agent.
|
458
|
+
|
458
459
|
## Contributing
|
459
460
|
|
460
461
|
Bug reports and pull requests are welcome on release_manager.
|
@@ -16,4 +16,5 @@ class InvalidBranchName < Exception; end
|
|
16
16
|
class PatchError < Exception; end
|
17
17
|
class AlreadyReleased < Exception; end
|
18
18
|
class AlreadyDeployed < Exception; end
|
19
|
-
class TagExists < Exception; end
|
19
|
+
class TagExists < Exception; end
|
20
|
+
class NoTagsExists < Exception; 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
|
@@ -144,6 +144,16 @@ module ReleaseManager
|
|
144
144
|
repo.tags.map(&:name)
|
145
145
|
end
|
146
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
|
+
|
147
157
|
# @param name [String] - the name of the tag to check for existence
|
148
158
|
# @return [Boolean] - return true if the tag exists
|
149
159
|
def tag_exists?(name)
|
@@ -152,9 +162,19 @@ module ReleaseManager
|
|
152
162
|
|
153
163
|
# push all the tags to the remote
|
154
164
|
# @param [String] remote_name - the remote name to push tags to
|
155
|
-
|
165
|
+
# @param id [String] - a ref spec to push, set to nil to push all
|
166
|
+
def push_tags(remote_name, id = nil)
|
156
167
|
remote = find_or_create_remote(remote_name)
|
157
|
-
|
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}")
|
158
178
|
logger.info("Pushing tags to remote #{remote.url}")
|
159
179
|
remote.push(refs, credentials: credentials)
|
160
180
|
end
|
@@ -204,9 +204,10 @@ class PuppetModule < WorkflowAction
|
|
204
204
|
end
|
205
205
|
|
206
206
|
# pushes the source and tags
|
207
|
-
|
207
|
+
# @param id [String] - a ref spec to push
|
208
|
+
def push_to_upstream(id = nil)
|
208
209
|
push_branch(source, src_branch)
|
209
|
-
push_tags(source)
|
210
|
+
push_tags(source, id)
|
210
211
|
end
|
211
212
|
|
212
213
|
# @return [String] the oid of the commit that was created
|
@@ -65,12 +65,13 @@ class Release
|
|
65
65
|
log.run(options[:remote], puppet_module.src_branch)
|
66
66
|
end
|
67
67
|
|
68
|
-
|
68
|
+
# @param id [String] - a ref spec to push
|
69
|
+
def push(id = nil)
|
69
70
|
if dry_run?
|
70
71
|
logger.info "Would have just pushed the code and tag to #{puppet_module.source}"
|
71
72
|
return
|
72
73
|
end
|
73
|
-
puppet_module.push_to_upstream
|
74
|
+
puppet_module.push_to_upstream(id)
|
74
75
|
end
|
75
76
|
|
76
77
|
def dry_run?
|
@@ -125,13 +126,13 @@ class Release
|
|
125
126
|
tag(id)
|
126
127
|
# pushes the updated code and tags to the upstream repo
|
127
128
|
if auto_release?
|
128
|
-
push
|
129
|
+
push(id)
|
129
130
|
return
|
130
131
|
end
|
131
132
|
print "Ready to release version #{version} to #{puppet_module.source}\n and forever change history(y/n)?: ".yellow
|
132
133
|
answer = gets.downcase.chomp
|
133
134
|
if answer == 'y'
|
134
|
-
push
|
135
|
+
push(id)
|
135
136
|
$?.success?
|
136
137
|
else
|
137
138
|
puts "Nah, forget it, this release wasn't that cool anyways.".yellow
|
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|