obs_deploy 0.3.0 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ebc8a1643cc4ad84ad5d480e44e6c98c8bbb008aaee87cd450f59ff85219083
4
- data.tar.gz: 219d68cf9a244dd94f011bfe8126b7c667c2477059dd5d5132da81b99a25018f
3
+ metadata.gz: 7a525028509dae49e8de2a70652610f8dbbc5e81f2006022bb5691113f76d9aa
4
+ data.tar.gz: 6c45a8f8a0e8a2957c8ff59d1b696e670d8299e2c01cfdd5567a80d4d0d14148
5
5
  SHA512:
6
- metadata.gz: 50e93f6d5392498366eb0da55273ac5fab0cb594b836a526147e081f85ba8e7e8dcda66246755c14905dbe4daa6108a8a3fc4c930f3b0ac119c9e02fb903248e
7
- data.tar.gz: b93b82add9aea39fcb322f005bf9a739a9b1ab4f2dca241c405ea151855146a2c5217f1f324fbc324723ea1d70cf6da8e0d4e0faeb45cc27ce0d6582587521cb
6
+ metadata.gz: 2fab4b9747706c4d5e2b44581a60c0f3ef21fe5e02b4f415959e4c907e0f46c0c0211d64b53d266107d0e33b05852ec8886462b587505908ebccf29eadd797b2
7
+ data.tar.gz: 61f0eca04c6465ba339bfde0b9cf8d4a846db4c236501bacd817b8b99fa0931aca1c833bd1d03b339fade9fae56c9825f6c7dd0db691523e7d88d1e77b4e937f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- obs_deploy (0.2.5)
4
+ obs_deploy (0.3.5)
5
5
  cheetah
6
6
  dry-cli
7
7
  nokogiri
@@ -16,7 +16,7 @@ GEM
16
16
  cheetah (0.5.2)
17
17
  abstract_method (~> 1.2)
18
18
  coderay (1.1.2)
19
- concurrent-ruby (1.1.6)
19
+ concurrent-ruby (1.1.7)
20
20
  crack (0.4.3)
21
21
  safe_yaml (~> 1.0.0)
22
22
  diff-lcs (1.3)
@@ -25,9 +25,10 @@ GEM
25
25
  hashdiff (1.0.1)
26
26
  jaro_winkler (1.5.4)
27
27
  method_source (1.0.0)
28
- mini_portile2 (2.4.0)
29
- nokogiri (1.10.9)
30
- mini_portile2 (~> 2.4.0)
28
+ mini_portile2 (2.5.0)
29
+ nokogiri (1.11.1)
30
+ mini_portile2 (~> 2.5.0)
31
+ racc (~> 1.4)
31
32
  parallel (1.19.1)
32
33
  parser (2.7.0.5)
33
34
  ast (~> 2.4.0)
@@ -35,6 +36,7 @@ GEM
35
36
  coderay (~> 1.1)
36
37
  method_source (~> 1.0)
37
38
  public_suffix (4.0.3)
39
+ racc (1.5.2)
38
40
  rainbow (3.0.0)
39
41
  rake (13.0.1)
40
42
  rexml (3.2.4)
data/dist/Makefile CHANGED
@@ -1,6 +1,6 @@
1
1
  spec:
2
2
  gem2rpm --fetch obs_deploy > rubygem-obs_deploy.spec
3
3
  rm *.gem
4
- clean:
4
+ spec-clean:
5
5
  spec-cleaner rubygem-obs_deploy.spec > x.spec
6
6
  mv x.spec rubygem-obs_deploy.spec
@@ -1,104 +1,51 @@
1
- # Generated from obs_deploy-0.2.5.gem by gem2rpm -*- rpm-spec -*-
2
- %define rbname obs_deploy
3
- %define version 0.2.5
4
- %define release 1
5
-
6
- Summary: OBS Deployment tool
7
- Name: ruby-gems-%{rbname}
8
-
9
- Version: %{version}
10
- Release: %{release}
11
- Group: Development/Ruby
12
- License: Distributable
13
- URL: https://openbuildservice.org
14
- Source0: %{rbname}-%{version}.gem
15
- # Make sure the spec template is included in the SRPM
16
- Source1: ruby-gems-%{rbname}.spec.in
17
- BuildRoot: %{_tmppath}/%{name}-%{version}-root
18
- Requires: ruby [""]
19
- Requires: ruby-gems >= 3.0.6
20
- Requires: ruby-gems-bundler >= 2.0
21
- Requires: ruby-gems-bundler < 3
22
- Requires: ruby-gems-pry
23
- Requires: ruby-gems-rake >= 13.0
24
- Requires: ruby-gems-rake < 14
25
- Requires: ruby-gems-rspec >= 3.0
26
- Requires: ruby-gems-rspec < 4
27
- Requires: ruby-gems-rubocop
28
- Requires: ruby-gems-webmock
29
- Requires: ruby-gems-cheetah
30
- Requires: ruby-gems-dry-cli
31
- Requires: ruby-gems-nokogiri
32
- BuildRequires: ruby [""]
33
- BuildRequires: ruby-gems >= 3.0.6
34
- BuildArch: noarch
35
- Provides: ruby(Obs_deploy) = %{version}
36
-
37
- %define gemdir /home/vpereira/.rvm/gems/ruby-2.5.0
38
- %define gembuilddir %{buildroot}%{gemdir}
1
+ #
2
+ # spec file for package rubygem-obs_deploy
3
+ #
4
+ # Copyright (c) 2020 SUSE LLC
5
+ #
6
+ # All modifications and additions to the file contributed by third parties
7
+ # remain the property of their copyright owners, unless otherwise agreed
8
+ # upon. The license for this file, and modifications and additions to the
9
+ # file, is the same license as for the pristine package itself (unless the
10
+ # license for the pristine package is not an Open Source License, in which
11
+ # case the license is the MIT License). An "Open Source License" is a
12
+ # license that conforms to the Open Source Definition (Version 1.9)
13
+ # published by the Open Source Initiative.
14
+
15
+ # Please submit bugfixes or comments via https://bugs.opensuse.org/
16
+ #
17
+
18
+
19
+ %define mod_name obs_deploy
20
+ %define mod_full_name %{mod_name}-%{version}
21
+ Name: rubygem-obs_deploy
22
+ Version: 0.3.0
23
+ Release: 0
24
+ Summary: OBS Deployment tool
25
+ License:
26
+ Group: Development/Languages/Ruby
27
+ URL: https://openbuildservice.org
28
+ Source: https://rubygems.org/gems/%{mod_full_name}.gem
29
+ BuildRequires: %{rubygem gem2rpm}
30
+ BuildRequires: %{ruby}
31
+ BuildRequires: ruby-macros >= 5
32
+ BuildRequires: update-alternatives
33
+ # FIXME: use proper Requires(pre/post/preun/...)
34
+ PreReq: update-alternatives
39
35
 
40
36
  %description
41
37
  OBS Deployment tool.
42
38
 
43
-
44
39
  %prep
45
- %setup -T -c
46
40
 
47
41
  %build
48
42
 
49
43
  %install
50
- %{__rm} -rf %{buildroot}
51
- mkdir -p %{gembuilddir}
52
- gem install --local --install-dir %{gembuilddir} --force %{SOURCE0}
53
- mkdir -p %{buildroot}/%{_bindir}
54
- mv %{gembuilddir}/bin/* %{buildroot}/%{_bindir}
55
- rmdir %{gembuilddir}/bin
56
-
57
- %clean
58
- %{__rm} -rf %{buildroot}
59
-
60
- %files
61
- %defattr(-, root, root)
62
- %{_bindir}/console
63
- %{_bindir}/obs_deploy
64
- %{_bindir}/setup
65
- %{gemdir}/gems/obs_deploy-0.2.5/
66
- %{gemdir}/gems/obs_deploy-0.2.5/
67
- %{gemdir}/gems/obs_deploy-0.2.5/
68
- %{gemdir}/gems/obs_deploy-0.2.5/
69
- %{gemdir}/gems/obs_deploy-0.2.5/
70
- %{gemdir}/gems/obs_deploy-0.2.5/
71
- %{gemdir}/gems/obs_deploy-0.2.5/
72
- %{gemdir}/gems/obs_deploy-0.2.5/
73
- %{gemdir}/gems/obs_deploy-0.2.5/
74
- %{gemdir}/gems/obs_deploy-0.2.5/
75
- %{gemdir}/gems/obs_deploy-0.2.5/
76
- %{gemdir}/gems/obs_deploy-0.2.5/
77
- %{gemdir}/gems/obs_deploy-0.2.5/
78
- %{gemdir}/gems/obs_deploy-0.2.5/
79
- %{gemdir}/gems/obs_deploy-0.2.5/
80
- %{gemdir}/gems/obs_deploy-0.2.5/
81
- %{gemdir}/gems/obs_deploy-0.2.5/
82
- %{gemdir}/gems/obs_deploy-0.2.5/
83
- %{gemdir}/gems/obs_deploy-0.2.5/
84
- %{gemdir}/gems/obs_deploy-0.2.5/
85
- %{gemdir}/gems/obs_deploy-0.2.5/
86
- %{gemdir}/gems/obs_deploy-0.2.5/
87
- %{gemdir}/gems/obs_deploy-0.2.5/
88
- %{gemdir}/gems/obs_deploy-0.2.5/
89
- %{gemdir}/gems/obs_deploy-0.2.5/
90
- %{gemdir}/gems/obs_deploy-0.2.5/
91
- %{gemdir}/gems/obs_deploy-0.2.5/
92
- %{gemdir}/gems/obs_deploy-0.2.5/
93
- %{gemdir}/gems/obs_deploy-0.2.5/
94
- %{gemdir}/gems/obs_deploy-0.2.5/
95
- %{gemdir}/gems/obs_deploy-0.2.5/
96
- %{gemdir}/gems/obs_deploy-0.2.5/
97
- %{gemdir}/gems/obs_deploy-0.2.5/
98
-
44
+ %gem_install \
45
+ --symlink-binaries \
46
+ --doc-files="README.md" \
47
+ -f
99
48
 
100
- %doc %{gemdir}/doc/obs_deploy-0.2.5
101
- %{gemdir}/cache/obs_deploy-0.2.5.gem
102
- %{gemdir}/specifications/obs_deploy-0.2.5.gemspec
49
+ %gem_packages
103
50
 
104
51
  %changelog
@@ -2,9 +2,11 @@
2
2
 
3
3
  module ObsDeploy
4
4
  class CheckDiff
5
- def initialize(server: 'https://api.opensuse.org', product: 'SLE_12_SP4')
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
+ @project = project
9
+ @target_server = target_server
8
10
  end
9
11
 
10
12
  def package_version
@@ -25,6 +27,10 @@ module ObsDeploy
25
27
  Net::HTTP.get(URI("https://github.com/openSUSE/open-build-service/compare/#{obs_running_commit}...#{package_commit}.diff"))
26
28
  end
27
29
 
30
+ def new_version_available?
31
+ obs_running_commit != package_commit
32
+ end
33
+
28
34
  def has_migration?
29
35
  return true if github_diff.nil? || github_diff.empty?
30
36
 
@@ -50,11 +56,11 @@ module ObsDeploy
50
56
  end
51
57
 
52
58
  def package_url
53
- URI("#{@server}/public/build/OBS:Server:Unstable/#{@product}/x86_64/obs-server")
59
+ URI("#{@server}/public/build/#{@project}/#{@product}/x86_64/obs-server")
54
60
  end
55
61
 
56
62
  def about_url
57
- URI("#{@server}/about")
63
+ URI("#{@target_server}/about")
58
64
  end
59
65
  end
60
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'
9
10
 
10
- def call(url:, **)
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
16
+
11
17
  puts "Deployed version: #{ObsDeploy::CheckDiff.new(server: url).obs_running_commit}"
12
18
  end
13
19
  end
@@ -2,7 +2,25 @@
2
2
 
3
3
  module ObsDeploy
4
4
  module CLI
5
- class GetDiff
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
+
23
+ end
6
24
  end
7
25
  end
8
26
  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'
12
13
 
13
- def call(url:, product:, **)
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
19
+
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'
8
9
 
9
- def call(url:, **)
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
15
+
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:, dry_run:, host:, port:, **)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ObsDeploy
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.5'
5
5
  end
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.0
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pereira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-08 00:00:00.000000000 Z
11
+ date: 2021-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,7 +150,6 @@ files:
150
150
  - ".gitignore"
151
151
  - ".rspec"
152
152
  - ".rubocop.yml"
153
- - ".travis.yml"
154
153
  - Dockerfile.dev
155
154
  - Dockerfile.rpm
156
155
  - Gemfile
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.3
7
- before_install: gem install bundler -v 2.0.2