vidar 1.5.4 → 1.7.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 +4 -4
- data/.bundler-version +1 -1
- data/.dependabot/config.yml +3 -0
- data/.github/workflows/auto-merge-dependencies.yml +24 -0
- data/.github/workflows/auto-merge.yml +4 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +19 -16
- data/README.md +4 -0
- data/lib/vidar/cli.rb +19 -2
- data/lib/vidar/config.rb +1 -0
- data/lib/vidar/deploy_config.rb +2 -1
- data/lib/vidar/honeycomb_notification.rb +87 -0
- data/lib/vidar/version.rb +1 -1
- data/lib/vidar.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eb2df292256761c82b4c0faab70db10cb3fcf9f6b28a3777ba5843cb9949deea
|
|
4
|
+
data.tar.gz: eed9221ba5e8418ecc518b7c2168a469235bc383949c32d09e23f0ff3086a5b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d949b5d18bafd71eed2722831c68b5bae941cf1e7fb62f8f5cb8c7b3a2e8c99ed54893a2982eecaf61857b984f772f5b40a1682504d538f1d97dafa9ac06b47
|
|
7
|
+
data.tar.gz: 1ed526fadb5d7780c1fdeaf6847793a7265329d1a29944a7a430245a0adcbd32efc33e15ef24f6f336fa8eec7cb1106bdea9d5e2e827a756788a3a7e2c518981
|
data/.bundler-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.4.4
|
data/.dependabot/config.yml
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
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.14.3
|
|
19
|
+
env:
|
|
20
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
21
|
+
MERGE_METHOD: squash
|
|
22
|
+
MERGE_DELETE_BRANCH: true
|
|
23
|
+
MERGE_LABELS: dependencies
|
|
24
|
+
MERGE_REMOVE_LABELS: ""
|
|
@@ -6,13 +6,16 @@ on:
|
|
|
6
6
|
check_suite:
|
|
7
7
|
types:
|
|
8
8
|
- completed
|
|
9
|
+
label:
|
|
10
|
+
types:
|
|
11
|
+
- created
|
|
9
12
|
status: {}
|
|
10
13
|
jobs:
|
|
11
14
|
automerge:
|
|
12
15
|
runs-on: ubuntu-latest
|
|
13
16
|
steps:
|
|
14
17
|
- name: automerge
|
|
15
|
-
uses:
|
|
18
|
+
uses: pascalgn/automerge-action@v0.14.3
|
|
16
19
|
env:
|
|
17
20
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
18
21
|
MERGE_METHOD: squash
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 1.7.0 - 2023-01-23
|
|
4
|
+
|
|
5
|
+
Add support for publishing Honeycomb markers on deployment.
|
|
6
|
+
|
|
7
|
+
## 1.6.0 - 2022-12-07
|
|
8
|
+
|
|
9
|
+
Allow more complex deployments. By passing extra options to the deployment command, we allow deployments where there are multiple containers per pod or where there is more than just deployments/cronjobs (like deamonsets or something similar).
|
|
10
|
+
|
|
3
11
|
## 1.5.3 - 2022-09-20
|
|
4
12
|
|
|
5
13
|
- fix determining deploy hook status (issue introduced in 1.5.2)
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
vidar (1.
|
|
4
|
+
vidar (1.7.0)
|
|
5
5
|
colorize
|
|
6
6
|
faraday
|
|
7
7
|
thor (~> 1.0)
|
|
@@ -18,20 +18,20 @@ GEM
|
|
|
18
18
|
crack (0.4.5)
|
|
19
19
|
rexml
|
|
20
20
|
diff-lcs (1.5.0)
|
|
21
|
-
faraday (2.7.
|
|
21
|
+
faraday (2.7.4)
|
|
22
22
|
faraday-net_http (>= 2.0, < 3.1)
|
|
23
23
|
ruby2_keywords (>= 0.0.4)
|
|
24
24
|
faraday-net_http (3.0.2)
|
|
25
25
|
hashdiff (1.0.1)
|
|
26
|
-
json (2.6.
|
|
26
|
+
json (2.6.3)
|
|
27
27
|
method_source (1.0.0)
|
|
28
28
|
parallel (1.22.1)
|
|
29
|
-
parser (3.
|
|
29
|
+
parser (3.2.0.0)
|
|
30
30
|
ast (~> 2.4.1)
|
|
31
|
-
pry (0.14.
|
|
31
|
+
pry (0.14.2)
|
|
32
32
|
coderay (~> 1.1)
|
|
33
33
|
method_source (~> 1.0)
|
|
34
|
-
public_suffix (5.0.
|
|
34
|
+
public_suffix (5.0.1)
|
|
35
35
|
rainbow (3.1.1)
|
|
36
36
|
rake (13.0.6)
|
|
37
37
|
regexp_parser (2.6.1)
|
|
@@ -42,33 +42,36 @@ GEM
|
|
|
42
42
|
rspec-mocks (~> 3.12.0)
|
|
43
43
|
rspec-core (3.12.0)
|
|
44
44
|
rspec-support (~> 3.12.0)
|
|
45
|
-
rspec-expectations (3.12.
|
|
45
|
+
rspec-expectations (3.12.2)
|
|
46
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
47
|
rspec-support (~> 3.12.0)
|
|
48
|
-
rspec-mocks (3.12.
|
|
48
|
+
rspec-mocks (3.12.3)
|
|
49
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
50
|
rspec-support (~> 3.12.0)
|
|
51
51
|
rspec-support (3.12.0)
|
|
52
|
-
rubocop (1.
|
|
52
|
+
rubocop (1.43.0)
|
|
53
53
|
json (~> 2.3)
|
|
54
54
|
parallel (~> 1.10)
|
|
55
|
-
parser (>= 3.
|
|
55
|
+
parser (>= 3.2.0.0)
|
|
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.
|
|
59
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
|
60
60
|
ruby-progressbar (~> 1.7)
|
|
61
|
-
unicode-display_width (>=
|
|
62
|
-
rubocop-ast (1.
|
|
61
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
62
|
+
rubocop-ast (1.24.1)
|
|
63
63
|
parser (>= 3.1.1.0)
|
|
64
|
+
rubocop-capybara (2.17.0)
|
|
65
|
+
rubocop (~> 1.41)
|
|
64
66
|
rubocop-rake (0.6.0)
|
|
65
67
|
rubocop (~> 1.0)
|
|
66
|
-
rubocop-rspec (2.
|
|
68
|
+
rubocop-rspec (2.18.0)
|
|
67
69
|
rubocop (~> 1.33)
|
|
70
|
+
rubocop-capybara
|
|
68
71
|
ruby-progressbar (1.11.0)
|
|
69
72
|
ruby2_keywords (0.0.5)
|
|
70
73
|
thor (1.2.1)
|
|
71
|
-
unicode-display_width (2.
|
|
74
|
+
unicode-display_width (2.4.2)
|
|
72
75
|
webmock (3.18.1)
|
|
73
76
|
addressable (>= 2.8.0)
|
|
74
77
|
crack (>= 0.3.2)
|
|
@@ -90,4 +93,4 @@ DEPENDENCIES
|
|
|
90
93
|
webmock
|
|
91
94
|
|
|
92
95
|
BUNDLED WITH
|
|
93
|
-
2.3.
|
|
96
|
+
2.3.26
|
data/README.md
CHANGED
|
@@ -71,6 +71,8 @@ image: gcr.io/[GCP-PROJECT-ID]/[APP-NAME]
|
|
|
71
71
|
namespace: borrower
|
|
72
72
|
# github name used to build deployment notification content
|
|
73
73
|
github: RenoFi/vidar
|
|
74
|
+
# The key to use for creating honeycomb markers, defaults to HONEYCOMB_API_KEY env var
|
|
75
|
+
honeycomb_api_key: secret
|
|
74
76
|
# deployments config per kubectl context, required for `monitor_deploy_status` command
|
|
75
77
|
deployments:
|
|
76
78
|
gke_project_us-east4_staging:
|
|
@@ -88,6 +90,8 @@ deployments:
|
|
|
88
90
|
sentry_webhook_url: https://sentry.io/api/hooks/release/builtin/123/asdf/
|
|
89
91
|
# Slack webhook url used to send deploy notifications, optional
|
|
90
92
|
slack_webhook_url: https://hooks.slack.com/services/ASCKNZ0vug2R3Ydo/ASCKNZ0vug2R3Ydo/ASCKNZ0vug2R3Ydo
|
|
93
|
+
# Name of the Honeycomb dataset to create a deployment marker in
|
|
94
|
+
honeycomb_dataset: staging
|
|
91
95
|
# docker-compose file, optional, default value: docker-compose.ci.yml
|
|
92
96
|
compose_file: docker-compose.ci.yml
|
|
93
97
|
# default_branch, optional, default value: main or master (auto-detected from local branches)
|
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)
|
|
@@ -75,6 +78,7 @@ module Vidar
|
|
|
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
|
|
|
77
80
|
slack_notification = SlackNotification.get
|
|
81
|
+
honeycomb_notification = HoneycombNotification.get
|
|
78
82
|
|
|
79
83
|
if status.success?
|
|
80
84
|
if template_name.to_s.empty?
|
|
@@ -93,17 +97,22 @@ module Vidar
|
|
|
93
97
|
Run.kubectl "describe job deploy-hook"
|
|
94
98
|
Log.error "Error running deploy hook template"
|
|
95
99
|
slack_notification.failure if slack_notification.configured?
|
|
100
|
+
honeycomb_notification.failure
|
|
96
101
|
exit(1)
|
|
97
102
|
end
|
|
98
103
|
end
|
|
99
104
|
else
|
|
100
105
|
Log.info "Error getting deploy hook template: #{error}"
|
|
101
106
|
slack_notification.failure if slack_notification.configured?
|
|
107
|
+
honeycomb_notification.failure
|
|
102
108
|
exit(1)
|
|
103
109
|
end
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
destination = options[:destination]
|
|
112
|
+
container = options[:container]
|
|
113
|
+
all = options[:all]
|
|
114
|
+
Log.info "Set kubectl image for #{all ? 'all ' : ''}#{destination} container=#{container}..."
|
|
115
|
+
Run.kubectl "set image #{destination} #{container}=#{Config.get!(:image)}:#{revision} #{all ? '--all' : ''}"
|
|
107
116
|
end
|
|
108
117
|
|
|
109
118
|
desc "release", "Build and publish docker images"
|
|
@@ -121,6 +130,7 @@ module Vidar
|
|
|
121
130
|
Log.info "Checking if all containers in #{Config.get!(:namespace)} namespace(s) are ready..."
|
|
122
131
|
|
|
123
132
|
slack_notification = SlackNotification.get
|
|
133
|
+
honeycomb_notification = HoneycombNotification.get
|
|
124
134
|
|
|
125
135
|
deploy_status = Vidar::DeployStatus.new(namespace: Config.get!(:namespace))
|
|
126
136
|
|
|
@@ -129,10 +139,12 @@ module Vidar
|
|
|
129
139
|
if deploy_status.success?
|
|
130
140
|
Log.info "OK: All containers are ready"
|
|
131
141
|
slack_notification.success if slack_notification.configured?
|
|
142
|
+
honeycomb_notification.success
|
|
132
143
|
invoke :notify_sentry
|
|
133
144
|
else
|
|
134
145
|
Log.error "ERROR: Some of containers are errored or not ready"
|
|
135
146
|
slack_notification.failure if slack_notification.configured?
|
|
147
|
+
honeycomb_notification.failure
|
|
136
148
|
exit(1)
|
|
137
149
|
end
|
|
138
150
|
end
|
|
@@ -189,6 +201,11 @@ module Vidar
|
|
|
189
201
|
sentry_notification.call if sentry_notification.configured?
|
|
190
202
|
end
|
|
191
203
|
|
|
204
|
+
desc "notify_honeycomb", "Send test honeycomb notification"
|
|
205
|
+
def notify_honeycomb
|
|
206
|
+
HoneycombNotification.get.success
|
|
207
|
+
end
|
|
208
|
+
|
|
192
209
|
method_option :message, required: true
|
|
193
210
|
desc "notify_slack", "Send custom slack notification"
|
|
194
211
|
def notify_slack
|
data/lib/vidar/config.rb
CHANGED
data/lib/vidar/deploy_config.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Vidar
|
|
|
6
6
|
|
|
7
7
|
attr_reader :name, :url,
|
|
8
8
|
:default_color, :success_color, :failure_color,
|
|
9
|
-
:slack_webhook_url, :sentry_webhook_url
|
|
9
|
+
:slack_webhook_url, :sentry_webhook_url, :honeycomb_dataset
|
|
10
10
|
|
|
11
11
|
def initialize(options)
|
|
12
12
|
@name = options.fetch(:name)
|
|
@@ -18,6 +18,7 @@ module Vidar
|
|
|
18
18
|
|
|
19
19
|
@slack_webhook_url = options[:slack_webhook_url]
|
|
20
20
|
@sentry_webhook_url = options[:sentry_webhook_url]
|
|
21
|
+
@honeycomb_dataset = options[:honeycomb_dataset]
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
end
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
module Vidar
|
|
2
|
+
class HoneycombNotification
|
|
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
|
+
api_key: Config.get(:honeycomb_api_key),
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def initialize(github:, revision:, revision_name:, deploy_config:, build_url: nil, api_key: nil, connection: Faraday.new)
|
|
15
|
+
@github = github
|
|
16
|
+
@revision = revision
|
|
17
|
+
@revision_name = revision_name
|
|
18
|
+
@build_url = build_url
|
|
19
|
+
@api_key = api_key
|
|
20
|
+
@dataset = deploy_config.honeycomb_dataset
|
|
21
|
+
@connection = connection
|
|
22
|
+
@start_time = Time.now.utc
|
|
23
|
+
@end_time = nil
|
|
24
|
+
@success = false
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def configured?
|
|
28
|
+
!dataset.nil? && !api_key.nil?
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def success
|
|
32
|
+
@end_time = Time.now.utc
|
|
33
|
+
@success = true
|
|
34
|
+
|
|
35
|
+
call
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def failure
|
|
39
|
+
@end_time = Time.now.utc
|
|
40
|
+
@success = false
|
|
41
|
+
|
|
42
|
+
call
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
attr_reader :connection,
|
|
48
|
+
:github,
|
|
49
|
+
:revision,
|
|
50
|
+
:revision_name,
|
|
51
|
+
:dataset,
|
|
52
|
+
:build_url,
|
|
53
|
+
:api_key,
|
|
54
|
+
:start_time,
|
|
55
|
+
:end_time
|
|
56
|
+
|
|
57
|
+
def success?
|
|
58
|
+
@success
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def call
|
|
62
|
+
return false unless configured?
|
|
63
|
+
|
|
64
|
+
response = connection.post do |req|
|
|
65
|
+
req.url "https://api.honeycomb.io/1/markers/#{dataset}"
|
|
66
|
+
req.headers['Content-Type'] = 'application/json'
|
|
67
|
+
req.headers['X-Honeycomb-Team'] = api_key.to_s
|
|
68
|
+
req.body = data.to_json
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
return true if response.status == 201
|
|
72
|
+
|
|
73
|
+
warn "Honeycomb marker not created: status: #{response.status} response: #{response.body}"
|
|
74
|
+
false
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def data
|
|
78
|
+
{
|
|
79
|
+
message: "#{success? ? 'Successful' : 'Failed'} deploy of #{github} revision #{revision} - #{revision_name}",
|
|
80
|
+
type: success? ? "deploy" : "failed_deploy",
|
|
81
|
+
start_time: start_time.to_i,
|
|
82
|
+
end_time: end_time.to_i,
|
|
83
|
+
url: build_url,
|
|
84
|
+
}
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
data/lib/vidar/version.rb
CHANGED
data/lib/vidar.rb
CHANGED
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.
|
|
4
|
+
version: 1.7.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:
|
|
12
|
+
date: 2023-01-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: colorize
|
|
@@ -195,6 +195,7 @@ files:
|
|
|
195
195
|
- ".github/ISSUE_TEMPLATE/story.md"
|
|
196
196
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
|
197
197
|
- ".github/workflows/auto-approve.yml"
|
|
198
|
+
- ".github/workflows/auto-merge-dependencies.yml"
|
|
198
199
|
- ".github/workflows/auto-merge.yml"
|
|
199
200
|
- ".github/workflows/ci.yml"
|
|
200
201
|
- ".gitignore"
|
|
@@ -211,6 +212,7 @@ files:
|
|
|
211
212
|
- lib/vidar/config.rb
|
|
212
213
|
- lib/vidar/deploy_config.rb
|
|
213
214
|
- lib/vidar/deploy_status.rb
|
|
215
|
+
- lib/vidar/honeycomb_notification.rb
|
|
214
216
|
- lib/vidar/interpolation.rb
|
|
215
217
|
- lib/vidar/k8s/container.rb
|
|
216
218
|
- lib/vidar/k8s/pod_set.rb
|
|
@@ -243,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
243
245
|
- !ruby/object:Gem::Version
|
|
244
246
|
version: '0'
|
|
245
247
|
requirements: []
|
|
246
|
-
rubygems_version: 3.
|
|
248
|
+
rubygems_version: 3.4.4
|
|
247
249
|
signing_key:
|
|
248
250
|
specification_version: 4
|
|
249
251
|
summary: K8s deployment tools based on thor
|