minke 1.13.10 → 1.13.11

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: 9d6c70ac5b53ba36744cc09453df044b63bc020a
4
- data.tar.gz: bfb537c17a7a55425ee172aaf36878b29ef9d405
3
+ metadata.gz: d74eb0c6b2a2675a6f5ff698852e20170dedf585
4
+ data.tar.gz: 9045a87f9ab54978fa6073bb8ca15b4c19c42ed1
5
5
  SHA512:
6
- metadata.gz: 46800a54dfffb96517d1d88c4863fa061854ee4d951582305bb808bce14469a638bc42174a860877d0c9144adf851558b1ed6933850ef47cf885abe80a550d70
7
- data.tar.gz: 3253eb9db99d248c24dca0709f19e093de150427f214a0c8b8cba101b7e502d8fa950bf5a81a4200718c0b6c1de5e242de6df34d58f1fd29a0c1f9d1d12fc08f
6
+ metadata.gz: fcf8d0fcf334fbdf375bb13aaaa7b28ffd934117546c1a4487ff07b24e6e403b2987cfd4a8f3706661c99a48969bda44178ce3a317bd8c61644ad1b7862720c9
7
+ data.tar.gz: 1394a7ae594929a9bd294014cf6bbd72f0fc6c5c690108c4ff2b1bef220285f960bbafcd886ad5f2d27cdf9a9fabb628553daa97aa25cf0922e84b2a0d4c5739
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.10;
34
- docker push nicholasjackson/minke:1.13.10;
33
+ docker tag nicholasjackson/minke nicholasjackson/minke:1.13.11;
34
+ docker push nicholasjackson/minke:1.13.11;
35
35
  curl https://hooks.microbadger.com/images/nicholasjackson/minke/tkpohfdrYPE0B0TL5NzLcOap4k0=;
36
36
  fi
data/docker/Gemfile CHANGED
@@ -8,7 +8,7 @@ gem "cucumber"
8
8
  gem "cucumber-rest-api", "= 0.3"
9
9
  gem 'cucumber-api', '~> 0.3'
10
10
 
11
- gem 'minke', "= 1.13.10"
11
+ gem 'minke', "= 1.13.11"
12
12
  gem 'minke-generator-swift', "= 0.4"
13
13
  gem 'minke-generator-netmvc'
14
14
  gem 'minke-generator-go', "= 0.8.5"
data/lib/minke/command.rb CHANGED
@@ -25,7 +25,7 @@ module Minke
25
25
  end
26
26
 
27
27
  task_runner = Minke::Tasks::TaskRunner.new ({
28
- :rake_helper => Minke::Helpers::Rake.new,
28
+ :ruby_helper => Minke::Helpers::Ruby.new,
29
29
  :copy_helper => Minke::Helpers::Copy.new,
30
30
  :service_discovery => Minke::Docker::ServiceDiscovery.new(project_name, Minke::Docker::DockerRunner.new(logger), network_name),
31
31
  :logger_helper => logger
@@ -18,12 +18,23 @@ module Minke
18
18
  # Returns:
19
19
  # public address for the container e.g. 0.0.0.0:8080
20
20
  def public_address_for service_name, private_port
21
- begin
22
- ip = @docker_runner.get_docker_ip_address
23
- container_details = find_container_by_name "/#{@project_name}_#{service_name}_1"
24
- #puts container_details
25
- ports = container_details.first.info['Ports'].select { |p| p['PrivatePort'] == private_port.to_i }.first
26
- rescue Exception => e
21
+ ip = ""
22
+ ports = nil
23
+
24
+ 10.times do
25
+ begin
26
+ ip = @docker_runner.get_docker_ip_address
27
+ container_details = find_container_by_name "/#{@project_name}_#{service_name}_1"
28
+ #puts container_details
29
+ ports = container_details.first.info['Ports'].select { |p|
30
+ p['PrivatePort'] == private_port.to_i
31
+ }.first
32
+ rescue Exception
33
+ sleep(1)
34
+ end
35
+ end
36
+
37
+ if ports == nil || ports['PublicPort'] == nil
27
38
  raise "Unable to find public address for '#{service_name}' on port #{private_port}"
28
39
  end
29
40
 
@@ -39,12 +50,24 @@ module Minke
39
50
  # Returns:
40
51
  # private address for the container e.g. 172.17.0.2:8080
41
52
  def bridge_address_for service_name, private_port
42
- begin
43
- container_details = find_container_by_name "/#{@project_name}_#{service_name}_1"
44
- ip = container_details.first.info['NetworkSettings']['Networks']["#{@docker_network}"]['IPAddress']
45
- rescue
53
+ ip = ""
54
+
55
+ 10.times do
56
+ begin
57
+ container_details = find_container_by_name "/#{@project_name}_#{service_name}_1"
58
+ ip = container_details
59
+ .first
60
+ .info['NetworkSettings']['Networks']["#{@docker_network}"]['IPAddress']
61
+ break
62
+ rescue
63
+ sleep(1)
64
+ end
65
+ end
66
+
67
+ if ip.length < 1
46
68
  raise "Unable to find bridge address for network: #{@docker_network}, container: #{service_name}, port: #{private_port}"
47
69
  end
70
+
48
71
  return "#{ip}:#{private_port}"
49
72
  end
50
73
 
@@ -0,0 +1,21 @@
1
+ module Minke
2
+ module Helpers
3
+ class Ruby
4
+
5
+ def initialize
6
+ load_ruby_files
7
+ end
8
+
9
+ def load_ruby_files
10
+ $LOAD_PATH.unshift Dir.pwd
11
+ Dir[File.join(Dir.pwd, "*.rb")].each {|file| require File.basename(file) }
12
+ end
13
+
14
+ ##
15
+ # invoke a rake task
16
+ def invoke_task(task, logger)
17
+ Minke::Extension.new(logger).send(task)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
- MINKE_VERSION="1.13.10"
2
+ MINKE_VERSION="1.13.11"
3
3
 
4
4
  DOCKER_SOCK="/var/run/docker.sock:/var/run/docker.sock"
5
5
  NEW_UUID=$(base64 /dev/urandom | tr -d '/+' | head -c 32 | tr '[:upper:]' '[:lower:]')
@@ -16,8 +16,10 @@ GEM_VOLUMES=""
16
16
  if [[ $1 != \generate* ]]; then
17
17
  # Test if we need to mount any special volumes for paths specified in the Gemfile
18
18
  while read -r line; do
19
- l=$(echo $line | sed "s/.*:path *=> *//" | sed "s/['|\"]\(.*\)['|\"]/\1/")
20
- GEM_VOLUMES="${GEM_VOLUMES} -v $l:$l"
19
+ if [[ $line != \#* ]]; then
20
+ l=$(echo $line | sed "s/.*:path *=> *//" | sed "s/['|\"]\(.*\)['|\"]/\1/")
21
+ GEM_VOLUMES="${GEM_VOLUMES} -v $l:$l"
22
+ fi
21
23
  done < <(grep :path Gemfile)
22
24
 
23
25
  DIR=$(dirname `pwd`)
@@ -9,18 +9,20 @@ module Minke
9
9
  compose_file = File.expand_path(compose_file)
10
10
  compose = @docker_compose_factory.create compose_file unless compose_file == nil
11
11
 
12
- run_with_block do
12
+ run_with_block do |pre_func, post_func|
13
13
  status = false
14
14
  begin
15
15
  compose.up
16
+ pre_func.call
17
+
16
18
  server_address = @service_discovery.build_address(@task_settings.health_check)
17
19
  @health_check.wait_for_HTTPOK(server_address) unless @task_settings.health_check == nil
18
-
19
20
  @shell_helper.execute "cucumber --color -f pretty #{get_features args}"
20
21
  rescue Exception => e
21
22
  raise ("Cucumber steps failed: #{e.message}") unless status == true
22
23
  ensure
23
24
  compose.down
25
+ post_func.call
24
26
  end
25
27
  end
26
28
  end
@@ -9,15 +9,17 @@ module Minke
9
9
  compose_file = File.expand_path(compose_file)
10
10
  compose = @docker_compose_factory.create compose_file unless compose_file == nil
11
11
 
12
- run_with_block do
12
+ run_with_block do |pre_func, post_func|
13
13
  begin
14
14
  compose.up
15
+ pre_func.call
15
16
  compose.logs
16
17
  rescue SystemExit, Interrupt
17
18
  @logger.info "Stopping...."
18
19
  raise SystemExit
19
20
  ensure
20
21
  compose.down
22
+ post_func.call
21
23
  end
22
24
  end
23
25
  end
@@ -29,11 +29,21 @@ module Minke
29
29
  begin
30
30
  @docker_network.create
31
31
  @consul.start_and_load_data @task_settings.consul_loader unless @task_settings.consul_loader == nil
32
- @task_runner.run_steps(@task_settings.pre) unless @task_settings == nil || @task_settings.pre == nil
33
-
34
- yield if block_given?
32
+
33
+ pre_func = -> {
34
+ @task_runner.run_steps(@task_settings.pre) unless @task_settings == nil || @task_settings.pre == nil
35
+ }
35
36
 
36
- @task_runner.run_steps(@task_settings.post) unless @task_settings == nil || @task_settings.post == nil
37
+ post_func = -> {
38
+ @task_runner.run_steps(@task_settings.post) unless @task_settings == nil || @task_settings.post == nil
39
+ }
40
+
41
+ if block_given?
42
+ yield(pre_func, post_func)
43
+ else
44
+ pre_func.call
45
+ post_func.call
46
+ end
37
47
  rescue Exception => e
38
48
  @logger.error e.message
39
49
  success = false
@@ -3,7 +3,7 @@ module Minke
3
3
  class TaskRunner
4
4
 
5
5
  def initialize args
6
- @rake_helper = args[:rake_helper]
6
+ @ruby_helper = args[:ruby_helper]
7
7
  @copy_helper = args[:copy_helper]
8
8
  @service_discovery = args[:service_discovery]
9
9
  @logger = args[:logger_helper]
@@ -12,15 +12,18 @@ module Minke
12
12
  ##
13
13
  # execute the defined steps in the given Minke::Config::TaskRunSettings
14
14
  def run_steps steps
15
- execute_rake_tasks steps.tasks unless steps.tasks == nil
15
+ execute_ruby_tasks steps.tasks unless steps.tasks == nil
16
16
  copy_assets steps.copy unless steps.copy == nil
17
17
  end
18
18
 
19
19
  private
20
20
  ##
21
21
  # execute an array of rake tasks
22
- def execute_rake_tasks tasks
23
- tasks.each { |t| @rake_helper.invoke_task t }
22
+ def execute_ruby_tasks tasks
23
+ tasks.each { |t|
24
+ @logger.debug "Executing task: #{t}"
25
+ @ruby_helper.invoke_task(t, @logger)
26
+ }
24
27
  end
25
28
 
26
29
  ##
data/lib/minke/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Minke
2
- VERSION = "1.13.10"
2
+ VERSION = "1.13.11"
3
3
  end
data/lib/minke.rb CHANGED
@@ -22,7 +22,7 @@ require 'minke/command'
22
22
  require 'minke/logger'
23
23
 
24
24
  require 'minke/helpers/copy'
25
- require 'minke/helpers/rake'
25
+ require 'minke/helpers/ruby'
26
26
  require 'minke/helpers/shell'
27
27
 
28
28
  require 'minke/docker/docker_compose'
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.10
4
+ version: 1.13.11
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-10-07 00:00:00.000000000 Z
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -254,7 +254,7 @@ files:
254
254
  - lib/minke/generators/register.rb
255
255
  - lib/minke/generators/shell_script.rb
256
256
  - lib/minke/helpers/copy.rb
257
- - lib/minke/helpers/rake.rb
257
+ - lib/minke/helpers/ruby.rb
258
258
  - lib/minke/helpers/shell.rb
259
259
  - lib/minke/logger.rb
260
260
  - lib/minke/scripts/minke
@@ -1,11 +0,0 @@
1
- module Minke
2
- module Helpers
3
- class Rake
4
- ##
5
- # invoke a rake task
6
- def invoke_task task
7
- Rake::Task[task].invoke
8
- end
9
- end
10
- end
11
- end