heroku_hatchet 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -1
- data/README.md +3 -0
- data/hatchet.gemspec +2 -0
- data/lib/hatchet/app.rb +22 -1
- data/lib/hatchet/version.rb +1 -1
- data/lib/hatchet.rb +1 -0
- data/test/hatchet/allow_failure_anvil_test.rb +11 -0
- data/test/hatchet/anvil_test.rb +0 -2
- data/test/test_helper.rb +1 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf055d51d17efef64a57f9d7cc5ba0efdfe29b3a
|
4
|
+
data.tar.gz: b51a1720cf9e6eebf7d0280ebca26efe68f431ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57a539206481a90f0118242f5af0587fd448abaf45dbcedf2fdf3be6e998d78d22feea5f80e7d7a5f4b652f167ea5467cfffdbbe6020e9b93686c1b1fa3c9000
|
7
|
+
data.tar.gz: 0af1e3c1a8c9a957d6dab4b987da269fef9a69c44adcebc647f4e8ee4965c184472c506ed0bb9e1516dc5ac33692d5335202d35f14bcef2d547ea361d3d19c91
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
## 0.1.1
|
2
|
+
|
3
|
+
- Allow auto retries of pushes by setting environment variable `HATCHET_RETRIES=3`
|
4
|
+
|
1
5
|
## 0.1.0
|
2
6
|
|
3
|
-
- Failed deploys now raise an exception
|
7
|
+
- Failed deploys now raise an exception, to ignore set `allow_failure: true` in the `Hatchet::App`
|
4
8
|
|
5
9
|
## 0.0.2
|
6
10
|
|
data/README.md
CHANGED
@@ -169,6 +169,9 @@ the command by going to the source code directory and running:
|
|
169
169
|
$ ./bin/hatchet --help
|
170
170
|
|
171
171
|
|
172
|
+
## Retries
|
173
|
+
|
174
|
+
Phantom errors happen. To auto retry deploy failures set the environment variable `HATCHET_RETRIES=3` which will auto retry deploys 3 times. By default deploys will not be retried. Once the number of retries has occurred the last exception will be raised.
|
172
175
|
|
173
176
|
## The Future
|
174
177
|
|
data/hatchet.gemspec
CHANGED
@@ -20,11 +20,13 @@ Gem::Specification.new do |gem|
|
|
20
20
|
|
21
21
|
gem.add_dependency "heroku-api"
|
22
22
|
gem.add_dependency "activesupport"
|
23
|
+
gem.add_dependency "rrrretry"
|
23
24
|
gem.add_dependency "anvil-cli"
|
24
25
|
gem.add_dependency "excon"
|
25
26
|
gem.add_dependency "thor"
|
26
27
|
|
27
28
|
gem.add_development_dependency "rake"
|
29
|
+
gem.add_development_dependency "mocha"
|
28
30
|
gem.add_development_dependency "parallel_tests"
|
29
31
|
end
|
30
32
|
|
data/lib/hatchet/app.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
module Hatchet
|
2
|
+
RETRIES = Integer(ENV['HATCHET_RETRIES'] || 1)
|
2
3
|
class App
|
3
4
|
attr_reader :name, :directory
|
4
5
|
|
@@ -72,16 +73,36 @@ module Hatchet
|
|
72
73
|
# creates a new app on heroku, "pushes" via anvil or git
|
73
74
|
# then yields to self so you can call self.run or
|
74
75
|
# self.deployed?
|
76
|
+
# Allow deploy failures on CI server by setting ENV['HATCHET_RETRIES']
|
75
77
|
def deploy(&block)
|
76
78
|
Dir.chdir(directory) do
|
77
79
|
self.setup!
|
78
|
-
|
80
|
+
self.push_with_retry!
|
79
81
|
block.call(self, heroku, output) if block.present?
|
80
82
|
end
|
81
83
|
ensure
|
82
84
|
self.teardown!
|
83
85
|
end
|
84
86
|
|
87
|
+
|
88
|
+
def push_with_retry!
|
89
|
+
RETRIES.times.retry do |attempt|
|
90
|
+
begin
|
91
|
+
@output = self.push!
|
92
|
+
rescue StandardError => error
|
93
|
+
puts retry_error_message(error, attempt)
|
94
|
+
raise error
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def retry_error_message(error, attempt)
|
100
|
+
attempt += 1
|
101
|
+
return "" if attempt == RETRIES
|
102
|
+
msg = "\nRetrying failed Attempt ##{attempt}/#{RETRIES} to push for '#{name}' due to error: \n"<<
|
103
|
+
"#{error.class} #{error.message}\n #{error.backtrace.join("\n ")}"
|
104
|
+
end
|
105
|
+
|
85
106
|
def output
|
86
107
|
@output
|
87
108
|
end
|
data/lib/hatchet/version.rb
CHANGED
data/lib/hatchet.rb
CHANGED
@@ -18,4 +18,15 @@ class AllowFailureAnvilTest < Test::Unit::TestCase
|
|
18
18
|
Hatchet::AnvilApp.new("no_lockfile", buildpack: @buildpack_path).deploy
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
def test_retries
|
23
|
+
Hatchet::App.const_set(:RETRIES, 2)
|
24
|
+
assert_raise(Anvil::Builder::BuildError) do
|
25
|
+
app = Hatchet::AnvilApp.new("no_lockfile", buildpack: @buildpack_path)
|
26
|
+
app.expects(:push!).twice.raises(Anvil::Builder::BuildError)
|
27
|
+
app.deploy
|
28
|
+
end
|
29
|
+
ensure
|
30
|
+
Hatchet::App.const_set(:RETRIES, 1)
|
31
|
+
end
|
21
32
|
end
|
data/test/hatchet/anvil_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_hatchet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: heroku-api
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rrrretry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: anvil-cli
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - '>='
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mocha
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: parallel_tests
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|