heroku_hatchet 1.1.9 → 1.2.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/.gitignore +2 -1
- data/CHANGELOG.md +6 -0
- data/lib/hatchet/anvil_app.rb +1 -1
- data/lib/hatchet/app.rb +22 -13
- data/lib/hatchet/git_app.rb +3 -1
- data/lib/hatchet/version.rb +1 -1
- data/test/hatchet/allow_failure_anvil_test.rb +3 -2
- data/test/hatchet/multi_cmd_runner_test.rb +0 -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: 41fe3c7326911d5c112ba7ef95ef7f25397fb59e
|
4
|
+
data.tar.gz: eba86db8f7652204a308b910e5d2e01c160b15f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82f41b5be9b220f58b504829044a7da3e38f690af0862a59692ac28cf61e0fc70808a99d6fb7878aaa69007108771dc55362349fdffeec2f1333bf8dbfefa7a2
|
7
|
+
data.tar.gz: 0f4a2b231c42870ffebbe886c0eaab1f4dd158a824321b7209846302a3a75389a71ed397d16cd7e3e1aa3d58fb46a9059fe2ebcbd5d3b50645d3b067b991b6cf
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## HEAD
|
2
2
|
|
3
|
+
## 1.2.0
|
4
|
+
|
5
|
+
- Change `App#push` default behavior to be `App#push_with_retry!`
|
6
|
+
- `App#in_directory` now copies source repo to tmpdir so it can be modified if needed
|
7
|
+
- Repo name now shows up in error outputs.
|
8
|
+
|
3
9
|
## 1.1.9
|
4
10
|
|
5
11
|
- Use TRAVIS_BRANCH if present
|
data/lib/hatchet/anvil_app.rb
CHANGED
@@ -10,7 +10,7 @@ module Hatchet
|
|
10
10
|
super
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def push_without_retry!
|
14
14
|
out, err = wrap_stdout_and_rescue(Anvil::Builder::BuildError) do
|
15
15
|
slug_url = Anvil::Engine.build(".", :buildpack => @buildpack, :pipeline => true)
|
16
16
|
puts "Releasing to http://#{@name}.herokuapp.com"
|
data/lib/hatchet/app.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Hatchet
|
2
2
|
class App
|
3
|
-
attr_reader :name, :directory
|
3
|
+
attr_reader :name, :directory, :repo_name
|
4
4
|
|
5
5
|
class FailedDeploy < StandardError
|
6
6
|
def initialize(app, output)
|
7
|
-
msg = "Could not deploy '#{app.name}' using '#{app.class}' at path: '#{app.directory}'\n" <<
|
7
|
+
msg = "Could not deploy '#{app.name}' (#{app.repo_name}) using '#{app.class}' at path: '#{app.directory}'\n" <<
|
8
8
|
" if this was expected add `allow_failure: true` to your deploy hash.\n" <<
|
9
9
|
"output:\n" <<
|
10
10
|
"#{output}"
|
@@ -13,7 +13,8 @@ module Hatchet
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize(repo_name, options = {})
|
16
|
-
@
|
16
|
+
@repo_name = repo_name
|
17
|
+
@directory = config.path_for_name(@repo_name)
|
17
18
|
@name = options[:name] || "test-app-#{Time.now.to_f}".gsub('.', '-')
|
18
19
|
@debug = options[:debug] || options[:debugging]
|
19
20
|
@allow_failure = options[:allow_failure] || false
|
@@ -102,7 +103,7 @@ module Hatchet
|
|
102
103
|
self
|
103
104
|
end
|
104
105
|
|
105
|
-
def
|
106
|
+
def push_without_retry!
|
106
107
|
raise NotImplementedError
|
107
108
|
end
|
108
109
|
|
@@ -116,8 +117,11 @@ module Hatchet
|
|
116
117
|
end
|
117
118
|
|
118
119
|
def in_directory(directory = self.directory)
|
119
|
-
Dir.
|
120
|
-
|
120
|
+
Dir.mktmpdir do |tmpdir|
|
121
|
+
FileUtils.cp_r("#{directory}/.", "#{tmpdir}/.")
|
122
|
+
Dir.chdir(tmpdir) do
|
123
|
+
yield directory
|
124
|
+
end
|
121
125
|
end
|
122
126
|
end
|
123
127
|
|
@@ -136,21 +140,26 @@ module Hatchet
|
|
136
140
|
end
|
137
141
|
|
138
142
|
|
139
|
-
def
|
140
|
-
|
143
|
+
def push
|
144
|
+
max_retries = @allow_failure ? 1 : RETRIES
|
145
|
+
max_retries.times.retry do |attempt|
|
141
146
|
begin
|
142
|
-
@output = self.
|
147
|
+
@output = self.push_without_retry!
|
143
148
|
rescue StandardError => error
|
144
|
-
puts retry_error_message(error, attempt)
|
149
|
+
puts retry_error_message(error, attempt, max_retries)
|
145
150
|
raise error
|
146
151
|
end
|
147
152
|
end
|
148
153
|
end
|
154
|
+
alias :push! :push
|
155
|
+
alias :push_with_retry :push
|
156
|
+
alias :push_with_retry! :push_with_retry
|
157
|
+
|
149
158
|
|
150
|
-
def retry_error_message(error, attempt)
|
159
|
+
def retry_error_message(error, attempt, max_retries)
|
151
160
|
attempt += 1
|
152
|
-
return "" if attempt ==
|
153
|
-
msg = "\nRetrying failed Attempt ##{attempt}/#{
|
161
|
+
return "" if attempt == max_retries
|
162
|
+
msg = "\nRetrying failed Attempt ##{attempt}/#{max_retries} to push for '#{name}' due to error: \n"<<
|
154
163
|
"#{error.class} #{error.message}\n #{error.backtrace.join("\n ")}"
|
155
164
|
end
|
156
165
|
|
data/lib/hatchet/git_app.rb
CHANGED
@@ -19,7 +19,9 @@ module Hatchet
|
|
19
19
|
"git@heroku.com:#{name}.git"
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def push_without_retry!
|
23
|
+
puts `pwd`
|
24
|
+
puts `ls`
|
23
25
|
output = `git push #{git_repo} master 2>&1`
|
24
26
|
if !$?.success?
|
25
27
|
raise FailedDeploy.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}\n#{output}") unless @allow_failure
|
data/lib/hatchet/version.rb
CHANGED
@@ -20,13 +20,14 @@ class AllowFailureAnvilTest < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_retries
|
23
|
+
orig_retries = Hatchet::RETRIES
|
23
24
|
Hatchet.const_set(:RETRIES, 2)
|
24
25
|
assert_raise(Anvil::Builder::BuildError) do
|
25
26
|
app = Hatchet::AnvilApp.new("no_lockfile", buildpack: @buildpack_path)
|
26
|
-
app.expects(:
|
27
|
+
app.expects(:push_without_retry!).twice.raises(Anvil::Builder::BuildError)
|
27
28
|
app.deploy
|
28
29
|
end
|
29
30
|
ensure
|
30
|
-
Hatchet.const_set(:RETRIES,
|
31
|
+
Hatchet.const_set(:RETRIES, orig_retries)
|
31
32
|
end
|
32
33
|
end
|
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: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: heroku-api
|