vidar 1.3.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.bundler-version +1 -0
- data/.dependabot/config.yml +7 -2
- data/.github/PULL_REQUEST_TEMPLATE.md +3 -15
- data/.github/workflows/auto-merge.yml +1 -1
- data/.github/workflows/ci.yml +28 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +61 -35
- data/README.md +1 -1
- data/Rakefile +1 -0
- data/lib/vidar/cli.rb +4 -2
- data/lib/vidar/config.rb +6 -1
- data/lib/vidar/deploy_config.rb +1 -1
- data/lib/vidar/interpolation.rb +1 -1
- data/lib/vidar/sentry_notification.rb +1 -1
- data/lib/vidar/slack_notification.rb +9 -8
- data/lib/vidar/version.rb +1 -1
- data/vidar.gemspec +3 -1
- metadata +22 -5
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3d537f85d8832eee399a795a023d6d1ec8d7c755742028bfebdc284faf1a73a
|
4
|
+
data.tar.gz: 9b9402f61125844939c73fdf1106a8e3b7b06d98a2445627bcc73ce3bed419bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f52e9983f88d1158cf00e3f1343f1fe8b21947766dd81ad59d0853c5fc1393f2d8f849d0de66239a431ef58a799b323269706cb8f9af3887e630cd9fef21d4e5
|
7
|
+
data.tar.gz: ddc33975a9aebebc95b22096fda74a683faf3225517d27c1739a024d7eaa6f81fa77afceeba3b28c64b55aef285c38fda188c9b31bea256489ddaa1394405459
|
data/.bundler-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.27
|
data/.dependabot/config.yml
CHANGED
@@ -3,9 +3,14 @@ version: 1
|
|
3
3
|
update_configs:
|
4
4
|
- package_manager: "ruby:bundler"
|
5
5
|
directory: "/"
|
6
|
-
update_schedule: "
|
6
|
+
update_schedule: "daily"
|
7
7
|
commit_message:
|
8
8
|
prefix: "[dependabot]"
|
9
9
|
allowed_updates:
|
10
10
|
- match:
|
11
|
-
|
11
|
+
dependency_type: "all"
|
12
|
+
update_type: "security"
|
13
|
+
automerged_updates:
|
14
|
+
- match:
|
15
|
+
dependency_type: "all"
|
16
|
+
update_type: "security:patch"
|
@@ -1,18 +1,6 @@
|
|
1
|
-
## Description
|
1
|
+
## Description, motivation and context
|
2
2
|
<!--- Describe your changes in detail -->
|
3
|
-
|
4
|
-
## Related issue(s)
|
5
|
-
<!--- GH issue number -->
|
6
|
-
|
7
|
-
## Motivation and Context
|
8
3
|
<!--- Why is this change required? What problem does it solve? -->
|
9
|
-
<!--- If it fixes an open issue, please link to the issue here. -->
|
10
4
|
|
11
|
-
##
|
12
|
-
<!---
|
13
|
-
|
14
|
-
## Screenshots (if appropriate):
|
15
|
-
<!--- Please add any screenshots of the feature. -->
|
16
|
-
|
17
|
-
## Related PRs
|
18
|
-
<!--- Please add links to any related PRs (backend, component packages, etc). -->
|
5
|
+
## Related issue(s) or PR(s)
|
6
|
+
<!--- GH issue number -->
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ['2.7', '3.0']
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v2
|
18
|
+
- name: Set up Ruby
|
19
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
20
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
21
|
+
# uses: ruby/setup-ruby@v1
|
22
|
+
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
26
|
+
|
27
|
+
- name: Run tests
|
28
|
+
run: bundle exec rake ci
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vidar (1.
|
4
|
+
vidar (1.4.1)
|
5
5
|
colorize
|
6
6
|
faraday
|
7
7
|
thor (~> 1.0)
|
@@ -9,63 +9,88 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
|
13
|
-
|
12
|
+
addressable (2.8.0)
|
13
|
+
public_suffix (>= 2.0.2, < 5.0)
|
14
|
+
ast (2.4.2)
|
15
|
+
awesome_print (1.9.2)
|
14
16
|
coderay (1.1.3)
|
15
17
|
colorize (0.8.1)
|
18
|
+
crack (0.4.5)
|
19
|
+
rexml
|
16
20
|
diff-lcs (1.4.4)
|
17
|
-
faraday (1.
|
21
|
+
faraday (1.8.0)
|
22
|
+
faraday-em_http (~> 1.0)
|
23
|
+
faraday-em_synchrony (~> 1.0)
|
24
|
+
faraday-excon (~> 1.1)
|
25
|
+
faraday-httpclient (~> 1.0.1)
|
26
|
+
faraday-net_http (~> 1.0)
|
27
|
+
faraday-net_http_persistent (~> 1.1)
|
28
|
+
faraday-patron (~> 1.0)
|
29
|
+
faraday-rack (~> 1.0)
|
18
30
|
multipart-post (>= 1.2, < 3)
|
19
|
-
ruby2_keywords
|
31
|
+
ruby2_keywords (>= 0.0.4)
|
32
|
+
faraday-em_http (1.0.0)
|
33
|
+
faraday-em_synchrony (1.0.0)
|
34
|
+
faraday-excon (1.1.0)
|
35
|
+
faraday-httpclient (1.0.1)
|
36
|
+
faraday-net_http (1.0.1)
|
37
|
+
faraday-net_http_persistent (1.2.0)
|
38
|
+
faraday-patron (1.0.0)
|
39
|
+
faraday-rack (1.0.0)
|
40
|
+
hashdiff (1.0.1)
|
20
41
|
method_source (1.0.0)
|
21
42
|
multipart-post (2.1.1)
|
22
|
-
parallel (1.
|
23
|
-
parser (
|
43
|
+
parallel (1.21.0)
|
44
|
+
parser (3.0.2.0)
|
24
45
|
ast (~> 2.4.1)
|
25
|
-
pry (0.
|
46
|
+
pry (0.14.1)
|
26
47
|
coderay (~> 1.1)
|
27
48
|
method_source (~> 1.0)
|
49
|
+
public_suffix (4.0.6)
|
28
50
|
rainbow (3.0.0)
|
29
|
-
rake (13.0.
|
30
|
-
regexp_parser (1.
|
31
|
-
rexml (3.2.
|
51
|
+
rake (13.0.6)
|
52
|
+
regexp_parser (2.1.1)
|
53
|
+
rexml (3.2.5)
|
32
54
|
rspec (3.10.0)
|
33
55
|
rspec-core (~> 3.10.0)
|
34
56
|
rspec-expectations (~> 3.10.0)
|
35
57
|
rspec-mocks (~> 3.10.0)
|
36
|
-
rspec-core (3.10.
|
58
|
+
rspec-core (3.10.1)
|
37
59
|
rspec-support (~> 3.10.0)
|
38
|
-
rspec-expectations (3.10.
|
60
|
+
rspec-expectations (3.10.1)
|
39
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
62
|
rspec-support (~> 3.10.0)
|
41
|
-
rspec-mocks (3.10.
|
63
|
+
rspec-mocks (3.10.2)
|
42
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
65
|
rspec-support (~> 3.10.0)
|
44
|
-
rspec-support (3.10.
|
45
|
-
rubocop (
|
66
|
+
rspec-support (3.10.2)
|
67
|
+
rubocop (1.22.0)
|
46
68
|
parallel (~> 1.10)
|
47
|
-
parser (>=
|
69
|
+
parser (>= 3.0.0.0)
|
48
70
|
rainbow (>= 2.2.2, < 4.0)
|
49
|
-
regexp_parser (>= 1.8)
|
71
|
+
regexp_parser (>= 1.8, < 3.0)
|
50
72
|
rexml
|
51
|
-
rubocop-ast (>=
|
73
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
52
74
|
ruby-progressbar (~> 1.7)
|
53
|
-
unicode-display_width (>= 1.4.0, <
|
54
|
-
rubocop-ast (1.
|
55
|
-
parser (>=
|
56
|
-
rubocop-
|
57
|
-
rubocop (
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
75
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
76
|
+
rubocop-ast (1.12.0)
|
77
|
+
parser (>= 3.0.1.1)
|
78
|
+
rubocop-rake (0.6.0)
|
79
|
+
rubocop (~> 1.0)
|
80
|
+
rubocop-rspec (2.5.0)
|
81
|
+
rubocop (~> 1.19)
|
82
|
+
ruby-progressbar (1.11.0)
|
83
|
+
ruby2_keywords (0.0.5)
|
84
|
+
thor (1.1.0)
|
85
|
+
unicode-display_width (2.1.0)
|
86
|
+
webmock (3.14.0)
|
87
|
+
addressable (>= 2.8.0)
|
88
|
+
crack (>= 0.3.2)
|
89
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
66
90
|
|
67
91
|
PLATFORMS
|
68
|
-
|
92
|
+
x86_64-darwin-20
|
93
|
+
x86_64-linux
|
69
94
|
|
70
95
|
DEPENDENCIES
|
71
96
|
awesome_print
|
@@ -74,9 +99,10 @@ DEPENDENCIES
|
|
74
99
|
rake
|
75
100
|
rspec
|
76
101
|
rubocop
|
77
|
-
rubocop-
|
102
|
+
rubocop-rake
|
78
103
|
rubocop-rspec
|
79
104
|
vidar!
|
105
|
+
webmock
|
80
106
|
|
81
107
|
BUNDLED WITH
|
82
|
-
2.
|
108
|
+
2.2.28
|
data/README.md
CHANGED
@@ -90,7 +90,7 @@ deployments:
|
|
90
90
|
slack_webhook_url: https://hooks.slack.com/services/ASCKNZ0vug2R3Ydo/ASCKNZ0vug2R3Ydo/ASCKNZ0vug2R3Ydo
|
91
91
|
# docker-compose file, optional, default value: docker-compose.ci.yml
|
92
92
|
compose_file: docker-compose.ci.yml
|
93
|
-
# default_branch, optional, default value: master
|
93
|
+
# default_branch, optional, default value: main or master (auto-detected from local branches)
|
94
94
|
default_branch: dev
|
95
95
|
# console_command, optional, default value: bin/console
|
96
96
|
console_command: rake console
|
data/Rakefile
CHANGED
data/lib/vidar/cli.rb
CHANGED
@@ -65,9 +65,11 @@ module Vidar
|
|
65
65
|
|
66
66
|
desc "deploy", "Perform k8s deployment with deploy hook"
|
67
67
|
method_option :revision, required: false
|
68
|
+
method_option :kubectl_context, required: false
|
68
69
|
def deploy
|
69
70
|
revision = options[:revision] || Config.get!(:revision)
|
70
|
-
|
71
|
+
kubectl_context = options[:kubectl_context] || Config.get!(:kubectl_context)
|
72
|
+
Log.info "Current kubectl context: #{kubectl_context}"
|
71
73
|
|
72
74
|
Log.info "Looking for deploy hook..."
|
73
75
|
template_name, error, status = Open3.capture3 "kubectl get cronjob deploy-hook-template -n #{Config.get!(:namespace)} -o name --ignore-not-found=true"
|
@@ -156,7 +158,7 @@ module Vidar
|
|
156
158
|
else
|
157
159
|
Log.info "Available containers:"
|
158
160
|
containers.each(&:print)
|
159
|
-
container = containers.
|
161
|
+
container = containers.detect { c.name == 'console' } || containers.last
|
160
162
|
|
161
163
|
Log.info "Running #{options[:command]} in #{container.pod_name}"
|
162
164
|
Run.kubectl("exec -it #{container.pod_name} -- #{options[:command]}")
|
data/lib/vidar/config.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Vidar
|
2
2
|
class Config
|
3
3
|
DEFAULT_MANIFEST_FILE = "vidar.yml".freeze
|
4
|
+
DEFAULT_BRANCHES = %w[main master].freeze
|
4
5
|
|
5
6
|
DEFAULT_OPTIONS = {
|
6
7
|
compose_file: -> { "docker-compose.ci.yml" },
|
7
|
-
default_branch: -> {
|
8
|
+
default_branch: -> { (DEFAULT_BRANCHES & branches).first || DEFAULT_BRANCHES.first },
|
8
9
|
current_branch: -> { `git rev-parse --abbrev-ref HEAD`.strip.tr("/", "-") },
|
9
10
|
revision: -> { `git rev-parse HEAD`.strip },
|
10
11
|
revision_name: -> { `git show --pretty=format:"%s (%h)" -s HEAD`.strip },
|
@@ -73,6 +74,10 @@ module Vidar
|
|
73
74
|
DeployConfig.new(deployment)
|
74
75
|
end
|
75
76
|
|
77
|
+
def branches
|
78
|
+
`git for-each-ref --format='%(refname:short)' refs/heads/*`.split("\n")
|
79
|
+
end
|
80
|
+
|
76
81
|
def default_branch?
|
77
82
|
get!(:current_branch) == get!(:default_branch)
|
78
83
|
end
|
data/lib/vidar/deploy_config.rb
CHANGED
@@ -10,7 +10,7 @@ module Vidar
|
|
10
10
|
|
11
11
|
def initialize(options)
|
12
12
|
@name = options.fetch(:name)
|
13
|
-
@url = options.fetch(:url)
|
13
|
+
@url = options.fetch(:url, nil)
|
14
14
|
|
15
15
|
@default_color = options.fetch(:default_color, DEFAULT_COLOR)
|
16
16
|
@success_color = options.fetch(:success_color, SUCCESS_COLOR)
|
data/lib/vidar/interpolation.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Vidar
|
2
2
|
class SlackNotification
|
3
|
-
def initialize(github:, revision:, revision_name:, deploy_config:, build_url: nil)
|
3
|
+
def initialize(github:, revision:, revision_name:, deploy_config:, build_url: nil, connection: Faraday.new)
|
4
4
|
@github = github
|
5
5
|
@revision = revision
|
6
6
|
@revision_name = revision_name
|
@@ -11,7 +11,7 @@ module Vidar
|
|
11
11
|
@success_color = deploy_config.success_color
|
12
12
|
@failure_color = deploy_config.failure_color
|
13
13
|
@webhook_url = deploy_config.slack_webhook_url
|
14
|
-
@connection =
|
14
|
+
@connection = connection
|
15
15
|
end
|
16
16
|
|
17
17
|
def configured?
|
@@ -57,13 +57,13 @@ module Vidar
|
|
57
57
|
def data(message:, color:)
|
58
58
|
text = [message].flatten.compact.join("\n")
|
59
59
|
{
|
60
|
-
|
60
|
+
attachments: [
|
61
61
|
{
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
title: github,
|
63
|
+
title_link: github_url,
|
64
|
+
color: color,
|
65
|
+
text: text,
|
66
|
+
fallback: text,
|
67
67
|
}
|
68
68
|
]
|
69
69
|
}
|
@@ -78,6 +78,7 @@ module Vidar
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def deploy_link
|
81
|
+
return deploy_name unless deploy_url
|
81
82
|
"<#{deploy_url}|#{deploy_name}>"
|
82
83
|
end
|
83
84
|
|
data/lib/vidar/version.rb
CHANGED
data/vidar.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
|
15
15
|
spec.metadata['homepage_uri'] = 'https://github.com/RenoFi/vidar'
|
16
16
|
spec.metadata['source_code_uri'] = 'https://github.com/RenoFi/vidar'
|
17
|
+
spec.metadata['changelog_uri'] = 'https://github.com/RenoFi/vidar/blob/master/CHANGELOG.md'
|
17
18
|
|
18
19
|
spec.files = Dir.chdir(__dir__) do
|
19
20
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin/|spec/|\.rub)}) }
|
@@ -34,6 +35,7 @@ Gem::Specification.new do |spec|
|
|
34
35
|
spec.add_development_dependency 'rake'
|
35
36
|
spec.add_development_dependency 'rspec'
|
36
37
|
spec.add_development_dependency 'rubocop'
|
37
|
-
spec.add_development_dependency 'rubocop-
|
38
|
+
spec.add_development_dependency 'rubocop-rake'
|
38
39
|
spec.add_development_dependency 'rubocop-rspec'
|
40
|
+
spec.add_development_dependency 'webmock'
|
39
41
|
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.
|
4
|
+
version: 1.4.1
|
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: 2021-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: colorize
|
@@ -138,7 +138,7 @@ dependencies:
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
- !ruby/object:Gem::Dependency
|
141
|
-
name: rubocop-
|
141
|
+
name: rubocop-rake
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - ">="
|
@@ -165,6 +165,20 @@ dependencies:
|
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: webmock
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
168
182
|
description:
|
169
183
|
email:
|
170
184
|
- knapo@knapo.net
|
@@ -174,6 +188,7 @@ executables:
|
|
174
188
|
extensions: []
|
175
189
|
extra_rdoc_files: []
|
176
190
|
files:
|
191
|
+
- ".bundler-version"
|
177
192
|
- ".dependabot/config.yml"
|
178
193
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
179
194
|
- ".github/ISSUE_TEMPLATE/config.yml"
|
@@ -181,9 +196,10 @@ files:
|
|
181
196
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
182
197
|
- ".github/workflows/auto-approve.yml"
|
183
198
|
- ".github/workflows/auto-merge.yml"
|
199
|
+
- ".github/workflows/ci.yml"
|
184
200
|
- ".gitignore"
|
185
201
|
- ".rspec"
|
186
|
-
-
|
202
|
+
- CHANGELOG.md
|
187
203
|
- Gemfile
|
188
204
|
- Gemfile.lock
|
189
205
|
- LICENSE
|
@@ -210,6 +226,7 @@ licenses:
|
|
210
226
|
metadata:
|
211
227
|
homepage_uri: https://github.com/RenoFi/vidar
|
212
228
|
source_code_uri: https://github.com/RenoFi/vidar
|
229
|
+
changelog_uri: https://github.com/RenoFi/vidar/blob/master/CHANGELOG.md
|
213
230
|
post_install_message:
|
214
231
|
rdoc_options: []
|
215
232
|
require_paths:
|
@@ -225,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
242
|
- !ruby/object:Gem::Version
|
226
243
|
version: '0'
|
227
244
|
requirements: []
|
228
|
-
rubygems_version: 3.
|
245
|
+
rubygems_version: 3.2.23
|
229
246
|
signing_key:
|
230
247
|
specification_version: 4
|
231
248
|
summary: K8s deployment tools based on thor
|