iapi-idlc-sdk-deploy 1.0.2 → 1.0.4

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: 51c3af5405162472763a357065de1cda57296675681129a2bcd683cdca894459
4
- data.tar.gz: fbd1e05b52899cd422058078384c33fdc16ec5e523a8b9a0d19b41fadb6fc32c
3
+ metadata.gz: e4b8dc43975b8053c49a1487838573b4e13a985b17dcb6269c597a79e9a542fe
4
+ data.tar.gz: 65fad06743ed47c2bb877fef6696057d00c76cd049a2e67e8b918550f1780005
5
5
  SHA512:
6
- metadata.gz: e913a47ae3da654c91ebda072ebedc034c13e1c4dd0a9e101a86c420998a8e4fb0492d1c84667fc05fc57cac97ec8b2032b215947df21a00225b02b6ab753a6d
7
- data.tar.gz: 56e6dbbf13116fcd7e1d0013a7f1e31a9ac21cb69e2641c6041e07b77d2ec279d03d41d33044b507695cdfd58e9973fff77ac4aa07667fbaa7fc478570049c36
6
+ metadata.gz: a6b9d4d226cd58247841e494845ec56b08969ce3a8ae3b7c8611caeb57921b0f284e8bbb33ae8e54cea5899cfe476d8e0f9320f8c3869da7382fa96cff2992ac
7
+ data.tar.gz: 3cc70fa96eaa147cc055a91e94c1757cfaf885770310764c71edf20e41aa8c0929353a8bee2b24d1738052cc452163173de43e6cb7d7a2fedb5475f1b1f1e030
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.4
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ -m markdown
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in idlc-sdk-deploy.gemspec
6
+ gemspec
data/Jenkinsfile ADDED
@@ -0,0 +1,21 @@
1
+ pipeline {
2
+ agent any
3
+ options {
4
+ buildDiscarder logRotator(daysToKeepStr: '5', numToKeepStr: '10')
5
+ }
6
+ stages {
7
+ stage('Ruby Gem Push') {
8
+ environment {
9
+ GEM_HOST_API_KEY = credentials('rubygems-apikey')
10
+ }
11
+ steps {
12
+ sh '''
13
+ DOCKER_CMD="docker run --rm -v $PWD:/opt -w /opt -e GEM_HOST_API_KEY -e BUILD_NUMBER -u 999 ruby:3.0"
14
+ $DOCKER_CMD gem build iapi-idlc-sdk-deploy.gemspec -o iapi-idlc-sdk-deploy.gem
15
+ $DOCKER_CMD gem push iapi-idlc-sdk-deploy.gem
16
+ '''
17
+ }
18
+ }
19
+ }
20
+ }
21
+
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Nathan Cazell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Idlc::Sdk::Deploy
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/idlc/sdk/deploy`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'iapi-idlc-sdk-deploy'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install iapi-idlc-sdk-deploy
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "idlc-sdk-deploy"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'iapi-idlc-sdk-deploy/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'iapi-idlc-sdk-deploy'
9
+ spec.version = Idlc::Deploy::VERSION
10
+ spec.authors = ["Nathan Cazell", "Michael McHolm"]
11
+ spec.email = ["techsupport@imageapi.com"]
12
+
13
+ spec.summary = 'IDLC SDK for AWS resources - Deploy'
14
+ spec.description = 'Provides deploy libraries for idlc-sdk. This gem is part of the IDLC SDK'
15
+ spec.homepage = 'https://bitbucket.org/imageapi/iapi-idlc-sdk-deploy'
16
+ spec.license = 'MIT'
17
+
18
+ spec.metadata = {
19
+ 'source_code_uri' => 'https://bitbucket.org/imageapi/iapi-idlc-sdk-deploy'
20
+ }
21
+
22
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
23
+ f.match(%r{^(test|spec|features)/})
24
+ end
25
+
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_development_dependency 'bundler', '~> 2'
29
+ spec.add_development_dependency 'rake', '>= 12.3.3'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
+ spec.add_development_dependency 'rubocop', '0.48.1'
32
+ spec.add_development_dependency 'pry'
33
+ spec.add_development_dependency 'yard'
34
+
35
+ spec.add_runtime_dependency 'iapi-idlc-sdk-core'
36
+ spec.add_runtime_dependency 'aws-sdk-elasticsearchservice', '1.77.0'
37
+ spec.add_runtime_dependency 'aws-sdk-ec2', '1.425.0'
38
+ spec.add_runtime_dependency 'net-telnet'
39
+ spec.add_runtime_dependency 'sshkey', '2.0.0'
40
+ spec.add_runtime_dependency 'terraform-binary'
41
+ spec.add_runtime_dependency 'commander', '4.4.6'
42
+ spec.add_runtime_dependency 'terraform_landscape', '0.2.1'
43
+ end
@@ -0,0 +1,218 @@
1
+ module Idlc
2
+ module Deploy
3
+ class Config
4
+ include Idlc::Helpers
5
+
6
+ class << self
7
+ def load_tasks
8
+ Dir.glob("#{__dir__}/tasks/*.rake").each do |task_file|
9
+ load task_file
10
+ end
11
+ end
12
+
13
+ def add_deployment_var(key, value)
14
+ ENV["TF_VAR_#{key}"] = value
15
+ end
16
+
17
+ def get_deployment_var(key)
18
+ ENV["TF_VAR_#{key}"]
19
+ end
20
+
21
+ def get_deployment_output(key)
22
+ `#{Terraform::Binary::Command.binary} output #{key}`.strip!
23
+ end
24
+
25
+ def whoami
26
+ # This method is meant to be run on an instance inside of a chef run to
27
+ # provision instance and environment metadata.
28
+
29
+ ENV['AWS_REGION'] = get_region
30
+
31
+ # Get the current instance id from the instance metadata.
32
+ instance = get_instance
33
+
34
+ # return environment metadata
35
+ metadata = get_env_metadata(instance['tags']['environment_key'])
36
+ metadata['hostname'] = set_hostname(instance)
37
+
38
+ metadata
39
+ end
40
+
41
+ def get_env_metadata(env_key)
42
+ client = Idlc::AWSLambdaProxy.new()
43
+
44
+ request = {
45
+ service: 'deploy',
46
+ method: 'GET',
47
+ lambda: 'metadata',
48
+ pathParameters: {
49
+ jobName: env_key
50
+ }
51
+ }
52
+ metadata = client.fetch(request)['deployments'].first
53
+
54
+ request = {
55
+ service: 'config',
56
+ method: 'GET',
57
+ lambda: "accounts",
58
+ pathParameters: {
59
+ accountName: metadata['environment']['account_alias']
60
+ }
61
+ }
62
+ account = client.fetch(request)
63
+
64
+ metadata['account'] = account['accounts'].first
65
+
66
+ request = {
67
+ service: 'config',
68
+ method: 'GET',
69
+ lambda: "applications",
70
+ pathParameters: {
71
+ appName: metadata['environment']['application_name'].downcase
72
+ }
73
+ }
74
+ application = client.fetch(request)
75
+
76
+ metadata['application'] = application['applications'].first
77
+
78
+ # find db and fs instance
79
+ metadata['instances'].each do |instance|
80
+ if (instance['hostname'].start_with?('db') || instance['hostname'].start_with?('rds'))
81
+ metadata['db_instance'] = instance
82
+ end
83
+
84
+ if (instance['hostname'].start_with?('fs'))
85
+ metadata['fs_instance'] = instance
86
+ end
87
+ end
88
+
89
+ metadata
90
+ end
91
+
92
+ def get_region
93
+ # Get the current az from the instance metadata.
94
+ metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'
95
+ az = Net::HTTP.get( URI.parse( metadata_endpoint + 'placement/availability-zone' ) )
96
+
97
+ # return
98
+ az[0..-2]
99
+ end
100
+
101
+ def get_instance
102
+ # Get the current instance id from the instance metadata.
103
+ metadata_endpoint = 'http://169.254.169.254/latest/meta-data/'
104
+ instance_id = Net::HTTP.get( URI.parse( metadata_endpoint + 'instance-id' ) )
105
+
106
+ # Create instance object with instance id.
107
+ instance = Aws::EC2::Instance.new( id: instance_id, region: ENV['AWS_REGION'] )
108
+
109
+ # save some instance info
110
+ i = {}
111
+ i['instance_id'] = instance_id
112
+
113
+ # save tags
114
+ i['tags'] = {}
115
+ instance.tags.each do |tag|
116
+ # Grab all of the tags as node attributes
117
+ i['tags'][tag.key] = tag.value
118
+ end
119
+
120
+ i
121
+ end
122
+
123
+ def set_hostname (instance)
124
+ hostname = instance['tags']['Name']
125
+
126
+ unless (instance['tags']['Name'].start_with?('db') || instance['tags']['Name'].start_with?('fs'))
127
+ # Use instance id for unique hostname
128
+ hostname = instance['tags']['Name'][0..4] + '-' + instance['instance_id'][2..10]
129
+ end
130
+
131
+ ec2_instance = Aws::EC2::Instance.new( id: instance['instance_id'], region: ENV['AWS_REGION'] )
132
+ ec2_instance.create_tags(
133
+ dry_run: false,
134
+ tags: [ # required
135
+ {
136
+ key: 'hostname',
137
+ value: hostname
138
+ }
139
+ ]
140
+ )
141
+
142
+ #return
143
+ hostname
144
+ end
145
+ end
146
+
147
+ def initialize(region)
148
+ @region = region
149
+
150
+ Idlc::Utility.check_for_creds
151
+
152
+ rescue Idlc::Utility::MissingCredentials => e
153
+ msg("WARN: #{e.message}\nFalling back to implicit authentication.")
154
+ end
155
+
156
+ def configure_state(bucket, sub_bucket, working_directory)
157
+ validate_environment
158
+
159
+ tf_version = Terraform::Binary::config.version.split('.')
160
+
161
+ configure_tfstatev8(bucket, sub_bucket, working_directory) if tf_version[0].to_i == 0 && tf_version[1].to_i <= 8
162
+ configure_tfstatev9(bucket, sub_bucket, working_directory) if tf_version[0].to_i >= 0 && tf_version[1].to_i > 8
163
+ end
164
+
165
+ def parse(config_file)
166
+ raise ArgumentError, "#{config_file} does not exist" unless File.exist? config_file
167
+ Config.add_deployment_var('inf_config_file', config_file)
168
+
169
+ # Parse the config file
170
+ YAML.load_file(config_file)['configuration'].each do |section, body|
171
+ next if section == 'dynamics' # skip the dynamics sections
172
+ next unless (section =~ /overrides/).nil? # skip the app overrides sections
173
+ next if body.nil?
174
+ body.each do |key, value|
175
+ debug("#{section}: #{key} = #{value}")
176
+ Config.add_deployment_var(key, value)
177
+ end
178
+ end
179
+ end
180
+
181
+ private
182
+
183
+ def configure_tfstatev8(bucket, sub_bucket, working_directory)
184
+ args = []
185
+ args << '-backend=s3'
186
+ args << '-backend-config="acl=private"'
187
+ args << "-backend-config=\"bucket=#{bucket}\""
188
+ args << '-backend-config="encrypt=true"'
189
+ args << "-backend-config=\"key=#{sub_bucket}/terraform.tfstate\""
190
+ args << "-backend-config=\"region=#{@region}\""
191
+
192
+ Terraform::Binary.remote("config #{args.join(' ')}")
193
+ Terraform::Binary.get("-update #{working_directory}")
194
+ end
195
+
196
+ def configure_tfstatev9(bucket, sub_bucket, working_directory)
197
+ args = []
198
+ args << "-backend-config=\"bucket=#{bucket}\""
199
+ args << "-backend-config=\"key=#{sub_bucket}/terraform.tfstate\""
200
+ args << "-backend-config=\"region=#{@region}\""
201
+ args << "-force-copy"
202
+
203
+ Terraform::Binary.init("#{args.join(' ')} #{working_directory}")
204
+ end
205
+
206
+ def validate_environment
207
+ %w[
208
+ TF_VAR_tfstate_bucket
209
+ TF_VAR_job_code
210
+ TF_VAR_env
211
+ TF_VAR_domain
212
+ ].each do |var|
213
+ raise "missing #{var} in environment" unless ENV.include? var
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,25 @@
1
+ module Idlc
2
+ module Deploy
3
+ module Keypair
4
+ class << self
5
+ def generate(outdir)
6
+ raise ArgumentError, 'Must specify output directory' if outdir.nil?
7
+
8
+ FileUtils.mkdir_p outdir unless File.directory? outdir
9
+
10
+ private_key_file = "#{outdir}/private_key.pem"
11
+ public_key_file = "#{outdir}/public_key.pem"
12
+
13
+ return if File.exist? private_key_file
14
+
15
+ rsa_key = SSHKey.generate
16
+ private_key = rsa_key.private_key
17
+ public_key = rsa_key.ssh_public_key
18
+
19
+ File.open(private_key_file, 'w') { |file| file.write(private_key) }
20
+ File.open(public_key_file, 'w') { |file| file.write(public_key) }
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,198 @@
1
+ module Idlc
2
+ module Deploy
3
+ module Power
4
+ class ConnectionError < StandardError; end
5
+ class InstanceKeepAlive < StandardError; end
6
+
7
+ class << self
8
+ include Idlc::Helpers
9
+
10
+ def start_instance(instance, async=false)
11
+ msg("Starting Instance (#{instance.id})...")
12
+ instance.start(
13
+ dry_run: false
14
+ )
15
+ unless async
16
+ obj = instance.wait_until_running
17
+ msg('Started Instance: ' + get_name(obj.tags))
18
+ end
19
+ end
20
+
21
+ def stop_instance(instance, async=false)
22
+ raise InstanceKeepAlive if keep_alive?(instance.tags)
23
+
24
+ msg("Stopping Instance (#{instance.id})...")
25
+ instance.stop(
26
+ dry_run: false
27
+ )
28
+ unless async
29
+ obj = instance.wait_until_stopped
30
+ msg('Stopped Instance: ' + get_name(obj.tags))
31
+ end
32
+ end
33
+
34
+ def enable_keep_alive(instance)
35
+ instance.create_tags(
36
+ dry_run: false,
37
+ tags: [ # required
38
+ {
39
+ key: 'keep_alive',
40
+ value: "true-#{Time.now.to_i}"
41
+ }
42
+ ]
43
+ )
44
+ end
45
+
46
+ def disable_keep_alive(instance)
47
+ instance.create_tags(
48
+ dry_run: false,
49
+ tags: [ # required
50
+ {
51
+ key: 'keep_alive',
52
+ value: 'false'
53
+ }
54
+ ]
55
+ )
56
+ end
57
+
58
+ def update_instance_type(instance, type)
59
+ unless instance.instance_type == type
60
+ name = get_name(instance.tags)
61
+ msg "Changing #{name}: #{instance.instance_type} => #{type}"
62
+
63
+ instance.modify_attribute(
64
+ dry_run: false,
65
+ attribute: 'instanceType',
66
+ value: type
67
+ )
68
+ end
69
+ end
70
+
71
+ def wait_for_tcp_connection(host, port, connection_timeout = 5, wait_timeout = 1500, sleep_time = 10)
72
+ connected = false
73
+ start_time = Time.now
74
+
75
+ until connected
76
+ begin
77
+ Net::Telnet.new(
78
+ 'Host' => host,
79
+ 'Port' => port,
80
+ 'Telnetmode' => false,
81
+ 'Timeout' => connection_timeout
82
+ )
83
+
84
+ connected = true
85
+ rescue ConnectionError, Net::OpenTimeout, Errno::ECONNREFUSED
86
+ check_timeout(start_time, wait_timeout)
87
+ debug("waiting for #{host}:#{port} ... (#{(Time.now - start_time)}s elapsed)")
88
+ sleep sleep_time
89
+ end
90
+ end
91
+
92
+ msg "recieved response from #{host}:#{port} !"
93
+ true
94
+ end
95
+
96
+ def wait_for_response(endpoint, success_text = nil, wait_timeout = 1500, sleep_time = 10)
97
+ connected = false
98
+ start_time = Time.now
99
+
100
+ until connected
101
+ begin
102
+ if success_text.nil? || success_text == ''
103
+ response = http_request("#{endpoint}/diagnostics/ping")
104
+ connected = success(response.body)
105
+ else
106
+ response = http_request(endpoint)
107
+ connected = simple_success(response.body, success_text)
108
+ end
109
+ rescue ConnectionError, Net::OpenTimeout, JSON::ParserError, Errno::ECONNREFUSED
110
+ check_timeout(start_time, wait_timeout)
111
+ sleep sleep_time
112
+ end
113
+ end
114
+
115
+ msg "recieved response from #{endpoint} !"
116
+ true
117
+ end
118
+
119
+ def get_name(tags)
120
+ name = ''
121
+
122
+ tags.each do |t|
123
+ name = t.value if t.key == 'Name'
124
+ end
125
+
126
+ # Return
127
+ name
128
+ end
129
+
130
+ private
131
+
132
+ def keep_alive?(tags)
133
+ k = 'false'
134
+ k = get_keep_alive(tags)
135
+
136
+ return !keep_alive_expired?(k) if true?(k.split('-')[0])
137
+ false
138
+ end
139
+
140
+ def keep_alive_expired?(tag)
141
+ tag_parts = tag.split('-')
142
+
143
+ msg("keep_alive expired..") if one_week_old?(tag_parts[1].to_i)
144
+ msg("keep_alive expires in #{((Time.now.to_i - (tag_parts[1].to_i + (7*24*3600)))/24/3600).abs} days..") unless one_week_old?(tag_parts[1].to_i)
145
+
146
+ one_week_old?(tag_parts[1].to_i)
147
+ end
148
+
149
+ def true?(string)
150
+ string.to_s == 'true'
151
+ end
152
+
153
+ def one_week_old?(ts)
154
+ (Time.now.to_i - ts) > (7*(24*3600))
155
+ end
156
+
157
+ def get_keep_alive(tags)
158
+ v = ''
159
+
160
+ tags.each do |t|
161
+ v = t.value if t.key == 'keep_alive'
162
+ end
163
+
164
+ # Return
165
+ v
166
+ end
167
+
168
+ def http_request(endpoint)
169
+ uri = URI.parse endpoint
170
+ http = Net::HTTP.new(uri.host, uri.port)
171
+ http.use_ssl = true
172
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
173
+
174
+ request = Net::HTTP::Get.new(uri.path)
175
+ http.request(request)
176
+ end
177
+
178
+ def success(body)
179
+ pong = JSON.parse(body)['data']['pong']
180
+ raise ConnectionError unless pong == true
181
+
182
+ true
183
+ end
184
+
185
+ def simple_success(body, search_text)
186
+ raise ConnectionError if (body =~ /#{search_text}/).nil?
187
+
188
+ true
189
+ end
190
+
191
+ def check_timeout(start_time, timeout)
192
+ elapsed_time = Time.now - start_time
193
+ raise ConnectionError, 'Exceeded Timeout for Completion..' if elapsed_time.to_i >= timeout
194
+ end
195
+ end
196
+ end
197
+ end
198
+ end
@@ -0,0 +1,7 @@
1
+ require 'json'
2
+
3
+ # desc 'setup environment'
4
+ task :setupv3 do
5
+ raise 'missing metadata file' unless File.exist? 'metadata.json'
6
+ ENV_METADATA = JSON.parse(open('metadata.json').read)['deployments'].first if File.exist? 'metadata.json'
7
+ end
@@ -0,0 +1,6 @@
1
+ module Idlc
2
+ module Deploy
3
+ build_number = ENV.fetch('BUILD_NUMBER', '0')
4
+ VERSION = "1.0.#{build_number}"
5
+ end
6
+ end
@@ -0,0 +1,24 @@
1
+ require 'aws-sdk-elasticsearchservice'
2
+ require 'aws-sdk-ec2'
3
+ require 'aws-sigv4'
4
+ require 'net/https'
5
+ require 'net/http'
6
+ require 'net-telnet'
7
+ require 'rspec/core/rake_task'
8
+ require 'sshkey'
9
+ require 'terraform/binary'
10
+ require 'tmpdir'
11
+
12
+ # Use the packer-binary gem to provide the executable
13
+ Terraform::Binary.configure do |config|
14
+ config.version = '0.8.7'
15
+ end
16
+
17
+ # Load the core gem, this also has the service deinitions defined in the $services global variable
18
+ require 'iapi-idlc-sdk-core'
19
+
20
+ require 'iapi-idlc-sdk-deploy/config'
21
+ require 'iapi-idlc-sdk-deploy/power'
22
+ require 'iapi-idlc-sdk-deploy/keypair'
23
+
24
+ Idlc::Deploy::Config.load_tasks
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iapi-idlc-sdk-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Cazell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-11-07 00:00:00.000000000 Z
12
+ date: 2023-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -113,30 +113,30 @@ dependencies:
113
113
  name: aws-sdk-elasticsearchservice
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ">="
116
+ - - '='
117
117
  - !ruby/object:Gem::Version
118
- version: '0'
118
+ version: 1.77.0
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ">="
123
+ - - '='
124
124
  - !ruby/object:Gem::Version
125
- version: '0'
125
+ version: 1.77.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: aws-sdk-ec2
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - ">="
130
+ - - '='
131
131
  - !ruby/object:Gem::Version
132
- version: '0'
132
+ version: 1.425.0
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - ">="
137
+ - - '='
138
138
  - !ruby/object:Gem::Version
139
- version: '0'
139
+ version: 1.425.0
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: net-telnet
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -214,7 +214,25 @@ email:
214
214
  executables: []
215
215
  extensions: []
216
216
  extra_rdoc_files: []
217
- files: []
217
+ files:
218
+ - ".gitignore"
219
+ - ".rspec"
220
+ - ".travis.yml"
221
+ - ".yardopts"
222
+ - Gemfile
223
+ - Jenkinsfile
224
+ - LICENSE.txt
225
+ - README.md
226
+ - Rakefile
227
+ - bin/console
228
+ - bin/setup
229
+ - iapi-idlc-sdk-deploy.gemspec
230
+ - lib/iapi-idlc-sdk-deploy.rb
231
+ - lib/iapi-idlc-sdk-deploy/config.rb
232
+ - lib/iapi-idlc-sdk-deploy/keypair.rb
233
+ - lib/iapi-idlc-sdk-deploy/power.rb
234
+ - lib/iapi-idlc-sdk-deploy/tasks/setupv3.rake
235
+ - lib/iapi-idlc-sdk-deploy/version.rb
218
236
  homepage: https://bitbucket.org/imageapi/iapi-idlc-sdk-deploy
219
237
  licenses:
220
238
  - MIT