openstax_aws 1.1.0 → 1.2.0

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: 5a062d5bb4d0c5c73fd23b6ed4c1d1b36e18d24143e6a74c7a51e4e3c552048d
4
- data.tar.gz: a7fcc57860108b12434d66f5e5ccc90e27494bf892a67a1f961aba942398ab8e
3
+ metadata.gz: eb329933135fb800a09d8883d181b3a44fa0ff97f58d79757c0710d35f30594c
4
+ data.tar.gz: ecf61c1aba906cfb3b7a848c42bffac57193864c138eaa84c8592c697be589c4
5
5
  SHA512:
6
- metadata.gz: 3be0e6e5c49c30f40e98575d0957fad14e025c6297f7276bcc71b8f42f427b0b349ff47b1c60ca3089a1901be4f9643afe68275aa468bb04e2a1412f426d5b37
7
- data.tar.gz: a369f3fb8b8a8f39165358cc24352b0a1b21c6af2fa1baf4bd4fc816877cf3ae8d2fa3e4bff67e49e7930ceb7e42e61942f31ee78c3e00bc92605fa3cb30dee8
6
+ metadata.gz: 903288c5e8e78ab5c94e660bbd8657ed9357002fb82a2cdc22f398284d3800daad6c478d669d4072e3c8f74d665aa0ed2fe27687c02e154e582b80fec4ffd97c
7
+ data.tar.gz: 75dae33c89bb17c0ebf211450551003158a85ee1228c877f17cad075f596fe5e82bb5562029ed2d746a4f9ea9cba9613d9e9f9cfbcd7e1ba466bc92178a6825a
@@ -0,0 +1,33 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+ schedule:
9
+ - cron: '0 0 * * 0' # weekly
10
+
11
+ jobs:
12
+ tests:
13
+ timeout-minutes: 10
14
+ runs-on: ubuntu-18.04
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.7
21
+ - uses: actions/cache@v2
22
+ with:
23
+ path: vendor/bundle
24
+ key: ${{ runner.os }}-gems-pr-${{ hashFiles('**/Gemfile.lock') }}
25
+ restore-keys: |
26
+ ${{ runner.os }}-gems-pr-
27
+ - name: Test
28
+ run: |
29
+ gem install bundler --force --no-document --version 2.1.4
30
+ bundle config path vendor/bundle
31
+ bundle config jobs 2
32
+ bundle install
33
+ bundle exec rake
@@ -6,16 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [1.1.0] - 2020-10-20
10
-
11
- Fixed Packer debug mode by reading and printing each character from Packer instead of each line.
9
+ ## [1.2.0] - 2021-01-12
12
10
 
13
- Restricted AMI search to images owned by the same account to prevent a potential security flaw.
11
+ - Added additional method to MskCluster resource, to return sorted list of bootstrap brokers
12
+ - Replaced Travis with GH Actions
13
+ - All secret types now default to SecureString, not just the RSA keys
14
+ - Added CloudFormation ERB templates (cfn files that end in .yml.erb)
15
+ - Gracefully handle interrupts while running Packer and return Packer's exit status from the call
14
16
 
15
- Gitignored Gemfile.lock.
17
+ ## [1.1.0] - 2020-10-20
16
18
 
17
- Removed development dependency on bundler 1.
19
+ - Fixed Packer debug mode by reading and printing each character from Packer instead of each line.
20
+ - Restricted AMI search to images owned by the same account to prevent a potential security flaw.
21
+ - Gitignored Gemfile.lock.
22
+ - Removed development dependency on bundler 1.
18
23
 
19
24
  ## [1.0.0] - 2020-10-03
20
25
 
21
- First official version.
26
+ - First official version.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # aws-ruby
2
2
 
3
- [![Build Status](https://travis-ci.org/openstax/aws-ruby.svg?branch=master)](https://travis-ci.org/openstax/aws-ruby)
3
+ [![Tests](https://github.com/openstax/aws-ruby/workflows/Tests/badge.svg)](https://github.com/openstax/aws-ruby/actions?query=workflow:Tests)
4
4
 
5
5
  The `openstax_aws` gem helps you deploy your applications to AWS using CloudFormation. It provides a layer on top of
6
6
  the AWS SDKs to help coordinate common deployment steps and configurations.
@@ -14,6 +14,10 @@ module OpenStax::Aws
14
14
  client.get_bootstrap_brokers(cluster_arn: cluster_arn).bootstrap_broker_string
15
15
  end
16
16
 
17
+ def sorted_bootstrap_broker_string
18
+ bootstrap_broker_string.split(',').sort.join(',')
19
+ end
20
+
17
21
  end
18
22
  end
19
23
 
@@ -55,7 +55,7 @@ module OpenStax::Aws
55
55
  stdout_err.sync = true
56
56
 
57
57
  while char = stdout_err.getc do
58
- print char
58
+ STDERR.print char
59
59
  end
60
60
  end
61
61
  end
@@ -53,24 +53,43 @@ module OpenStax::Aws
53
53
  ami = ""
54
54
 
55
55
  Open3.popen2e(command) do |stdin, stdout_err, wait_thr|
56
- stdout_err.sync = true
56
+ begin
57
+ previous_interrupt_handler = Signal.trap 'INT' do
58
+ # Interrupt Packer
59
+ Process.kill 'INT', wait_thr.pid
57
60
 
58
- line = ''
61
+ # Restore previous interrupt handler so we don't interrupt Packer again
62
+ Signal.trap 'INT', previous_interrupt_handler
59
63
 
60
- while char = stdout_err.getc do
61
- line << char
62
- print char
64
+ # Disable other code that restores previous interrupt
65
+ previous_interrupt_handler = nil
66
+ end
63
67
 
64
- next unless char == "\n"
65
-
66
- matchami = line.match(/AMI: (ami-[0-9\-a-z]*)/i)
67
- ami = matchami.captures[0] if matchami
68
+ stdout_err.sync = true
68
69
 
69
70
  line = ''
71
+
72
+ while char = stdout_err.getc do
73
+ line << char
74
+ STDERR.print char
75
+
76
+ next unless char == "\n"
77
+
78
+ matchami = line.match(/AMI: (ami-[0-9\-a-z]*)/i)
79
+ ami = matchami.captures[0] if matchami
80
+
81
+ line = ''
82
+ end
83
+ ensure
84
+ # Restore previous interrupt unless we did so already
85
+ Signal.trap 'INT', previous_interrupt_handler unless previous_interrupt_handler.nil?
70
86
  end
71
- end
72
87
 
73
- puts ami
88
+ puts ami
89
+
90
+ # Return Packer's exit status wrapped in a Process::Status object
91
+ wait_thr.value
92
+ end
74
93
  end
75
94
  end
76
95
 
@@ -146,7 +146,7 @@ module OpenStax::Aws
146
146
 
147
147
  def process_individual_spec_value(spec_value, substitutions)
148
148
  generated = false
149
- type = "String"
149
+ type = "SecureString"
150
150
 
151
151
  value = case spec_value
152
152
  when /^random\(hex,(\d+)\)$/
@@ -158,7 +158,6 @@ module OpenStax::Aws
158
158
  num_characters = $1.to_i
159
159
  SecureRandom.urlsafe_base64(num_characters)[0..num_characters-1]
160
160
  when /^rsa\((\d+)\)$/
161
- type = "SecureString"
162
161
  generated = true
163
162
  key_length = $1.to_i
164
163
  OpenSSL::PKey::RSA.new(key_length).to_s
@@ -52,9 +52,13 @@ module OpenStax::Aws
52
52
  path = File.join(base_directory, "#{@id}.yml")
53
53
 
54
54
  if !File.file?(path)
55
- path = File.join(base_directory, "#{@id}.json")
55
+ path = File.join(base_directory, "#{@id}.yml.erb")
56
+
56
57
  if !File.file?(path)
57
- raise "Couldn't infer an existing template file for stack #{@id}"
58
+ path = File.join(base_directory, "#{@id}.json")
59
+ if !File.file?(path)
60
+ raise "Couldn't infer an existing template file for stack #{@id}"
61
+ end
58
62
  end
59
63
  end
60
64
  end
@@ -26,8 +26,20 @@ module OpenStax::Aws
26
26
  File.basename(absolute_file_path)
27
27
  end
28
28
 
29
+ def extname
30
+ File.extname(absolute_file_path)
31
+ end
32
+
33
+ def erb?
34
+ extname == '.erb'
35
+ end
36
+
29
37
  def body
30
- @body ||= File.read(absolute_file_path)
38
+ return @body unless @body.nil?
39
+
40
+ @body = File.read(absolute_file_path)
41
+ @body = ERB.new(@body).tap { |erb| erb.filename = absolute_file_path }.result if erb?
42
+ @body
31
43
  end
32
44
 
33
45
  def hash
@@ -1,5 +1,5 @@
1
1
  module OpenStax
2
2
  module Aws
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstax_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2021-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-autoscaling
@@ -273,8 +273,8 @@ executables:
273
273
  extensions: []
274
274
  extra_rdoc_files: []
275
275
  files:
276
+ - ".github/workflows/tests.yml"
276
277
  - ".gitignore"
277
- - ".travis.yml"
278
278
  - CHANGELOG.md
279
279
  - Gemfile
280
280
  - LICENSE.txt
@@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
342
  - !ruby/object:Gem::Version
343
343
  version: '0'
344
344
  requirements: []
345
- rubygems_version: 3.1.4
345
+ rubygems_version: 3.0.3
346
346
  signing_key:
347
347
  specification_version: 4
348
348
  summary: openstax IaC
@@ -1,12 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.6
5
- cache: bundler
6
- bundler_args: --retry=6
7
- script:
8
- - bundle exec rake
9
- notifications:
10
- email: false
11
- before_install:
12
- - gem install bundler