dry-stack 0.1.41 → 0.1.43

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: e50bf1ab7cc3dcf9c8fd85551c44a62708465e2fd009be5d3827dbc4963a95b3
4
- data.tar.gz: '09f8c06441be98dfd8e3f5a81ad6e21554f4413b8bd5f7e3fa75e2595a832f3a'
3
+ metadata.gz: 5ee28483702d068eb62990c00e7447bb99d0350ccc78600b485e986829df2a82
4
+ data.tar.gz: c0d912f9aced3405fc8bfb517283b6ec6092d3fa037be7db03366bffead6a0dc
5
5
  SHA512:
6
- metadata.gz: c7e4fbe865fd9dc1a9e6a35d87d248b3e7a4c709589af2279fc53364abf367582e78ad584415a78140c5755323422493075f577afc7718eaca1a9a16d3d5fb90
7
- data.tar.gz: 3cd726f77074ccfd626acf83d9a3abb9e3c4578a955925d24ce7269e9a08f1ce7dadb367b729cf7749ed3a2759839e0b70a0ba6d2b31bb52719a4c0206f8d2ff
6
+ metadata.gz: fa739cf6cab7b0e38726b82b36aa4b1e660cdea1dc5b2406d0992489f92f242fa17a4fbf597d953d67c7d97d3a9f5d2599733a05492713ef59554897af857392
7
+ data.tar.gz: fbf16fac58fead0736b3eaf7a22d5b52327f214064498be2097662d96f6e7fcc2b0224100ab53763456fe1392c0b033767c7d032b52bb27f9b370bf4e3a8eb30
@@ -1,4 +1,6 @@
1
1
  require_relative 'command_line'
2
+ require 'net/http'
3
+ require 'uri'
2
4
 
3
5
  Dry::CommandLine::COMMANDS[:swarm_deploy] = Class.new do
4
6
  def options(parser)
@@ -56,8 +58,8 @@ Dry::CommandLine::COMMANDS[:swarm_deploy] = Class.new do
56
58
  exec_i "docker --context #{name} config create #{stack.name}_readme -", stack.description
57
59
  deploy_status = 'deployed'
58
60
  ensure
59
- if ENV['DEPLOY_REGISTRY'] || ENV['CI_DEPLOY_REGISTRY']
60
- deploy_registry = ENV['DEPLOY_REGISTRY'] || ENV['CI_DEPLOY_REGISTRY']
61
+ if ENV['CI_DEPLOY_REGISTRY']
62
+ deploy_registry = ENV['CI_DEPLOY_REGISTRY']
61
63
  puts "Sending deploy status to #{deploy_registry}"
62
64
  data = {
63
65
  deploy_host: endpoint,
@@ -67,8 +69,20 @@ Dry::CommandLine::COMMANDS[:swarm_deploy] = Class.new do
67
69
  deploy_status:,
68
70
  stack: YAML.load(yaml, aliases: true)
69
71
  }
70
- exec_i "curl -s -X POST #{deploy_registry}/api/v1/swarm_deploy -H 'Content-Type: application/json' -d @-", data.to_json do |return_value, std_out, std_err|
71
- puts "POST Return value: #{return_value}"
72
+
73
+ begin
74
+ uri = URI("#{deploy_registry}/api/v1/swarm_deploy")
75
+ http = Net::HTTP.new(uri.host, uri.port)
76
+ http.use_ssl = uri.scheme == 'https'
77
+
78
+ request = Net::HTTP::Post.new(uri)
79
+ request['Content-Type'] = 'application/json'
80
+ request.body = data.to_json
81
+
82
+ response = http.request(request)
83
+ puts "POST Return value: #{response.code}"
84
+ rescue => e
85
+ puts "Error: #{e.message}"
72
86
  end
73
87
  end
74
88
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  class Stack
3
- VERSION = '0.1.41'
3
+ VERSION = '0.1.43'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.41
4
+ version: 0.1.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B