vidar 1.1.5 → 1.4.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: ed660da4b231ed9dfd128c739f85bbcd5635007a907016e8d5f5b981ffa98372
4
- data.tar.gz: 926998278a721071e8232acbaafd3daf742693d219a26e8db59551072770dc3e
3
+ metadata.gz: b09b655bc0059808f6e0373ebcf7e2e70b99d0cb9935e1e882cb63f609e2550d
4
+ data.tar.gz: 1fc818361e0ac1d324bc0077bce17036999264657f50f1a3274b366dd16b6ce5
5
5
  SHA512:
6
- metadata.gz: a17be0f3854b58d0f9a040ca7314bc877a4cc697e9ae92b7f60291795a833259318cb5f59b99c324f8b88d70de27a0e55f6ef6480d32eb5e46f316337718a538
7
- data.tar.gz: '083c14b658ab0eff7425086b6736461198b84af6de2be568a9767e8c0b6aa2db09fa5ecc245162610bc3808d96d6a2b08056e2dc9c1455d4d33cf9010272bad3'
6
+ metadata.gz: 7bdf349a69e3d83d1baa584bcd648adfb3cd2de1e34382577514f0436ef08fdd2e8884956ab77df450ba6af441e91a12b0a70dd3f3baaa20919e2d97cbfec3e8
7
+ data.tar.gz: 43bb2ff9ed08d64344412cb8e06a43c2ef61445e109fdcf09412472339110073071b30516ebfc3c8bb8a0535f7bfc2d802465b59fd034206dadc7e5de46bc15b
@@ -1,7 +1,7 @@
1
- # automatically approve PRs submitted by Dependabot
1
+ # automatically approve PRs submitted by Dependabot or Renofidev
2
2
  # this will allow Dependabot to automatically merge dependency update PRs where CI passes
3
3
  # from: https://github.com/hmarr/auto-approve-action
4
- name: Auto approve Dependabot PRs
4
+ name: Auto approve dependency upgrades PRs
5
5
 
6
6
  on:
7
7
  pull_request
@@ -11,6 +11,6 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: hmarr/auto-approve-action@v2.0.0
14
- if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
14
+ if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' || github.actor == 'renofidev'
15
15
  with:
16
16
  github-token: "${{ secrets.GITHUB_TOKEN }}"
@@ -0,0 +1,19 @@
1
+ name: automerge
2
+ on:
3
+ pull_request_review:
4
+ types:
5
+ - submitted
6
+ check_suite:
7
+ types:
8
+ - completed
9
+ status: {}
10
+ jobs:
11
+ automerge:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: automerge
15
+ uses: "pascalgn/automerge-action@v0.11.0"
16
+ env:
17
+ GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
18
+ MERGE_METHOD: squash
19
+ MERGE_DELETE_BRANCH: true
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vidar (1.1.5)
4
+ vidar (1.4.0)
5
5
  colorize
6
6
  faraday
7
7
  thor (~> 1.0)
@@ -9,56 +9,68 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
+ addressable (2.7.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
12
14
  ast (2.4.1)
13
15
  awesome_print (1.8.0)
14
16
  coderay (1.1.3)
15
17
  colorize (0.8.1)
18
+ crack (0.4.4)
16
19
  diff-lcs (1.4.4)
17
- faraday (1.0.1)
20
+ faraday (1.1.0)
18
21
  multipart-post (>= 1.2, < 3)
22
+ ruby2_keywords
23
+ hashdiff (1.0.1)
19
24
  method_source (1.0.0)
20
25
  multipart-post (2.1.1)
21
- parallel (1.19.2)
22
- parser (2.7.1.4)
26
+ parallel (1.20.1)
27
+ parser (2.7.2.0)
23
28
  ast (~> 2.4.1)
24
29
  pry (0.13.1)
25
30
  coderay (~> 1.1)
26
31
  method_source (~> 1.0)
32
+ public_suffix (4.0.6)
27
33
  rainbow (3.0.0)
28
34
  rake (13.0.1)
29
- regexp_parser (1.7.1)
35
+ regexp_parser (2.0.0)
30
36
  rexml (3.2.4)
31
- rspec (3.9.0)
32
- rspec-core (~> 3.9.0)
33
- rspec-expectations (~> 3.9.0)
34
- rspec-mocks (~> 3.9.0)
35
- rspec-core (3.9.2)
36
- rspec-support (~> 3.9.3)
37
- rspec-expectations (3.9.2)
37
+ rspec (3.10.0)
38
+ rspec-core (~> 3.10.0)
39
+ rspec-expectations (~> 3.10.0)
40
+ rspec-mocks (~> 3.10.0)
41
+ rspec-core (3.10.0)
42
+ rspec-support (~> 3.10.0)
43
+ rspec-expectations (3.10.0)
38
44
  diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.9.0)
40
- rspec-mocks (3.9.1)
45
+ rspec-support (~> 3.10.0)
46
+ rspec-mocks (3.10.0)
41
47
  diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.9.0)
43
- rspec-support (3.9.3)
44
- rubocop (0.90.0)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-support (3.10.0)
50
+ rubocop (1.6.1)
45
51
  parallel (~> 1.10)
46
- parser (>= 2.7.1.1)
52
+ parser (>= 2.7.1.5)
47
53
  rainbow (>= 2.2.2, < 4.0)
48
- regexp_parser (>= 1.7)
54
+ regexp_parser (>= 1.8, < 3.0)
49
55
  rexml
50
- rubocop-ast (>= 0.3.0, < 1.0)
56
+ rubocop-ast (>= 1.2.0, < 2.0)
51
57
  ruby-progressbar (~> 1.7)
52
58
  unicode-display_width (>= 1.4.0, < 2.0)
53
- rubocop-ast (0.3.0)
54
- parser (>= 2.7.1.4)
55
- rubocop-performance (1.7.1)
56
- rubocop (>= 0.82.0)
57
- rubocop-rspec (1.43.2)
58
- rubocop (~> 0.87)
59
+ rubocop-ast (1.3.0)
60
+ parser (>= 2.7.1.5)
61
+ rubocop-rake (0.5.1)
62
+ rubocop
63
+ rubocop-rspec (2.0.1)
64
+ rubocop (~> 1.0)
65
+ rubocop-ast (>= 1.1.0)
59
66
  ruby-progressbar (1.10.1)
67
+ ruby2_keywords (0.0.2)
60
68
  thor (1.0.1)
61
69
  unicode-display_width (1.7.0)
70
+ webmock (3.10.0)
71
+ addressable (>= 2.3.6)
72
+ crack (>= 0.3.2)
73
+ hashdiff (>= 0.4.0, < 2.0.0)
62
74
 
63
75
  PLATFORMS
64
76
  ruby
@@ -70,9 +82,10 @@ DEPENDENCIES
70
82
  rake
71
83
  rspec
72
84
  rubocop
73
- rubocop-performance
85
+ rubocop-rake
74
86
  rubocop-rspec
75
87
  vidar!
88
+ webmock
76
89
 
77
90
  BUNDLED WITH
78
91
  2.1.4
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
@@ -5,4 +5,4 @@ require 'rubocop/rake_task'
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
  RuboCop::RakeTask.new
7
7
 
8
- task default: %i[rubocop:auto_correct spec]
8
+ task default: %i[spec rubocop:auto_correct]
@@ -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
- Log.info "Current kubectl context: #{Config.get!(:kubectl_context)}"
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"
@@ -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: -> { "master" },
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 },
@@ -53,7 +54,7 @@ module Vidar
53
54
  end
54
55
 
55
56
  def build_url
56
- value = ENV[get(:build_env).to_s]
57
+ value = ENV[get(:build_env).to_s] || get(:build_url)
57
58
  value&.empty? ? nil : value
58
59
  end
59
60
 
@@ -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
@@ -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)
@@ -8,7 +8,7 @@ module Vidar
8
8
  fail ArgumentError, "getter must respond_to get." unless getter.respond_to?(:get)
9
9
 
10
10
  string.gsub(INTERPOLATION_PATTERN) do |match|
11
- getter.get($1) || match # rubocop:disable Style/PerlBackrefs
11
+ getter.get($1) || ENV[$1] || match # rubocop:disable Style/PerlBackrefs
12
12
  end
13
13
  end
14
14
  end
@@ -1,18 +1,17 @@
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
7
7
  @build_url = build_url
8
- @build_hostname = ::URI.parse(build_url || '').hostname
9
8
  @deploy_name = deploy_config.name
10
9
  @deploy_url = deploy_config.url
11
10
  @default_color = deploy_config.default_color
12
11
  @success_color = deploy_config.success_color
13
12
  @failure_color = deploy_config.failure_color
14
13
  @webhook_url = deploy_config.slack_webhook_url
15
- @connection = Faraday.new
14
+ @connection = connection
16
15
  end
17
16
 
18
17
  def configured?
@@ -20,12 +19,19 @@ module Vidar
20
19
  end
21
20
 
22
21
  def failure
23
- message = "Failed deploy of #{github_link} to #{deploy_link} :fire: <!channel> #{build_link}"
22
+ message = [
23
+ "Failed deploy of #{github_link} to #{deploy_link}.",
24
+ ":fire: <!channel>",
25
+ build_link
26
+ ]
24
27
  perform_with data(message: message, color: failure_color)
25
28
  end
26
29
 
27
30
  def success
28
- message = "Successful deploy of #{github_link} to #{deploy_link}. #{build_link}"
31
+ message = [
32
+ "Successful deploy of #{github_link} to #{deploy_link}.",
33
+ build_link
34
+ ]
29
35
  perform_with data(message: message, color: success_color)
30
36
  end
31
37
 
@@ -46,17 +52,18 @@ module Vidar
46
52
  attr_reader :github, :revision, :revision_name,
47
53
  :deploy_name, :deploy_url, :webhook_url,
48
54
  :default_color, :success_color, :failure_color,
49
- :connection, :build_url, :build_hostname
55
+ :connection, :build_url
50
56
 
51
57
  def data(message:, color:)
58
+ text = [message].flatten.compact.join("\n")
52
59
  {
53
60
  "attachments": [
54
61
  {
55
62
  "title": github,
56
63
  "title_link": github_url,
57
64
  "color": color,
58
- "text": message,
59
- "fallback": message
65
+ "text": text,
66
+ "fallback": text,
60
67
  }
61
68
  ]
62
69
  }
@@ -71,11 +78,12 @@ module Vidar
71
78
  end
72
79
 
73
80
  def deploy_link
81
+ return deploy_name unless deploy_url
74
82
  "<#{deploy_url}|#{deploy_name}>"
75
83
  end
76
84
 
77
85
  def build_link
78
- build_url && "<#{build_url}|View the build on #{build_hostname}>"
86
+ build_url && "<#{build_url}|View the build.>"
79
87
  end
80
88
  end
81
89
  end
@@ -1,3 +1,3 @@
1
1
  module Vidar
2
- VERSION = '1.1.5'.freeze
2
+ VERSION = '1.4.0'.freeze
3
3
  end
@@ -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-performance'
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.1.5
4
+ version: 1.4.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: 2020-09-02 00:00:00.000000000 Z
12
+ date: 2020-12-14 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-performance
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
@@ -180,6 +194,7 @@ files:
180
194
  - ".github/ISSUE_TEMPLATE/story.md"
181
195
  - ".github/PULL_REQUEST_TEMPLATE.md"
182
196
  - ".github/workflows/auto-approve.yml"
197
+ - ".github/workflows/auto-merge.yml"
183
198
  - ".gitignore"
184
199
  - ".rspec"
185
200
  - ".travis.yml"
@@ -209,6 +224,7 @@ licenses:
209
224
  metadata:
210
225
  homepage_uri: https://github.com/RenoFi/vidar
211
226
  source_code_uri: https://github.com/RenoFi/vidar
227
+ changelog_uri: https://github.com/RenoFi/vidar/blob/master/CHANGELOG.md
212
228
  post_install_message:
213
229
  rdoc_options: []
214
230
  require_paths:
@@ -224,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
240
  - !ruby/object:Gem::Version
225
241
  version: '0'
226
242
  requirements: []
227
- rubygems_version: 3.1.2
243
+ rubygems_version: 3.1.4
228
244
  signing_key:
229
245
  specification_version: 4
230
246
  summary: K8s deployment tools based on thor