obs_deploy 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile.dev +2 -1
- data/Gemfile.lock +5 -3
- data/README.md +0 -19
- data/lib/obs_deploy.rb +1 -1
- data/lib/obs_deploy/apache_sysconfig.rb +2 -2
- data/lib/obs_deploy/check_diff.rb +1 -1
- data/lib/obs_deploy/cli/commands.rb +0 -1
- data/lib/obs_deploy/cli/commands/get_deployed_version.rb +1 -1
- data/lib/obs_deploy/cli/commands/get_diff.rb +0 -1
- data/lib/obs_deploy/cli/commands/get_package_version.rb +1 -1
- data/lib/obs_deploy/cli/commands/get_pending_migration.rb +10 -5
- data/lib/obs_deploy/cli/commands/systemctl.rb +0 -1
- data/lib/obs_deploy/version.rb +1 -1
- data/obs_deploy.gemspec +1 -0
- metadata +16 -3
- data/lib/obs_deploy/cli/commands/deploy.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 742d7413da49ee796b72615ec9afe90e02932ff51515ed35f309a69bd36d70b7
|
4
|
+
data.tar.gz: 1c3dc21990343ce26ddd0adf22dd5b648e6f242d5e51d610517185768c9f9ec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 774d0befa8e754c054956e2eaefdc208460bf4f1e7914fb0f92208dfd21b09bcef0d60ba2a255d9543cadd54cc3d0ed8eb8cbf50cd9a89c282bcde42d05b7665
|
7
|
+
data.tar.gz: 71c62909fe69a8899e91eefe7a6bd7ccfb2f56a45561913dc854dc5d9838790ecf75080abb23c3f747e90fbad142ee0e682b14219b82d570a31f17506f334fa2
|
data/Dockerfile.dev
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
FROM opensuse/tumbleweed
|
2
2
|
|
3
3
|
RUN zypper --gpg-auto-import-keys refresh
|
4
|
-
RUN zypper install -y openssh vim iputils
|
4
|
+
RUN zypper install -y openssh vim iputils ruby2.7 ruby2.7-devel ruby2.7-rubygem-cheetah ruby2.7-rubygem-nokogiri
|
5
|
+
RUN gem install git_diff_parser dry-cli
|
5
6
|
|
6
7
|
COPY entrypoint.sh /entrypoint.sh
|
7
8
|
RUN chmod +x /entrypoint.sh
|
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.9)
|
5
5
|
cheetah
|
6
6
|
dry-cli
|
7
|
+
git_diff_parser
|
7
8
|
nokogiri
|
8
9
|
|
9
10
|
GEM
|
@@ -16,12 +17,13 @@ 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)
|
@@ -82,4 +84,4 @@ DEPENDENCIES
|
|
82
84
|
webmock
|
83
85
|
|
84
86
|
BUNDLED WITH
|
85
|
-
2.
|
87
|
+
2.2.8
|
data/README.md
CHANGED
@@ -27,25 +27,6 @@ zypper in ruby2.6-rubygem-obs_deploy
|
|
27
27
|
## Usage
|
28
28
|
|
29
29
|
|
30
|
-
|
31
|
-
### To deploy
|
32
|
-
|
33
|
-
As default it will run in `dry-run` mode (no changes are made)
|
34
|
-
|
35
|
-
#### dry-run:
|
36
|
-
|
37
|
-
`obs_deploy deploy --user root --host localhost`
|
38
|
-
|
39
|
-
or
|
40
|
-
|
41
|
-
`obs_deploy deploy --user root --host localhost --dry-run`
|
42
|
-
|
43
|
-
### deploy
|
44
|
-
|
45
|
-
`obs_deploy deploy --user root --host localhost --no-dry-run`
|
46
|
-
|
47
|
-
|
48
|
-
|
49
30
|
### To check which version is deployed
|
50
31
|
|
51
32
|
`obs_deploy deployed-version [--host <server>]`
|
data/lib/obs_deploy.rb
CHANGED
@@ -10,7 +10,7 @@ module ObsDeploy
|
|
10
10
|
|
11
11
|
def enable_maintenance_mode
|
12
12
|
unless maintenance_mode?
|
13
|
-
content = File.read(path).gsub(/^#{server_flags}
|
13
|
+
content = File.read(path).gsub(/^#{server_flags}="STATUS"$/,
|
14
14
|
apache_status_line(maintenance))
|
15
15
|
write_apache_sysconfig(content)
|
16
16
|
end
|
@@ -18,7 +18,7 @@ module ObsDeploy
|
|
18
18
|
|
19
19
|
def disable_maintenance_mode
|
20
20
|
if maintenance_mode?
|
21
|
-
content = File.read(path).gsub(/^#{server_flags}
|
21
|
+
content = File.read(path).gsub(/^#{server_flags}="STATUS MAINTENANCE"/,
|
22
22
|
apache_status_line(no_maintenance))
|
23
23
|
write_apache_sysconfig(content)
|
24
24
|
end
|
@@ -17,7 +17,6 @@ module ObsDeploy
|
|
17
17
|
register 'available-package', GetPackageVersion, aliases: ['ap']
|
18
18
|
register 'deployed-version', GetDeployedVersion, aliases: ['dv']
|
19
19
|
register 'version', Version, aliases: ['v', '-v', '--version']
|
20
|
-
register 'deploy', Deploy, aliases: ['dp']
|
21
20
|
register 'refresh-repositories', RefreshRepositories, aliases: ['rr']
|
22
21
|
register 'systemctl', Systemctl, aliases: ['sys']
|
23
22
|
register 'pending-migrations', GetPendingMigration, aliases: ['pm']
|
@@ -16,7 +16,7 @@ module ObsDeploy
|
|
16
16
|
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
|
17
17
|
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
puts "Available package: #{ObsDeploy::CheckDiff.new(server: url, product: product).package_version}"
|
21
21
|
end
|
22
22
|
end
|
@@ -1,23 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'openssl'
|
3
4
|
module ObsDeploy
|
4
5
|
module CLI
|
5
6
|
module Commands
|
6
7
|
class GetPendingMigration < Dry::CLI::Command
|
7
|
-
option :url, type: :string, default: 'https://api.opensuse.org', desc: '
|
8
|
-
option :
|
8
|
+
option :url, type: :string, default: 'https://api.opensuse.org', desc: 'where the packages are available to be installed'
|
9
|
+
option :targeturl, type: :string, default: 'https://api.opensuse.org', desc: 'where we actually want to deploy '
|
10
|
+
option :ignore_certificate, aliases: ['k'], type: :boolean, default: false, desc: 'Ignore invalid or self-signed SSL certificates'
|
9
11
|
|
10
|
-
def call(url:, ignore_certificate:, **)
|
12
|
+
def call(url:, targeturl:, ignore_certificate:, **)
|
11
13
|
if ignore_certificate
|
12
14
|
OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
|
13
15
|
OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
|
14
16
|
end
|
15
|
-
|
16
|
-
migrations = ObsDeploy::CheckDiff.new(server: url).migrations
|
17
|
+
|
18
|
+
migrations = ObsDeploy::CheckDiff.new(server: url, target_server: targeturl).migrations
|
19
|
+
|
17
20
|
if migrations.empty?
|
18
21
|
puts 'No pending migrations'
|
22
|
+
exit(0)
|
19
23
|
else
|
20
24
|
puts migrations
|
25
|
+
exit(1)
|
21
26
|
end
|
22
27
|
end
|
23
28
|
end
|
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.
|
4
|
+
version: 0.4.0
|
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-03-11 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
|
@@ -168,7 +182,6 @@ files:
|
|
168
182
|
- lib/obs_deploy/apache_sysconfig.rb
|
169
183
|
- lib/obs_deploy/check_diff.rb
|
170
184
|
- lib/obs_deploy/cli/commands.rb
|
171
|
-
- lib/obs_deploy/cli/commands/deploy.rb
|
172
185
|
- lib/obs_deploy/cli/commands/get_deployed_version.rb
|
173
186
|
- lib/obs_deploy/cli/commands/get_diff.rb
|
174
187
|
- lib/obs_deploy/cli/commands/get_package_version.rb
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ObsDeploy
|
4
|
-
module CLI
|
5
|
-
module Commands
|
6
|
-
class Deploy < Dry::CLI::Command
|
7
|
-
desc 'Deploy obs-api'
|
8
|
-
|
9
|
-
option :user, type: :string, default: 'root', desc: 'User'
|
10
|
-
option :dry_run, type: :boolean, default: true, desc: 'Dry run'
|
11
|
-
option :host, type: :string, default: 'localhost', desc: 'Set the server address'
|
12
|
-
option :port, type: :int, default: 22, desc: 'Set the server port'
|
13
|
-
|
14
|
-
def call(user:, dry_run:, host:, port:, **)
|
15
|
-
ssh_driver = ObsDeploy::SSH.new(user: user, server: host, port: port)
|
16
|
-
zypper = ObsDeploy::Zypper.new(dry_run: dry_run)
|
17
|
-
ssh_driver.run(zypper.update)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|