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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90c469d4c950ce4239a5e921c97b9b84403e8afb
4
- data.tar.gz: e341234c86529656bb71689281b3007126962beb
3
+ metadata.gz: f1eb100282aec6a63243d57a5d99e057a16a6f72
4
+ data.tar.gz: 80945c3821447d4f1611dfaef6a79074073ee204
5
5
  SHA512:
6
- metadata.gz: a6c1f27f4c0d7104cca252aad0812abb02509cc40f4c249bb889fcbacd7824fb8b7823e5d42e236693c706e8856507e0ac4d230c06bb3658128d4b677db94f93
7
- data.tar.gz: add4a8609417cfee032143cd922d569b2ab2e7f2088dd2f60ff5de8e50e888c26ac8f79073798daeb23e916d9cb8f1d69b6c5861f93dd454a82a5da79fbf646e
6
+ metadata.gz: e1de851fb872828299abc3446836fcc0994b5e8ce35c6e8c26d3c507c7ca88085b38427e3bafe4ba0176228b3cce4ba7277fb9966075b77ba743d0f93aeb9721
7
+ data.tar.gz: 3003adc21f31b607ec98542dbf0e8f54516cfc82607689320b6293ef9cc411176ccfc62924e756d927a8e080edba7ff9b8d20a2dc0ff021a7aa584d784974eb2
@@ -1,7 +1,8 @@
1
1
  # Release Manager
2
2
 
3
- ## Unreleased
4
-
3
+ ## 0.9.0
4
+ * Adds ability to push a single tag
5
+
5
6
  ## 0.8.3
6
7
  * Fixes issue when git urls with hypens not being found
7
8
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- release_manager (0.8.3)
4
+ release_manager (0.9.0)
5
5
  gitlab (~> 4.2.0)
6
6
  highline (~> 1.7)
7
7
  rugged (~> 0.26)
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| puts 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
- def push_tags(remote_name)
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
- refs = repo.tags.map(&:canonical_name)
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
- def push_to_upstream
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
@@ -24,7 +24,6 @@ class R10kDeployer
24
24
  # cleanup branch, checkout previous branch
25
25
  end
26
26
  if mr
27
- ENV['MERGE_REQUEST_URL'] = mr.web_url
28
27
  puts mr.web_url
29
28
  end
30
29
  end
@@ -65,12 +65,13 @@ class Release
65
65
  log.run(options[:remote], puppet_module.src_branch)
66
66
  end
67
67
 
68
- def push
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
@@ -1,3 +1,3 @@
1
1
  module ReleaseManager
2
- VERSION = "0.8.3"
2
+ VERSION = "0.9.0"
3
3
  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.8.3
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-19 00:00:00.000000000 Z
11
+ date: 2018-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab