hybrid_platforms_conductor 33.3.0 → 33.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +31 -2
- data/docs/config_dsl.md +43 -0
- data/lib/hybrid_platforms_conductor/bitbucket.rb +134 -90
- data/lib/hybrid_platforms_conductor/common_config_dsl/bitbucket.rb +12 -44
- data/lib/hybrid_platforms_conductor/common_config_dsl/github.rb +9 -31
- data/lib/hybrid_platforms_conductor/confluence.rb +93 -88
- data/lib/hybrid_platforms_conductor/credentials.rb +112 -95
- data/lib/hybrid_platforms_conductor/deployer.rb +2 -2
- data/lib/hybrid_platforms_conductor/github.rb +39 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +4 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/confluence.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/keepass.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/secrets_reader/thycotic.rb +3 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +4 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/github_ci.rb +4 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_conf.rb +6 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/jenkins_ci_masters_ok.rb +6 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +3 -1
- data/lib/hybrid_platforms_conductor/logger_helpers.rb +7 -1
- data/lib/hybrid_platforms_conductor/thycotic.rb +80 -75
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +6 -0
- data/spec/hybrid_platforms_conductor_test/api/credentials_spec.rb +247 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/keepass_spec.rb +280 -319
- data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb +2 -2
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb +49 -69
- data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/github_ci_spec.rb +29 -39
- metadata +18 -2
data/spec/hybrid_platforms_conductor_test/api/deployer/secrets_reader_plugins/thycotic_spec.rb
CHANGED
@@ -39,9 +39,9 @@ describe HybridPlatformsConductor::Deployer do
|
|
39
39
|
if user.nil?
|
40
40
|
user = 'thycotic_user_from_netrc'
|
41
41
|
password = 'thycotic_password_from_netrc'
|
42
|
-
expect(
|
42
|
+
expect(test_deployer.instance_variable_get(:@secrets_readers)[:thycotic]).to receive(:with_credentials_for) do |id, resource: nil, &client_code|
|
43
43
|
expect(id).to eq :thycotic
|
44
|
-
expect(
|
44
|
+
expect(resource).to eq thycotic_url
|
45
45
|
client_code.call user, password
|
46
46
|
end
|
47
47
|
end
|
data/spec/hybrid_platforms_conductor_test/api/tests_runner/test_plugins/bitbucket_conf_spec.rb
CHANGED
@@ -5,8 +5,9 @@ describe HybridPlatformsConductor::TestsRunner do
|
|
5
5
|
context 'with bitbucket_conf' do
|
6
6
|
|
7
7
|
it 'iterates over defined Bitbucket repos' do
|
8
|
-
|
9
|
-
|
8
|
+
with_test_platform(
|
9
|
+
{ nodes: { 'node' => {} } },
|
10
|
+
additional_config: <<~EO_CONFIG
|
10
11
|
bitbucket_repos(
|
11
12
|
url: 'https://my_bb1.my_domain.com',
|
12
13
|
project: 'PR1',
|
@@ -34,73 +35,52 @@ describe HybridPlatformsConductor::TestsRunner do
|
|
34
35
|
}
|
35
36
|
)
|
36
37
|
EO_CONFIG
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
},
|
84
|
-
{
|
85
|
-
bitbucket_url: 'https://my_bb2.my_domain.com',
|
86
|
-
repo_info: {
|
87
|
-
name: 'repo4',
|
88
|
-
project: 'PR2',
|
89
|
-
url: 'https://my_bb2.my_domain.com/scm/pr2/repo4.git',
|
90
|
-
jenkins_ci_url: 'https://my_jenkins.com/job/repo4',
|
91
|
-
checks: {
|
92
|
-
branch_permissions: [
|
93
|
-
{
|
94
|
-
type: 'fast-forward-only',
|
95
|
-
branch: 'master',
|
96
|
-
exempted_users: ['toto']
|
97
|
-
}
|
98
|
-
]
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
]
|
103
|
-
end
|
38
|
+
) do
|
39
|
+
test_tests_runner.tests = [:bitbucket_conf]
|
40
|
+
WebMock.disable_net_connect!
|
41
|
+
stub_request(:get, 'https://my_bb1.my_domain.com/rest/api/1.0/projects/PR1/repos/repo1/settings/pull-requests').to_return(body: {}.to_json)
|
42
|
+
stub_request(:get, 'https://my_bb1.my_domain.com/rest/default-reviewers/1.0/projects/PR1/repos/repo1/conditions').to_return(body: {}.to_json)
|
43
|
+
expect(Git).to receive(:ls_remote).with('https://my_bb1.my_domain.com/scm/pr1/repo1.git').and_return(
|
44
|
+
'branches' => { 'master' => { sha: '12345' } },
|
45
|
+
'tags' => { 'v1.0.0' => { sha: '12345' } }
|
46
|
+
)
|
47
|
+
stub_request(:get, 'https://my_bb1.my_domain.com/rest/api/1.0/projects/PR1/repos/repo2/settings/pull-requests').to_return(body: {}.to_json)
|
48
|
+
stub_request(:get, 'https://my_bb1.my_domain.com/rest/default-reviewers/1.0/projects/PR1/repos/repo2/conditions').to_return(body: {}.to_json)
|
49
|
+
expect(Git).to receive(:ls_remote).with('https://my_bb1.my_domain.com/scm/pr1/repo2.git').and_return(
|
50
|
+
'branches' => { 'master' => { sha: '12345' } },
|
51
|
+
'tags' => { 'v1.0.0' => { sha: '12345' } }
|
52
|
+
)
|
53
|
+
stub_request(:get, 'https://my_bb2.my_domain.com/rest/api/1.0/projects/PR2/repos/repo3/settings/pull-requests').to_return(body: {}.to_json)
|
54
|
+
stub_request(:get, 'https://my_bb2.my_domain.com/rest/default-reviewers/1.0/projects/PR2/repos/repo3/conditions').to_return(body: {}.to_json)
|
55
|
+
stub_request(:get, 'https://my_bb2.my_domain.com/rest/branch-permissions/2.0/projects/PR2/repos/repo3/restrictions').to_return(body: {
|
56
|
+
'values' => [{
|
57
|
+
'type' => 'fast-forward-only',
|
58
|
+
'matcher' => { 'id' => 'refs/heads/master' },
|
59
|
+
'users' => [{ 'name' => 'toto' }],
|
60
|
+
'groups' => [],
|
61
|
+
'accessKeys' => []
|
62
|
+
}]
|
63
|
+
}.to_json)
|
64
|
+
expect(Git).to receive(:ls_remote).with('https://my_bb2.my_domain.com/scm/pr2/repo3.git').and_return(
|
65
|
+
'branches' => { 'master' => { sha: '12345' } },
|
66
|
+
'tags' => { 'v1.0.0' => { sha: '12345' } }
|
67
|
+
)
|
68
|
+
stub_request(:get, 'https://my_bb2.my_domain.com/rest/api/1.0/projects/PR2/repos/repo4/settings/pull-requests').to_return(body: {}.to_json)
|
69
|
+
stub_request(:get, 'https://my_bb2.my_domain.com/rest/default-reviewers/1.0/projects/PR2/repos/repo4/conditions').to_return(body: {}.to_json)
|
70
|
+
stub_request(:get, 'https://my_bb2.my_domain.com/rest/branch-permissions/2.0/projects/PR2/repos/repo4/restrictions').to_return(body: {
|
71
|
+
'values' => [{
|
72
|
+
'type' => 'fast-forward-only',
|
73
|
+
'matcher' => { 'id' => 'refs/heads/master' },
|
74
|
+
'users' => [{ 'name' => 'toto' }],
|
75
|
+
'groups' => [],
|
76
|
+
'accessKeys' => []
|
77
|
+
}]
|
78
|
+
}.to_json)
|
79
|
+
expect(Git).to receive(:ls_remote).with('https://my_bb2.my_domain.com/scm/pr2/repo4.git').and_return(
|
80
|
+
'branches' => { 'master' => { sha: '12345' } },
|
81
|
+
'tags' => { 'v1.0.0' => { sha: '12345' } }
|
82
|
+
)
|
83
|
+
expect(test_tests_runner.run_tests(%w[node])).to eq 0
|
104
84
|
end
|
105
85
|
end
|
106
86
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'octokit'
|
2
|
+
|
1
3
|
describe HybridPlatformsConductor::TestsRunner do
|
2
4
|
|
3
5
|
context 'when checking test plugins' do
|
@@ -5,8 +7,9 @@ describe HybridPlatformsConductor::TestsRunner do
|
|
5
7
|
context 'with github_ci' do
|
6
8
|
|
7
9
|
it 'iterates over defined Github repos' do
|
8
|
-
|
9
|
-
|
10
|
+
with_test_platform(
|
11
|
+
{ nodes: { 'node' => {} } },
|
12
|
+
additional_config: <<~EO_CONFIG
|
10
13
|
github_repos(
|
11
14
|
url: 'https://my_gh.my_domain.com',
|
12
15
|
user: 'GH-User1',
|
@@ -23,45 +26,32 @@ describe HybridPlatformsConductor::TestsRunner do
|
|
23
26
|
]
|
24
27
|
)
|
25
28
|
EO_CONFIG
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
) do
|
30
|
+
ENV['hpc_user_for_github'] = 'test-github-user'
|
31
|
+
ENV['hpc_password_for_github'] = 'GHTestToken'
|
32
|
+
test_tests_runner.tests = [:github_ci]
|
33
|
+
first_time = true
|
34
|
+
expect(Octokit::Client).to receive(:new).with(access_token: 'GHTestToken').twice do
|
35
|
+
mocked_client = instance_double(Octokit::Client)
|
36
|
+
if first_time
|
37
|
+
expect(mocked_client).to receive(:repository_workflow_runs).with('GH-User1/repo1').and_return(
|
38
|
+
workflow_runs: [{ head_branch: 'master', created_at: '2021-12-01 12:45:11', conclusion: 'success' }]
|
39
|
+
)
|
40
|
+
expect(mocked_client).to receive(:repository_workflow_runs).with('GH-User1/repo2').and_return(
|
41
|
+
workflow_runs: [{ head_branch: 'master', created_at: '2021-12-01 12:45:11', conclusion: 'success' }]
|
42
|
+
)
|
43
|
+
first_time = false
|
44
|
+
else
|
45
|
+
expect(mocked_client).to receive(:repository_workflow_runs).with('GH-User2/repo3').and_return(
|
46
|
+
workflow_runs: [{ head_branch: 'master', created_at: '2021-12-01 12:45:11', conclusion: 'success' }]
|
47
|
+
)
|
48
|
+
expect(mocked_client).to receive(:repository_workflow_runs).with('GH-User2/repo4').and_return(
|
49
|
+
workflow_runs: [{ head_branch: 'master', created_at: '2021-12-01 12:45:11', conclusion: 'success' }]
|
50
|
+
)
|
33
51
|
end
|
34
|
-
|
35
|
-
{
|
36
|
-
github_url: 'https://my_gh.my_domain.com/',
|
37
|
-
repo_info: {
|
38
|
-
name: 'repo1',
|
39
|
-
slug: 'GH-User1/repo1'
|
40
|
-
}
|
41
|
-
},
|
42
|
-
{
|
43
|
-
github_url: 'https://my_gh.my_domain.com/',
|
44
|
-
repo_info: {
|
45
|
-
name: 'repo2',
|
46
|
-
slug: 'GH-User1/repo2'
|
47
|
-
}
|
48
|
-
},
|
49
|
-
{
|
50
|
-
github_url: 'https://api.github.com/',
|
51
|
-
repo_info: {
|
52
|
-
name: 'repo3',
|
53
|
-
slug: 'GH-User2/repo3'
|
54
|
-
}
|
55
|
-
},
|
56
|
-
{
|
57
|
-
github_url: 'https://api.github.com/',
|
58
|
-
repo_info: {
|
59
|
-
name: 'repo4',
|
60
|
-
slug: 'GH-User2/repo4'
|
61
|
-
}
|
62
|
-
}
|
63
|
-
]
|
52
|
+
mocked_client
|
64
53
|
end
|
54
|
+
expect(test_tests_runner.run_tests(%w[node])).to eq 0
|
65
55
|
end
|
66
56
|
end
|
67
57
|
|
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.
|
4
|
+
version: 33.4.0
|
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-07-
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: range_operators
|
@@ -332,6 +332,20 @@ dependencies:
|
|
332
332
|
- - "~>"
|
333
333
|
- !ruby/object:Gem::Version
|
334
334
|
version: '2.4'
|
335
|
+
- !ruby/object:Gem::Dependency
|
336
|
+
name: webmock
|
337
|
+
requirement: !ruby/object:Gem::Requirement
|
338
|
+
requirements:
|
339
|
+
- - "~>"
|
340
|
+
- !ruby/object:Gem::Version
|
341
|
+
version: '3.11'
|
342
|
+
type: :development
|
343
|
+
prerelease: false
|
344
|
+
version_requirements: !ruby/object:Gem::Requirement
|
345
|
+
requirements:
|
346
|
+
- - "~>"
|
347
|
+
- !ruby/object:Gem::Version
|
348
|
+
version: '3.11'
|
335
349
|
description: Provides a complete toolset to help DevOps maintain, deploy, monitor
|
336
350
|
and test multiple platforms using various technologies
|
337
351
|
email:
|
@@ -718,6 +732,7 @@ files:
|
|
718
732
|
- lib/hybrid_platforms_conductor/current_dir_monitor.rb
|
719
733
|
- lib/hybrid_platforms_conductor/deployer.rb
|
720
734
|
- lib/hybrid_platforms_conductor/executable.rb
|
735
|
+
- lib/hybrid_platforms_conductor/github.rb
|
721
736
|
- lib/hybrid_platforms_conductor/hpc_plugins/action/bash.rb
|
722
737
|
- lib/hybrid_platforms_conductor/hpc_plugins/action/interactive.rb
|
723
738
|
- lib/hybrid_platforms_conductor/hpc_plugins/action/my_action.rb.sample
|
@@ -842,6 +857,7 @@ files:
|
|
842
857
|
- spec/hybrid_platforms_conductor_test/api/actions_executor/timeout_spec.rb
|
843
858
|
- spec/hybrid_platforms_conductor_test/api/cmd_runner_spec.rb
|
844
859
|
- spec/hybrid_platforms_conductor_test/api/config_spec.rb
|
860
|
+
- spec/hybrid_platforms_conductor_test/api/credentials_spec.rb
|
845
861
|
- spec/hybrid_platforms_conductor_test/api/deployer/check_spec.rb
|
846
862
|
- spec/hybrid_platforms_conductor_test/api/deployer/config_dsl_spec.rb
|
847
863
|
- spec/hybrid_platforms_conductor_test/api/deployer/deploy_spec.rb
|