avm-tools 0.60.0 → 0.62.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/cached_download.rb +39 -0
- data/lib/avm/eac_redmine_base0/core_update.rb +110 -0
- data/lib/avm/eac_redmine_base0/data_unit.rb +27 -0
- data/lib/avm/eac_redmine_base0/deploy.rb +36 -0
- data/lib/avm/eac_redmine_base0/instance.rb +38 -0
- data/lib/avm/launcher/context/instance_manager.rb +76 -0
- data/lib/avm/launcher/context/instance_manager/cached_instance.rb +37 -0
- data/lib/avm/launcher/context/instance_manager/cached_instances.rb +35 -0
- data/lib/avm/launcher/errors/base.rb +10 -0
- data/lib/avm/launcher/errors/non_project.rb +15 -0
- data/lib/avm/launcher/instances/base.rb +94 -0
- data/lib/avm/launcher/instances/base/cache.rb +43 -0
- data/lib/avm/projects/stereotypes/git_subrepo/warp.rb +5 -4
- data/lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb +3 -1
- data/lib/avm/sync.rb +94 -0
- data/lib/avm/tools/runner/eac_redmine_base0.rb +2 -2
- data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +67 -0
- data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +1 -1
- data/lib/avm/tools/runner/git/issue.rb +43 -4
- data/lib/avm/tools/version.rb +1 -1
- data/lib/eac_launcher/context.rb +2 -2
- data/lib/eac_launcher/context/instance_discovery.rb +2 -2
- data/lib/eac_launcher/git/base/dirty_files.rb +1 -1
- data/lib/eac_launcher/git/sub_warp_base.rb +3 -2
- data/lib/eac_launcher/instances.rb +2 -2
- data/lib/eac_launcher/instances/error.rb +7 -3
- data/lib/eac_launcher/paths/logical.rb +2 -2
- data/lib/eac_launcher/publish/base.rb +2 -2
- data/template/avm/{stereotypes/eac_redmine_base0 → eac_redmine_base0}/deploy/config/install.sh.template +0 -0
- data/template/avm/{stereotypes/eac_redmine_base0 → eac_redmine_base0}/deploy/config/secrets.yml +0 -0
- metadata +19 -11
- data/lib/avm/stereotypes/eac_redmine_base0/data_unit.rb +0 -29
- data/lib/avm/stereotypes/eac_redmine_base0/deploy.rb +0 -38
- data/lib/avm/stereotypes/eac_redmine_base0/instance.rb +0 -40
- data/lib/eac_launcher/context/instance_manager.rb +0 -95
- data/lib/eac_launcher/instances/base.rb +0 -91
- data/lib/eac_launcher/instances/base/cache.rb +0 -41
data/lib/avm/tools/version.rb
CHANGED
data/lib/eac_launcher/context.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/core_ext/hash/indifferent_access'
|
4
|
+
require 'avm/launcher/context/instance_manager'
|
4
5
|
require 'eac_ruby_utils/simple_cache'
|
5
6
|
require 'eac_ruby_utils/console/speaker'
|
6
7
|
require 'eac_launcher/context/instance_discovery'
|
7
|
-
require 'eac_launcher/context/instance_manager'
|
8
8
|
require 'eac_launcher/context/settings'
|
9
9
|
require 'eac_launcher/paths/logical'
|
10
10
|
require 'eac_launcher/project'
|
@@ -39,7 +39,7 @@ module EacLauncher
|
|
39
39
|
@settings = ::EacLauncher::Context::Settings.new(build_option(:settings_file))
|
40
40
|
@cache_root = build_option(:cache_root)
|
41
41
|
@publish_options = { new: false, confirm: false, stereotype: nil }
|
42
|
-
@instance_manager = ::
|
42
|
+
@instance_manager = ::Avm::Launcher::Context::InstanceManager.new(self)
|
43
43
|
@recache = false
|
44
44
|
end
|
45
45
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'ruby-progressbar'
|
4
|
-
require '
|
4
|
+
require 'avm/launcher/instances/base'
|
5
5
|
|
6
6
|
module EacLauncher
|
7
7
|
class Context
|
@@ -22,7 +22,7 @@ module EacLauncher
|
|
22
22
|
update_progress_format(path)
|
23
23
|
on_rescued_path_instances(path) do |r|
|
24
24
|
if path.project?
|
25
|
-
parent_instance = ::
|
25
|
+
parent_instance = ::Avm::Launcher::Instances::Base.instanciate(path, parent_instance)
|
26
26
|
r << path
|
27
27
|
end
|
28
28
|
children = path.children
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'avm/projects/stereotype'
|
4
|
+
require 'avm/launcher/errors/base'
|
4
5
|
|
5
6
|
module EacLauncher
|
6
7
|
module Git
|
@@ -11,7 +12,7 @@ module EacLauncher
|
|
11
12
|
r = find_parent_instance(instance.parent)
|
12
13
|
return r if r
|
13
14
|
|
14
|
-
::EacLauncher::Instances::
|
15
|
+
::EacLauncher::Instances::Errors::Base.new('Git parent not found')
|
15
16
|
end
|
16
17
|
|
17
18
|
def find_parent_instance(current)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require '
|
3
|
+
require 'avm/launcher/errors/base'
|
4
|
+
require 'avm/launcher/instances/base'
|
5
5
|
require 'eac_launcher/instances/runner_helper'
|
6
6
|
require 'eac_launcher/instances/settings'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'avm/stereotypes'
|
3
|
+
require 'avm/projects/stereotypes'
|
4
4
|
require 'eac_launcher/paths/real'
|
5
5
|
|
6
6
|
module EacLauncher
|
@@ -68,7 +68,7 @@ module EacLauncher
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def warped_uncached
|
71
|
-
if is_a?(::
|
71
|
+
if is_a?(::Avm::Launcher::Instances::Base)
|
72
72
|
stereotypes.each do |s|
|
73
73
|
return s.warp_class.new(self) if s.warp_class
|
74
74
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'avm/launcher/errors/base'
|
4
4
|
|
5
5
|
module EacLauncher
|
6
6
|
module Publish
|
@@ -35,7 +35,7 @@ module EacLauncher
|
|
35
35
|
|
36
36
|
def check_with_rescue
|
37
37
|
internal_check
|
38
|
-
rescue ::EacLauncher::Instances::
|
38
|
+
rescue ::EacLauncher::Instances::Errors::Base => e
|
39
39
|
::EacLauncher::Publish::CheckResult.blocked("Error: #{e}")
|
40
40
|
rescue ::EacLauncher::Git::Error => e
|
41
41
|
::EacLauncher::Publish::CheckResult.blocked("Git error: #{e}")
|
File without changes
|
data/template/avm/{stereotypes/eac_redmine_base0 → eac_redmine_base0}/deploy/config/secrets.yml
RENAMED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avm-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.62.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -274,6 +274,7 @@ files:
|
|
274
274
|
- Gemfile
|
275
275
|
- exe/avm
|
276
276
|
- lib/avm.rb
|
277
|
+
- lib/avm/cached_download.rb
|
277
278
|
- lib/avm/configs.rb
|
278
279
|
- lib/avm/data.rb
|
279
280
|
- lib/avm/data/instance.rb
|
@@ -289,6 +290,10 @@ files:
|
|
289
290
|
- lib/avm/docker/image.rb
|
290
291
|
- lib/avm/docker/registry.rb
|
291
292
|
- lib/avm/docker/runner.rb
|
293
|
+
- lib/avm/eac_redmine_base0/core_update.rb
|
294
|
+
- lib/avm/eac_redmine_base0/data_unit.rb
|
295
|
+
- lib/avm/eac_redmine_base0/deploy.rb
|
296
|
+
- lib/avm/eac_redmine_base0/instance.rb
|
292
297
|
- lib/avm/executables.rb
|
293
298
|
- lib/avm/files.rb
|
294
299
|
- lib/avm/files/formatter.rb
|
@@ -358,6 +363,13 @@ files:
|
|
358
363
|
- lib/avm/instances/entries.rb
|
359
364
|
- lib/avm/instances/entries/entry_reader.rb
|
360
365
|
- lib/avm/instances/entry_keys.rb
|
366
|
+
- lib/avm/launcher/context/instance_manager.rb
|
367
|
+
- lib/avm/launcher/context/instance_manager/cached_instance.rb
|
368
|
+
- lib/avm/launcher/context/instance_manager/cached_instances.rb
|
369
|
+
- lib/avm/launcher/errors/base.rb
|
370
|
+
- lib/avm/launcher/errors/non_project.rb
|
371
|
+
- lib/avm/launcher/instances/base.rb
|
372
|
+
- lib/avm/launcher/instances/base/cache.rb
|
361
373
|
- lib/avm/local_projects.rb
|
362
374
|
- lib/avm/local_projects/instance.rb
|
363
375
|
- lib/avm/local_projects/jobs/update.rb
|
@@ -405,9 +417,6 @@ files:
|
|
405
417
|
- lib/avm/stereotypes/eac_rails_base0/deploy.rb
|
406
418
|
- lib/avm/stereotypes/eac_rails_base0/instance.rb
|
407
419
|
- lib/avm/stereotypes/eac_redmine_base0.rb
|
408
|
-
- lib/avm/stereotypes/eac_redmine_base0/data_unit.rb
|
409
|
-
- lib/avm/stereotypes/eac_redmine_base0/deploy.rb
|
410
|
-
- lib/avm/stereotypes/eac_redmine_base0/instance.rb
|
411
420
|
- lib/avm/stereotypes/eac_ubuntu_base0.rb
|
412
421
|
- lib/avm/stereotypes/eac_ubuntu_base0/apache.rb
|
413
422
|
- lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb
|
@@ -433,6 +442,7 @@ files:
|
|
433
442
|
- lib/avm/stereotypes/postgresql/instance_with.rb
|
434
443
|
- lib/avm/stereotypes/rails.rb
|
435
444
|
- lib/avm/stereotypes/rails/instance.rb
|
445
|
+
- lib/avm/sync.rb
|
436
446
|
- lib/avm/tools.rb
|
437
447
|
- lib/avm/tools/runner.rb
|
438
448
|
- lib/avm/tools/runner/eac_rails_base0.rb
|
@@ -443,6 +453,7 @@ files:
|
|
443
453
|
- lib/avm/tools/runner/eac_rails_base0/runner.rb
|
444
454
|
- lib/avm/tools/runner/eac_redmine_base0.rb
|
445
455
|
- lib/avm/tools/runner/eac_redmine_base0/bundle.rb
|
456
|
+
- lib/avm/tools/runner/eac_redmine_base0/core_update.rb
|
446
457
|
- lib/avm/tools/runner/eac_redmine_base0/data.rb
|
447
458
|
- lib/avm/tools/runner/eac_redmine_base0/data/dump.rb
|
448
459
|
- lib/avm/tools/runner/eac_redmine_base0/deploy.rb
|
@@ -483,7 +494,6 @@ files:
|
|
483
494
|
- lib/eac_launcher.rb
|
484
495
|
- lib/eac_launcher/context.rb
|
485
496
|
- lib/eac_launcher/context/instance_discovery.rb
|
486
|
-
- lib/eac_launcher/context/instance_manager.rb
|
487
497
|
- lib/eac_launcher/context/settings.rb
|
488
498
|
- lib/eac_launcher/git.rb
|
489
499
|
- lib/eac_launcher/git/base.rb
|
@@ -499,8 +509,6 @@ files:
|
|
499
509
|
- lib/eac_launcher/git/sub_warp_base.rb
|
500
510
|
- lib/eac_launcher/git/warp_base.rb
|
501
511
|
- lib/eac_launcher/instances.rb
|
502
|
-
- lib/eac_launcher/instances/base.rb
|
503
|
-
- lib/eac_launcher/instances/base/cache.rb
|
504
512
|
- lib/eac_launcher/instances/error.rb
|
505
513
|
- lib/eac_launcher/instances/runner_helper.rb
|
506
514
|
- lib/eac_launcher/instances/settings.rb
|
@@ -518,6 +526,8 @@ files:
|
|
518
526
|
- lib/eac_launcher/vendor.rb
|
519
527
|
- lib/eac_launcher/vendor/github.rb
|
520
528
|
- lib/eac_launcher/version.rb
|
529
|
+
- template/avm/eac_redmine_base0/deploy/config/install.sh.template
|
530
|
+
- template/avm/eac_redmine_base0/deploy/config/secrets.yml
|
521
531
|
- template/avm/ruby/gems/generator/gemspec.template
|
522
532
|
- template/avm/ruby/gems/generator/root_lib.template
|
523
533
|
- template/avm/ruby/gems/generator/static/Gemfile
|
@@ -527,8 +537,6 @@ files:
|
|
527
537
|
- template/avm/self/docker_image/Dockerfile
|
528
538
|
- template/avm/self/docker_image/entrypoint.sh
|
529
539
|
- template/avm/stereotypes/eac_rails_base0/deploy/config/database.yml.template
|
530
|
-
- template/avm/stereotypes/eac_redmine_base0/deploy/config/install.sh.template
|
531
|
-
- template/avm/stereotypes/eac_redmine_base0/deploy/config/secrets.yml
|
532
540
|
- template/avm/stereotypes/eac_ubuntu_base0/docker_image/Dockerfile
|
533
541
|
- template/avm/stereotypes/eac_webapp_base0/apache_host/no_ssl.conf
|
534
542
|
- template/avm/stereotypes/eac_wordpress_base0/deploy/wp-config.php.template
|
@@ -966,7 +974,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
966
974
|
- !ruby/object:Gem::Version
|
967
975
|
version: '0'
|
968
976
|
requirements: []
|
969
|
-
rubygems_version: 3.0.
|
977
|
+
rubygems_version: 3.0.8
|
970
978
|
signing_key:
|
971
979
|
specification_version: 4
|
972
980
|
summary: Tools for AVM.
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/data/instance/unit'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
require 'open-uri'
|
6
|
-
|
7
|
-
module Avm
|
8
|
-
module Stereotypes
|
9
|
-
module EacRedmineBase0
|
10
|
-
class DataUnit < ::Avm::Data::Instance::Unit
|
11
|
-
common_constructor :instance
|
12
|
-
|
13
|
-
EXTENSION = '.tar'
|
14
|
-
|
15
|
-
def do_dump(data_path)
|
16
|
-
::File.open(data_path, 'wb') do |file|
|
17
|
-
file << URI.parse(export_url).read
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def export_url
|
22
|
-
uri = ::Addressable::URI.parse(instance.read_entry('web.url')) + '/backup/export'
|
23
|
-
uri.query_values = { key: instance.read_entry('admin.api_key') }
|
24
|
-
uri.to_s
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/stereotypes/eac_webapp_base0/deploy'
|
4
|
-
require 'eac_ruby_utils/ruby'
|
5
|
-
|
6
|
-
module Avm
|
7
|
-
module Stereotypes
|
8
|
-
module EacRedmineBase0
|
9
|
-
class Deploy < ::Avm::Stereotypes::EacWebappBase0::Deploy
|
10
|
-
set_callback :assert_instance_branch, :after, :run_installer
|
11
|
-
|
12
|
-
def run_installer
|
13
|
-
infom 'Running installer'
|
14
|
-
::EacRubyUtils::Ruby.on_clean_environment do
|
15
|
-
installer_command.system!
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def installer_command
|
20
|
-
instance.host_env.command(installer_path, install_task)
|
21
|
-
end
|
22
|
-
|
23
|
-
def installer_path
|
24
|
-
::File.join(instance.read_entry(:fs_path), 'plugins', 'redmine_installer', 'installer',
|
25
|
-
'run.sh')
|
26
|
-
end
|
27
|
-
|
28
|
-
def install_task
|
29
|
-
if instance.read_entry_optional('web.path').present?
|
30
|
-
'redmine_as_apache_path'
|
31
|
-
else
|
32
|
-
'redmine_as_apache_base'
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'avm/stereotypes/eac_redmine_base0/data_unit'
|
4
|
-
require 'avm/stereotypes/eac_ubuntu_base0/docker_image'
|
5
|
-
require 'avm/stereotypes/eac_webapp_base0/instance'
|
6
|
-
require 'avm/stereotypes/rails/instance'
|
7
|
-
|
8
|
-
module Avm
|
9
|
-
module Stereotypes
|
10
|
-
module EacRedmineBase0
|
11
|
-
class Instance < ::Avm::Stereotypes::EacWebappBase0::Instance
|
12
|
-
include ::Avm::Stereotypes::Rails::Instance
|
13
|
-
|
14
|
-
FILES_UNITS = { files: 'files' }.freeze
|
15
|
-
|
16
|
-
def docker_image_class
|
17
|
-
::Avm::Stereotypes::EacUbuntuBase0::DockerImage
|
18
|
-
end
|
19
|
-
|
20
|
-
def docker_run_arguments
|
21
|
-
[
|
22
|
-
'--volume', "#{read_entry(:fs_path)}:/home/myuser/eac_redmine_base0",
|
23
|
-
'--publish', "#{read_entry(:ssh_port)}:22",
|
24
|
-
'--publish', "#{read_entry(:http_port)}:80",
|
25
|
-
'--publish', "#{read_entry(:https_port)}:443"
|
26
|
-
]
|
27
|
-
end
|
28
|
-
|
29
|
-
def data_package
|
30
|
-
@data_package ||= ::Avm::Data::Instance::Package.new(
|
31
|
-
self,
|
32
|
-
units: {
|
33
|
-
all: ::Avm::Stereotypes::EacRedmineBase0::DataUnit.new(self)
|
34
|
-
}
|
35
|
-
)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_launcher/publish/check_result'
|
4
|
-
require('yaml')
|
5
|
-
|
6
|
-
module EacLauncher
|
7
|
-
class Context
|
8
|
-
class InstanceManager
|
9
|
-
include ::EacRubyUtils::SimpleCache
|
10
|
-
|
11
|
-
def initialize(context)
|
12
|
-
@context = context
|
13
|
-
end
|
14
|
-
|
15
|
-
def publish_state_set(instance, stereotype_name, check_status)
|
16
|
-
data = cached_instances_file_content_uncached
|
17
|
-
data[instance.logical] ||= {}
|
18
|
-
data[instance.logical][:publish_state] ||= {}
|
19
|
-
data[instance.logical][:publish_state][stereotype_name] = check_status
|
20
|
-
write_cache_file(data)
|
21
|
-
end
|
22
|
-
|
23
|
-
def pending_instances
|
24
|
-
instances.select { |instance| pending_instance?(instance) }
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def instances_uncached
|
30
|
-
(cached_instances || search_instances).select(&:included?)
|
31
|
-
end
|
32
|
-
|
33
|
-
def search_instances
|
34
|
-
cache_instances(::EacLauncher::Context::InstanceDiscovery.new(@context).instances)
|
35
|
-
end
|
36
|
-
|
37
|
-
def cached_instances
|
38
|
-
return nil if @context.recache
|
39
|
-
return nil unless cached_instances_file_content
|
40
|
-
|
41
|
-
CachedInstances.new(cached_instances_file_content).instances
|
42
|
-
end
|
43
|
-
|
44
|
-
def cached_instances_file_content_uncached
|
45
|
-
r = YAML.load_file(cache_file_path)
|
46
|
-
r.is_a?(::Hash) ? r : nil
|
47
|
-
rescue Errno::ENOENT
|
48
|
-
nil
|
49
|
-
end
|
50
|
-
|
51
|
-
def cache_instances(instances)
|
52
|
-
write_cache_file(Hash[instances.map { |i| [i.logical, i.to_h] }])
|
53
|
-
instances
|
54
|
-
end
|
55
|
-
|
56
|
-
def write_cache_file(data)
|
57
|
-
::File.write(cache_file_path, data.to_yaml)
|
58
|
-
end
|
59
|
-
|
60
|
-
def cache_file_path
|
61
|
-
::File.join(@context.cache_root, 'instances.yml')
|
62
|
-
end
|
63
|
-
|
64
|
-
def pending_instance?(instance)
|
65
|
-
data = cached_instances_file_content
|
66
|
-
return false unless data[instance.logical]
|
67
|
-
return false unless data[instance.logical][:publish_state].is_a?(Hash)
|
68
|
-
|
69
|
-
data[instance.logical][:publish_state].any? do |_k, v|
|
70
|
-
::EacLauncher::Publish::CheckResult.pending_status?(v)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
class CachedInstances
|
75
|
-
def initialize(content)
|
76
|
-
@content = content
|
77
|
-
@instances = {}
|
78
|
-
end
|
79
|
-
|
80
|
-
def instances
|
81
|
-
@content.keys.map { |k| by_logical_path(k) }
|
82
|
-
end
|
83
|
-
|
84
|
-
def by_logical_path(key)
|
85
|
-
return @instances[key] if @instances.key?(key)
|
86
|
-
|
87
|
-
h = @content[key]
|
88
|
-
parent_instance = h[:parent] ? by_logical_path(h[:parent]) : nil
|
89
|
-
path = ::EacLauncher::Paths::Logical.from_h(@context, h)
|
90
|
-
@instances[key] = ::EacLauncher::Instances::Base.instanciate(path, parent_instance)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|