release_manager 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6069b076747b74494e4aaf2d464abd5436d742b
4
- data.tar.gz: 277bbc9bb132f094ccf4cdcc7a761741cd92eaef
3
+ metadata.gz: 1e186490a7357d97daefeaf8337a6de1fb1f12dd
4
+ data.tar.gz: b9f2e85a0497c460847291524f598e151988b28c
5
5
  SHA512:
6
- metadata.gz: 892cde4d6302725ada12b0b1e89f2854d61fac8d375492b1916a5d5d8e5cce99c6871107a2f8cac1bdd1a5cf2b51427297fdd7c0501448d7e6530ac9bd72ce46
7
- data.tar.gz: 1fbc83551bdb199c07ea26835e98e0d9ddff4195de16ff5845419dff6f665b4024dd2518dc74322cd8ae381e7941b00372de578ae18c66687f9f60a3938b0486
6
+ metadata.gz: 93b5fdde39f5917395ad9743a91a41c6be41cc3845d2e01271980015af99c6f03ec940ad908c0a4c968159aaec22c86fa7f65f7d5882b9c377dfb3d13ede8813
7
+ data.tar.gz: 1624f3df2c269bbc2128c5d5afce001f0856f3581a11f55024e7ae6367b83e6291c21e2dbd55407f40952e2d4efda63fe44b15c78f13b90a3a6d92d921f55a79
@@ -1,5 +1,10 @@
1
1
  # Release Manager
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.8.1
6
+ * Improves error handling when tags already exist
7
+ * Fixes #12 - deploy-r10k does not write a patch file
3
8
  ## 0.8.0
4
9
  * Allows for creating sandboxes from different targets
5
10
  * Allow for releasing one off patches with release-mod
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- release_manager (0.8.0)
4
+ release_manager (0.8.1)
5
5
  gitlab (~> 4.2.0)
6
6
  highline (~> 1.7)
7
7
  rugged (~> 0.26)
data/README.md CHANGED
@@ -308,11 +308,11 @@ uses the version in metadata.json file as a reference and increments to semver i
308
308
 
309
309
  Follow the steps below to create a new patch release and deploy straight to production
310
310
 
311
- 1. Create a new sandbox based on the branch or tag you want to fix. `sandbox-create -s v0.5.0 -n patch_0.5.1`
311
+ 1. Create a new sandbox based on the branch or tag you want to fix. `sandbox-create -s upstream/v0.5.0 -n patch_0.5.1`
312
312
  2. cd ~/repos/r10k-control
313
313
  3. Make your changes in that branch and update the changelog
314
- 4. Push your code to the remote Git repo and activate your CI pipeline (optional)
315
- 5. Release the new version `release-mod -l patch -s patch_0.5.1` (creates tag v0.5.1)
314
+ 4. Push your code to the remote Git repo and activate your CI pipeline (recommended)
315
+ 5. Release the new version `release-mod -l patch -s patch_0.5.1` (creates tag v0.5.1 from the sandbox)
316
316
  6. Deploy the patch release to production `deploy-r10k -s v0.5.1 -d production`
317
317
 
318
318
  ## Configuration Settings
@@ -255,8 +255,10 @@ module ReleaseManager
255
255
  # @param [String] file - the path to the patch file you want to apply
256
256
  def apply_patch(file)
257
257
  # TODO: change this to rugged implementation
258
+ empty = File.read(file).length < 1
258
259
  logger.info("Applying patch #{file}")
259
260
  output = ''
261
+ logger.debug("The patch file is empty for some reason") if empty
260
262
  Dir.chdir(path) do
261
263
  output = `#{git_command} apply #{file} 2>&1`
262
264
  end
@@ -99,6 +99,7 @@ class R10kDeployer
99
99
  return control_repo.logger.info("nothing to commit or deploy") if diff.deltas.count < 1
100
100
  Tempfile.open('git_patch') do |patchfile|
101
101
  patchfile.write(diff.patch)
102
+ patchfile.rewind # allows us to read from the beginning of the file
102
103
  control_repo.apply_patch(patchfile.path)
103
104
  control_repo.add_all
104
105
  end
@@ -108,33 +108,39 @@ class Release
108
108
  # currently this must be done manually by a release manager
109
109
  #
110
110
  def release
111
- unless auto_release?
112
- print "Have you merged your code? Did you fetch and rebase against the upstream? Want to continue (y/n)?: ".yellow
113
- answer = gets.downcase.chomp
114
- if answer == 'n'
115
- return false
111
+ begin
112
+ unless auto_release?
113
+ print "Have you merged your code? Did you fetch and rebase against the upstream? Want to continue (y/n)?: ".yellow
114
+ answer = gets.downcase.chomp
115
+ if answer == 'n'
116
+ return false
117
+ end
116
118
  end
117
- end
118
119
 
119
- # updates the metadata.json file to the next version
120
- bump
121
- # updates the changelog to the next version based on the metadata file
122
- id = bump_log
123
- # tags the r10k-module with the version found in the metadata.json file
124
- tag(id)
125
- # pushes the updated code and tags to the upstream repo
126
- if auto_release?
127
- push
128
- return
129
- end
130
- print "Ready to release version #{version} to #{puppet_module.source}\n and forever change history(y/n)?: ".yellow
131
- answer = gets.downcase.chomp
132
- if answer == 'y'
133
- push
134
- $?.success?
135
- else
136
- puts "Nah, forget it, this release wasn't that cool anyways.".yellow
137
- false
120
+ # updates the metadata.json file to the next version
121
+ bump
122
+ # updates the changelog to the next version based on the metadata file
123
+ id = bump_log
124
+ # tags the r10k-module with the version found in the metadata.json file
125
+ tag(id)
126
+ # pushes the updated code and tags to the upstream repo
127
+ if auto_release?
128
+ push
129
+ return
130
+ end
131
+ print "Ready to release version #{version} to #{puppet_module.source}\n and forever change history(y/n)?: ".yellow
132
+ answer = gets.downcase.chomp
133
+ if answer == 'y'
134
+ push
135
+ $?.success?
136
+ else
137
+ puts "Nah, forget it, this release wasn't that cool anyways.".yellow
138
+ false
139
+ end
140
+ rescue Rugged::TagError => e
141
+ logger.fatal(e.message)
142
+ logger.fatal("You might need to rebase your branch")
143
+ exit 1
138
144
  end
139
145
  end
140
146
 
@@ -9,25 +9,31 @@ class RemoteRelease < Release
9
9
  # currently this must be done manually by a release manager
10
10
  #
11
11
  def release
12
- unless auto_release?
13
- print "Have you merged your code? Did you fetch and rebase against the upstream? Want to continue (y/n)?: ".yellow
14
- answer = gets.downcase.chomp
15
- if answer == 'n'
16
- return false
17
- end
18
- print "Ready to release version #{version.next} to #{puppet_module.source}\n and forever change history(y/n)?: ".yellow
19
- answer = gets.downcase.chomp
20
- if answer != 'y'
21
- puts "Nah, forget it, this release wasn't that cool anyways.".yellow
22
- return false
12
+ begin
13
+ unless auto_release?
14
+ print "Have you merged your code? Did you fetch and rebase against the upstream? Want to continue (y/n)?: ".yellow
15
+ answer = gets.downcase.chomp
16
+ if answer == 'n'
17
+ return false
18
+ end
19
+ print "Ready to release version #{version.next} to #{puppet_module.source}\n and forever change history(y/n)?: ".yellow
20
+ answer = gets.downcase.chomp
21
+ if answer != 'y'
22
+ puts "Nah, forget it, this release wasn't that cool anyways.".yellow
23
+ return false
24
+ end
23
25
  end
26
+ # updates the metadata.js file to the next version
27
+ bump
28
+ # updates the changelog to the next version based on the metadata file
29
+ id = bump_log
30
+ # tags the r10k-module with the version found in the metadata.json file
31
+ tag(id)
32
+ rescue Rugged::TagError => e
33
+ logger.fatal(e.message)
34
+ logger.fatal("You might need to rebase your branch")
35
+ exit 1
24
36
  end
25
- # updates the metadata.js file to the next version
26
- bump
27
- # updates the changelog to the next version based on the metadata file
28
- id = bump_log
29
- # tags the r10k-module with the version found in the metadata.json file
30
- tag(id)
31
37
  end
32
38
 
33
39
  def run
@@ -1,3 +1,3 @@
1
1
  module ReleaseManager
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
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.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-11 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab