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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d315483e6cd1509b1ea90279b800beb2a969f57956a44f7df08c5844ec9f539b
4
- data.tar.gz: 5f66b2f956bd2820b80dc634d68cea6dc84c7e23079253ef990fe5be8d131d0c
3
+ metadata.gz: 3c903b4979a0e4002e76f54d76a91f4651d5dfb2f20701909fefa5ac48954298
4
+ data.tar.gz: 5f54f9ebf2ec4b23a12109638aee44cc841d244c5e3f6f76994841eb47995950
5
5
  SHA512:
6
- metadata.gz: 03570dbbf7075600e686b4f36d1a15d51c812582ab558574c28bb4eb3f80f76618c20bb1bb6d4473a644078fcff0d831360cbfbe12a653727d6609d5a8c66853
7
- data.tar.gz: 107c8c3accdc9690cb7daafd1a0c9a20ea21e2730d9618de2913e6d7c5ff1d6a6191f552890272436ff0833c1456bce67ae8fbafc4eaa29da667a795c5fdd404
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
@@ -1,5 +1,7 @@
1
1
  ## HEAD
2
2
 
3
+ - Circle CI support in `ci:setup` command (https://github.com/heroku/hatchet/pull/76)
4
+
3
5
  ## 5.0.0
4
6
 
5
7
  - Shelling out to `heroku` commands no longer uses `Bundler.with_clean_env` (https://github.com/heroku/hatchet/pull/74)
data/Gemfile CHANGED
@@ -2,4 +2,3 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'm'
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: There is a section below on getting Hatchet to work on Travis.
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 travis (by leaving `HATCHET_BUILDPACK_BRANCH` blank).
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 Travis
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
- To run on travis, you will need to configure your `.travis.yml` to run the appropriate commands and to set up encrypted data so you can run tests against a valid heroku user.
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
- 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
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
- before_script: bundle exec hatchet ci:setup
352
+ bundle exec hatchet ci:setup
406
353
  ```
407
354
 
408
- I recommend signing up for a new heroku account for running your tests on travis to prevent exceding 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).
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
- If your Travis tests are containerized, you may need sudo to complete this successfully. In that case, add the following:
415
-
416
- ```yml
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
- Bundler.with_clean_env do
25
- result = `#{command}`
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
@@ -31,4 +31,5 @@ Gem::Specification.new do |gem|
31
31
  gem.add_development_dependency "mocha", ">= 1"
32
32
  gem.add_development_dependency "parallel_tests", ">= 2"
33
33
  gem.add_development_dependency "travis", ">= 1"
34
+ gem.add_development_dependency "m"
34
35
  end
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "5.0.0"
2
+ VERSION = "5.0.1"
3
3
  end
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.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"