cutlass 0.2.1 → 0.2.2
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/dependabot.yml +5 -4
- data/.github/workflows/check_changelog.yml +14 -8
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +9 -9
- data/README.md +2 -2
- data/lib/cutlass/app.rb +2 -2
- data/lib/cutlass/container_boot.rb +2 -1
- data/lib/cutlass/function_query.rb +13 -1
- data/lib/cutlass/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 343c9862759141c5feeba0bafbac9aad72a2ea74330ad2868c2fb8cfcdca84a4
|
4
|
+
data.tar.gz: 24f5abe57557982cda38e335311911c3af688dc36cdc42e5436b429cb1fc72bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2591d579985513433cb26690d1abadde25ba00914d7fa2b7733f2431d8387e34dc757360982db2b3156a44c20dc7cfa5f74ab969f77b8b9f9c2a63527baa1519
|
7
|
+
data.tar.gz: 0b9ecaf0726b5483f600ef5178baa948ed61be5ea18e8ed52910d13990755889d9f57abab982b1d5e972350919d805070852d8bcf2aaeeeb162b26156b982d17
|
data/.github/dependabot.yml
CHANGED
@@ -2,8 +2,9 @@ version: 2
|
|
2
2
|
updates:
|
3
3
|
- package-ecosystem: "bundler"
|
4
4
|
directory: "/"
|
5
|
-
open-pull-requests-limit: 1 # Limit concurrent CI runs from executing
|
6
5
|
schedule:
|
7
|
-
interval: "
|
8
|
-
|
9
|
-
|
6
|
+
interval: "daily"
|
7
|
+
- package-ecosystem: "github-actions"
|
8
|
+
directory: "/"
|
9
|
+
schedule:
|
10
|
+
interval: "daily"
|
@@ -1,16 +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:
|
9
|
+
runs-on: ubuntu-latest
|
8
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') &&
|
9
15
|
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
|
10
16
|
!contains(github.event.pull_request.labels.*.name, 'automation')
|
11
|
-
runs-on: ubuntu-latest
|
12
17
|
steps:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
18
|
+
- uses: actions/checkout@v2.3.4
|
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/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## 0.2.2
|
4
|
+
|
5
|
+
- Support :memory option for start_container https://github.com/heroku/cutlass/pull/27
|
6
|
+
- Add debug log when a function query fails https://github.com/heroku/cutlass/pull/17
|
7
|
+
|
3
8
|
## 0.2.1
|
4
9
|
|
5
10
|
- Fix incorrect conversion of a ProcessStatus into an exit code https://github.com/heroku/cutlass/pull/16
|
data/Gemfile.lock
CHANGED
@@ -1,34 +1,34 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cutlass (0.2.
|
4
|
+
cutlass (0.2.2)
|
5
5
|
docker-api (>= 2.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.
|
10
|
+
addressable (2.8.0)
|
11
11
|
public_suffix (>= 2.0.2, < 5.0)
|
12
12
|
ast (2.4.2)
|
13
13
|
crack (0.4.5)
|
14
14
|
rexml
|
15
15
|
dead_end (1.1.6)
|
16
16
|
diff-lcs (1.4.4)
|
17
|
-
docker-api (2.
|
17
|
+
docker-api (2.2.0)
|
18
18
|
excon (>= 0.47.0)
|
19
19
|
multi_json
|
20
|
-
excon (0.
|
20
|
+
excon (0.85.0)
|
21
21
|
hashdiff (1.0.1)
|
22
22
|
multi_json (1.15.0)
|
23
23
|
parallel (1.20.1)
|
24
|
-
parallel_split_test (0.
|
24
|
+
parallel_split_test (0.10.0)
|
25
25
|
parallel (>= 0.5.13)
|
26
26
|
rspec-core (>= 3.9.0)
|
27
27
|
parser (3.0.1.0)
|
28
28
|
ast (~> 2.4.1)
|
29
29
|
public_suffix (4.0.6)
|
30
30
|
rainbow (3.0.0)
|
31
|
-
rake (13.0.
|
31
|
+
rake (13.0.6)
|
32
32
|
regexp_parser (2.1.1)
|
33
33
|
rexml (3.2.5)
|
34
34
|
rspec (3.10.0)
|
@@ -63,8 +63,8 @@ GEM
|
|
63
63
|
rubocop (= 1.12.1)
|
64
64
|
rubocop-performance (= 1.10.1)
|
65
65
|
unicode-display_width (2.0.0)
|
66
|
-
webmock (3.
|
67
|
-
addressable (>= 2.
|
66
|
+
webmock (3.14.0)
|
67
|
+
addressable (>= 2.8.0)
|
68
68
|
crack (>= 0.3.2)
|
69
69
|
hashdiff (>= 0.4.0, < 2.0.0)
|
70
70
|
yard (0.9.26)
|
@@ -85,4 +85,4 @@ DEPENDENCIES
|
|
85
85
|
yard
|
86
86
|
|
87
87
|
BUNDLED WITH
|
88
|
-
2.2.
|
88
|
+
2.2.22
|
data/README.md
CHANGED
@@ -92,7 +92,7 @@ Cutlass::App.new("ruby-getting-started").transaction do |app|
|
|
92
92
|
#
|
93
93
|
# Basically there's a ton of caveats to using this feature. Tread lightly.
|
94
94
|
app.start_container(expose_ports: [8080]) do |container|
|
95
|
-
response = Excon.get("http://localhost:#{container.
|
95
|
+
response = Excon.get("http://localhost:#{container.get_host_port(8080)}/", :idempotent => true, :retry_limit => 5, :retry_interval => 1)
|
96
96
|
expect(response.body).to eq("Welcome to rails")
|
97
97
|
|
98
98
|
# Warning, this does not use the CNB entrypoint so it's in a different dir
|
@@ -169,7 +169,7 @@ An instance of BashResult is returned whenever Cutlass interacts with the shell
|
|
169
169
|
|
170
170
|
Once built an app can `app.start_container` to yield a ContainerControl object.
|
171
171
|
|
172
|
-
- `container.
|
172
|
+
- `container.get_host_port(<port>)` Returns the port on the host machine (your computer, not docker) that docker is bound to
|
173
173
|
- Warning: These following commands do not use the CNB entry point so CNB env vars are not loaded and it my be a different dir than you're expecting
|
174
174
|
- `container.bash_exec(<command>)` Executes a bash command inside of a running container. Returns a BashResult object. By default this will raise an exception if the command returns non-zero exit code. Use kwarg `container.bash_exec(<command>, exception_on_failure: false)` to disable. Returns a BashResult object.
|
175
175
|
- `container.contains_file?(<file path>)` Checks to see if a given file exists on disk. Returns a BashResult object
|
data/lib/cutlass/app.rb
CHANGED
@@ -90,10 +90,10 @@ module Cutlass
|
|
90
90
|
on_teardown { thread.join }
|
91
91
|
end
|
92
92
|
|
93
|
-
def start_container(
|
93
|
+
def start_container(opts = {})
|
94
94
|
raise "No block given" unless block_given?
|
95
95
|
|
96
|
-
ContainerBoot.new(image_id: last_build.image_id
|
96
|
+
ContainerBoot.new(opts.merge(image_id: last_build.image_id)).call do |container|
|
97
97
|
yield container
|
98
98
|
end
|
99
99
|
end
|
@@ -33,7 +33,7 @@ module Cutlass
|
|
33
33
|
# container. It does not execute the container's entrypoint. That means if you're running
|
34
34
|
# inside of a CNB image, that env vars won't be set and the directory might be different.
|
35
35
|
class ContainerBoot
|
36
|
-
def initialize(image_id:, expose_ports: [])
|
36
|
+
def initialize(image_id:, expose_ports: [], memory: nil)
|
37
37
|
@expose_ports = Array(expose_ports)
|
38
38
|
config = {
|
39
39
|
"Image" => image_id,
|
@@ -52,6 +52,7 @@ module Cutlass
|
|
52
52
|
port_bindings["#{port}/tcp"] = [{"HostPort" => ""}]
|
53
53
|
end
|
54
54
|
|
55
|
+
config["Memory"] = memory.to_i if memory
|
55
56
|
@container = Docker::Container.create(config)
|
56
57
|
end
|
57
58
|
|
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "json"
|
2
4
|
require "base64"
|
5
|
+
require "cgi"
|
3
6
|
|
4
7
|
module Cutlass
|
5
8
|
# The purpose of this class is to trigger "Salesforce Functions"
|
@@ -13,11 +16,14 @@ module Cutlass
|
|
13
16
|
# end
|
14
17
|
#
|
15
18
|
class FunctionQuery
|
16
|
-
|
19
|
+
attr_reader :io
|
20
|
+
|
21
|
+
def initialize(port:, spec_version: nil, body: {}, io: Kernel)
|
17
22
|
@send_body = body
|
18
23
|
@port = port
|
19
24
|
@response = nil
|
20
25
|
@spec_version = spec_version || "1.0"
|
26
|
+
@io = io
|
21
27
|
end
|
22
28
|
|
23
29
|
def call
|
@@ -48,6 +54,12 @@ module Cutlass
|
|
48
54
|
|
49
55
|
def as_json
|
50
56
|
JSON.parse(body || "")
|
57
|
+
rescue JSON::ParserError => e
|
58
|
+
io.warn "Body: #{body}"
|
59
|
+
io.warn "Code: #{response&.status}"
|
60
|
+
io.warn "Headers: #{response&.headers.inspect}"
|
61
|
+
io.warn "x-extra-info: #{CGI.unescape(response&.headers&.[]("x-extra-info") || "")}"
|
62
|
+
raise e
|
51
63
|
end
|
52
64
|
|
53
65
|
def body
|
data/lib/cutlass/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cutlass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- schneems
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
95
|
+
rubygems_version: 3.1.4
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Write CNB integration tests for Pack in Ruby with cutlass
|