indocker 0.0.6 → 0.1.0
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 +5 -5
- data/.gitignore +10 -2
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +5 -2
- data/Gemfile.lock +17 -49
- data/LICENSE.txt +17 -18
- data/README.md +33 -1
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/indocker.gemspec +26 -25
- data/lib/indocker.rb +429 -130
- data/lib/indocker/artifacts/git.rb +25 -0
- data/lib/indocker/build_context.rb +87 -0
- data/lib/indocker/build_context_helper.rb +109 -0
- data/lib/indocker/build_context_pool.rb +36 -0
- data/lib/indocker/build_server.rb +2 -0
- data/lib/indocker/colored_string.rb +33 -0
- data/lib/indocker/concerns/inspectable.rb +12 -0
- data/lib/indocker/configuration_deployer.rb +525 -0
- data/lib/indocker/configurations/configuration.rb +122 -0
- data/lib/indocker/configurations/configuration_builder.rb +250 -0
- data/lib/indocker/configurations/formatters/stdout.rb +36 -0
- data/lib/indocker/container_deployer.rb +73 -0
- data/lib/indocker/container_helper.rb +13 -0
- data/lib/indocker/container_runner.rb +23 -0
- data/lib/indocker/containers/container.rb +118 -0
- data/lib/indocker/containers/container_builder.rb +186 -0
- data/lib/indocker/containers/restart_policy.rb +36 -0
- data/lib/indocker/context_args.rb +44 -0
- data/lib/indocker/crontab_redeploy_rules_builder.rb +54 -0
- data/lib/indocker/deploy_context.rb +126 -0
- data/lib/indocker/deployment_checker.rb +121 -0
- data/lib/indocker/deployment_progress.rb +495 -0
- data/lib/indocker/docker.rb +87 -0
- data/lib/indocker/docker_run_args.rb +175 -0
- data/lib/indocker/env_file_helper.rb +13 -0
- data/lib/indocker/env_files/local.rb +8 -0
- data/lib/indocker/env_files/remote.rb +8 -0
- data/lib/indocker/hash_merger.rb +9 -0
- data/lib/indocker/images/image.rb +86 -0
- data/lib/indocker/images/image_builder.rb +98 -0
- data/lib/indocker/images/image_compiler.rb +68 -0
- data/lib/indocker/images/template_compiler.rb +15 -0
- data/lib/indocker/images/templates_compiler.rb +28 -0
- data/lib/indocker/images_compiler.rb +38 -0
- data/lib/indocker/indocker_helper.rb +9 -0
- data/lib/indocker/network.rb +12 -0
- data/lib/indocker/network_helper.rb +7 -0
- data/lib/indocker/registries/abstract.rb +17 -0
- data/lib/indocker/registries/local.rb +5 -0
- data/lib/indocker/registries/remote.rb +12 -0
- data/lib/indocker/repositories/abstract.rb +25 -0
- data/lib/indocker/repositories/clonner.rb +15 -0
- data/lib/indocker/repositories/git.rb +21 -0
- data/lib/indocker/repositories/local.rb +20 -0
- data/lib/indocker/repositories/no_sync.rb +20 -0
- data/lib/indocker/rsync.rb +52 -0
- data/lib/indocker/server.rb +20 -0
- data/lib/indocker/server_pool.rb +30 -0
- data/lib/indocker/shell.rb +60 -0
- data/lib/indocker/ssh_result_logger.rb +18 -0
- data/lib/indocker/ssh_session.rb +92 -0
- data/lib/indocker/version.rb +1 -1
- data/lib/indocker/volume_helper.rb +7 -0
- data/lib/indocker/volumes/external.rb +8 -0
- data/lib/indocker/volumes/local.rb +9 -0
- data/lib/indocker/volumes/repository.rb +9 -0
- metadata +88 -230
- data/bin/indocker +0 -9
- data/lib/indocker/application_initializer.rb +0 -19
- data/lib/indocker/cli.rb +0 -27
- data/lib/indocker/configs/config.rb +0 -147
- data/lib/indocker/configs/config_factory.rb +0 -37
- data/lib/indocker/configs/config_initializer.rb +0 -9
- data/lib/indocker/configs/locator.rb +0 -23
- data/lib/indocker/container/container_builder.rb +0 -29
- data/lib/indocker/container/container_directives_runner.rb +0 -54
- data/lib/indocker/container/container_dsl.rb +0 -83
- data/lib/indocker/container/container_evaluator.rb +0 -13
- data/lib/indocker/container/container_inspector.rb +0 -26
- data/lib/indocker/container/container_manager.rb +0 -122
- data/lib/indocker/container/container_metadata.rb +0 -112
- data/lib/indocker/container/container_metadata_factory.rb +0 -30
- data/lib/indocker/container/container_metadata_repository.rb +0 -27
- data/lib/indocker/directives/base.rb +0 -17
- data/lib/indocker/directives/container_directives/base.rb +0 -23
- data/lib/indocker/directives/container_directives/cmd.rb +0 -7
- data/lib/indocker/directives/container_directives/depends_on.rb +0 -7
- data/lib/indocker/directives/container_directives/env.rb +0 -7
- data/lib/indocker/directives/container_directives/env_file.rb +0 -7
- data/lib/indocker/directives/container_directives/expose.rb +0 -7
- data/lib/indocker/directives/container_directives/from.rb +0 -14
- data/lib/indocker/directives/container_directives/network.rb +0 -12
- data/lib/indocker/directives/container_directives/ports.rb +0 -15
- data/lib/indocker/directives/container_directives/ready.rb +0 -16
- data/lib/indocker/directives/container_directives/volume.rb +0 -23
- data/lib/indocker/directives/image_directives/base.rb +0 -27
- data/lib/indocker/directives/image_directives/cmd.rb +0 -19
- data/lib/indocker/directives/image_directives/copy.rb +0 -32
- data/lib/indocker/directives/image_directives/docker_cp.rb +0 -20
- data/lib/indocker/directives/image_directives/entrypoint.rb +0 -19
- data/lib/indocker/directives/image_directives/env.rb +0 -9
- data/lib/indocker/directives/image_directives/env_file.rb +0 -19
- data/lib/indocker/directives/image_directives/expose.rb +0 -9
- data/lib/indocker/directives/image_directives/from.rb +0 -36
- data/lib/indocker/directives/image_directives/registry.rb +0 -30
- data/lib/indocker/directives/image_directives/run.rb +0 -17
- data/lib/indocker/directives/image_directives/workdir.rb +0 -9
- data/lib/indocker/directives/partial.rb +0 -21
- data/lib/indocker/docker_api/container_config.rb +0 -121
- data/lib/indocker/docker_api/docker_api.rb +0 -207
- data/lib/indocker/dsl_context.rb +0 -21
- data/lib/indocker/envs/env_metadata.rb +0 -39
- data/lib/indocker/envs/loader.rb +0 -19
- data/lib/indocker/errors.rb +0 -21
- data/lib/indocker/git/git_api.rb +0 -32
- data/lib/indocker/git/git_helper.rb +0 -34
- data/lib/indocker/git/git_service.rb +0 -21
- data/lib/indocker/handlers/container_run.rb +0 -20
- data/lib/indocker/handlers/container_stop.rb +0 -17
- data/lib/indocker/handlers/performable.rb +0 -22
- data/lib/indocker/image/image_builder.rb +0 -54
- data/lib/indocker/image/image_dependencies_manager.rb +0 -47
- data/lib/indocker/image/image_directives_runner.rb +0 -99
- data/lib/indocker/image/image_dockerfile_builder.rb +0 -24
- data/lib/indocker/image/image_dsl.rb +0 -89
- data/lib/indocker/image/image_evaluator.rb +0 -21
- data/lib/indocker/image/image_helper.rb +0 -9
- data/lib/indocker/image/image_metadata.rb +0 -50
- data/lib/indocker/image/image_metadata_factory.rb +0 -31
- data/lib/indocker/image/image_metadata_repository.rb +0 -29
- data/lib/indocker/networks/network_metadata.rb +0 -9
- data/lib/indocker/networks/network_metadata_factory.rb +0 -9
- data/lib/indocker/networks/network_metadata_repository.rb +0 -34
- data/lib/indocker/partial/partial_metadata.rb +0 -8
- data/lib/indocker/partial/partial_metadata_repository.rb +0 -26
- data/lib/indocker/registry/registry_api.rb +0 -46
- data/lib/indocker/registry/registry_helper.rb +0 -20
- data/lib/indocker/registry/registry_service.rb +0 -28
- data/lib/indocker/utils/ioc_container.rb +0 -17
- data/lib/indocker/utils/logger.rb +0 -62
- data/lib/indocker/utils/logger_factory.rb +0 -13
- data/lib/indocker/utils/registry_authenticator.rb +0 -19
- data/lib/indocker/utils/render_namespace.rb +0 -11
- data/lib/indocker/utils/render_util.rb +0 -15
- data/lib/indocker/utils/string_utils.rb +0 -11
- data/lib/indocker/utils/tar_helper.rb +0 -40
- data/lib/indocker/utils/test_logger_factory.rb +0 -9
- data/lib/indocker/volumes/volume_metadata.rb +0 -9
- data/lib/indocker/volumes/volume_metadata_factory.rb +0 -9
- data/lib/indocker/volumes/volume_metadata_repository.rb +0 -34
- data/spec/example/.indocker/config.rb +0 -30
- data/spec/example/.indocker/images_and_containers.rb +0 -25
- data/spec/example/assets/index.css +0 -1
- data/spec/example/assets/index.js +0 -1
- data/spec/fixtures/spec.env +0 -2
- data/spec/indocker/configs/config_factory_spec.rb +0 -18
- data/spec/indocker/configs/config_spec.rb +0 -88
- data/spec/indocker/container/container_builder_spec.rb +0 -67
- data/spec/indocker/container/container_manager_spec.rb +0 -278
- data/spec/indocker/docker_api/container_config_spec.rb +0 -64
- data/spec/indocker/docker_api/docker_api_spec.rb +0 -112
- data/spec/indocker/handlers/container_run_spec.rb +0 -60
- data/spec/indocker/image/image_builder_spec.rb +0 -153
- data/spec/indocker/image/image_directives_runner_spec.rb +0 -141
- data/spec/indocker/image/image_dockerfile_builder_spec.rb +0 -25
- data/spec/indocker/image/image_evaluator_spec.rb +0 -85
- data/spec/spec_helper.rb +0 -68
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 91f327fcfb82bd30d26d102d302226fbe32dfacd0c269985311b13606eca5d46
|
|
4
|
+
data.tar.gz: a2aca349450f5c5c6ebc383c71b676f36dc3e45ad9cd33ee0fabafc17bc819fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8d3ec5cbb23b2e2e183f87f04d37dd4bd00e847f805d4864d78c88d721871e6b38082b19523321a77f12a4b9839db0e00a5588bc394e240df0369d59386f1b34
|
|
7
|
+
data.tar.gz: 27477f7cffd4bec8b3ad4abf3c60bc93af5779ee88f97440363bf238d2e04160e4509cf2da3960f5c528c77d3c79f92ce85e94b3ccd64b0aca4559dbdc444de9
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,67 +1,35 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
indocker (0.0
|
|
5
|
-
byebug
|
|
6
|
-
colorize
|
|
7
|
-
docker-api
|
|
8
|
-
docker_registry2
|
|
9
|
-
git
|
|
10
|
-
smart_ioc
|
|
11
|
-
thor
|
|
4
|
+
indocker (0.1.0)
|
|
12
5
|
|
|
13
6
|
GEM
|
|
14
7
|
remote: https://rubygems.org/
|
|
15
8
|
specs:
|
|
16
|
-
byebug (9.1.0)
|
|
17
|
-
colorize (0.8.1)
|
|
18
9
|
diff-lcs (1.3)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
git (1.3.0)
|
|
28
|
-
http-cookie (1.0.3)
|
|
29
|
-
domain_name (~> 0.5)
|
|
30
|
-
mime-types (3.1)
|
|
31
|
-
mime-types-data (~> 3.2015)
|
|
32
|
-
mime-types-data (3.2016.0521)
|
|
33
|
-
multi_json (1.12.2)
|
|
34
|
-
netrc (0.11.0)
|
|
35
|
-
rest-client (2.0.2)
|
|
36
|
-
http-cookie (>= 1.0.2, < 2.0)
|
|
37
|
-
mime-types (>= 1.16, < 4.0)
|
|
38
|
-
netrc (~> 0.8)
|
|
39
|
-
rspec (3.7.0)
|
|
40
|
-
rspec-core (~> 3.7.0)
|
|
41
|
-
rspec-expectations (~> 3.7.0)
|
|
42
|
-
rspec-mocks (~> 3.7.0)
|
|
43
|
-
rspec-core (3.7.0)
|
|
44
|
-
rspec-support (~> 3.7.0)
|
|
45
|
-
rspec-expectations (3.7.0)
|
|
10
|
+
rake (10.5.0)
|
|
11
|
+
rspec (3.9.0)
|
|
12
|
+
rspec-core (~> 3.9.0)
|
|
13
|
+
rspec-expectations (~> 3.9.0)
|
|
14
|
+
rspec-mocks (~> 3.9.0)
|
|
15
|
+
rspec-core (3.9.1)
|
|
16
|
+
rspec-support (~> 3.9.1)
|
|
17
|
+
rspec-expectations (3.9.0)
|
|
46
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
|
-
rspec-support (~> 3.
|
|
48
|
-
rspec-mocks (3.
|
|
19
|
+
rspec-support (~> 3.9.0)
|
|
20
|
+
rspec-mocks (3.9.1)
|
|
49
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
|
-
rspec-support (~> 3.
|
|
51
|
-
rspec-support (3.
|
|
52
|
-
smart_ioc (0.2.1)
|
|
53
|
-
thor (0.20.0)
|
|
54
|
-
unf (0.1.4)
|
|
55
|
-
unf_ext
|
|
56
|
-
unf_ext (0.0.7.4)
|
|
22
|
+
rspec-support (~> 3.9.0)
|
|
23
|
+
rspec-support (3.9.2)
|
|
57
24
|
|
|
58
25
|
PLATFORMS
|
|
59
26
|
ruby
|
|
60
27
|
|
|
61
28
|
DEPENDENCIES
|
|
62
|
-
|
|
29
|
+
bundler (~> 1.17)
|
|
63
30
|
indocker!
|
|
64
|
-
|
|
31
|
+
rake (~> 10.0)
|
|
32
|
+
rspec (~> 3.0)
|
|
65
33
|
|
|
66
34
|
BUNDLED WITH
|
|
67
|
-
1.
|
|
35
|
+
1.17.3
|
data/LICENSE.txt
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2020 TODO: Write your name
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
the following conditions:
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
12
11
|
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
15
14
|
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
OF
|
|
22
|
-
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
# InDocker
|
|
2
|
+
|
|
3
|
+
Docker Containers Deployment
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'indocker'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install indocker
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
TODO: Write usage instructions here
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
28
|
+
|
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "indocker"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/indocker.gemspec
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
require_relative 'lib/indocker/version'
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
s.summary = "Indocker"
|
|
7
|
-
s.description = "DSL for build, run and deploy docker containers"
|
|
8
|
-
s.authors = ["Droid Labs"]
|
|
9
|
-
s.email = 'hello@droidlabs.pro'
|
|
10
|
-
|
|
11
|
-
s.files = `git ls-files`.split($/)
|
|
12
|
-
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
13
|
-
s.test_files = s.files.grep(%r{^(spec)/})
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "indocker/version"
|
|
14
5
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
s.add_dependency "docker_registry2"
|
|
21
|
-
s.add_dependency "thor"
|
|
22
|
-
s.add_dependency "colorize"
|
|
23
|
-
s.add_dependency "git"
|
|
24
|
-
s.add_dependency "byebug" # TODO: remove after release
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "indocker"
|
|
8
|
+
spec.version = Indocker::VERSION
|
|
9
|
+
spec.authors = ["Ruslan Gatiyatov", "Iskander Khaziev"]
|
|
10
|
+
spec.email = ["gvalmon@gmail.com"]
|
|
25
11
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
spec.summary = %q{Docker Containers Deployment}
|
|
13
|
+
spec.description = %q{Docker Containers Deployment}
|
|
14
|
+
spec.homepage = "https://github.com/ArtStation/indocker"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
21
|
+
end
|
|
22
|
+
spec.bindir = "exe"
|
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
|
+
spec.require_paths = ["lib"]
|
|
25
|
+
|
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
29
|
+
end
|
data/lib/indocker.rb
CHANGED
|
@@ -1,155 +1,454 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "indocker/version"
|
|
2
|
+
require 'logger'
|
|
3
|
+
$LOAD_PATH << File.join(__dir__, 'indocker')
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
require_relative 'indocker/colored_string'
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
module Indocker
|
|
8
|
+
module Repositories
|
|
9
|
+
autoload :Abstract, 'repositories/abstract'
|
|
10
|
+
autoload :Git, 'repositories/git'
|
|
11
|
+
autoload :Local, 'repositories/local'
|
|
12
|
+
autoload :NoSync, 'repositories/no_sync'
|
|
13
|
+
autoload :Clonner, 'repositories/clonner'
|
|
14
|
+
end
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
require 'indocker/errors'
|
|
15
|
-
require 'indocker/cli'
|
|
16
|
-
require 'indocker/dsl_context'
|
|
17
|
-
|
|
18
|
-
require 'indocker/docker_api/docker_api'
|
|
19
|
-
require 'indocker/docker_api/container_config'
|
|
20
|
-
|
|
21
|
-
require 'indocker/configs/config'
|
|
22
|
-
require 'indocker/configs/config_factory'
|
|
23
|
-
require 'indocker/configs/locator'
|
|
24
|
-
require 'indocker/configs/config_initializer'
|
|
25
|
-
|
|
26
|
-
require 'indocker/utils/logger'
|
|
27
|
-
require 'indocker/utils/logger_factory'
|
|
28
|
-
require 'indocker/utils/test_logger_factory'
|
|
29
|
-
require 'indocker/utils/tar_helper'
|
|
30
|
-
require 'indocker/utils/string_utils'
|
|
31
|
-
require 'indocker/utils/registry_authenticator'
|
|
32
|
-
require 'indocker/utils/render_util'
|
|
33
|
-
require 'indocker/utils/render_namespace'
|
|
34
|
-
|
|
35
|
-
require 'indocker/handlers/performable'
|
|
36
|
-
require 'indocker/handlers/container_run'
|
|
37
|
-
require 'indocker/handlers/container_stop'
|
|
38
|
-
|
|
39
|
-
require 'indocker/utils/ioc_container'
|
|
40
|
-
|
|
41
|
-
require 'indocker/envs/env_metadata'
|
|
42
|
-
require 'indocker/envs/loader'
|
|
43
|
-
|
|
44
|
-
require 'indocker/registry/registry_helper'
|
|
45
|
-
require 'indocker/registry/registry_service'
|
|
46
|
-
require 'indocker/registry/registry_api'
|
|
47
|
-
|
|
48
|
-
require 'indocker/image/image_metadata'
|
|
49
|
-
require 'indocker/image/image_metadata_factory'
|
|
50
|
-
require 'indocker/image/image_dsl'
|
|
51
|
-
require 'indocker/image/image_metadata_repository'
|
|
52
|
-
require 'indocker/image/image_builder'
|
|
53
|
-
require 'indocker/image/image_dependencies_manager'
|
|
54
|
-
require 'indocker/image/image_evaluator'
|
|
55
|
-
require 'indocker/image/image_dockerfile_builder'
|
|
56
|
-
require 'indocker/image/image_directives_runner'
|
|
57
|
-
|
|
58
|
-
require 'indocker/container/container_metadata'
|
|
59
|
-
require 'indocker/container/container_metadata_repository'
|
|
60
|
-
require 'indocker/container/container_metadata_factory'
|
|
61
|
-
require 'indocker/container/container_manager'
|
|
62
|
-
require 'indocker/container/container_evaluator'
|
|
63
|
-
require 'indocker/container/container_dsl'
|
|
64
|
-
require 'indocker/container/container_builder'
|
|
65
|
-
require 'indocker/container/container_directives_runner'
|
|
66
|
-
|
|
67
|
-
require 'indocker/partial/partial_metadata'
|
|
68
|
-
require 'indocker/partial/partial_metadata_repository'
|
|
69
|
-
|
|
70
|
-
require 'indocker/directives/base'
|
|
71
|
-
require 'indocker/directives/partial'
|
|
72
|
-
|
|
73
|
-
require 'indocker/networks/network_metadata'
|
|
74
|
-
require 'indocker/networks/network_metadata_factory'
|
|
75
|
-
require 'indocker/networks/network_metadata_repository'
|
|
76
|
-
|
|
77
|
-
require 'indocker/volumes/volume_metadata'
|
|
78
|
-
require 'indocker/volumes/volume_metadata_factory'
|
|
79
|
-
require 'indocker/volumes/volume_metadata_repository'
|
|
80
|
-
|
|
81
|
-
require 'indocker/directives/image_directives/base'
|
|
82
|
-
require 'indocker/directives/image_directives/cmd'
|
|
83
|
-
require 'indocker/directives/image_directives/entrypoint'
|
|
84
|
-
require 'indocker/directives/image_directives/env'
|
|
85
|
-
require 'indocker/directives/image_directives/copy'
|
|
86
|
-
require 'indocker/directives/image_directives/from'
|
|
87
|
-
require 'indocker/directives/image_directives/run'
|
|
88
|
-
require 'indocker/directives/image_directives/workdir'
|
|
89
|
-
require 'indocker/directives/image_directives/expose'
|
|
90
|
-
require 'indocker/directives/image_directives/env_file'
|
|
91
|
-
require 'indocker/directives/image_directives/docker_cp'
|
|
92
|
-
require 'indocker/directives/image_directives/registry'
|
|
93
|
-
|
|
94
|
-
require 'indocker/directives/container_directives/base'
|
|
95
|
-
require 'indocker/directives/container_directives/from'
|
|
96
|
-
require 'indocker/directives/container_directives/network'
|
|
97
|
-
require 'indocker/directives/container_directives/ports'
|
|
98
|
-
require 'indocker/directives/container_directives/expose'
|
|
99
|
-
require 'indocker/directives/container_directives/depends_on'
|
|
100
|
-
require 'indocker/directives/container_directives/ready'
|
|
101
|
-
require 'indocker/directives/container_directives/cmd'
|
|
102
|
-
require 'indocker/directives/container_directives/volume'
|
|
103
|
-
require 'indocker/directives/container_directives/env_file'
|
|
104
|
-
require 'indocker/directives/container_directives/env'
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
require 'indocker/git/git_helper'
|
|
16
|
+
module Configurations
|
|
17
|
+
autoload :Configuration, 'configurations/configuration'
|
|
18
|
+
autoload :ConfigurationBuilder, 'configurations/configuration_builder'
|
|
108
19
|
|
|
109
|
-
module
|
|
110
|
-
|
|
20
|
+
module Formatters
|
|
21
|
+
autoload :Stdout, 'configurations/formatters/stdout'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
module Registries
|
|
26
|
+
autoload :Abstract, 'registries/abstract'
|
|
27
|
+
autoload :Local, 'registries/local'
|
|
28
|
+
autoload :Remote, 'registries/remote'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
module Concerns
|
|
32
|
+
autoload :Inspectable, 'concerns/inspectable'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
module Images
|
|
36
|
+
autoload :Image, 'images/image'
|
|
37
|
+
autoload :ImageBuilder, 'images/image_builder'
|
|
38
|
+
autoload :ImageCompiler, 'images/image_compiler'
|
|
39
|
+
autoload :TemplateCompiler, 'images/template_compiler'
|
|
40
|
+
autoload :TemplatesCompiler, 'images/templates_compiler'
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
module Containers
|
|
44
|
+
autoload :Container, 'containers/container'
|
|
45
|
+
autoload :ContainerBuilder, 'containers/container_builder'
|
|
46
|
+
autoload :RestartPolicy, 'containers/restart_policy'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
module Volumes
|
|
50
|
+
autoload :Local, 'volumes/local'
|
|
51
|
+
autoload :External, 'volumes/external'
|
|
52
|
+
autoload :Repository, 'volumes/repository'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
module EnvFiles
|
|
56
|
+
autoload :Local, 'env_files/local'
|
|
57
|
+
autoload :Remote, 'env_files/remote'
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
module Artifacts
|
|
61
|
+
autoload :Git, 'artifacts/git'
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
autoload :HashMerger, 'hash_merger'
|
|
65
|
+
autoload :BuildServer, 'build_server'
|
|
66
|
+
autoload :Server, 'server'
|
|
67
|
+
autoload :ConfigurationDeployer, 'configuration_deployer'
|
|
68
|
+
autoload :SshSession, 'ssh_session'
|
|
69
|
+
autoload :BuildContextPool, 'build_context_pool'
|
|
70
|
+
autoload :BuildContext, 'build_context'
|
|
71
|
+
autoload :BuildContextHelper, 'build_context_helper'
|
|
72
|
+
autoload :Shell, 'shell'
|
|
73
|
+
autoload :Docker, 'docker'
|
|
74
|
+
autoload :ContextArgs, 'context_args'
|
|
75
|
+
autoload :Network, 'network'
|
|
76
|
+
autoload :ContainerDeployer, 'container_deployer'
|
|
77
|
+
autoload :ServerPool, 'server_pool'
|
|
78
|
+
autoload :DeployContext, 'deploy_context'
|
|
79
|
+
autoload :ContainerHelper, 'container_helper'
|
|
80
|
+
autoload :DockerRunArgs, 'docker_run_args'
|
|
81
|
+
autoload :VolumeHelper, 'volume_helper'
|
|
82
|
+
autoload :NetworkHelper, 'network_helper'
|
|
83
|
+
autoload :Rsync, 'rsync'
|
|
84
|
+
autoload :EnvFileHelper, 'env_file_helper'
|
|
85
|
+
autoload :IndockerHelper, 'indocker_helper'
|
|
86
|
+
autoload :ImagesCompiler, 'images_compiler'
|
|
87
|
+
autoload :ContainerRunner, 'container_runner'
|
|
88
|
+
autoload :SshResultLogger, 'ssh_result_logger'
|
|
89
|
+
autoload :DeploymentProgress, 'deployment_progress'
|
|
90
|
+
autoload :DeploymentChecker, 'deployment_checker'
|
|
91
|
+
autoload :CrontabRedeployRulesBuilder, 'crontab_redeploy_rules_builder'
|
|
111
92
|
|
|
112
93
|
class << self
|
|
113
|
-
def
|
|
114
|
-
|
|
115
|
-
ioc.image_metadata_factory.create(name, &definition)
|
|
116
|
-
)
|
|
94
|
+
def set_export_command(command)
|
|
95
|
+
@export_command = command
|
|
117
96
|
end
|
|
118
97
|
|
|
119
|
-
def
|
|
120
|
-
|
|
121
|
-
ioc.container_metadata_factory.create(name, attach: attach, &definition)
|
|
122
|
-
)
|
|
98
|
+
def export_command
|
|
99
|
+
@export_command
|
|
123
100
|
end
|
|
124
101
|
|
|
125
|
-
def
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
102
|
+
def set_deploy_dir(val)
|
|
103
|
+
@deploy_dir = val
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def set_root_dir(val)
|
|
107
|
+
@root_dir = val
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def deploy_dir
|
|
111
|
+
if @deploy_dir
|
|
112
|
+
@deploy_dir
|
|
113
|
+
else
|
|
114
|
+
raise ArgumentError.new("deploy dir was not specified")
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def root_dir
|
|
119
|
+
if @root_dir
|
|
120
|
+
File.expand_path(@root_dir)
|
|
121
|
+
else
|
|
122
|
+
raise ArgumentError.new("root dir was not specified")
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def add_artifact(artifact)
|
|
127
|
+
artifacts.push(artifact)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def add_repository(repository)
|
|
131
|
+
if !repository.is_a?(Indocker::Repositories::Abstract)
|
|
132
|
+
raise ArgumentError.new("should be an instance of Indocker::Repositories::Abstract, got: #{repository.inspect}")
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
repositories.push(repository)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def add_registry(registry)
|
|
139
|
+
if !registry.is_a?(Indocker::Registries::Abstract)
|
|
140
|
+
raise ArgumentError.new("should be an instance of Indocker::Registries::Abstract, got: #{registry.inspect}")
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
registries.push(registry)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def add_server(server)
|
|
147
|
+
if !server.is_a?(Indocker::Server)
|
|
148
|
+
raise ArgumentError.new("should be an instance of Indocker::Server, got: #{server.inspect}")
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
existing = servers.detect {|s| s == server}
|
|
152
|
+
|
|
153
|
+
if existing
|
|
154
|
+
raise ArgumentError.new("server with name #{server.name} was already defined")
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
servers.push(server)
|
|
129
158
|
end
|
|
130
159
|
|
|
131
160
|
def define_network(name)
|
|
132
|
-
|
|
133
|
-
|
|
161
|
+
if networks.detect {|n| n.name == name}
|
|
162
|
+
raise ArgumentError.new("network :#{name} was already defined")
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
networks.push(Indocker::Network.new(name))
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def container_files
|
|
169
|
+
@container_files || (raise ArgumentError.new("container files were not found. Set bounded contexts dir"))
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def image_files
|
|
173
|
+
@image_files || (raise ArgumentError.new("image files were not found. Set bounded contexts dir"))
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def set_bounded_contexts_dir(path)
|
|
177
|
+
@container_files = {}
|
|
178
|
+
|
|
179
|
+
Dir[File.join(path, '**/container.rb')].map do |path|
|
|
180
|
+
name = path.gsub('/container.rb', '').split('/').last.to_sym
|
|
181
|
+
@container_files[name] = path
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
@image_files = {}
|
|
185
|
+
|
|
186
|
+
Dir[File.join(path, '**/image.rb')].map do |path|
|
|
187
|
+
name = path.gsub('/image.rb', '').split('/').last.to_sym
|
|
188
|
+
@image_files[name] = path
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def define_env_file(env_file)
|
|
193
|
+
if env_files.detect {|ef| ef.name == env_file.name}
|
|
194
|
+
Indocker.logger.error("env file :#{env_file.name} was already defined")
|
|
195
|
+
exit 1
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
env_files.push(env_file)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def define_volume(volume)
|
|
202
|
+
if volumes.detect { |v| v.name == volume.name}
|
|
203
|
+
raise ArgumentError.new("volume :#{volume.name} was already defined")
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
volumes.push(volume)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def add_build_server(build_server)
|
|
210
|
+
if !build_server.is_a?(Indocker::BuildServer)
|
|
211
|
+
raise ArgumentError.new("should be an instance of Indocker::BuildServer, got: #{build_server.inspect}")
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
existing = build_servers.detect {|s| s == build_server}
|
|
215
|
+
|
|
216
|
+
if existing
|
|
217
|
+
raise ArgumentError.new("build server with name #{build_server.name} was already defined")
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
build_servers.push(build_server)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def repositories
|
|
224
|
+
@repositories ||= []
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
def registries
|
|
228
|
+
@registries ||= []
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def networks
|
|
232
|
+
@networks ||= []
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def volumes
|
|
236
|
+
@volumes ||= []
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def servers
|
|
240
|
+
@servers ||= []
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def artifacts
|
|
244
|
+
@artifacts ||= []
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
def build_servers
|
|
248
|
+
@build_servers ||= []
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def env_files
|
|
252
|
+
@env_files ||= []
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def configuration
|
|
256
|
+
@configuration || (raise ArgumentError.new("no configuration provided"))
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def images
|
|
260
|
+
@images ||= []
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def containers
|
|
264
|
+
@containers ||= []
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def build_configuration(name)
|
|
268
|
+
builder = Indocker::Configurations::ConfigurationBuilder.new(
|
|
269
|
+
name: name,
|
|
270
|
+
repositories: repositories,
|
|
271
|
+
registries: registries,
|
|
272
|
+
servers: servers,
|
|
273
|
+
build_servers: build_servers,
|
|
274
|
+
volumes: volumes,
|
|
275
|
+
networks: networks,
|
|
276
|
+
env_files: env_files,
|
|
277
|
+
containers: containers,
|
|
134
278
|
)
|
|
279
|
+
|
|
280
|
+
@configuration = builder.configuration
|
|
281
|
+
builder
|
|
135
282
|
end
|
|
136
283
|
|
|
137
|
-
def
|
|
138
|
-
|
|
139
|
-
|
|
284
|
+
def define_image(name)
|
|
285
|
+
path = caller[0].split(':').first
|
|
286
|
+
|
|
287
|
+
if !(path =~ /\/image.rb$/)
|
|
288
|
+
Indocker.logger.error("image :#{name} should be defined in image.rb file")
|
|
289
|
+
exit 1
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
builder = Indocker::Images::ImageBuilder.new(
|
|
293
|
+
name: name,
|
|
294
|
+
configuration: configuration,
|
|
295
|
+
dir: path.split('image.rb').first
|
|
140
296
|
)
|
|
297
|
+
|
|
298
|
+
images.push(builder.image)
|
|
299
|
+
|
|
300
|
+
builder
|
|
141
301
|
end
|
|
142
302
|
|
|
143
|
-
def
|
|
144
|
-
|
|
303
|
+
def define_container(name)
|
|
304
|
+
builder = Indocker::Containers::ContainerBuilder.new(
|
|
305
|
+
name: name,
|
|
306
|
+
configuration: configuration,
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
containers.push(builder.container)
|
|
310
|
+
builder
|
|
145
311
|
end
|
|
146
312
|
|
|
147
|
-
def
|
|
148
|
-
|
|
313
|
+
def deploy(containers: [], skip_tags: [], tags: [], skip_dependent: false, skip_containers: [], servers: [], skip_build: false, force_restart: false, skip_force_restart: [], auto_confirm: false, require_confirmation: false)
|
|
314
|
+
Indocker::ConfigurationDeployer
|
|
315
|
+
.new(Indocker.logger)
|
|
316
|
+
.run(
|
|
317
|
+
configuration: configuration,
|
|
318
|
+
deploy_containers: containers,
|
|
319
|
+
deploy_tags: tags,
|
|
320
|
+
skip_dependent: skip_dependent,
|
|
321
|
+
skip_containers: skip_containers,
|
|
322
|
+
servers: servers,
|
|
323
|
+
skip_build: skip_build,
|
|
324
|
+
force_restart: force_restart,
|
|
325
|
+
skip_tags: skip_tags,
|
|
326
|
+
skip_force_restart: skip_force_restart,
|
|
327
|
+
auto_confirm: auto_confirm,
|
|
328
|
+
require_confirmation: require_confirmation,
|
|
329
|
+
)
|
|
149
330
|
end
|
|
150
331
|
|
|
151
|
-
def
|
|
152
|
-
|
|
332
|
+
def check(servers: [])
|
|
333
|
+
Indocker::DeploymentChecker
|
|
334
|
+
.new(Indocker.logger)
|
|
335
|
+
.run(
|
|
336
|
+
configuration: configuration,
|
|
337
|
+
servers: servers,
|
|
338
|
+
)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def launched?(contaner_name, servers: [])
|
|
342
|
+
silent_logger = Logger.new(File.open(File::NULL, "w"))
|
|
343
|
+
Indocker::DeploymentChecker
|
|
344
|
+
.new(silent_logger, silent_logger)
|
|
345
|
+
.launched?(
|
|
346
|
+
contaner_name,
|
|
347
|
+
configuration: configuration,
|
|
348
|
+
servers: servers,
|
|
349
|
+
)
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def compile(images:, skip_dependent:)
|
|
353
|
+
Indocker::ImagesCompiler
|
|
354
|
+
.new(Indocker.logger)
|
|
355
|
+
.compile(
|
|
356
|
+
configuration: configuration,
|
|
357
|
+
image_list: images,
|
|
358
|
+
skip_dependent: skip_dependent,
|
|
359
|
+
)
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
def run(container_name, force_restart)
|
|
363
|
+
Indocker::ContainerRunner
|
|
364
|
+
.new(Indocker.logger)
|
|
365
|
+
.run(
|
|
366
|
+
configuration: configuration,
|
|
367
|
+
container_name: container_name,
|
|
368
|
+
force_restart: force_restart
|
|
369
|
+
)
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
def global_build_args
|
|
373
|
+
Indocker::ContextArgs.new(nil, configuration.global_build_args, nil)
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
def helper
|
|
377
|
+
Indocker::BuildContextHelper.new(Indocker.configuration, nil)
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def logger
|
|
381
|
+
@logger ||= begin
|
|
382
|
+
logger = if @log_level == Logger::DEBUG
|
|
383
|
+
Logger.new(STDOUT)
|
|
384
|
+
else
|
|
385
|
+
Logger.new(File.open(File::NULL, "w"))
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
logger.level = @log_level || Logger::INFO
|
|
389
|
+
|
|
390
|
+
logger.formatter = proc do |severity, datetime, progname, msg|
|
|
391
|
+
level = Logger::SEV_LABEL.index(severity)
|
|
392
|
+
|
|
393
|
+
severity = case level
|
|
394
|
+
when Logger::INFO
|
|
395
|
+
severity.green
|
|
396
|
+
when Logger::WARN
|
|
397
|
+
severity.purple
|
|
398
|
+
when Logger::DEBUG
|
|
399
|
+
severity.yellow
|
|
400
|
+
when Logger::ERROR
|
|
401
|
+
severity.red
|
|
402
|
+
when Logger::FATAL
|
|
403
|
+
severity.red
|
|
404
|
+
else
|
|
405
|
+
severity
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
severity = severity.downcase
|
|
409
|
+
|
|
410
|
+
if logger.debug?
|
|
411
|
+
if msg == "{timestamp}"
|
|
412
|
+
""
|
|
413
|
+
else
|
|
414
|
+
"#{datetime.strftime("%Y/%m/%d %H:%M:%S")} #{severity}: #{msg}\n"
|
|
415
|
+
end
|
|
416
|
+
else
|
|
417
|
+
# Use a nicer logging for not debug
|
|
418
|
+
if msg == "{timestamp}"
|
|
419
|
+
datetime.strftime("%Y/%m/%d %H:%M:%S\n").grey
|
|
420
|
+
else
|
|
421
|
+
" #{severity}: #{msg}\n"
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
logger
|
|
427
|
+
end
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
def set_log_level(level)
|
|
431
|
+
@log_level = level
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
def set_dockerignore(ignore_list)
|
|
435
|
+
@dockerignore = ignore_list
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
def dockerignore
|
|
439
|
+
@dockerignore || []
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
def build_helper(&proc)
|
|
443
|
+
Indocker::BuildContextHelper.class_exec(&proc)
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
def set_configuration_name(name)
|
|
447
|
+
@configuration_name = name
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
def configuration_name
|
|
451
|
+
@configuration_name || (raise ArgumentError.new("configuration was not specified"))
|
|
153
452
|
end
|
|
154
453
|
end
|
|
155
|
-
end
|
|
454
|
+
end
|