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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6108df69ef77042bd071df45a813aafc53d4b48684a6d5348f999da8e641d7ce
4
- data.tar.gz: a6b71ca0d84404bed8f8ea12f6eebb01ec2664bd72a5b66d7c16eb76a2bd37e9
3
+ metadata.gz: 343c9862759141c5feeba0bafbac9aad72a2ea74330ad2868c2fb8cfcdca84a4
4
+ data.tar.gz: 24f5abe57557982cda38e335311911c3af688dc36cdc42e5436b429cb1fc72bc
5
5
  SHA512:
6
- metadata.gz: 05f3f9e730c1b20ee833ac67b0c4a18210d5554e66dbc7e892e30cc6275af24c7c40517d1e543f50fc055b405209acba99b2c6e6a18fa7537618211fb065c69e
7
- data.tar.gz: 5cc971e2fcf8ff09e815fc46904b23f4f5be348d2ddeb02104a6113715a0ac3ad255cc7332fdf89966d78deb86e7ca5ca732c23da402bca68e8f7d8a824d56e4
6
+ metadata.gz: 2591d579985513433cb26690d1abadde25ba00914d7fa2b7733f2431d8387e34dc757360982db2b3156a44c20dc7cfa5f74ab969f77b8b9f9c2a63527baa1519
7
+ data.tar.gz: 0b9ecaf0726b5483f600ef5178baa948ed61be5ea18e8ed52910d13990755889d9f57abab982b1d5e972350919d805070852d8bcf2aaeeeb162b26156b982d17
@@ -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: "weekly"
8
- labels:
9
- - "dependencies"
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
- pull_request:
5
- types: [opened, reopened, edited, synchronize]
4
+ pull_request:
5
+ types: [opened, reopened, edited, labeled, unlabeled, synchronize]
6
+
6
7
  jobs:
7
- build:
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
- - uses: actions/checkout@v1
14
- - name: Check that CHANGELOG is touched
15
- run: |
16
- cat $GITHUB_EVENT_PATH | jq .pull_request.title | grep -i '\[\(\(changelog skip\)\|\(ci skip\)\)\]' || git diff remotes/origin/${{ github.base_ref }} --name-only | grep CHANGELOG.md
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.1)
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.7.0)
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.1.0)
17
+ docker-api (2.2.0)
18
18
  excon (>= 0.47.0)
19
19
  multi_json
20
- excon (0.81.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.9.1)
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.3)
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.13.0)
67
- addressable (>= 2.3.6)
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.15
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.port(8080)}/", :idempotent => true, :retry_limit => 5, :retry_interval => 1)
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.port(<port>)` Returns the port on the host machine (your computer, not docker) that docker is bound to
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(expose_ports: [])
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, expose_ports: expose_ports).call do |container|
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
- def initialize(port:, spec_version: nil, body: {})
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Cutlass
4
4
  # Version
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.2"
6
6
  end
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.1
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-05-19 00:00:00.000000000 Z
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.2.15
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