vidar 1.5.3 → 1.6.0

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: '0285b9b472201e5b27b1f212e11e131216730a58324e814e8d6683576572f545'
4
- data.tar.gz: 1193d600fd742c6dd97b54e0449dea7d62d92ba356c4e4fceab8cb50b479edbe
3
+ metadata.gz: 24308079faca44676b4766b065eea95db5bbb05634f4a26f289e140ce9fdd3ab
4
+ data.tar.gz: 33450f66da00a4eee7ee189ced7e6f17db5833ac8a1ae67d1e8e32f0f2a5a25f
5
5
  SHA512:
6
- metadata.gz: cfca6ad6fa6cb6f4a99b197f4a1b56e8ee6ca456e768849d76b431c958330cd0c2e2463495101f4bc71d1337ff958ba4cb55dd47aba2b761e1873c2c513d8380
7
- data.tar.gz: 293becab50473d6d600d6ae36e2374db88c839798cbc51ae6fed100780f1f8717f7bb442c18742a6840f115ecff5c0b7d87a027928f1be16c4a4223b19f362a3
6
+ metadata.gz: 6c581da30ad838b41f2279cb67b7fe5067e072a4819ac4c411337e424b37c2d4780fab3eb347539841c4c49206e8842b9348bf72135e6ca507db670da628d83a
7
+ data.tar.gz: 1b5890bce77fad3dc35ef4832e485971f7341884a1268589ab02af4361cf9acda87ec8c36bcb4b90d3e3d9034f206c158bf6a1eb37d16058c6824bec73c66798
data/.bundler-version CHANGED
@@ -1 +1 @@
1
- 2.3.22
1
+ 2.3.26
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vidar (1.5.3)
4
+ vidar (1.6.0)
5
5
  colorize
6
6
  faraday
7
7
  thor (~> 1.0)
@@ -18,15 +18,15 @@ GEM
18
18
  crack (0.4.5)
19
19
  rexml
20
20
  diff-lcs (1.5.0)
21
- faraday (2.5.2)
21
+ faraday (2.7.1)
22
22
  faraday-net_http (>= 2.0, < 3.1)
23
23
  ruby2_keywords (>= 0.0.4)
24
- faraday-net_http (3.0.0)
24
+ faraday-net_http (3.0.2)
25
25
  hashdiff (1.0.1)
26
- json (2.6.2)
26
+ json (2.6.3)
27
27
  method_source (1.0.0)
28
28
  parallel (1.22.1)
29
- parser (3.1.2.1)
29
+ parser (3.1.3.0)
30
30
  ast (~> 2.4.1)
31
31
  pry (0.14.1)
32
32
  coderay (~> 1.1)
@@ -34,36 +34,36 @@ GEM
34
34
  public_suffix (5.0.0)
35
35
  rainbow (3.1.1)
36
36
  rake (13.0.6)
37
- regexp_parser (2.5.0)
37
+ regexp_parser (2.6.1)
38
38
  rexml (3.2.5)
39
- rspec (3.11.0)
40
- rspec-core (~> 3.11.0)
41
- rspec-expectations (~> 3.11.0)
42
- rspec-mocks (~> 3.11.0)
43
- rspec-core (3.11.0)
44
- rspec-support (~> 3.11.0)
45
- rspec-expectations (3.11.1)
39
+ rspec (3.12.0)
40
+ rspec-core (~> 3.12.0)
41
+ rspec-expectations (~> 3.12.0)
42
+ rspec-mocks (~> 3.12.0)
43
+ rspec-core (3.12.0)
44
+ rspec-support (~> 3.12.0)
45
+ rspec-expectations (3.12.0)
46
46
  diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.11.0)
48
- rspec-mocks (3.11.1)
47
+ rspec-support (~> 3.12.0)
48
+ rspec-mocks (3.12.0)
49
49
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.11.0)
51
- rspec-support (3.11.1)
52
- rubocop (1.36.0)
50
+ rspec-support (~> 3.12.0)
51
+ rspec-support (3.12.0)
52
+ rubocop (1.39.0)
53
53
  json (~> 2.3)
54
54
  parallel (~> 1.10)
55
55
  parser (>= 3.1.2.1)
56
56
  rainbow (>= 2.2.2, < 4.0)
57
57
  regexp_parser (>= 1.8, < 3.0)
58
58
  rexml (>= 3.2.5, < 4.0)
59
- rubocop-ast (>= 1.20.1, < 2.0)
59
+ rubocop-ast (>= 1.23.0, < 2.0)
60
60
  ruby-progressbar (~> 1.7)
61
61
  unicode-display_width (>= 1.4.0, < 3.0)
62
- rubocop-ast (1.21.0)
62
+ rubocop-ast (1.24.0)
63
63
  parser (>= 3.1.1.0)
64
64
  rubocop-rake (0.6.0)
65
65
  rubocop (~> 1.0)
66
- rubocop-rspec (2.13.1)
66
+ rubocop-rspec (2.15.0)
67
67
  rubocop (~> 1.33)
68
68
  ruby-progressbar (1.11.0)
69
69
  ruby2_keywords (0.0.5)
@@ -90,4 +90,4 @@ DEPENDENCIES
90
90
  webmock
91
91
 
92
92
  BUNDLED WITH
93
- 2.3.22
93
+ 2.3.26
data/lib/vidar/cli.rb CHANGED
@@ -66,6 +66,9 @@ module Vidar
66
66
  desc "deploy", "Perform k8s deployment with deploy hook"
67
67
  method_option :revision, required: false
68
68
  method_option :kubectl_context, required: false
69
+ method_option :destination, required: false, default: "deployments,cronjobs"
70
+ method_option :container, required: false, default: "*"
71
+ method_option :all, required: false, type: :boolean, default: true
69
72
  def deploy
70
73
  revision = options[:revision] || Config.get!(:revision)
71
74
  kubectl_context = options[:kubectl_context] || Config.get!(:kubectl_context)
@@ -74,6 +77,8 @@ module Vidar
74
77
  Log.info "Looking for deploy hook..."
75
78
  template_name, error, status = Open3.capture3 "kubectl get cronjob deploy-hook-template -n #{Config.get!(:namespace)} -o name --ignore-not-found=true"
76
79
 
80
+ slack_notification = SlackNotification.get
81
+
77
82
  if status.success?
78
83
  if template_name.to_s.empty?
79
84
  Log.info "No deploy hook found"
@@ -90,16 +95,21 @@ module Vidar
90
95
  unless deploy_status.success?
91
96
  Run.kubectl "describe job deploy-hook"
92
97
  Log.error "Error running deploy hook template"
98
+ slack_notification.failure if slack_notification.configured?
93
99
  exit(1)
94
100
  end
95
101
  end
96
102
  else
97
103
  Log.info "Error getting deploy hook template: #{error}"
104
+ slack_notification.failure if slack_notification.configured?
98
105
  exit(1)
99
106
  end
100
107
 
101
- Log.info "Set kubectl image..."
102
- Run.kubectl "set image deployments,cronjobs *=#{Config.get!(:image)}:#{revision} --all"
108
+ destination = options[:destination]
109
+ container = options[:container]
110
+ all = options[:all]
111
+ Log.info "Set kubectl image for #{all ? 'all ' : ''}#{destination} container=#{container}..."
112
+ Run.kubectl "set image #{destination} #{container}=#{Config.get!(:image)}:#{revision} #{all ? '--all' : ''}"
103
113
  end
104
114
 
105
115
  desc "release", "Build and publish docker images"
@@ -116,13 +126,7 @@ module Vidar
116
126
  Log.info "Current kubectl context: #{Config.get!(:kubectl_context)}"
117
127
  Log.info "Checking if all containers in #{Config.get!(:namespace)} namespace(s) are ready..."
118
128
 
119
- slack_notification = SlackNotification.new(
120
- github: Config.get!(:github),
121
- revision: Config.get!(:revision),
122
- revision_name: Config.get!(:revision_name),
123
- build_url: Config.build_url,
124
- deploy_config: Config.deploy_config
125
- )
129
+ slack_notification = SlackNotification.get
126
130
 
127
131
  deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace))
128
132
 
@@ -1,5 +1,15 @@
1
1
  module Vidar
2
2
  class SlackNotification
3
+ def self.get
4
+ new(
5
+ github: Config.get!(:github),
6
+ revision: Config.get!(:revision),
7
+ revision_name: Config.get!(:revision_name),
8
+ build_url: Config.build_url,
9
+ deploy_config: Config.deploy_config
10
+ )
11
+ end
12
+
3
13
  def initialize(github:, revision:, revision_name:, deploy_config:, build_url: nil, connection: Faraday.new)
4
14
  @github = github
5
15
  @revision = revision
data/lib/vidar/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vidar
2
- VERSION = '1.5.3'.freeze
2
+ VERSION = '1.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-09-21 00:00:00.000000000 Z
12
+ date: 2022-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  - !ruby/object:Gem::Version
244
244
  version: '0'
245
245
  requirements: []
246
- rubygems_version: 3.3.7
246
+ rubygems_version: 3.3.26
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: K8s deployment tools based on thor