hybrid_platforms_conductor 33.9.0 → 33.9.1

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: d88a5c946d63351586ef1b77ec9840e13e84af48c210bc8dfd1004abc27f547d
4
- data.tar.gz: 8d04e563077d81cc72d5c3dc883f0010205a3880a255c1fb229ff3ba11771b49
3
+ metadata.gz: 2f6fe7f17295eff7ec9450d1ee910807a17904b8fa3c2bc5959449805b3c4aee
4
+ data.tar.gz: 3e39403d767099165e0765ba631effcb76b4d998ab7e34069d6d63ce9d75979a
5
5
  SHA512:
6
- metadata.gz: 211847acef3bff5d8e2e554a6262c783230989c3877b830cdbf4a3c5ff8a0fdb414669c891b9bf102f8adf26aed4000189df7565a1e33e93094ee384a577cbd1
7
- data.tar.gz: 1faa911b27e3fdda61c605711de26598c6bac9a533519a4b2d583da479f1be9ea32265433d34cf9d8c6aaeee06d45e83b80e648c013ed2342df728a83f9bb6cf
6
+ metadata.gz: 2abe0958607c3980f84acfb55a1d1b4b5dd96e03ab94db21f1069a30e9026e7053fca09125c253c619bd3228772718acf744af6447450d8bb36277ee341c18e5
7
+ data.tar.gz: a14bfcaaf1bff4ca92206d54c7e2bf0d7367c8ccd1609a311bec0c9fb844e3ae1fd1aaf2836ab7e69446b98713bdfea227653da4c55b2c2d1c797ed9896465bb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [v33.9.1](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.9.0...v33.9.1) (2021-09-01 16:59:59)
2
+
3
+ ## Global changes
4
+ ### Patches
5
+
6
+ * [[Fix(nodes_to_deploy)] [#110] Make sure unknown platforms are taken into account when detecting nodes to be deployed](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/c1b8312c5d473a1c5d044f6cda3ad9bed2b3ca61)
7
+
8
+ ## Changes for nodes_to_deploy
9
+ ### Patches
10
+
11
+ * [[Fix(nodes_to_deploy)] [#110] Make sure unknown platforms are taken into account when detecting nodes to be deployed](https://github.com/sweet-delights/hybrid-platforms-conductor/commit/c1b8312c5d473a1c5d044f6cda3ad9bed2b3ca61)
12
+
1
13
  # [v33.9.0](https://github.com/sweet-delights/hybrid-platforms-conductor/compare/v33.8.4...v33.9.0) (2021-08-24 13:15:44)
2
14
 
3
15
  ## Global changes
data/bin/nodes_to_deploy CHANGED
@@ -17,6 +17,7 @@ executable = HybridPlatformsConductor::Executable.new(deploy_options: false) do
17
17
  end
18
18
  end
19
19
  nodes_handler = executable.nodes_handler
20
+ platforms_handler = executable.platforms_handler
20
21
  deployer = executable.deployer
21
22
 
22
23
  executable.parse_options!
@@ -72,20 +73,29 @@ unless ignore_deploy_info
72
73
  commit_id = node_deploy_info[:deployment_info]["commit_id_#{repo_idx}".to_sym]
73
74
  impacted_nodes = cache_impacted_nodes.dig(repo_name, commit_id)
74
75
  if impacted_nodes.nil?
75
- begin
76
- impacted_nodes, _single_impacted_nodes, _impacted_services, _impact_global = nodes_handler.impacted_nodes_from_git_diff(
77
- repo_name,
78
- from_commit: commit_id,
79
- to_commit: 'master'
80
- )
81
- rescue HybridPlatformsConductor::NodesHandler::GitError
82
- # Consider the node was deployed with a non-release branch commit (as it is missing)
76
+ if platforms_handler.platform(repo_name)
77
+ begin
78
+ impacted_nodes, _single_impacted_nodes, _impacted_services, _impact_global = nodes_handler.impacted_nodes_from_git_diff(
79
+ repo_name,
80
+ from_commit: commit_id,
81
+ to_commit: 'master'
82
+ )
83
+ rescue HybridPlatformsConductor::NodesHandler::GitError
84
+ # Consider the node was deployed with a non-release branch commit (as it is missing)
85
+ # So we have to make sure we deploy it again
86
+ executable.log_warn "[ #{node} ] - Unknown commit ID from deployment logs: #{repo_name} / #{commit_id}."
87
+ impacted_nodes = :unknown
88
+ end
89
+ else
90
+ # Consider the node was deployed with an obdsolete platform (as it is unknown)
83
91
  # So we have to make sure we deploy it again
84
- impacted_nodes = [node]
92
+ executable.log_warn "[ #{node} ] - Unknown platform from deployment logs: #{repo_name}."
93
+ impacted_nodes = :unknown
85
94
  end
86
95
  cache_impacted_nodes[repo_name] = {} unless cache_impacted_nodes.key?(repo_name)
87
96
  cache_impacted_nodes[repo_name][commit_id] = impacted_nodes
88
97
  end
98
+ impacted_nodes = [node] if impacted_nodes == :unknown
89
99
  if impacted_nodes.include?(node)
90
100
  executable.log_debug "[ #{node} ] - Diffs on #{repo_name} between #{commit_id} and master are impacting this node."
91
101
  node_impacted = true
@@ -1,5 +1,5 @@
1
1
  module HybridPlatformsConductor
2
2
 
3
- VERSION = '33.9.0'
3
+ VERSION = '33.9.1'
4
4
 
5
5
  end
@@ -190,6 +190,81 @@ describe 'nodes_to_deploy executable' do
190
190
  end
191
191
  end
192
192
 
193
+ it 'considers nodes having the same invalid commit ids in their logs to be deployed' do
194
+ with_test_platform_for_nodes_to_deploy do
195
+ expect(test_deployer).to receive(:deployment_info_from).with(%w[node1 node2]).and_return(
196
+ 'node1' => {
197
+ services: %w[service1],
198
+ deployment_info: {
199
+ repo_name_0: 'platform',
200
+ commit_id_0: 'abcdef1',
201
+ exit_status: 0
202
+ },
203
+ exit_status: 0,
204
+ stdout: '',
205
+ stderr: ''
206
+ },
207
+ 'node2' => {
208
+ services: %w[service2],
209
+ deployment_info: {
210
+ repo_name_0: 'platform',
211
+ commit_id_0: 'abcdef1',
212
+ exit_status: 0
213
+ },
214
+ exit_status: 0,
215
+ stdout: '',
216
+ stderr: ''
217
+ }
218
+ )
219
+ expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with('platform', from_commit: 'abcdef1', to_commit: 'master') do
220
+ raise HybridPlatformsConductor::NodesHandler::GitError, 'Mocked git error due to an invalid commit id'
221
+ end
222
+ exit_code, stdout = run 'nodes_to_deploy'
223
+ expect(exit_code).to eq 0
224
+ expect(stdout).to eq <<~EO_STDOUT
225
+ ===== Nodes to deploy =====
226
+ node1
227
+ node2
228
+ EO_STDOUT
229
+ end
230
+ end
231
+
232
+ it 'considers nodes having unknown platforms in their logs to be deployed' do
233
+ with_test_platform_for_nodes_to_deploy do
234
+ expect(test_deployer).to receive(:deployment_info_from).with(%w[node1 node2]).and_return(
235
+ 'node1' => {
236
+ services: %w[service1],
237
+ deployment_info: {
238
+ repo_name_0: 'unknown_platform',
239
+ commit_id_0: 'abcdef1',
240
+ exit_status: 0
241
+ },
242
+ exit_status: 0,
243
+ stdout: '',
244
+ stderr: ''
245
+ },
246
+ 'node2' => {
247
+ services: %w[service2],
248
+ deployment_info: {
249
+ repo_name_0: 'platform',
250
+ commit_id_0: 'abcdef2',
251
+ exit_status: 0
252
+ },
253
+ exit_status: 0,
254
+ stdout: '',
255
+ stderr: ''
256
+ }
257
+ )
258
+ expect(test_nodes_handler).to receive(:impacted_nodes_from_git_diff).with('platform', from_commit: 'abcdef2', to_commit: 'master').and_return [%w[], [], [], false]
259
+ exit_code, stdout = run 'nodes_to_deploy'
260
+ expect(exit_code).to eq 0
261
+ expect(stdout).to eq <<~EO_STDOUT
262
+ ===== Nodes to deploy =====
263
+ node1
264
+ EO_STDOUT
265
+ end
266
+ end
267
+
193
268
  it 'ignores impacts if asked' do
194
269
  with_test_platform_for_nodes_to_deploy do
195
270
  exit_code, stdout = run 'nodes_to_deploy', '--ignore-deployed-info'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hybrid_platforms_conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 33.9.0
4
+ version: 33.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muriel Salvan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-24 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: range_operators