heroku_hatchet 4.0.6 → 4.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +8 -35
- data/etc/ci_setup.rb +3 -2
- data/lib/hatchet/app.rb +6 -2
- data/lib/hatchet/version.rb +1 -1
- data/test/hatchet/app_test.rb +8 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d62240ccab36896f21d254213e96976f8efbcb9294dd79c9a614f6167926a0d
|
4
|
+
data.tar.gz: 9b56fff4dc3217e079fb7e47ce43cd96c56632f72501a12cfbd476bda6be3acf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e31bbcca0a7e163acfe5c8ae66a0f7e9aa4296095bbf5e43e9fb53df852b6fc628bb428519c5939b566ed3fa047d9e8a670cba786cc3d97fd8191592f2432de2
|
7
|
+
data.tar.gz: bd9f296e0f5b2f28728f09b7d4aca5795f22659ab738e49d6cc88a438b49fcd3bb7a3524da8389f81d73377322ef012551542fcdef45cfa34d42d029dc6a75e5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## HEAD
|
2
2
|
|
3
|
+
## 4.0.7
|
4
|
+
|
5
|
+
- Exit code is now returned from `app.run` commands (https://github.com/heroku/hatchet/pull/58)
|
6
|
+
- ci_setup.rb no longer emits an error when run on `sh` (https://github.com/heroku/hatchet/pull/57)
|
7
|
+
|
3
8
|
## 4.0.6
|
4
9
|
|
5
10
|
- Setup script `hatchet ci:setup` added (https://github.com/heroku/hatchet/pull/55)
|
data/README.md
CHANGED
@@ -41,17 +41,11 @@ $ travis encrypt HEROKU_API_USER=<example@example.com> --add
|
|
41
41
|
|
42
42
|
If you're running locally, your system credentials will be pulled from `heroku auth:token`
|
43
43
|
|
44
|
-
You'll also need to trigger a "setup" step for CI tasks.
|
45
|
-
|
46
|
-
```ruby
|
47
|
-
require 'hatchet/tasks'
|
48
|
-
```
|
49
|
-
|
50
|
-
Then execute the script `hatchet:setup_ci`. You can do it on Travis CI like this:
|
44
|
+
You'll also need to trigger a "setup" step for CI tasks. You can do it on Travis CI like this:
|
51
45
|
|
52
46
|
```
|
53
47
|
# .travis.yml
|
54
|
-
before_script: bundle exec
|
48
|
+
before_script: bundle exec hatchet ci:setup
|
55
49
|
```
|
56
50
|
|
57
51
|
and on Heroku CI like this:
|
@@ -61,7 +55,7 @@ and on Heroku CI like this:
|
|
61
55
|
"environments": {
|
62
56
|
"test": {
|
63
57
|
"scripts": {
|
64
|
-
"test-setup": "bundle exec
|
58
|
+
"test-setup": "bundle exec hatchet ci:setup",
|
65
59
|
}
|
66
60
|
}
|
67
61
|
}
|
@@ -321,42 +315,21 @@ To run on travis you will need to configure your `.travis.yml` to run the approp
|
|
321
315
|
|
322
316
|
For reference see the `.travis.yml` from [hatchet](https://github.com/heroku/hatchet/blob/master/.travis.yml) and the [heroku-ruby-buildpack](https://github.com/heroku/heroku-buildpack-ruby/blob/master/.travis.yml). To make running on travis easier there is a rake task in Hatchet that can be run before your tests are executed
|
323
317
|
|
324
|
-
```
|
325
|
-
before_script: bundle exec
|
318
|
+
```yml
|
319
|
+
before_script: bundle exec hatchet ci:setup
|
326
320
|
```
|
327
321
|
|
328
322
|
I recommend signing up for a new heroku account for running your tests on travis, otherwise you will quickly excede your API limit. Once you have the new api token you can use this technique to [securely send travis the data](http://docs.travis-ci.com/user/environment-variables/#Secure-Variables).
|
329
323
|
|
330
|
-
|
331
|
-
```
|
324
|
+
```sh
|
332
325
|
$ travis encrypt HEROKU_API_KEY=<token> --add
|
333
326
|
```
|
334
327
|
|
335
|
-
You'll also need to download the Heroku CLI. Add the executable `etc/ci_setup.sh` to your project, with contents:
|
336
|
-
|
337
|
-
```
|
338
|
-
#!/usr/bin/env bash
|
339
|
-
|
340
|
-
sudo apt-get -qq update
|
341
|
-
sudo apt-get install software-properties-common
|
342
|
-
curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://cli-assets.heroku.com/install-ubuntu.sh | sh
|
343
|
-
```
|
344
|
-
|
345
|
-
Be sure to change the file permissions with `chmod u+x etc/ci_setup.sh` so that the file is executable.
|
346
|
-
|
347
|
-
To run this and download the Heroku cli, you will need to add this step before your install or script depending on your Travis setup process.
|
348
|
-
|
349
|
-
```
|
350
|
-
before_script:
|
351
|
-
- bash etc/ci_setup.sh
|
352
|
-
```
|
353
|
-
|
354
328
|
If your Travis tests are containerized, you may need sudo to complete this successfully. In that case, you'll need to add the following:
|
355
329
|
|
356
|
-
```
|
330
|
+
```yml
|
331
|
+
before_script: bundle exec hatchet ci:setup
|
357
332
|
sudo: required
|
358
|
-
before_install:
|
359
|
-
- sudo bash etc/ci_setup.sh
|
360
333
|
```
|
361
334
|
|
362
335
|
## Extra App Commands
|
data/etc/ci_setup.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'bundler'
|
3
|
+
require 'shellwords'
|
3
4
|
puts "== Setting Up CI =="
|
4
5
|
|
5
6
|
netrc_file = "#{ENV['HOME']}/.netrc"
|
@@ -16,8 +17,8 @@ end
|
|
16
17
|
[
|
17
18
|
"bundle exec hatchet ci:install_heroku",
|
18
19
|
"bundle exec hatchet install",
|
19
|
-
"
|
20
|
-
"
|
20
|
+
"git config --get user.email > /dev/null || git config --global user.email #{ENV.fetch('HEROKU_API_USER').shellescape}",
|
21
|
+
"git config --get user.name > /dev/null || git config --global user.name 'BuildpackTester'",
|
21
22
|
].each do |command|
|
22
23
|
puts "== Running: #{command}"
|
23
24
|
Bundler.with_clean_env do
|
data/lib/hatchet/app.rb
CHANGED
@@ -108,8 +108,12 @@ module Hatchet
|
|
108
108
|
# but programatically and with more control
|
109
109
|
def run(cmd_type, command = nil, options = {}, &block)
|
110
110
|
command = cmd_type.to_s if command.nil?
|
111
|
-
heroku_options = (options.delete(:heroku) || {}).map
|
112
|
-
|
111
|
+
heroku_options = (options.delete(:heroku) || {}).map do |k,v|
|
112
|
+
arg = "--#{k.to_s.shellescape}"
|
113
|
+
arg << "=#{v.to_s.shellescape}" unless v.nil?
|
114
|
+
arg
|
115
|
+
end.join(" ")
|
116
|
+
heroku_command = "heroku run -a #{name} #{heroku_options} --exit-code -- #{command}"
|
113
117
|
bundle_exec do
|
114
118
|
if block_given?
|
115
119
|
ReplRunner.new(cmd_type, heroku_command, options).run(&block)
|
data/lib/hatchet/version.rb
CHANGED
data/test/hatchet/app_test.rb
CHANGED
@@ -62,4 +62,12 @@ class AppTest < Minitest::Test
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
def test_run
|
67
|
+
app = Hatchet::GitApp.new("default_ruby")
|
68
|
+
app.deploy do
|
69
|
+
assert_match /ls: cannot access 'foo bar #baz': No such file or directory\s+Gemfile/, app.run("ls -a Gemfile 'foo bar #baz'")
|
70
|
+
assert (0 != $?.exitstatus) # $? is from the app.run use of backticks
|
71
|
+
end
|
72
|
+
end
|
65
73
|
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: 4.0.
|
4
|
+
version: 4.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: platform-api
|
@@ -247,8 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
- !ruby/object:Gem::Version
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
|
-
|
251
|
-
rubygems_version: 2.7.6
|
250
|
+
rubygems_version: 3.0.3
|
252
251
|
signing_key:
|
253
252
|
specification_version: 4
|
254
253
|
summary: Hatchet is a an integration testing library for developing Heroku buildpacks.
|