heroku_hatchet 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +49 -0
- data/CHANGELOG.md +2 -0
- data/Gemfile +0 -1
- data/README.md +12 -69
- data/etc/ci_setup.rb +8 -6
- data/hatchet.gemspec +1 -0
- data/lib/hatchet/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c903b4979a0e4002e76f54d76a91f4651d5dfb2f20701909fefa5ac48954298
|
4
|
+
data.tar.gz: 5f54f9ebf2ec4b23a12109638aee44cc841d244c5e3f6f76994841eb47995950
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aed83bd81ea797e0626184d82d0cc0d9582db9b94741e2388020196600c0d4061ddcc17d913593c85098d2f3654979be81eb643f6710e640a9bf2d74f193893
|
7
|
+
data.tar.gz: 34fe3e85dc3531538d84fcdfecdc204af64f3699cae3e77d89a361c999ddd1a75d1fd736a0772bcd5727a0605971176ca7cecb8ed1c9eae53dceee37e3ae9aa5
|
@@ -0,0 +1,49 @@
|
|
1
|
+
version: 2
|
2
|
+
references:
|
3
|
+
unit: &unit
|
4
|
+
run:
|
5
|
+
name: Run test suite
|
6
|
+
command: bundle exec parallel_test test/hatchet -n 11
|
7
|
+
hatchet_setup: &hatchet_setup
|
8
|
+
run:
|
9
|
+
name: Hatchet setup
|
10
|
+
command: |
|
11
|
+
bundle exec hatchet ci:setup
|
12
|
+
bundle: &bundle
|
13
|
+
run:
|
14
|
+
name: install dependencies
|
15
|
+
command: |
|
16
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
17
|
+
jobs:
|
18
|
+
"ruby-2.5":
|
19
|
+
docker:
|
20
|
+
- image: circleci/ruby:2.5
|
21
|
+
steps:
|
22
|
+
- checkout
|
23
|
+
- <<: *bundle
|
24
|
+
- <<: *hatchet_setup
|
25
|
+
- <<: *unit
|
26
|
+
"ruby-2.6":
|
27
|
+
docker:
|
28
|
+
- image: circleci/ruby:2.6
|
29
|
+
steps:
|
30
|
+
- checkout
|
31
|
+
- <<: *bundle
|
32
|
+
- <<: *hatchet_setup
|
33
|
+
- <<: *unit
|
34
|
+
"ruby-2.7":
|
35
|
+
docker:
|
36
|
+
- image: circleci/ruby:2.7
|
37
|
+
steps:
|
38
|
+
- checkout
|
39
|
+
- <<: *bundle
|
40
|
+
- <<: *hatchet_setup
|
41
|
+
- <<: *unit
|
42
|
+
|
43
|
+
workflows:
|
44
|
+
version: 2
|
45
|
+
build:
|
46
|
+
jobs:
|
47
|
+
- "ruby-2.5"
|
48
|
+
- "ruby-2.6"
|
49
|
+
- "ruby-2.7"
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,62 +4,13 @@
|
|
4
4
|
|
5
5
|
Hatchet is a an integration testing library for developing Heroku buildpacks.
|
6
6
|
|
7
|
-
[![Build Status](https://travis-ci.org/heroku/hatchet.svg?branch=master)](https://travis-ci.org/heroku/hatchet)
|
8
|
-
|
9
7
|
## Install
|
10
8
|
|
11
9
|
First run:
|
12
10
|
|
13
11
|
$ bundle install
|
14
12
|
|
15
|
-
This library uses the heroku CLI and API. You will need to make your API key available to the system. If you're running on a CI platform, you'll need to generate an OAuth token and make it available on the system you're running on.
|
16
|
-
|
17
|
-
To get a token, install the https://github.com/heroku/heroku-cli-oauth#creating plugin. Then run:
|
18
|
-
|
19
|
-
```sh
|
20
|
-
$ heroku authorizations:create --description "For Travis"
|
21
|
-
Creating OAuth Authorization... done
|
22
|
-
Client: <none>
|
23
|
-
ID: <id value>
|
24
|
-
Description: For Travis
|
25
|
-
Scope: global
|
26
|
-
Token: <token>
|
27
|
-
```
|
28
|
-
|
29
|
-
You'll set the `<token>` value to the `HEROKU_API_KEY` env var. For example, you could add it on Travis like this:
|
30
|
-
|
31
|
-
```sh
|
32
|
-
$ travis encrypt HEROKU_API_KEY=<token> --add
|
33
|
-
```
|
34
|
-
|
35
|
-
You'll also need an email address that goes with your token:
|
36
|
-
|
37
|
-
```sh
|
38
|
-
$ travis encrypt HEROKU_API_USER=<example@example.com> --add
|
39
|
-
```
|
40
|
-
|
41
|
-
If you're running locally, your system credentials will be pulled from `heroku auth:token`.
|
42
|
-
|
43
|
-
You'll also need to trigger a "setup" step for CI tasks. You can do it on Travis CI like this:
|
44
|
-
|
45
|
-
```
|
46
|
-
# .travis.yml
|
47
|
-
before_script: bundle exec hatchet ci:setup
|
48
|
-
```
|
49
|
-
|
50
|
-
and on Heroku CI like this:
|
51
|
-
|
52
|
-
```json
|
53
|
-
{
|
54
|
-
"environments": {
|
55
|
-
"test": {
|
56
|
-
"scripts": {
|
57
|
-
"test-setup": "bundle exec hatchet ci:setup",
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
```
|
13
|
+
This library uses the heroku CLI and API. You will need to make your API key available to the system. If you're running on a CI platform, you'll need to generate an OAuth token and make it available on the system you're running on see the "CI" section below.
|
63
14
|
|
64
15
|
## Run the Tests
|
65
16
|
|
@@ -83,7 +34,7 @@ Whatever testing framework you chose, we recommend using a parallel test runner
|
|
83
34
|
|
84
35
|
If you're unfamiliar with the ruby testing eco-system or want some help, start by looking at existing projects.
|
85
36
|
|
86
|
-
*Spoilers
|
37
|
+
*Spoilers*: There is a section below on getting Hatchet to work on CI
|
87
38
|
|
88
39
|
## Testing a Buildpack
|
89
40
|
|
@@ -152,7 +103,7 @@ HATCHET_BUILDPACK_BASE=https://github.com/heroku/heroku-buildpack-ruby.git
|
|
152
103
|
HATCHET_BUILDPACK_BRANCH=master
|
153
104
|
```
|
154
105
|
|
155
|
-
If you do not specify `HATCHET_BUILDPACK_URL` the default Ruby buildpack will be used. If you do not specify a `HATCHET_BUILDPACK_BRANCH` the current branch you are on will be used. This is how the Ruby buildpack runs tests on branches on
|
106
|
+
If you do not specify `HATCHET_BUILDPACK_URL` the default Ruby buildpack will be used. If you do not specify a `HATCHET_BUILDPACK_BRANCH` the current branch you are on will be used. This is how the Ruby buildpack runs tests on branches on CI (by leaving `HATCHET_BUILDPACK_BRANCH` blank).
|
156
107
|
|
157
108
|
If the `ENV['HATCHET_RETRIES']` is set to a number, deploys are expected to work and automatically retry that number of times. Due to testing using a network and random failures, setting this value to `3` retries seems to work well. If an app cannot be deployed within its allotted number of retries, an error will be raised.
|
158
109
|
|
@@ -391,31 +342,23 @@ Hatchet::Runner.new("rails5_ruby_schema_format", buildpacks: buildpacks).run_ci
|
|
391
342
|
end
|
392
343
|
```
|
393
344
|
|
394
|
-
## Testing on
|
395
|
-
|
396
|
-
Once you've got your tests working locally, you'll likely want to get them running on Travis because a) CI is awesome, and b) you can use pull requests to run your all your tests in parallel without having to kill your network connection.
|
397
|
-
|
398
|
-
Set the `HATCHET_DEPLOY_STRATEGY` to `git`.
|
345
|
+
## Testing on CI
|
399
346
|
|
400
|
-
|
347
|
+
Once you've got your tests working locally, you'll likely want to get them running on CI. For reference see the [Circle CI config from this repo](https://github.com/heroku/hatchet/blob/master/.circleci/config.yml) and the [Heroku CI config from the ruby buildpack](https://github.com/heroku/heroku-buildpack-ruby/blob/master/app.json).
|
401
348
|
|
402
|
-
|
349
|
+
To make running on CI easier, there is a setup script in Hatchet that can be run before your tests are executed:
|
403
350
|
|
404
351
|
```yml
|
405
|
-
|
352
|
+
bundle exec hatchet ci:setup
|
406
353
|
```
|
407
354
|
|
408
|
-
|
355
|
+
If you're a Heroku employee see [private instructions for setting up test users](https://github.com/heroku/languages-team/blob/master/guides/create_test_users_for_ci.md) to generate a user a grab the API token. Once you have an API token you'll want to set up these env vars with your CI provider:
|
409
356
|
|
410
|
-
```sh
|
411
|
-
$ travis encrypt HEROKU_API_KEY=<token> --add
|
412
357
|
```
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
before_script: bundle exec hatchet ci:setup
|
418
|
-
sudo: required
|
358
|
+
HATCHET_APP_LIMIT=100
|
359
|
+
HATCHET_RETRIES=3
|
360
|
+
HEROKU_API_KEY=<redacted>
|
361
|
+
HEROKU_API_USER=<redacted@example.com>
|
419
362
|
```
|
420
363
|
|
421
364
|
## Extra App Commands
|
data/etc/ci_setup.rb
CHANGED
@@ -8,9 +8,13 @@ unless File.exists?(netrc_file)
|
|
8
8
|
File.open(netrc_file, 'w') do |file|
|
9
9
|
file.write <<-EOF
|
10
10
|
machine git.heroku.com
|
11
|
-
login #{ENV.fetch('HEROKU_API_USER')}
|
12
|
-
password #{ENV.fetch('HEROKU_API_KEY')}
|
11
|
+
login #{ENV.fetch('HEROKU_API_USER')}
|
12
|
+
password #{ENV.fetch('HEROKU_API_KEY')}
|
13
|
+
machine api.heroku.com
|
14
|
+
login #{ENV.fetch('HEROKU_API_USER')}
|
15
|
+
password #{ENV.fetch('HEROKU_API_KEY')}
|
13
16
|
EOF
|
17
|
+
`chmod 0600 "$HOME/.netrc"`
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
@@ -21,9 +25,7 @@ end
|
|
21
25
|
"git config --get user.name > /dev/null || git config --global user.name 'BuildpackTester'",
|
22
26
|
].each do |command|
|
23
27
|
puts "== Running: #{command}"
|
24
|
-
|
25
|
-
|
26
|
-
raise "Command failed: #{command.inspect}\nResult: #{result}" unless $?.success?
|
27
|
-
end
|
28
|
+
result = `#{command}`
|
29
|
+
raise "Command failed: #{command.inspect}\nResult: #{result}" unless $?.success?
|
28
30
|
end
|
29
31
|
puts "== Done =="
|
data/hatchet.gemspec
CHANGED
data/lib/hatchet/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_hatchet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '1'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: m
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
description: Hatchet is a an integration testing library for developing Heroku buildpacks.
|
182
196
|
email:
|
183
197
|
- richard.schneeman+rubygems@gmail.com
|
@@ -186,6 +200,7 @@ executables:
|
|
186
200
|
extensions: []
|
187
201
|
extra_rdoc_files: []
|
188
202
|
files:
|
203
|
+
- ".circleci/config.yml"
|
189
204
|
- ".github/workflows/check_changelog.yml"
|
190
205
|
- ".gitignore"
|
191
206
|
- ".travis.yml"
|