heroku_hatchet 7.3.4 → 7.4.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/.github/workflows/check_changelog.yml +16 -7
- data/.github/workflows/ci.yml +38 -0
- data/CHANGELOG.md +6 -0
- data/lib/hatchet/app.rb +1 -1
- data/lib/hatchet/heroku_run.rb +46 -7
- data/lib/hatchet/templates/check_changelog.erb +16 -7
- data/lib/hatchet/version.rb +1 -1
- data/spec/hatchet/app_spec.rb +1 -1
- data/spec/hatchet/ci_spec.rb +4 -0
- data/spec/unit/heroku_run_spec.rb +22 -4
- metadata +4 -4
- data/.circleci/config.yml +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e33ffcf73b42d412f81525fdce9b77baa34da4083a6662cb14ddb098a0535dc
|
4
|
+
data.tar.gz: 3d73f585c00dd74cd4733802af979ba75e2c04e4cb93118128fdaf6efe9bc53b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9ef93379dd21e7808f30d9a2ed6179a76aa12679d5a1129a1ed394682c3e046abcc6c8b87ae8d3112edc5ff77965f90d42550be6d09a49ed89b7ad7270fdf14
|
7
|
+
data.tar.gz: 6cd06944d64ca9ae96ed8b25744000de748a5235dc52fab838368b9afc75c28af6dc9c1432106a99f972b4044d94762ce573fcaef2fa91f062a68aad2000b05a
|
@@ -1,13 +1,22 @@
|
|
1
1
|
name: Check Changelog
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
4
|
+
pull_request:
|
5
|
+
types: [opened, reopened, edited, labeled, unlabeled, synchronize]
|
6
|
+
|
6
7
|
jobs:
|
7
|
-
|
8
|
+
check-changelog:
|
8
9
|
runs-on: ubuntu-latest
|
10
|
+
if: |
|
11
|
+
!contains(github.event.pull_request.body, '[skip changelog]') &&
|
12
|
+
!contains(github.event.pull_request.body, '[changelog skip]') &&
|
13
|
+
!contains(github.event.pull_request.body, '[skip ci]') &&
|
14
|
+
!contains(github.event.pull_request.labels.*.name, 'skip changelog') &&
|
15
|
+
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
|
16
|
+
!contains(github.event.pull_request.labels.*.name, 'automation')
|
9
17
|
steps:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- name: Check that CHANGELOG is touched
|
20
|
+
run: |
|
21
|
+
git fetch origin ${{ github.base_ref }} --depth 1 && \
|
22
|
+
git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
|
@@ -0,0 +1,38 @@
|
|
1
|
+
name: CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
# Avoid duplicate builds on PRs.
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
ruby-version: ["2.7", "3.0", "3.1"]
|
18
|
+
runs-on: ubuntu-22.04
|
19
|
+
env:
|
20
|
+
HATCHET_APP_LIMIT: 100
|
21
|
+
HATCHET_RETRIES: 3
|
22
|
+
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
|
23
|
+
HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }}
|
24
|
+
IS_RUNNING_ON_CI: 1
|
25
|
+
HATCHET_EXPENSIVE_MODE: 1
|
26
|
+
PARALLEL_SPLIT_TEST_PROCESSES: 25
|
27
|
+
steps:
|
28
|
+
- name: Checkout
|
29
|
+
uses: actions/checkout@v3
|
30
|
+
- name: Set up Ruby ${{ matrix.ruby-version }} and dependencies
|
31
|
+
uses: ruby/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{ matrix.ruby-version }}
|
34
|
+
bundler-cache: true
|
35
|
+
- name: Hatchet setup
|
36
|
+
run: bundle exec hatchet ci:setup
|
37
|
+
- name: Run test suite
|
38
|
+
run: bundle exec parallel_split_test spec/
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## HEAD
|
2
2
|
|
3
|
+
## 7.4.0
|
4
|
+
|
5
|
+
- Supports "basic" scaledown (https://github.com/heroku/hatchet/pull/193)
|
6
|
+
- Breaking: Support for Ruby 2.2 is soft removed going forward only Ruby versions on the currently released stack will be supported
|
7
|
+
- Bugfix: `heroku run` calls are now properly rate throttled and retried https://github.com/heroku/hatchet/pull/187
|
8
|
+
|
3
9
|
## 7.3.4
|
4
10
|
|
5
11
|
- Memoize `Hatchet::App.default_buildpack` (https://github.com/heroku/hatchet/pull/183)
|
data/lib/hatchet/app.rb
CHANGED
data/lib/hatchet/heroku_run.rb
CHANGED
@@ -1,4 +1,39 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
1
3
|
module Hatchet
|
4
|
+
class BashResult
|
5
|
+
attr_reader :stdout, :stderr, :status
|
6
|
+
|
7
|
+
def initialize(stdout:, stderr:, status:, set_global_status: false)
|
8
|
+
@stdout = stdout
|
9
|
+
@stderr = stderr
|
10
|
+
@status = status.respond_to?(:exitstatus) ? status.exitstatus : status.to_i
|
11
|
+
`exit #{@status}` if set_global_status
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Boolean]
|
15
|
+
def success?
|
16
|
+
@status == 0
|
17
|
+
end
|
18
|
+
|
19
|
+
def failed?
|
20
|
+
!success?
|
21
|
+
end
|
22
|
+
|
23
|
+
# Testing helper methods
|
24
|
+
def include?(value)
|
25
|
+
stdout.include?(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
def match?(value)
|
29
|
+
stdout.match?(value)
|
30
|
+
end
|
31
|
+
|
32
|
+
def match(value)
|
33
|
+
stdout.match(value)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
2
37
|
# Used for running Heroku commands
|
3
38
|
#
|
4
39
|
# Example:
|
@@ -28,18 +63,21 @@ module Hatchet
|
|
28
63
|
@command = build_heroku_command(command, heroku || {})
|
29
64
|
@retry_on_empty = retry_on_empty
|
30
65
|
@stderr = stderr
|
31
|
-
@
|
32
|
-
@status = nil
|
66
|
+
@result = nil
|
33
67
|
@empty_fail_count = 0
|
34
68
|
end
|
35
69
|
|
70
|
+
def result
|
71
|
+
raise "You must run `call` on this object first" unless @result
|
72
|
+
@result
|
73
|
+
end
|
74
|
+
|
36
75
|
def output
|
37
|
-
|
38
|
-
@output
|
76
|
+
result.stdout
|
39
77
|
end
|
40
78
|
|
41
79
|
def status
|
42
|
-
|
80
|
+
result
|
43
81
|
@status
|
44
82
|
end
|
45
83
|
|
@@ -68,12 +106,13 @@ module Hatchet
|
|
68
106
|
private def execute!
|
69
107
|
ShellThrottle.new(platform_api: @app.platform_api).call do |throttle|
|
70
108
|
run_shell!
|
71
|
-
throw(:throttle) if
|
109
|
+
throw(:throttle) if @result.stderr.match?(/reached the API rate limit/)
|
72
110
|
end
|
73
111
|
end
|
74
112
|
|
75
113
|
private def run_shell!
|
76
|
-
|
114
|
+
stdout, stderr, status = Open3.capture3(@command)
|
115
|
+
@result = BashResult.new(stdout: stdout, stderr: stderr, status: status, set_global_status: true)
|
77
116
|
@status = $?
|
78
117
|
end
|
79
118
|
|
@@ -1,13 +1,22 @@
|
|
1
1
|
name: Check Changelog
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
4
|
+
pull_request:
|
5
|
+
types: [opened, reopened, edited, labeled, unlabeled, synchronize]
|
6
|
+
|
6
7
|
jobs:
|
7
|
-
|
8
|
+
check-changelog:
|
8
9
|
runs-on: ubuntu-latest
|
10
|
+
if: |
|
11
|
+
!contains(github.event.pull_request.body, '[skip changelog]') &&
|
12
|
+
!contains(github.event.pull_request.body, '[changelog skip]') &&
|
13
|
+
!contains(github.event.pull_request.body, '[skip ci]') &&
|
14
|
+
!contains(github.event.pull_request.labels.*.name, 'skip changelog') &&
|
15
|
+
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
|
16
|
+
!contains(github.event.pull_request.labels.*.name, 'automation')
|
9
17
|
steps:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- name: Check that CHANGELOG is touched
|
20
|
+
run: |
|
21
|
+
git fetch origin ${{ github.base_ref }} --depth 1 && \
|
22
|
+
git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
|
data/lib/hatchet/version.rb
CHANGED
data/spec/hatchet/app_spec.rb
CHANGED
@@ -63,7 +63,7 @@ describe "AppTest" do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "create app with stack" do
|
66
|
-
stack = "heroku-
|
66
|
+
stack = "heroku-18"
|
67
67
|
app = Hatchet::App.new("default_ruby", stack: stack)
|
68
68
|
app.create_app
|
69
69
|
expect(app.platform_api.app.info(app.name)["build_stack"]["name"]).to eq(stack)
|
data/spec/hatchet/ci_spec.rb
CHANGED
@@ -27,6 +27,8 @@ describe "CIFourTest" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "error with bad app" do
|
30
|
+
pending("upgrade rails 5 app to newer")
|
31
|
+
|
30
32
|
expect {
|
31
33
|
Hatchet::GitApp.new("rails5_ci_fails_no_database", stack: "heroku-18").run_ci { }
|
32
34
|
}.to raise_error(/PG::ConnectionBad: could not connect to server/)
|
@@ -51,6 +53,8 @@ describe "CIFourTest" do
|
|
51
53
|
end
|
52
54
|
|
53
55
|
it "ci create app with stack" do
|
56
|
+
pending("upgrade rails 5 app to newer")
|
57
|
+
|
54
58
|
app = Hatchet::GitApp.new("rails5_ruby_schema_format")
|
55
59
|
app.run_ci do |test_run|
|
56
60
|
expect(test_run.output).to match("Ruby buildpack tests completed successfully")
|
@@ -50,7 +50,7 @@ describe "HerokuRun" do
|
|
50
50
|
run_obj = Hatchet::HerokuRun.new("ruby -v", app: @app, stderr: stderr)
|
51
51
|
|
52
52
|
def run_obj.run_shell!
|
53
|
-
@
|
53
|
+
@result = Hatchet::BashResult.new(stdout: "", stderr: "", status: 1)
|
54
54
|
@status = Object.new
|
55
55
|
end
|
56
56
|
|
@@ -65,7 +65,7 @@ describe "HerokuRun" do
|
|
65
65
|
run_obj = Hatchet::HerokuRun.new("ruby -v", app: @app, stderr: stderr)
|
66
66
|
|
67
67
|
def run_obj.run_shell!
|
68
|
-
@
|
68
|
+
@result = Hatchet::BashResult.new(stdout: "not empty", stderr: "", status: 1)
|
69
69
|
@status = Object.new
|
70
70
|
end
|
71
71
|
|
@@ -80,7 +80,7 @@ describe "HerokuRun" do
|
|
80
80
|
run_obj = Hatchet::HerokuRun.new("ruby -v", app: @app, stderr: stderr, retry_on_empty: false)
|
81
81
|
|
82
82
|
def run_obj.run_shell!
|
83
|
-
@
|
83
|
+
@result = Hatchet::BashResult.new(stdout: "", stderr: "", status: 1)
|
84
84
|
@status = Object.new
|
85
85
|
end
|
86
86
|
|
@@ -90,6 +90,24 @@ describe "HerokuRun" do
|
|
90
90
|
expect(stderr.string).to_not include("retrying the command.")
|
91
91
|
end
|
92
92
|
|
93
|
+
it "retries work when message is delivered via stderr" do
|
94
|
+
stderr = StringIO.new
|
95
|
+
run_obj = Hatchet::HerokuRun.new("ruby -v", app: @app, stderr: stderr, retry_on_empty: false)
|
96
|
+
|
97
|
+
def run_obj.run_shell!
|
98
|
+
@throttle_retry_count ||= 0
|
99
|
+
@throttle_retry_count += 1
|
100
|
+
@command = "echo 'lol'" if @throttle_retry_count > 1
|
101
|
+
|
102
|
+
super
|
103
|
+
end
|
104
|
+
|
105
|
+
run_obj.instance_variable_set(:@command, "ruby -e 'STDERR.puts %Q{reached the API rate limit}'")
|
106
|
+
run_obj.call
|
107
|
+
|
108
|
+
expect(run_obj.instance_variable_get(:@throttle_retry_count)).to eq(2)
|
109
|
+
end
|
110
|
+
|
93
111
|
it "retries 0 times on empty result when disabled via ENV var" do
|
94
112
|
begin
|
95
113
|
original_env = ENV["HATCHET_DISABLE_EMPTY_RUN_RETRY"]
|
@@ -98,7 +116,7 @@ describe "HerokuRun" do
|
|
98
116
|
run_obj = Hatchet::HerokuRun.new("ruby -v", app: @app, stderr: stderr)
|
99
117
|
|
100
118
|
def run_obj.run_shell!
|
101
|
-
@
|
119
|
+
@result = Hatchet::BashResult.new(stdout: "", stderr: "", status: 1)
|
102
120
|
@status = Object.new
|
103
121
|
end
|
104
122
|
|
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: 7.
|
4
|
+
version: 7.4.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:
|
11
|
+
date: 2023-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: platform-api
|
@@ -158,8 +158,8 @@ executables:
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
-
- ".circleci/config.yml"
|
162
161
|
- ".github/workflows/check_changelog.yml"
|
162
|
+
- ".github/workflows/ci.yml"
|
163
163
|
- ".gitignore"
|
164
164
|
- CHANGELOG.md
|
165
165
|
- Gemfile
|
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
230
230
|
- !ruby/object:Gem::Version
|
231
231
|
version: '0'
|
232
232
|
requirements: []
|
233
|
-
rubygems_version: 3.
|
233
|
+
rubygems_version: 3.3.26
|
234
234
|
signing_key:
|
235
235
|
specification_version: 4
|
236
236
|
summary: Hatchet is a an integration testing library for developing Heroku buildpacks.
|
data/.circleci/config.yml
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
version: 2
|
2
|
-
references:
|
3
|
-
unit: &unit
|
4
|
-
run:
|
5
|
-
name: Run test suite
|
6
|
-
command: PARALLEL_SPLIT_TEST_PROCESSES=25 bundle exec parallel_split_test spec/
|
7
|
-
environment:
|
8
|
-
HATCHET_EXPENSIVE_MODE: 1 # !!!! WARNING !!!! ONLY RUN THIS IF YOU WORK FOR HEROKU !!!! WARNING !!!!
|
9
|
-
restore: &restore
|
10
|
-
restore_cache:
|
11
|
-
keys:
|
12
|
-
- v1_bundler_deps-{{ .Environment.CIRCLE_JOB }}
|
13
|
-
save: &save
|
14
|
-
save_cache:
|
15
|
-
paths:
|
16
|
-
- ./vendor/bundle
|
17
|
-
key: v1_bundler_deps-{{ .Environment.CIRCLE_JOB }} # CIRCLE_JOB e.g. "ruby-2.5"
|
18
|
-
hatchet_setup: &hatchet_setup
|
19
|
-
run:
|
20
|
-
name: Hatchet setup
|
21
|
-
command: |
|
22
|
-
bundle exec hatchet ci:setup
|
23
|
-
bundle: &bundle
|
24
|
-
run:
|
25
|
-
name: install dependencies
|
26
|
-
command: |
|
27
|
-
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
28
|
-
bundle update
|
29
|
-
bundle clean
|
30
|
-
|
31
|
-
jobs:
|
32
|
-
"ruby-2.2":
|
33
|
-
docker:
|
34
|
-
- image: circleci/ruby:2.2
|
35
|
-
steps:
|
36
|
-
- checkout
|
37
|
-
- <<: *restore
|
38
|
-
- <<: *bundle
|
39
|
-
- <<: *hatchet_setup
|
40
|
-
- <<: *unit
|
41
|
-
- <<: *save
|
42
|
-
"ruby-2.5":
|
43
|
-
docker:
|
44
|
-
- image: circleci/ruby:2.5
|
45
|
-
steps:
|
46
|
-
- checkout
|
47
|
-
- <<: *restore
|
48
|
-
- <<: *bundle
|
49
|
-
- <<: *hatchet_setup
|
50
|
-
- <<: *unit
|
51
|
-
- <<: *save
|
52
|
-
"ruby-2.7":
|
53
|
-
docker:
|
54
|
-
- image: circleci/ruby:2.7
|
55
|
-
steps:
|
56
|
-
- checkout
|
57
|
-
- <<: *restore
|
58
|
-
- <<: *bundle
|
59
|
-
- <<: *hatchet_setup
|
60
|
-
- <<: *unit
|
61
|
-
- <<: *save
|
62
|
-
|
63
|
-
workflows:
|
64
|
-
version: 2
|
65
|
-
build:
|
66
|
-
jobs:
|
67
|
-
- "ruby-2.2"
|
68
|
-
- "ruby-2.5"
|
69
|
-
- "ruby-2.7"
|