minke 1.13.5 → 1.13.6

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
  SHA1:
3
- metadata.gz: a0416f3e50c39ec19fc793b2d6a1706cc521fea8
4
- data.tar.gz: 16ef6ecab0adac8658a892c4eb9abad9456e4626
3
+ metadata.gz: 176d12ca1ffae1e33888bfb76ceb8e36e4a213de
4
+ data.tar.gz: 15bc30494e6873a3206a4498395d530a7a29b8c8
5
5
  SHA512:
6
- metadata.gz: 25949f80afb1d4a8c99eff183aba029079a11f8206d33721b8c3d4bf09a8d468713fab5f927e7c5f6905eb7f701e86e9ef4cb9ba71405353e79d2de518a6e7f2
7
- data.tar.gz: 72513cb55be4b42f3c99a133aca0629fed3345bed984c28aa45074b124fd91a1db3dc8d42196afe9136e5c8fca2a3df0d93f912e531eb3a3746add3554463454
6
+ metadata.gz: 95b342a6eebe1539bbdd862b1d6bc06c9432d00caf26232097e750d0a0e76fc706760c97128f5e116a95cfee4e3e57b3f7d1dbb0a8f4da1d04bb5d04c25eca49
7
+ data.tar.gz: 681f63787d28450a20a28c608c8a9101ce2d0a73ecfa6e6495d4bd599a1d179aaecb0e47d9c235ba9aea60e8bf2396beb87fe2c3ebe2afffb97858926edc38aa
data/.travis.yml CHANGED
@@ -30,7 +30,7 @@ after_deploy:
30
30
  docker build -t nicholasjackson/minke --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` .;
31
31
  docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
32
32
  docker push nicholasjackson/minke:latest;
33
- docker tag nicholasjackson/minke nicholasjackson/minke:1.13.5;
34
- docker push nicholasjackson/minke:1.13.5;
33
+ docker tag nicholasjackson/minke nicholasjackson/minke:1.13.6;
34
+ docker push nicholasjackson/minke:1.13.6;
35
35
  curl https://hooks.microbadger.com/images/nicholasjackson/minke/tkpohfdrYPE0B0TL5NzLcOap4k0=;
36
36
  fi
data/bin/minke CHANGED
@@ -79,7 +79,6 @@ subcommands = {
79
79
 
80
80
  global.order!
81
81
  command = ARGV.shift
82
- subcommands[command].order! unless command == ''
83
82
 
84
83
  def load_config config_file, verbose
85
84
  reader = Minke::Config::Reader.new Minke::Logging.create_logger(verbose)
data/docker/Gemfile CHANGED
@@ -8,8 +8,8 @@ gem "cucumber"
8
8
  gem "cucumber-rest-api", "= 0.3"
9
9
  gem 'cucumber-api', '~> 0.3'
10
10
 
11
- gem 'minke', "= 1.13.5"
11
+ gem 'minke', "= 1.13.6"
12
12
  gem 'minke-generator-swift', "= 0.2.2"
13
13
  gem 'minke-generator-netmvc'
14
- gem 'minke-generator-go', "= 0.8.4"
14
+ gem 'minke-generator-go', "= 0.8.5"
15
15
  gem 'minke-generator-spring'
data/lib/minke/command.rb CHANGED
@@ -52,7 +52,6 @@ module Minke
52
52
  :task_name => task,
53
53
  :docker_runner => Minke::Docker::DockerRunner.new(logger, network_name),
54
54
  :task_runner => task_runner,
55
- :error_helper => Minke::Helpers::Error.new,
56
55
  :shell_helper => shell,
57
56
  :logger_helper => logger,
58
57
  :generator_config => generator_config,
@@ -65,14 +64,15 @@ module Minke
65
64
  end
66
65
 
67
66
  def create_tasks task
67
+ dependencies = create_dependencies(task)
68
68
  return {
69
- :bundler => Minke::Tasks::Bundle.new(create_dependencies(task)),
70
- :fetch => Minke::Tasks::Fetch.new(create_dependencies(task)),
71
- :build => Minke::Tasks::Build.new(create_dependencies(task)),
72
- :test => Minke::Tasks::Test.new(create_dependencies(task)),
73
- :build_image => Minke::Tasks::BuildImage.new(create_dependencies(task)),
74
- :cucumber => Minke::Tasks::Cucumber.new(create_dependencies(task)),
75
- :push => Minke::Tasks::Push.new(create_dependencies(task))
69
+ :bundler => Minke::Tasks::Bundle.new(dependencies),
70
+ :fetch => Minke::Tasks::Fetch.new(dependencies),
71
+ :build => Minke::Tasks::Build.new(dependencies),
72
+ :test => Minke::Tasks::Test.new(dependencies),
73
+ :build_image => Minke::Tasks::BuildImage.new(dependencies),
74
+ :cucumber => Minke::Tasks::Cucumber.new(dependencies),
75
+ :push => Minke::Tasks::Push.new(dependencies)
76
76
  }
77
77
  end
78
78
 
@@ -24,8 +24,8 @@ module Minke
24
24
  # stop consul
25
25
  def stop
26
26
  @logger.info "Stopping Consul"
27
- @docker_runner.stop_container @container
28
- @docker_runner.delete_container @container
27
+ @docker_runner.stop_container @container unless @container == nil
28
+ @docker_runner.delete_container @container unless @container == nil
29
29
  end
30
30
 
31
31
  private
@@ -14,12 +14,12 @@ module Minke
14
14
  ##
15
15
  # waits until a 200 response is received from the given url
16
16
  def wait_for_HTTPOK url
17
- @logger.debug "Waiting for server #{url} to start #{@count} attempts left"
17
+ @logger.debug "Waiting for server #{url} to start #{@count} attempts remaining"
18
18
 
19
19
  begin
20
20
  response = RestClient.send('get', url)
21
21
  rescue
22
- @logger.error 'Invalid response from server'
22
+ @logger.debug 'Invalid response from server'
23
23
  end
24
24
 
25
25
  check_response response, url
@@ -41,6 +41,7 @@ module Minke
41
41
  if @count > 0
42
42
  wait_for_HTTPOK url
43
43
  else
44
+ @logger.error "Server: #{url} failed health check"
44
45
  raise 'Server failed to start'
45
46
  end
46
47
  end
@@ -1,3 +1,5 @@
1
+ require 'pry'
2
+
1
3
  module Minke
2
4
  module Docker
3
5
  ##
@@ -21,8 +23,9 @@ module Minke
21
23
  begin
22
24
  ip = @docker_runner.get_docker_ip_address
23
25
  container_details = find_container_by_name "/#{@project_name}_#{service_name}_1"
26
+ #puts container_details
24
27
  ports = container_details.first.info['Ports'].select { |p| p['PrivatePort'] == private_port.to_i }.first
25
- rescue
28
+ rescue Exception => e
26
29
  raise "Unable to find public address for '#{service_name}' on port #{private_port}"
27
30
  end
28
31
 
@@ -59,7 +59,7 @@ module Minke
59
59
  container, success = @docker_runner.create_and_run_container build_image, ["#{File.expand_path(@variables.src_root)}:/src"], nil, '/src', command
60
60
 
61
61
  # throw exception if failed
62
- @helper.fatal_error " #{command}" unless success
62
+ raise " #{command}" unless success
63
63
  #command = Minke::Helpers.replace_vars_in_section generator.generate_command, '##SERVICE_NAME##', APPLICATION_NAME
64
64
  #container, ret = Minke::Docker.create_and_run_container config, command
65
65
  ensure
@@ -10,15 +10,14 @@ module Minke
10
10
  def execute command
11
11
  @logger.debug command
12
12
 
13
- Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
14
- while line = stdout.gets
13
+ Open3.popen2e(command) do |stdin, stdout_err, wait_thr|
14
+ while line = stdout_err.gets
15
15
  @logger.debug line
16
16
  end
17
17
 
18
18
  exit_status = wait_thr.value
19
19
  unless exit_status.success?
20
- @logger.error "Error executing command: #{command}"
21
- abort
20
+ raise "Error executing command: #{command}"
22
21
  end
23
22
  end
24
23
  end
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
- MINKE_VERSION="1.13.5"
2
+ MINKE_VERSION="1.13.6"
3
3
  ERROR="Please specify a command e.g. ./minke build"
4
4
 
5
5
  DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock"
@@ -16,10 +16,11 @@ module Minke
16
16
  server_address = @service_discovery.build_address(@task_settings.health_check)
17
17
  @health_check.wait_for_HTTPOK(server_address) unless @task_settings.health_check == nil
18
18
 
19
- status = @shell_helper.execute "cucumber --color -f pretty #{get_features args}"
19
+ @shell_helper.execute "cucumber --color -f pretty #{get_features args}"
20
+ rescue Exception => e
21
+ raise ("Cucumber steps failed: #{e.message}") unless status == true
20
22
  ensure
21
23
  compose.down
22
- @error_helper.fatal_error("Cucumber steps failed") unless status == true
23
24
  end
24
25
  end
25
26
  end
@@ -9,7 +9,6 @@ module Minke
9
9
  @task_name = args[:task_name]
10
10
  @docker_runner = args[:docker_runner]
11
11
  @task_runner = args[:task_runner]
12
- @error_helper = args[:error_helper]
13
12
  @shell_helper = args[:shell_helper]
14
13
  @logger = args[:logger_helper]
15
14
  @generator_config = args[:generator_config]
@@ -25,6 +24,8 @@ module Minke
25
24
  # run_with_config executes the task steps for the given
26
25
  # - block containing custom actions
27
26
  def run_with_block
27
+ success = true
28
+
28
29
  begin
29
30
  @docker_network.create
30
31
  @consul.start_and_load_data @task_settings.consul_loader unless @task_settings.consul_loader == nil
@@ -33,10 +34,21 @@ module Minke
33
34
  yield if block_given?
34
35
 
35
36
  @task_runner.run_steps(@task_settings.post) unless @task_settings == nil || @task_settings.post == nil
37
+ rescue Exception => e
38
+ @logger.error e.message
39
+ success = false
36
40
  ensure
37
41
  @consul.stop unless @task_settings.consul_loader == nil
38
- @docker_network.remove
42
+ begin
43
+ @docker_network.remove
44
+ rescue Exception => e
45
+ # Trap removing a network as minke may have been called with an existing network and containers
46
+ # may still be attached.
47
+ @logger.error e.message
48
+ end
39
49
  end
50
+
51
+ abort unless success
40
52
  end
41
53
 
42
54
  ##
@@ -58,7 +70,7 @@ module Minke
58
70
  container, success = @docker_runner.create_and_run_container args
59
71
 
60
72
  # throw exception if failed
61
- @error_helper.fatal_error "Unable to run command #{command}" unless success
73
+ raise "Unable to run command #{command}" unless success
62
74
  ensure
63
75
  @docker_runner.delete_container container
64
76
  end
@@ -75,8 +87,11 @@ module Minke
75
87
 
76
88
  if build_file != nil
77
89
  build_image = "#{@config.application_name}-buildimage"
90
+
91
+ @logger.debug "Building image: #{build_image} from file #{build_file}"
78
92
  @docker_runner.build_image build_file, build_image
79
93
  else
94
+ @logger.debug "Pulling image: #{build_image}"
80
95
  @docker_runner.pull_image build_image unless @docker_runner.find_image build_image
81
96
  end
82
97
 
data/lib/minke/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Minke
2
- VERSION = "1.13.5"
2
+ VERSION = "1.13.6"
3
3
  end
data/lib/minke.rb CHANGED
@@ -21,7 +21,6 @@ require 'minke/version'
21
21
  require 'minke/command'
22
22
 
23
23
  require 'minke/helpers/copy'
24
- require 'minke/helpers/error'
25
24
  require 'minke/helpers/rake'
26
25
  require 'minke/helpers/shell'
27
26
 
data/minke.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'guard'
25
25
  spec.add_development_dependency 'guard-rspec'
26
26
  spec.add_development_dependency 'webmock'
27
+ spec.add_development_dependency 'pry'
27
28
 
28
29
  spec.add_runtime_dependency 'sshkey'
29
30
  spec.add_runtime_dependency 'colorize'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minke
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.5
4
+ version: 1.13.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nic Jackson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-28 00:00:00.000000000 Z
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: sshkey
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -239,7 +253,6 @@ files:
239
253
  - lib/minke/generators/register.rb
240
254
  - lib/minke/generators/shell_script.rb
241
255
  - lib/minke/helpers/copy.rb
242
- - lib/minke/helpers/error.rb
243
256
  - lib/minke/helpers/rake.rb
244
257
  - lib/minke/helpers/shell.rb
245
258
  - lib/minke/scripts/minke
@@ -1,12 +0,0 @@
1
- module Minke
2
- module Helpers
3
- class Error
4
- ##
5
- # fatal_error aborts the current execute with the given message
6
- def fatal_error message
7
- abort message.colorize(:red)
8
- end
9
-
10
- end
11
- end
12
- end