vidar 1.10.0 → 1.12.0

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: 837a79fe42926308748fbfeb816fdfd9b65bc4f13baefb499cbca936ac668f8f
4
- data.tar.gz: 9bd7ba8776bb814eef39e909464ddf91027cb2c4f9b4b9caea04a247e17aa6cd
3
+ metadata.gz: 0e21235eabc301414c37258a2b10f6ab8a52a515309b245ae4e5bca95613e8a0
4
+ data.tar.gz: ee14da413b9ccda05ef4dba37d2acc2ad086551a6c49e69169926fd9f5064ab7
5
5
  SHA512:
6
- metadata.gz: 153146b937497d0d0f2496f18aa4da97d4437e244a1e68018740366539f20f6543921de10012aa8fb3774251a174be235b10b9e22e83a224cb2ca01b2942449e
7
- data.tar.gz: 670e654205cd66abb504d3bcf6cd928a6f3fc7c7ff90f2493b865b075097c47ac5fc94f3af5fd7c4361f9cb8ebad83701dd5f5cff7c6a8d2c5ca70e130dd3802
6
+ metadata.gz: 052e082e128802d77780433250917a3453480cad166f9286543fb263e4786b23c11bc2e6c3d8680ffbed55857c9e23c57cb844b60af04df0345f5cf45a8f9a3f
7
+ data.tar.gz: 8e4539f0e20827d8ec3363c6b49bea3b2c2530c261e4605ddc38b91df048fef27c3bf0962bf4100babad1f2e669336d95e3f7da4142e1dda34cf5b4672bceb25
data/.bundler-version CHANGED
@@ -1 +1 @@
1
- 2.5.6
1
+ 2.5.16
@@ -0,0 +1,15 @@
1
+ version: 2
2
+
3
+ updates:
4
+ - package-ecosystem: "bundler"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "weekly"
8
+ day: "monday"
9
+ time: "08:00"
10
+ timezone: "UTC"
11
+ commit-message:
12
+ prefix: "[dependabot]"
13
+ labels:
14
+ - "automerge"
15
+ - "dependencies"
@@ -1,8 +1,9 @@
1
1
  name: Auto approve dependency upgrades and hot-fix PRs
2
2
  on:
3
3
  pull_request_target:
4
- types: [labeled, unlabeled, edited, ready_for_review, review_requested, auto_merge_enabled]
5
-
4
+ types:
5
+ - labeled
6
+ - ready_for_review
6
7
  jobs:
7
8
  auto-approve:
8
9
  runs-on: ubuntu-latest
@@ -6,9 +6,6 @@ on:
6
6
  check_suite:
7
7
  types:
8
8
  - completed
9
- label:
10
- types:
11
- - created
12
9
  status: {}
13
10
  jobs:
14
11
  automerge:
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: [3.1, 3.2]
14
+ ruby-version: [3.2, 3.3]
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.11.0 - 2024-06-04
4
+
5
+ Add set_image command.
6
+
7
+ ## 1.10.0 - 2024-02-29
8
+
9
+ Drop ruby 3.0 support and add 3.3 support.
10
+
3
11
  ## 1.9.2 - 2023-12-11
4
12
 
5
13
  Improves and simplifies how docker layers are cached and used. Adds `build_and_cache_base` command.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vidar (1.10.0)
4
+ vidar (1.12.0)
5
5
  colorize
6
6
  faraday
7
7
  thor (~> 1.0)
@@ -9,83 +9,79 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- addressable (2.8.6)
13
- public_suffix (>= 2.0.2, < 6.0)
12
+ addressable (2.8.7)
13
+ public_suffix (>= 2.0.2, < 7.0)
14
14
  ast (2.4.2)
15
15
  awesome_print (1.9.2)
16
- bigdecimal (3.1.6)
16
+ bigdecimal (3.1.8)
17
17
  coderay (1.1.3)
18
18
  colorize (1.1.0)
19
19
  crack (1.0.0)
20
20
  bigdecimal
21
21
  rexml
22
22
  diff-lcs (1.5.1)
23
- faraday (2.9.0)
23
+ faraday (2.10.0)
24
24
  faraday-net_http (>= 2.0, < 3.2)
25
+ logger
25
26
  faraday-net_http (3.1.0)
26
27
  net-http
27
28
  hashdiff (1.1.0)
28
- json (2.7.1)
29
+ json (2.7.2)
29
30
  language_server-protocol (3.17.0.3)
30
- method_source (1.0.0)
31
+ logger (1.6.0)
32
+ method_source (1.1.0)
31
33
  net-http (0.4.1)
32
34
  uri
33
- parallel (1.24.0)
34
- parser (3.3.0.5)
35
+ parallel (1.25.1)
36
+ parser (3.3.4.0)
35
37
  ast (~> 2.4.1)
36
38
  racc
37
- prism (0.24.0)
38
39
  pry (0.14.2)
39
40
  coderay (~> 1.1)
40
41
  method_source (~> 1.0)
41
- public_suffix (5.0.4)
42
- racc (1.7.3)
42
+ public_suffix (6.0.0)
43
+ racc (1.8.0)
43
44
  rainbow (3.1.1)
44
- rake (13.1.0)
45
- regexp_parser (2.9.0)
46
- rexml (3.2.6)
45
+ rake (13.2.1)
46
+ regexp_parser (2.9.2)
47
+ rexml (3.3.2)
48
+ strscan
47
49
  rspec (3.13.0)
48
50
  rspec-core (~> 3.13.0)
49
51
  rspec-expectations (~> 3.13.0)
50
52
  rspec-mocks (~> 3.13.0)
51
53
  rspec-core (3.13.0)
52
54
  rspec-support (~> 3.13.0)
53
- rspec-expectations (3.13.0)
55
+ rspec-expectations (3.13.1)
54
56
  diff-lcs (>= 1.2.0, < 2.0)
55
57
  rspec-support (~> 3.13.0)
56
- rspec-mocks (3.13.0)
58
+ rspec-mocks (3.13.1)
57
59
  diff-lcs (>= 1.2.0, < 2.0)
58
60
  rspec-support (~> 3.13.0)
59
61
  rspec-support (3.13.1)
60
- rubocop (1.61.0)
62
+ rubocop (1.65.0)
61
63
  json (~> 2.3)
62
64
  language_server-protocol (>= 3.17.0)
63
65
  parallel (~> 1.10)
64
66
  parser (>= 3.3.0.2)
65
67
  rainbow (>= 2.2.2, < 4.0)
66
- regexp_parser (>= 1.8, < 3.0)
68
+ regexp_parser (>= 2.4, < 3.0)
67
69
  rexml (>= 3.2.5, < 4.0)
68
- rubocop-ast (>= 1.30.0, < 2.0)
70
+ rubocop-ast (>= 1.31.1, < 2.0)
69
71
  ruby-progressbar (~> 1.7)
70
72
  unicode-display_width (>= 2.4.0, < 3.0)
71
- rubocop-ast (1.31.0)
72
- parser (>= 3.3.0.4)
73
- prism (>= 0.24.0)
74
- rubocop-capybara (2.20.0)
75
- rubocop (~> 1.41)
76
- rubocop-factory_bot (2.25.1)
77
- rubocop (~> 1.41)
73
+ rubocop-ast (1.31.3)
74
+ parser (>= 3.3.1.0)
78
75
  rubocop-rake (0.6.0)
79
76
  rubocop (~> 1.0)
80
- rubocop-rspec (2.26.1)
81
- rubocop (~> 1.40)
82
- rubocop-capybara (~> 2.17)
83
- rubocop-factory_bot (~> 2.22)
77
+ rubocop-rspec (3.0.3)
78
+ rubocop (~> 1.61)
84
79
  ruby-progressbar (1.13.0)
80
+ strscan (3.1.0)
85
81
  thor (1.3.1)
86
82
  unicode-display_width (2.5.0)
87
83
  uri (0.13.0)
88
- webmock (3.23.0)
84
+ webmock (3.23.1)
89
85
  addressable (>= 2.8.0)
90
86
  crack (>= 0.3.2)
91
87
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -106,4 +102,4 @@ DEPENDENCIES
106
102
  webmock
107
103
 
108
104
  BUNDLED WITH
109
- 2.5.6
105
+ 2.5.16
data/lib/vidar/cli.rb CHANGED
@@ -89,9 +89,11 @@ module Vidar
89
89
  method_option :destination, required: false, default: "deployments,cronjobs"
90
90
  method_option :container, required: false, default: "*"
91
91
  method_option :all, required: false, type: :boolean, default: true
92
+ method_option :max_tries, required: false, default: "30"
92
93
  def deploy
93
94
  revision = options[:revision] || Config.get!(:revision)
94
95
  kubectl_context = options[:kubectl_context] || Config.get!(:kubectl_context)
96
+ max_tries = options[:max_tries].to_i
95
97
  Log.info "Current kubectl context: #{kubectl_context}"
96
98
 
97
99
  Log.info "Looking for deploy hook..."
@@ -104,14 +106,7 @@ module Vidar
104
106
  if template_name.to_s.empty?
105
107
  Log.info "No deploy hook found"
106
108
  else
107
- Log.info "Executing deploy hook #{template_name.strip!}..."
108
- Run.kubectl "delete job deploy-hook --ignore-not-found=true"
109
- Run.kubectl "set image cronjobs/deploy-hook-template deploy-hook-template=#{Config.get!(:image)}:#{revision} --all"
110
- Run.kubectl "create job deploy-hook --from=#{template_name}"
111
-
112
- deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace), filter: "deploy-hook")
113
- deploy_status.wait_until_up
114
- deploy_status.wait_until_completed
109
+ deploy_status = run_deploy_hook(template_name:, revision:, max_tries:)
115
110
 
116
111
  unless deploy_status.success?
117
112
  Run.kubectl "describe job deploy-hook"
@@ -135,6 +130,24 @@ module Vidar
135
130
  Run.kubectl "set image #{destination} #{container}=#{Config.get!(:image)}:#{revision} #{all ? '--all' : ''}"
136
131
  end
137
132
 
133
+ desc "set_image", "Set image for k8s deployment"
134
+ method_option :revision, required: false
135
+ method_option :kubectl_context, required: false
136
+ method_option :destination, required: false, default: "deployments,cronjobs"
137
+ method_option :container, required: false, default: "*"
138
+ method_option :all, required: false, type: :boolean, default: true
139
+ def set_image
140
+ revision = options[:revision] || Config.get!(:revision)
141
+ kubectl_context = options[:kubectl_context] || Config.get!(:kubectl_context)
142
+ Log.info "Current kubectl context: #{kubectl_context}"
143
+
144
+ destination = options[:destination]
145
+ container = options[:container]
146
+ all = options[:all]
147
+ Log.info "Set kubectl image for #{all ? 'all ' : ''}#{destination} container=#{container}..."
148
+ Run.kubectl "set image #{destination} #{container}=#{Config.get!(:image)}:#{revision} #{all ? '--all' : ''}"
149
+ end
150
+
138
151
  desc "release", "Build and publish docker images"
139
152
  def release
140
153
  Log.info "Build and release #{Config.get!(:image)}:#{Config.get!(:revision)}"
@@ -145,14 +158,17 @@ module Vidar
145
158
  end
146
159
 
147
160
  desc "monitor_deploy_status", "Check is deployment has finished and sends post-deploy notification"
161
+ method_option :max_tries, required: false, default: "30"
148
162
  def monitor_deploy_status
163
+ max_tries = options[:max_tries].to_i
164
+
149
165
  Log.info "Current kubectl context: #{Config.get!(:kubectl_context)}"
150
- Log.info "Checking if all containers in #{Config.get!(:namespace)} namespace(s) are ready..."
166
+ Log.info "Checking if all containers in #{Config.get!(:namespace)} namespace(s) are ready (#{max_tries} tries)..."
151
167
 
152
168
  slack_notification = SlackNotification.get
153
169
  honeycomb_notification = HoneycombNotification.get
154
170
 
155
- deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace))
171
+ deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace), max_tries:)
156
172
 
157
173
  deploy_status.wait_until_completed
158
174
 
@@ -239,5 +255,19 @@ module Vidar
239
255
 
240
256
  slack_notification.deliver(message: options[:message]) if slack_notification.configured?
241
257
  end
258
+
259
+ private
260
+
261
+ def run_deploy_hook(template_name:, revision:, max_tries:)
262
+ Log.info "Executing deploy hook #{template_name.strip!} (#{max_tries} tries)..."
263
+ Run.kubectl "delete job deploy-hook --ignore-not-found=true"
264
+ Run.kubectl "set image cronjobs/deploy-hook-template deploy-hook-template=#{Config.get!(:image)}:#{revision} --all"
265
+ Run.kubectl "create job deploy-hook --from=#{template_name}"
266
+
267
+ deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace), filter: "deploy-hook", max_tries:)
268
+ deploy_status.wait_until_up
269
+ deploy_status.wait_until_completed
270
+ deploy_status
271
+ end
242
272
  end
243
273
  end
data/lib/vidar/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vidar
2
- VERSION = '1.10.0'.freeze
2
+ VERSION = '1.12.0'.freeze
3
3
  end
data/vidar.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata['changelog_uri'] = 'https://github.com/RenoFi/vidar/blob/master/CHANGELOG.md'
18
18
  spec.metadata['rubygems_mfa_required'] = 'true'
19
19
 
20
- spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
20
+ spec.required_ruby_version = Gem::Requirement.new('>= 3.2.0')
21
21
 
22
22
  spec.files = Dir.chdir(__dir__) do
23
23
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin/|spec/|\.rub)}) }
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.10.0
4
+ version: 1.12.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: 2024-02-29 00:00:00.000000000 Z
12
+ date: 2024-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -68,8 +68,8 @@ files:
68
68
  - ".github/ISSUE_TEMPLATE/config.yml"
69
69
  - ".github/ISSUE_TEMPLATE/story.md"
70
70
  - ".github/PULL_REQUEST_TEMPLATE.md"
71
+ - ".github/dependabot.yml"
71
72
  - ".github/workflows/auto-approve.yml"
72
- - ".github/workflows/auto-merge-dependencies.yml"
73
73
  - ".github/workflows/auto-merge.yml"
74
74
  - ".github/workflows/ci.yml"
75
75
  - ".gitignore"
@@ -112,14 +112,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - ">="
114
114
  - !ruby/object:Gem::Version
115
- version: 3.1.0
115
+ version: 3.2.0
116
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  requirements:
118
118
  - - ">="
119
119
  - !ruby/object:Gem::Version
120
120
  version: '0'
121
121
  requirements: []
122
- rubygems_version: 3.5.3
122
+ rubygems_version: 3.5.16
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: K8s deployment tools based on thor
@@ -1,24 +0,0 @@
1
- name: automerge-dependencies
2
- on:
3
- pull_request_review:
4
- types:
5
- - submitted
6
- check_suite:
7
- types:
8
- - completed
9
- label:
10
- types:
11
- - created
12
- status: {}
13
- jobs:
14
- automerge:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - name: automerge-dependencies
18
- uses: pascalgn/automerge-action@v0.16.2
19
- env:
20
- GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
21
- MERGE_METHOD: squash
22
- MERGE_DELETE_BRANCH: true
23
- MERGE_LABELS: "dependencies,!automerge blocked"
24
- MERGE_REMOVE_LABELS: ""