obs_deploy 0.3.1 → 0.3.6
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 +4 -4
- data/Gemfile.lock +5 -3
- data/lib/obs_deploy.rb +1 -1
- data/lib/obs_deploy/check_diff.rb +4 -3
- data/lib/obs_deploy/cli/commands.rb +8 -6
- data/lib/obs_deploy/cli/commands/get_deployed_version.rb +7 -1
- data/lib/obs_deploy/cli/commands/get_diff.rb +18 -1
- data/lib/obs_deploy/cli/commands/get_package_version.rb +7 -1
- data/lib/obs_deploy/cli/commands/get_pending_migration.rb +7 -1
- data/lib/obs_deploy/cli/commands/refresh_repositories.rb +1 -2
- data/lib/obs_deploy/version.rb +1 -1
- data/obs_deploy.gemspec +1 -0
- metadata +16 -3
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335af2b4a7a3ab016abe414a29abbf75ce1ea4620db7a743c38c5bbc31d6e7e9
|
4
|
+
data.tar.gz: 72e73f24db2bcc84de791d0ce34e97982addc8d798404dd6b2b3bf51ad7dd0c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e3e237db240f2d1cef473a46a6108371f6e96353d415f8eb450bb9bc3fa220f4431c34cc151997582114467737d92cb14c724d66ad648ae30b34afb12d0c2d9
|
7
|
+
data.tar.gz: c654df6ee218ce489eea777187107f0154bbaa3fc9e1f6093dd94858e2ba3406db81f8c2b7f37a545adf7e76d96d0ecd3924f6a69121e513f0bd2fcb7b89c2e2
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
obs_deploy (0.3.
|
4
|
+
obs_deploy (0.3.6)
|
5
5
|
cheetah
|
6
6
|
dry-cli
|
7
|
+
git_diff_parser
|
7
8
|
nokogiri
|
8
9
|
|
9
10
|
GEM
|
@@ -16,17 +17,18 @@ GEM
|
|
16
17
|
cheetah (0.5.2)
|
17
18
|
abstract_method (~> 1.2)
|
18
19
|
coderay (1.1.2)
|
19
|
-
concurrent-ruby (1.1.
|
20
|
+
concurrent-ruby (1.1.8)
|
20
21
|
crack (0.4.3)
|
21
22
|
safe_yaml (~> 1.0.0)
|
22
23
|
diff-lcs (1.3)
|
23
24
|
dry-cli (0.6.0)
|
24
25
|
concurrent-ruby (~> 1.0)
|
26
|
+
git_diff_parser (3.2.0)
|
25
27
|
hashdiff (1.0.1)
|
26
28
|
jaro_winkler (1.5.4)
|
27
29
|
method_source (1.0.0)
|
28
30
|
mini_portile2 (2.5.0)
|
29
|
-
nokogiri (1.11.
|
31
|
+
nokogiri (1.11.1)
|
30
32
|
mini_portile2 (~> 2.5.0)
|
31
33
|
racc (~> 1.4)
|
32
34
|
parallel (1.19.1)
|
data/lib/obs_deploy.rb
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
module ObsDeploy
|
4
4
|
class CheckDiff
|
5
|
-
def initialize(server: 'https://api.opensuse.org', product: 'SLE_12_SP4', project: 'OBS:Server:Unstable')
|
5
|
+
def initialize(server: 'https://api.opensuse.org', product: 'SLE_12_SP4', project: 'OBS:Server:Unstable', target_server: 'https://api.opensuse.org')
|
6
6
|
@server = server
|
7
7
|
@product = product
|
8
8
|
@project = project
|
9
|
+
@target_server = target_server
|
9
10
|
end
|
10
11
|
|
11
12
|
def package_version
|
@@ -33,7 +34,7 @@ module ObsDeploy
|
|
33
34
|
def has_migration?
|
34
35
|
return true if github_diff.nil? || github_diff.empty?
|
35
36
|
|
36
|
-
github_diff.match?(%r{db/migrate})
|
37
|
+
GitDiffParser.parse(github_diff).files.any? { |f| f.match?(%r{db/migrate}) }
|
37
38
|
end
|
38
39
|
|
39
40
|
def has_data_migration?
|
@@ -59,7 +60,7 @@ module ObsDeploy
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def about_url
|
62
|
-
URI("#{@
|
63
|
+
URI("#{@target_server}/about")
|
63
64
|
end
|
64
65
|
end
|
65
66
|
end
|
@@ -11,15 +11,17 @@ module ObsDeploy
|
|
11
11
|
autoload :GetDeployedVersion, File.join(__dir__, 'commands/get_deployed_version.rb')
|
12
12
|
autoload :Systemctl, File.join(__dir__, 'commands/systemctl.rb')
|
13
13
|
autoload :GetPendingMigration, File.join(__dir__, 'commands/get_pending_migration.rb')
|
14
|
+
autoload :GetDiff, File.join(__dir__, 'commands/get_diff.rb')
|
14
15
|
|
15
16
|
# register the commands and its command line
|
16
|
-
register 'available-package', GetPackageVersion
|
17
|
-
register 'deployed-version', GetDeployedVersion
|
17
|
+
register 'available-package', GetPackageVersion, aliases: ['ap']
|
18
|
+
register 'deployed-version', GetDeployedVersion, aliases: ['dv']
|
18
19
|
register 'version', Version, aliases: ['v', '-v', '--version']
|
19
|
-
register 'deploy', Deploy
|
20
|
-
register 'refresh-repositories', RefreshRepositories
|
21
|
-
register 'systemctl', Systemctl
|
22
|
-
register 'pending-migrations', GetPendingMigration
|
20
|
+
register 'deploy', Deploy, aliases: ['dp']
|
21
|
+
register 'refresh-repositories', RefreshRepositories, aliases: ['rr']
|
22
|
+
register 'systemctl', Systemctl, aliases: ['sys']
|
23
|
+
register 'pending-migrations', GetPendingMigration, aliases: ['pm']
|
24
|
+
register 'check-diff', GetDiff, aliases: ['cd']
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -6,8 +6,14 @@ module ObsDeploy
|
|
6
6
|
class GetDeployedVersion < Dry::CLI::Command
|
7
7
|
desc 'Get the deployed version of OBS'
|
8
8
|
option :url, type: :string, default: 'https://api.opensuse.org', desc: 'API url'
|
9
|
+
option :ignore_certificate, aliases: ['k'], type: :bool, default: false, desc: 'Ignore invalid or self-signed SSL certificates'
|
10
|
+
|
11
|
+
def call(url:, ignore_certificate:, **)
|
12
|
+
if ignore_certificate
|
13
|
+
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
|
14
|
+
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
|
15
|
+
end
|
9
16
|
|
10
|
-
def call(url:, **)
|
11
17
|
puts "Deployed version: #{ObsDeploy::CheckDiff.new(server: url).obs_running_commit}"
|
12
18
|
end
|
13
19
|
end
|
@@ -2,7 +2,24 @@
|
|
2
2
|
|
3
3
|
module ObsDeploy
|
4
4
|
module CLI
|
5
|
-
|
5
|
+
module Commands
|
6
|
+
class GetDiff < Dry::CLI::Command
|
7
|
+
desc 'Get diff between deployed package and available package'
|
8
|
+
option :url, type: :string, default: 'https://api.opensuse.org', desc: 'API url'
|
9
|
+
option :package, type: :string, default: 'obs-api', desc: 'Package name'
|
10
|
+
option :project, type: :string, default: 'OBS:Server:Unstable', desc: 'Project name'
|
11
|
+
option :product, type: :string, default: 'SLE_12_SP4', desc: 'Product name'
|
12
|
+
option :architecture, type: :string, default: 'x86_64', desc: 'Architecture'
|
13
|
+
option :ignore_certificate, aliases: ['k'], type: :bool, default: false, desc: 'Ignore invalid or self-signed SSL certificates'
|
14
|
+
|
15
|
+
def call(url:, product:, project:, ignore_certificate:, **)
|
16
|
+
if ignore_certificate
|
17
|
+
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
|
18
|
+
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
|
19
|
+
end
|
20
|
+
puts "diff : #{ObsDeploy::CheckDiff.new(server: url, project: project, product: product).github_diff}"
|
21
|
+
end
|
22
|
+
end
|
6
23
|
end
|
7
24
|
end
|
8
25
|
end
|
@@ -9,8 +9,14 @@ module ObsDeploy
|
|
9
9
|
option :package, type: :string, default: 'obs-api', desc: 'Package name'
|
10
10
|
option :product, type: :string, default: 'SLE_12_SP4', desc: 'Product name'
|
11
11
|
option :architecture, type: :string, default: 'x86_64', desc: 'Architecture'
|
12
|
+
option :ignore_certificate, aliases: ['k'], type: :bool, default: false, desc: 'Ignore invalid or self-signed SSL certificates'
|
13
|
+
|
14
|
+
def call(url:, ignore_certificate:, product:, **)
|
15
|
+
if ignore_certificate
|
16
|
+
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
|
17
|
+
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
|
18
|
+
end
|
12
19
|
|
13
|
-
def call(url:, product:, **)
|
14
20
|
puts "Available package: #{ObsDeploy::CheckDiff.new(server: url, product: product).package_version}"
|
15
21
|
end
|
16
22
|
end
|
@@ -5,8 +5,14 @@ module ObsDeploy
|
|
5
5
|
module Commands
|
6
6
|
class GetPendingMigration < Dry::CLI::Command
|
7
7
|
option :url, type: :string, default: 'https://api.opensuse.org', desc: 'API url'
|
8
|
+
option :ignore_certificate, aliases: ['k'], type: :bool, default: false, desc: 'Ignore invalid or self-signed SSL certificates'
|
9
|
+
|
10
|
+
def call(url:, ignore_certificate:, **)
|
11
|
+
if ignore_certificate
|
12
|
+
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
|
13
|
+
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
|
14
|
+
end
|
8
15
|
|
9
|
-
def call(url:, **)
|
10
16
|
migrations = ObsDeploy::CheckDiff.new(server: url).migrations
|
11
17
|
if migrations.empty?
|
12
18
|
puts 'No pending migrations'
|
@@ -6,11 +6,10 @@ module ObsDeploy
|
|
6
6
|
class RefreshRepositories < Dry::CLI::Command
|
7
7
|
desc 'Refresh zypper repositories'
|
8
8
|
option :user, type: :string, default: 'root', desc: 'User'
|
9
|
-
option :dry_run, type: :bool, default: true, desc: 'Dry run'
|
10
9
|
option :host, type: :string, default: 'localhost', desc: 'Set the server address'
|
11
10
|
option :port, type: :int, default: 22, desc: 'Set the server port'
|
12
11
|
|
13
|
-
def call(user:,
|
12
|
+
def call(user:, host:, port:, **)
|
14
13
|
ssh_driver = ObsDeploy::SSH.new(user: user, server: host, port: port)
|
15
14
|
zypper = ObsDeploy::Zypper.new
|
16
15
|
ssh_driver.run(zypper.refresh)
|
data/lib/obs_deploy/version.rb
CHANGED
data/obs_deploy.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: obs_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Pereira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: git_diff_parser
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: nokogiri
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,7 +164,6 @@ files:
|
|
150
164
|
- ".gitignore"
|
151
165
|
- ".rspec"
|
152
166
|
- ".rubocop.yml"
|
153
|
-
- ".travis.yml"
|
154
167
|
- Dockerfile.dev
|
155
168
|
- Dockerfile.rpm
|
156
169
|
- Gemfile
|