lita-nexus 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/CHANGELOG.md +3 -0
- data/README.md +10 -9
- data/lib/lita/handlers/nexus.rb +4 -1
- data/lib/nexushelper/remote.rb +8 -3
- data/lita-nexus.gemspec +2 -1
- data/spec/lita/handlers/nexus_spec.rb +58 -11
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9e8478e68e75511ed9ce99998c40a280a198600
|
4
|
+
data.tar.gz: 0ab905b4f2370f2c42d54d466bc0d7ed8f8ad4c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f1058969a70d8cda6ba1ec122a3b89b9e802442bbadd3741d74f7db602044c359216469241d3fd27bb5e9fccf291d3d91f8bb0ce96cfb8059e72293c52a7f5d
|
7
|
+
data.tar.gz: 077f3486f956ea6bace8e96408f3b0dbc1949e163e1574ad12752f728565f3071403938c6d9240ac413522b855cbf3b91faedb0b0de3036e38d21e1dad2dde07
|
data/.rspec
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -15,16 +15,17 @@ Encrypted password can be generated use example rsa_encrypt script
|
|
15
15
|
## Configuration
|
16
16
|
```ruby
|
17
17
|
Lita.configure do |config|
|
18
|
-
config.handlers.nexus.url =
|
19
|
-
config.handlers.nexus.username = '
|
18
|
+
config.handlers.nexus.url = "http://localhost:8081/"
|
19
|
+
config.handlers.nexus.username = 'admin'
|
20
20
|
#encrypted use rsa_public_key
|
21
|
-
config.handlers.nexus.password_hash =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
# config.handlers.nexus.password_hash =
|
22
|
+
# 'Zrt3Hwo7Er4nu9Ne4r0Y6ykuxwxlmvKTrEN26G7EYw63Wtnt9K4H9e933NEZ
|
23
|
+
# eaqUhjoXKYCylhZNWsSj/KDnrEflCCr4eHkFq3kwNi9fRraI3kWVoBzg0v2E
|
24
|
+
# jn5sVCVgrIKG3W8p+RGKbm+HEnkNSZRKJumqJy3vtPcbgMdSlWZQPpwNP4X2
|
25
|
+
# c4NnOUNVY3nmEijX1FJkGnfL3pcZlJgx60lLhhLbGnKQkLz5LdeFRbiiXaVw
|
26
|
+
# acFQufgrhNN85AsKaUlDp/n8ISuMB1K1nGVdN2ZYByf1aKVYwnIWdj+omffz
|
27
|
+
# Da2gZuDpdDWvNfYsm7o3JV6BcmsS9YgiaeiBNi0l1Q=='
|
28
|
+
config.handlers.nexus.password_plain = 'admin123'
|
28
29
|
config.handlers.nexus.verify_ssl = false
|
29
30
|
config.handlers.nexus.default_repository = 'entertainment'
|
30
31
|
#used to decrypt password hash
|
data/lib/lita/handlers/nexus.rb
CHANGED
@@ -7,12 +7,15 @@ module Lita
|
|
7
7
|
# insert handler code here
|
8
8
|
config :url, required: true, type: String
|
9
9
|
config :username, required: true, type: String
|
10
|
-
|
10
|
+
#use either plain password or encrypted one
|
11
|
+
config :password_hash, required: false, type: String
|
12
|
+
config :password_plain, required: false, type: String
|
11
13
|
config :default_repository, required: false, type: String
|
12
14
|
config :verify_ssl, required: false, type: [TrueClass,FalseClass], default: false
|
13
15
|
config :rsa_private_key, required: true, type: String
|
14
16
|
config :current_repository, required: false, type: String
|
15
17
|
|
18
|
+
|
16
19
|
include ::LitaNexusHelper::Remote
|
17
20
|
|
18
21
|
route(
|
data/lib/nexushelper/remote.rb
CHANGED
@@ -6,9 +6,14 @@ module LitaNexusHelper
|
|
6
6
|
module Remote
|
7
7
|
def nexus_remote
|
8
8
|
begin
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
if config.password_plain.nil? || config.password_plain.length <1
|
10
|
+
pk_path = config.rsa_private_key
|
11
|
+
pk = OpenSSL::PKey::RSA.new File.read(pk_path)
|
12
|
+
decrypted_pass = pk.private_decrypt Base64::decode64(config.password_hash)
|
13
|
+
else
|
14
|
+
decrypted_pass = config.password_plain
|
15
|
+
end
|
16
|
+
|
12
17
|
overrides = {
|
13
18
|
:url => config.url,
|
14
19
|
:repository => get_current_repo,
|
data/lita-nexus.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-nexus"
|
3
|
-
spec.version = "0.1.
|
3
|
+
spec.version = "0.1.3"
|
4
4
|
spec.authors = ["Wang, Dawei"]
|
5
5
|
spec.email = ["dwang@entertainment.com"]
|
6
6
|
spec.description = "Lita Nexus Operations"
|
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "rake"
|
25
25
|
#spec.add_development_dependency "rack-test"
|
26
26
|
spec.add_development_dependency "rspec", ">= 3.0.0"
|
27
|
+
spec.add_development_dependency "docker-api"
|
27
28
|
end
|
@@ -1,18 +1,65 @@
|
|
1
1
|
require "spec_helper"
|
2
|
+
require 'docker'
|
2
3
|
|
3
4
|
describe Lita::Handlers::Nexus, lita_handler: true do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
@image = Docker::Image.create('fromImage' => 'sonatype/nexus:oss')
|
8
|
+
|
9
|
+
|
10
|
+
#
|
11
|
+
@container_data = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
|
12
|
+
'Cmd' => "true"
|
13
|
+
)
|
14
|
+
@container_data.rename('lita_nexus_data')
|
15
|
+
@container_data.start
|
16
|
+
|
17
|
+
sleep 5
|
18
|
+
|
19
|
+
#check docker image documentation
|
20
|
+
default_settings =[
|
21
|
+
'MAX_HEAP=768m'
|
22
|
+
]
|
23
|
+
@container_nexus = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
|
24
|
+
'Env'=> default_settings,
|
25
|
+
'ExposedPorts' => {
|
26
|
+
'8081/tcp' => {}
|
27
|
+
},
|
28
|
+
'HostConfig' => {
|
29
|
+
'PortBindings' => { '8081/tcp' => [{ 'HostPort' => '8081' }] }
|
30
|
+
},
|
31
|
+
'VolumesFrom' => ['lita_nexus_data']
|
32
|
+
)
|
33
|
+
@container_nexus.rename('lita_nexus')
|
34
|
+
@container_nexus.start
|
35
|
+
|
36
|
+
# waiting container to startup
|
37
|
+
wait_time = ENV['LITA_NEXUS_WAIT_TIME'] || 20
|
38
|
+
sleep wait_time
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
after :all do
|
43
|
+
puts "Shutting down containers"
|
44
|
+
@container_nexus.stop
|
45
|
+
@container_nexus.delete(:force => true)
|
46
|
+
sleep 1
|
47
|
+
@container_data.delete(:force => true)
|
48
|
+
end
|
49
|
+
|
4
50
|
before do
|
5
|
-
registry.config.handlers.nexus.url = '
|
6
|
-
registry.config.handlers.nexus.username = '
|
7
|
-
registry.config.handlers.nexus.password_hash =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
51
|
+
registry.config.handlers.nexus.url = 'http://localhost:8081/'
|
52
|
+
registry.config.handlers.nexus.username = 'admin'
|
53
|
+
# registry.config.handlers.nexus.password_hash =
|
54
|
+
# 'C3Enajd6ygmzot1CB8H7FdYb7oLOpOr+fZMisp4HDfb8l1YDaNRxUhCYKxYq
|
55
|
+
# ma3qv6fxmU3wkPLfcN1c/u164jgGVPPl4mi8PtZxbN2uAh0hm/sIqTAoFczy
|
56
|
+
# 6lctLPNNYb3eK+4lH/XvOHeS1L+uSwPIiQNub//IsE7MeWz3gW6AXr0I5sUt
|
57
|
+
# k81o63GwYqdT0VS4PpJqfl2zq8LHd6s0SFUfZv02HvW0TvwNxmjiWnsRYLcs
|
58
|
+
# aU9B+umfH9rCqNXNqDaAgEDXBTbMkqTjwQvRi0qMouQmITPC7dnC2lYsC/Ka
|
59
|
+
# HXpfWKIFjbVtf5Tslfj1l5/9mW7PTtwyeXc7z50iUA=='
|
60
|
+
registry.config.handlers.nexus.password_plain='admin123'
|
14
61
|
registry.config.handlers.nexus.verify_ssl = false
|
15
|
-
registry.config.handlers.nexus.default_repository = '
|
62
|
+
registry.config.handlers.nexus.default_repository = 'releases'
|
16
63
|
registry.config.handlers.nexus.rsa_private_key = "#{File.expand_path('~')}/.ssh/id_rsa"
|
17
64
|
end
|
18
65
|
it do
|
@@ -64,7 +111,7 @@ describe Lita::Handlers::Nexus, lita_handler: true do
|
|
64
111
|
puts replies
|
65
112
|
end
|
66
113
|
it 'set current repo ' do
|
67
|
-
send_command('nexus set current repo
|
114
|
+
send_command('nexus set current repo snapshots')
|
68
115
|
puts "Setting current repo"
|
69
116
|
puts replies
|
70
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-nexus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wang, Dawei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: docker-api
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Lita Nexus Operations
|
98
112
|
email:
|
99
113
|
- dwang@entertainment.com
|
@@ -103,6 +117,7 @@ extensions: []
|
|
103
117
|
extra_rdoc_files: []
|
104
118
|
files:
|
105
119
|
- ".gitignore"
|
120
|
+
- ".rspec"
|
106
121
|
- CHANGELOG.md
|
107
122
|
- Gemfile
|
108
123
|
- README.md
|