dapp 0.7.9 → 0.7.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/en/common.yml +3 -0
- data/config/en/net_status.yml +28 -30
- data/lib/dapp/cli.rb +9 -9
- data/lib/dapp/cli/bp.rb +2 -2
- data/lib/dapp/cli/build.rb +2 -2
- data/lib/dapp/cli/cleanup.rb +2 -2
- data/lib/dapp/cli/list.rb +2 -2
- data/lib/dapp/cli/push.rb +2 -2
- data/lib/dapp/cli/run.rb +2 -2
- data/lib/dapp/cli/spush.rb +2 -2
- data/lib/dapp/cli/stage_image.rb +2 -2
- data/lib/dapp/cli/stages.rb +6 -6
- data/lib/dapp/cli/stages/cleanup_local.rb +2 -2
- data/lib/dapp/cli/stages/cleanup_repo.rb +2 -2
- data/lib/dapp/cli/stages/flush_local.rb +2 -2
- data/lib/dapp/cli/stages/flush_repo.rb +2 -2
- data/lib/dapp/cli/stages/pull.rb +2 -2
- data/lib/dapp/cli/stages/push.rb +2 -2
- data/lib/dapp/cli/tag.rb +2 -2
- data/lib/dapp/config/artifact_group.rb +4 -4
- data/lib/dapp/config/base.rb +20 -2
- data/lib/dapp/config/dimg/instance_methods.rb +10 -8
- data/lib/dapp/config/directive/artifact.rb +25 -8
- data/lib/dapp/config/directive/artifact_base.rb +6 -5
- data/lib/dapp/config/directive/base.rb +1 -5
- data/lib/dapp/config/directive/chef.rb +2 -2
- data/lib/dapp/config/directive/docker/dimg.rb +3 -3
- data/lib/dapp/config/directive/git_artifact_remote.rb +2 -2
- data/lib/dapp/config/directive/mount.rb +3 -2
- data/lib/dapp/config/directive/shell/dimg.rb +5 -8
- data/lib/dapp/core_ext/hash.rb +1 -1
- data/lib/dapp/image/stage.rb +2 -0
- data/lib/dapp/project/command/common.rb +16 -0
- data/lib/dapp/project/command/push.rb +1 -1
- data/lib/dapp/project/command/run.rb +1 -1
- data/lib/dapp/project/command/spush.rb +2 -2
- data/lib/dapp/project/command/stage_image.rb +1 -1
- data/lib/dapp/project/command/tag.rb +1 -1
- data/lib/dapp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f2da7e934e3e3b6d9e08042e859d7614701c769
|
4
|
+
data.tar.gz: 1358edc575c90ad5b33be8dc024da8e660c241b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2443ae77043f7191132924f08848706514276b915e931dae425e630519a9feca503f22d86355e7c7cc17f6a9b936ae4b54d83d20d149740794d5e62f724453ed
|
7
|
+
data.tar.gz: 5e7326b71d8655d03100169fb492ed3c73f6b2580810dcd06711044eafc2ca002dc4322f2ebe1b6fde4402e1bd7d67eb482ceb8f94bb7c5c9c836c36a3a62482
|
data/config/en/common.yml
CHANGED
@@ -8,6 +8,8 @@ en:
|
|
8
8
|
difference: "difference: %{value} MB"
|
9
9
|
commands: "commands:"
|
10
10
|
instructions: "instructions:"
|
11
|
+
container:
|
12
|
+
launched_command: "Launched command: '%{command}'"
|
11
13
|
process:
|
12
14
|
artifact_copy: "copying artifact '%{name}'"
|
13
15
|
artifact_building: "building artifact '%{name}'"
|
@@ -50,6 +52,7 @@ en:
|
|
50
52
|
another_image_already_tagged: 'WARNING: image with other id already exist.'
|
51
53
|
tag_ignored: "WARNING: tag '%{tag}' ignored."
|
52
54
|
dimg_not_found_in_registry: "WARNING: Dimg not found in registry."
|
55
|
+
stage_artifact_rewritten: "WARNING: Artifact stage rewritten from %{conflict_stage} to %{stage}."
|
53
56
|
group:
|
54
57
|
install_group: 'Install group'
|
55
58
|
setup_group: 'Setup group'
|
data/config/en/net_status.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
en:
|
2
2
|
net_status:
|
3
|
-
missing_translation: "Missing translation for code:
|
3
|
+
missing_translation: "Missing translation for code: `%{code}`!"
|
4
4
|
shellout:
|
5
5
|
shell_command_failed: ">>> START STREAM\n%{stream}\n>>> END STREAM"
|
6
6
|
dimg:
|
@@ -8,9 +8,9 @@ en:
|
|
8
8
|
dimg_not_run: "Dimg run failed!"
|
9
9
|
git_branch_without_name: "Dimg has specific revision that isn't associated with a branch name!"
|
10
10
|
ci_environment_required: 'CI environment required (Travis or GitLab CI)!'
|
11
|
-
chef_stage_checksum_not_calculated: "Chef stage
|
11
|
+
chef_stage_checksum_not_calculated: "Chef stage `%{stage}` checksum is not calculated yet, run build first"
|
12
12
|
dappfile:
|
13
|
-
incorrect: "Dappfile with
|
13
|
+
incorrect: "Dappfile with `%{error}`:\n%{message}"
|
14
14
|
build:
|
15
15
|
from_image_required: 'Missing from_image!'
|
16
16
|
image_already_untagged: "Image `%{name}` already untagged!"
|
@@ -18,51 +18,49 @@ en:
|
|
18
18
|
built_id_not_defined: '`from.built_id` not defined!'
|
19
19
|
from_image_not_found: 'Image `%{name}` not found!'
|
20
20
|
project:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
tag_command_incorrect_tag: "Incorrect tag ('%{name}') given!"
|
26
|
-
repo_name_incorrect: "Incorrect repo ('%{name}') given!"
|
21
|
+
command_unexpected_dimgs_number: "Command can process only one dimg!\nAmbiguous dimg pattern: `%{dimgs_names}`!"
|
22
|
+
no_such_dimg: "No such dimg: `%{dimgs_patterns}`!"
|
23
|
+
tag_command_incorrect_tag: "Incorrect tag (`%{name}`) given!"
|
24
|
+
repo_name_incorrect: "Incorrect repo (`%{name}`) given!"
|
27
25
|
dappfile_not_found: "Dappfile not found!"
|
28
26
|
cannot_run_ssh_agent: "Cannot run ssh-agent"
|
29
|
-
ssh_key_not_found: "Ssh key
|
30
|
-
mrproper_required_option: "Expected command option
|
27
|
+
ssh_key_not_found: "Ssh key `%{path}` not exist!"
|
28
|
+
mrproper_required_option: "Expected command option `--improper-dev-mode-cache`, `--improper-cache-version-stages` or `--all`!"
|
31
29
|
config:
|
32
30
|
dimg_name_required: 'Dimg name required!'
|
33
|
-
dimg_name_incorrect: "Dimg has incorrect name
|
34
|
-
export_to_required: "Export:
|
31
|
+
dimg_name_incorrect: "Dimg has incorrect name `%{name}`: doesn't match regex `%{reg}`!"
|
32
|
+
export_to_required: "Export: `to` directive required!"
|
35
33
|
export_cwd_absolute_path_required: "Export: given cwd path must be absolute!"
|
36
|
-
export_to_absolute_path_required: "Export: given
|
37
|
-
export_include_paths_relative_path_required: "Export: given
|
38
|
-
export_exclude_paths_relative_path_required: "Export: given
|
39
|
-
mount_from_absolute_path_required: "Mount: given
|
40
|
-
mount_from_type_required: "Mount:
|
34
|
+
export_to_absolute_path_required: "Export: given `to` path must be absolute!"
|
35
|
+
export_include_paths_relative_path_required: "Export: given `include_paths` path must be relative!"
|
36
|
+
export_exclude_paths_relative_path_required: "Export: given `exclude_paths` path must be relative!"
|
37
|
+
mount_from_absolute_path_required: "Mount: given `from` path must be absolute!"
|
38
|
+
mount_from_type_required: "Mount: `from` directive expect `build_dir` or `tmp_dir` type!"
|
41
39
|
builder_type_conflict: 'Conflict between builder types!'
|
42
40
|
builder_type_unsupported: "Defined unsupported builder type `%{type}`!"
|
43
41
|
docker_from_incorrect: "`docker.from` has incorrect value `%{name}`!"
|
44
|
-
stage_artifact_not_associated: "Artifact not associated with any stage: expected
|
45
|
-
stage_artifact_double_associate: "
|
46
|
-
stage_artifact_not_supported_associated_stage: "
|
42
|
+
stage_artifact_not_associated: "Artifact not associated with any stage: expected `before` or `after` attribute!"
|
43
|
+
stage_artifact_double_associate: "Cannot use `%{stage}` stage for artifact, already used in `%{conflict_stage}` stage!"
|
44
|
+
stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
|
47
45
|
artifact_conflict: "Conflict between artifacts paths!"
|
48
|
-
scratch_unsupported_directive: "Scratch dimg has unsupported directive
|
46
|
+
scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
|
49
47
|
scratch_artifact_required: "Scratch dimg without artifacts!"
|
50
|
-
scratch_artifact_associated: "Scratch artifact cannot be associated: not expected
|
51
|
-
scratch_artifact_docker_from: "Scratch artifact must have directive
|
48
|
+
scratch_artifact_associated: "Scratch artifact cannot be associated: not expected `before`/`after` attribute!"
|
49
|
+
scratch_artifact_docker_from: "Scratch artifact must have directive `docker.from`!"
|
52
50
|
chef:
|
53
|
-
stage_path_overlap: "Cannot install
|
54
|
-
mdapp_dependency_in_metadata_forbidden: "Using mdapp as dependency in metadata.rb forbidden: detected
|
51
|
+
stage_path_overlap: "Cannot install `%{cookbook}` cookbook's path %{from} into %{to}: already exists"
|
52
|
+
mdapp_dependency_in_metadata_forbidden: "Using mdapp as dependency in metadata.rb forbidden: detected `%{dependency}`"
|
55
53
|
cookbook_path_not_found: "Dapp cookbook directory not found at %{path}"
|
56
54
|
cookbook_berksfile_not_found: "Dapp cookbook Berksfile not found at %{path}"
|
57
55
|
cookbook_metadata_not_found: "Dapp cookbook metadata.rb file not found at %{path}"
|
58
|
-
cookbook_not_specified_in_berksfile: "Dapp cookbook
|
56
|
+
cookbook_not_specified_in_berksfile: "Dapp cookbook `%{name}` not specified in Berksfile at %{path}"
|
59
57
|
registry:
|
60
58
|
incorrect_repo: 'Incorrect repository!'
|
61
59
|
no_such_dimg: 'No such dimg in registry!'
|
62
60
|
authenticate_type_not_supported: 'Registry authenticate type not supported!'
|
63
|
-
page_not_found: "Page
|
61
|
+
page_not_found: "Page `%{url}` not found!"
|
64
62
|
user_not_authorized: 'User not authorized!'
|
65
63
|
response_with_error_status: 'Response with error status!'
|
66
|
-
berksfile_absolute_path_forbidden: "Absolute paths in Berksfile are not allowed (cookbook
|
64
|
+
berksfile_absolute_path_forbidden: "Absolute paths in Berksfile are not allowed (cookbook `%{cookbook}`, path: `%{path}`)"
|
67
65
|
lock:
|
68
|
-
timeout: "Could not obtain lock for
|
66
|
+
timeout: "Could not obtain lock for `%{name}` within %{timeout} seconds"
|
data/lib/dapp/cli.rb
CHANGED
@@ -12,16 +12,16 @@ Usage: dapp [options] sub-command [sub-command options]
|
|
12
12
|
|
13
13
|
Available subcommands: (for details, dapp SUB-COMMAND --help)
|
14
14
|
|
15
|
-
dapp build [options] [
|
16
|
-
dapp bp [options] [
|
17
|
-
dapp push [options] [
|
18
|
-
dapp spush [options] [DIMG
|
19
|
-
dapp tag [options] [DIMG
|
20
|
-
dapp list [options] [
|
21
|
-
dapp run [options] [DIMG
|
22
|
-
dapp cleanup [options] [
|
15
|
+
dapp build [options] [DIMG ...]
|
16
|
+
dapp bp [options] [DIMG ...] REPO
|
17
|
+
dapp push [options] [DIMG ...] REPO
|
18
|
+
dapp spush [options] [DIMG] REPO
|
19
|
+
dapp tag [options] [DIMG] TAG
|
20
|
+
dapp list [options] [DIMG ...]
|
21
|
+
dapp run [options] [DIMG] [DOCKER ARGS]
|
22
|
+
dapp cleanup [options] [DIMG ...]
|
23
23
|
dapp mrproper [options]
|
24
|
-
dapp stage image [options] [DIMG
|
24
|
+
dapp stage image [options] [DIMG]
|
25
25
|
dapp stages
|
26
26
|
|
27
27
|
Options:
|
data/lib/dapp/cli/bp.rb
CHANGED
@@ -6,9 +6,9 @@ module Dapp
|
|
6
6
|
Version: #{Dapp::VERSION}
|
7
7
|
|
8
8
|
Usage:
|
9
|
-
dapp bp [options] [
|
9
|
+
dapp bp [options] [DIMG ...] REPO
|
10
10
|
|
11
|
-
|
11
|
+
DIMG Dapp image to process [default: *].
|
12
12
|
REPO Pushed image name.
|
13
13
|
|
14
14
|
Options:
|
data/lib/dapp/cli/build.rb
CHANGED
data/lib/dapp/cli/cleanup.rb
CHANGED
data/lib/dapp/cli/list.rb
CHANGED
data/lib/dapp/cli/push.rb
CHANGED
data/lib/dapp/cli/run.rb
CHANGED
@@ -6,9 +6,9 @@ module Dapp
|
|
6
6
|
Version: #{Dapp::VERSION}
|
7
7
|
|
8
8
|
Usage:
|
9
|
-
dapp run [options] [DIMG
|
9
|
+
dapp run [options] [DIMG] [DOCKER ARGS]
|
10
10
|
|
11
|
-
DIMG
|
11
|
+
DIMG Dapp image to process [default: *].
|
12
12
|
DOCKER ARGS Docker run options and command separated by '--'
|
13
13
|
|
14
14
|
Options:
|
data/lib/dapp/cli/spush.rb
CHANGED
@@ -6,9 +6,9 @@ module Dapp
|
|
6
6
|
Version: #{Dapp::VERSION}
|
7
7
|
|
8
8
|
Usage:
|
9
|
-
dapp spush [options] [
|
9
|
+
dapp spush [options] [DIMG] REPO
|
10
10
|
|
11
|
-
|
11
|
+
DIMG Dapp image to process [default: *].
|
12
12
|
REPO Pushed image name.
|
13
13
|
|
14
14
|
Options:
|
data/lib/dapp/cli/stage_image.rb
CHANGED
@@ -6,9 +6,9 @@ module Dapp
|
|
6
6
|
Version: #{Dapp::VERSION}
|
7
7
|
|
8
8
|
Usage:
|
9
|
-
dapp stage image [options] [DIMG
|
9
|
+
dapp stage image [options] [DIMG]
|
10
10
|
|
11
|
-
DIMG
|
11
|
+
DIMG Dapp image to process [default: *].
|
12
12
|
|
13
13
|
Options:
|
14
14
|
BANNER
|
data/lib/dapp/cli/stages.rb
CHANGED
@@ -9,12 +9,12 @@ Version: #{Dapp::VERSION}
|
|
9
9
|
|
10
10
|
Available subcommands: (for details, dapp SUB-COMMAND --help)
|
11
11
|
|
12
|
-
dapp stages cleanup local
|
13
|
-
dapp stages cleanup repo
|
14
|
-
dapp stages flush local
|
15
|
-
dapp stages flush repo
|
16
|
-
dapp stages push
|
17
|
-
dapp stages pull
|
12
|
+
dapp stages cleanup local [options] [DIMG ...] REPO
|
13
|
+
dapp stages cleanup repo [options] [DIMG ...] REPO
|
14
|
+
dapp stages flush local [options] [DIMG ...]
|
15
|
+
dapp stages flush repo [options] [DIMG ...] REPO
|
16
|
+
dapp stages push [options] [DIMG ...] REPO
|
17
|
+
dapp stages pull [options] [DIMG ...] REPO
|
18
18
|
|
19
19
|
Options:
|
20
20
|
BANNER
|
@@ -7,9 +7,9 @@ module Dapp
|
|
7
7
|
Version: #{Dapp::VERSION}
|
8
8
|
|
9
9
|
Usage:
|
10
|
-
dapp stages cleanup local [options] [
|
10
|
+
dapp stages cleanup local [options] [DIMG ...] REPO
|
11
11
|
|
12
|
-
|
12
|
+
DIMG Dapp image to process [default: *].
|
13
13
|
|
14
14
|
Options:
|
15
15
|
BANNER
|
@@ -7,9 +7,9 @@ module Dapp
|
|
7
7
|
Version: #{Dapp::VERSION}
|
8
8
|
|
9
9
|
Usage:
|
10
|
-
dapp stages cleanup repo [options] [
|
10
|
+
dapp stages cleanup repo [options] [DIMG ...] REPO
|
11
11
|
|
12
|
-
|
12
|
+
DIMG Dapp image to process [default: *].
|
13
13
|
|
14
14
|
Options:
|
15
15
|
BANNER
|
@@ -7,9 +7,9 @@ module Dapp
|
|
7
7
|
Version: #{Dapp::VERSION}
|
8
8
|
|
9
9
|
Usage:
|
10
|
-
dapp stages flush local [options] [
|
10
|
+
dapp stages flush local [options] [DIMG ...]
|
11
11
|
|
12
|
-
|
12
|
+
DIMG Dapp image to process [default: *].
|
13
13
|
|
14
14
|
Options:
|
15
15
|
BANNER
|
@@ -7,9 +7,9 @@ module Dapp
|
|
7
7
|
Version: #{Dapp::VERSION}
|
8
8
|
|
9
9
|
Usage:
|
10
|
-
dapp stages flush repo [options] [
|
10
|
+
dapp stages flush repo [options] [DIMG ...] REPO
|
11
11
|
|
12
|
-
|
12
|
+
DIMG Dapp image to process [default: *].
|
13
13
|
|
14
14
|
Options:
|
15
15
|
BANNER
|
data/lib/dapp/cli/stages/pull.rb
CHANGED
@@ -7,9 +7,9 @@ module Dapp
|
|
7
7
|
Version: #{Dapp::VERSION}
|
8
8
|
|
9
9
|
Usage:
|
10
|
-
dapp stages pull [options] [DIMG
|
10
|
+
dapp stages pull [options] [DIMG ...] REPO
|
11
11
|
|
12
|
-
DIMG
|
12
|
+
DIMG Dapp image to process [default: *].
|
13
13
|
|
14
14
|
Options:
|
15
15
|
BANNER
|
data/lib/dapp/cli/stages/push.rb
CHANGED
@@ -7,9 +7,9 @@ module Dapp
|
|
7
7
|
Version: #{Dapp::VERSION}
|
8
8
|
|
9
9
|
Usage:
|
10
|
-
dapp stages push [options] [DIMG
|
10
|
+
dapp stages push [options] [DIMG ...] REPO
|
11
11
|
|
12
|
-
DIMG
|
12
|
+
DIMG Dapp image to process [default: *].
|
13
13
|
|
14
14
|
Options:
|
15
15
|
BANNER
|
data/lib/dapp/cli/tag.rb
CHANGED
@@ -6,9 +6,9 @@ module Dapp
|
|
6
6
|
Version: #{Dapp::VERSION}
|
7
7
|
|
8
8
|
Usage:
|
9
|
-
dapp tag [options] [DIMG
|
9
|
+
dapp tag [options] [DIMG] TAG
|
10
10
|
|
11
|
-
DIMG
|
11
|
+
DIMG Dapp image to process [default: *].
|
12
12
|
REPO Pushed image name.
|
13
13
|
|
14
14
|
Options:
|
@@ -12,11 +12,11 @@ module Dapp
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def _shell(&blk)
|
15
|
-
@_shell ||= Directive::Shell::Artifact.new(&blk)
|
15
|
+
@_shell ||= Directive::Shell::Artifact.new(project: project, &blk)
|
16
16
|
end
|
17
17
|
|
18
18
|
def _docker(&blk)
|
19
|
-
@_docker ||= Directive::Docker::Artifact.new(&blk)
|
19
|
+
@_docker ||= Directive::Docker::Artifact.new(project: project, &blk)
|
20
20
|
end
|
21
21
|
|
22
22
|
undef :artifact
|
@@ -32,7 +32,7 @@ module Dapp
|
|
32
32
|
def export(*args, &blk)
|
33
33
|
@_export.concat begin
|
34
34
|
artifact_config = pass_to_default(ArtifactDimg.new("artifact-#{SecureRandom.hex(2)}", project: project))
|
35
|
-
artifact = Directive::Artifact.new(config: artifact_config)
|
35
|
+
artifact = Directive::Artifact.new(project: project, config: artifact_config)
|
36
36
|
artifact.send(:export, *args, &blk)
|
37
37
|
artifact._export
|
38
38
|
end
|
@@ -46,7 +46,7 @@ module Dapp
|
|
46
46
|
|
47
47
|
def pass_to_default(obj)
|
48
48
|
super(obj).tap do |artifact_dimg|
|
49
|
-
artifact_dimg.instance_variable_set(:@_artifact_dependencies,
|
49
|
+
artifact_dimg.instance_variable_set(:@_artifact_dependencies, _artifact_dependencies.dup)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/dapp/config/base.rb
CHANGED
@@ -11,8 +11,26 @@ module Dapp
|
|
11
11
|
|
12
12
|
attr_reader :project
|
13
13
|
|
14
|
-
def
|
15
|
-
|
14
|
+
def marshal_dump
|
15
|
+
instance_variables
|
16
|
+
.reject {|variable| variable == :@project}
|
17
|
+
.map {|variable| [variable, instance_variable_get(variable)]}
|
18
|
+
end
|
19
|
+
|
20
|
+
def marshal_load(variable_values)
|
21
|
+
variable_values.each do |variable, value|
|
22
|
+
instance_variable_set(variable, value)
|
23
|
+
end
|
24
|
+
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def _clone
|
29
|
+
Marshal.load Marshal.dump(self)
|
30
|
+
end
|
31
|
+
|
32
|
+
def _clone_to(obj)
|
33
|
+
obj.marshal_load marshal_dump
|
16
34
|
end
|
17
35
|
end
|
18
36
|
end
|
@@ -47,7 +47,7 @@ module Dapp
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def mount(to, &blk)
|
50
|
-
_mount << Directive::Mount.new(to, &blk)
|
50
|
+
_mount << Directive::Mount.new(to, project: project, &blk)
|
51
51
|
end
|
52
52
|
|
53
53
|
def _dev_mode
|
@@ -59,15 +59,15 @@ module Dapp
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def _chef
|
62
|
-
@_chef ||= Directive::Chef.new
|
62
|
+
@_chef ||= Directive::Chef.new(project: project)
|
63
63
|
end
|
64
64
|
|
65
65
|
def _shell
|
66
|
-
@_shell ||= Directive::Shell::Dimg.new
|
66
|
+
@_shell ||= Directive::Shell::Dimg.new(project: project)
|
67
67
|
end
|
68
68
|
|
69
69
|
def _docker
|
70
|
-
@_docker ||= Directive::Docker::Dimg.new
|
70
|
+
@_docker ||= Directive::Docker::Dimg.new(project: project)
|
71
71
|
end
|
72
72
|
|
73
73
|
def _mount
|
@@ -75,7 +75,7 @@ module Dapp
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def _git_artifact
|
78
|
-
@_git_artifact ||= GitArtifact.new
|
78
|
+
@_git_artifact ||= GitArtifact.new(project: project)
|
79
79
|
end
|
80
80
|
|
81
81
|
[:build_dir, :tmp_dir].each do |mount_type|
|
@@ -114,17 +114,19 @@ module Dapp
|
|
114
114
|
class GitArtifact < Directive::Base
|
115
115
|
attr_reader :_local, :_remote
|
116
116
|
|
117
|
-
def initialize
|
117
|
+
def initialize(**kwargs, &blk)
|
118
118
|
@_local = []
|
119
119
|
@_remote = []
|
120
|
+
|
121
|
+
super(**kwargs, &blk)
|
120
122
|
end
|
121
123
|
|
122
124
|
def local(_, &blk)
|
123
|
-
@_local << Directive::GitArtifactLocal.new(&blk)
|
125
|
+
@_local << Directive::GitArtifactLocal.new(project: project, &blk)
|
124
126
|
end
|
125
127
|
|
126
128
|
def remote(repo_url, &blk)
|
127
|
-
@_remote << Directive::GitArtifactRemote.new(repo_url, &blk)
|
129
|
+
@_remote << Directive::GitArtifactRemote.new(repo_url, project: project, &blk)
|
128
130
|
end
|
129
131
|
|
130
132
|
def _local
|
@@ -6,9 +6,10 @@ module Dapp
|
|
6
6
|
class Artifact < ArtifactBase
|
7
7
|
attr_reader :_config
|
8
8
|
|
9
|
-
def initialize(config
|
9
|
+
def initialize(config:, **kwargs, &blk)
|
10
10
|
@_config = config
|
11
|
-
|
11
|
+
|
12
|
+
super(**kwargs, &blk)
|
12
13
|
end
|
13
14
|
|
14
15
|
def _export
|
@@ -31,19 +32,35 @@ module Dapp
|
|
31
32
|
protected
|
32
33
|
|
33
34
|
def before(stage)
|
34
|
-
|
35
|
+
stage = stage.to_sym
|
36
|
+
associate_validation!(:before, stage, @_before)
|
35
37
|
@_before = stage
|
36
38
|
end
|
37
39
|
|
38
40
|
def after(stage)
|
39
|
-
|
41
|
+
stage = stage.to_sym
|
42
|
+
associate_validation!(:after, stage, @_after)
|
40
43
|
@_after = stage
|
41
44
|
end
|
42
45
|
|
43
|
-
def associate_validation!(type, stage)
|
44
|
-
|
45
|
-
|
46
|
-
|
46
|
+
def associate_validation!(type, stage, old_stage)
|
47
|
+
conflict_type = [:before, :after].find { |t| t != type }
|
48
|
+
conflict_stage = send("_#{conflict_type}")
|
49
|
+
|
50
|
+
raise Error::Config, code: :stage_artifact_not_supported_associated_stage,
|
51
|
+
data: { stage: "#{type} #{stage.inspect}" } unless [:install, :setup].include? stage
|
52
|
+
|
53
|
+
raise Error::Config, code: :stage_artifact_double_associate,
|
54
|
+
data: { stage: "#{type} #{stage.inspect}",
|
55
|
+
conflict_stage: "#{conflict_type} #{conflict_stage.inspect}" } if conflict_stage
|
56
|
+
|
57
|
+
defined_stage = send("_#{type}")
|
58
|
+
project.log_config_warning(desc: {
|
59
|
+
code: :stage_artifact_rewritten,
|
60
|
+
context: :warning,
|
61
|
+
data: { stage: "#{type} #{stage.inspect}",
|
62
|
+
conflict_stage: "#{type} #{defined_stage.inspect}" }
|
63
|
+
}) if defined_stage
|
47
64
|
end
|
48
65
|
end
|
49
66
|
end
|
@@ -5,9 +5,10 @@ module Dapp
|
|
5
5
|
class ArtifactBase < Base
|
6
6
|
attr_reader :_owner, :_group
|
7
7
|
|
8
|
-
def initialize
|
8
|
+
def initialize(**kwargs, &blk)
|
9
9
|
@_export = []
|
10
|
-
|
10
|
+
|
11
|
+
super(**kwargs, &blk)
|
11
12
|
end
|
12
13
|
|
13
14
|
def _export
|
@@ -23,13 +24,13 @@ module Dapp
|
|
23
24
|
class Export < Directive::Base
|
24
25
|
attr_accessor :_cwd, :_to, :_include_paths, :_exclude_paths, :_owner, :_group
|
25
26
|
|
26
|
-
def initialize(cwd = '/')
|
27
|
+
def initialize(cwd = '/', **kwargs, &blk)
|
27
28
|
raise Error::Config, code: :export_cwd_absolute_path_required unless Pathname(cwd).absolute?
|
28
29
|
@_cwd = cwd
|
29
30
|
@_include_paths ||= []
|
30
31
|
@_exclude_paths ||= []
|
31
32
|
|
32
|
-
super()
|
33
|
+
super(**kwargs, &blk)
|
33
34
|
end
|
34
35
|
|
35
36
|
def _artifact_options
|
@@ -84,7 +85,7 @@ module Dapp
|
|
84
85
|
end
|
85
86
|
|
86
87
|
def export(absolute_dir_path = '/', &blk)
|
87
|
-
@_export << self.class.const_get('Export').new(absolute_dir_path, &blk)
|
88
|
+
@_export << self.class.const_get('Export').new(absolute_dir_path, project: project, &blk)
|
88
89
|
end
|
89
90
|
end
|
90
91
|
end
|
@@ -6,7 +6,7 @@ module Dapp
|
|
6
6
|
class Dimg < Base
|
7
7
|
attr_reader :_volume, :_expose, :_env, :_label, :_cmd, :_onbuild, :_workdir, :_user, :_entrypoint
|
8
8
|
|
9
|
-
def initialize
|
9
|
+
def initialize(**kwargs, &blk)
|
10
10
|
@_volume = []
|
11
11
|
@_expose = []
|
12
12
|
@_env = {}
|
@@ -14,7 +14,7 @@ module Dapp
|
|
14
14
|
@_cmd = []
|
15
15
|
@_onbuild = []
|
16
16
|
|
17
|
-
super
|
17
|
+
super(**kwargs, &blk)
|
18
18
|
end
|
19
19
|
|
20
20
|
def volume(*args)
|
@@ -70,7 +70,7 @@ module Dapp
|
|
70
70
|
protected
|
71
71
|
|
72
72
|
def clone_to_artifact
|
73
|
-
Artifact.new.tap do |docker|
|
73
|
+
Artifact.new(project: project).tap do |docker|
|
74
74
|
docker.instance_variable_set('@_from', @_from)
|
75
75
|
end
|
76
76
|
end
|
@@ -5,11 +5,11 @@ module Dapp
|
|
5
5
|
class GitArtifactRemote < GitArtifactLocal
|
6
6
|
attr_reader :_url, :_name, :_branch, :_commit
|
7
7
|
|
8
|
-
def initialize(url)
|
8
|
+
def initialize(url, **kwargs, &blk)
|
9
9
|
@_url = url
|
10
10
|
@_name = url.gsub(%r{.*?([^\/ ]+)\.git}, '\\1')
|
11
11
|
|
12
|
-
super()
|
12
|
+
super(**kwargs, &blk)
|
13
13
|
end
|
14
14
|
|
15
15
|
def _export
|
@@ -6,10 +6,11 @@ module Dapp
|
|
6
6
|
attr_reader :_from, :_to
|
7
7
|
attr_reader :_type
|
8
8
|
|
9
|
-
def initialize(to)
|
9
|
+
def initialize(to, **kwargs, &blk)
|
10
10
|
raise Error::Config, code: :mount_to_absolute_path_required unless Pathname((to = to.to_s)).absolute?
|
11
11
|
@_to = to
|
12
|
-
|
12
|
+
|
13
|
+
super(**kwargs, &blk)
|
13
14
|
end
|
14
15
|
|
15
16
|
protected
|
@@ -13,7 +13,7 @@ module Dapp
|
|
13
13
|
|
14
14
|
def self.stage_command_generator(stage)
|
15
15
|
define_method stage do |&blk|
|
16
|
-
(variable = instance_variable_get("@_#{stage}") || StageCommand.new).instance_eval(&blk)
|
16
|
+
(variable = instance_variable_get("@_#{stage}") || StageCommand.new(project: project)).instance_eval(&blk)
|
17
17
|
instance_variable_set("@_#{stage}", variable)
|
18
18
|
end
|
19
19
|
|
@@ -34,9 +34,10 @@ module Dapp
|
|
34
34
|
attr_reader :_version
|
35
35
|
attr_reader :_run
|
36
36
|
|
37
|
-
def initialize
|
37
|
+
def initialize(**kwargs, &blk)
|
38
38
|
@_run = []
|
39
|
-
|
39
|
+
|
40
|
+
super(**kwargs, &blk)
|
40
41
|
end
|
41
42
|
|
42
43
|
def run(*args)
|
@@ -55,11 +56,7 @@ module Dapp
|
|
55
56
|
end
|
56
57
|
|
57
58
|
def clone_to_artifact
|
58
|
-
Artifact.new
|
59
|
-
instance_variables.each do |variable|
|
60
|
-
shell.instance_variable_set(variable, instance_variable_get(marshal_dup(variable)))
|
61
|
-
end
|
62
|
-
end
|
59
|
+
_clone_to Artifact.new(project: project)
|
63
60
|
end
|
64
61
|
end
|
65
62
|
end
|
data/lib/dapp/core_ext/hash.rb
CHANGED
@@ -6,7 +6,7 @@ module Dapp
|
|
6
6
|
def in_depth_merge(hash) # do not conflict with activesupport`s deep_merge
|
7
7
|
merge(hash) do |_, v1, v2|
|
8
8
|
if v1.is_a?(::Hash) && v2.is_a?(::Hash)
|
9
|
-
v1.
|
9
|
+
v1.in_depth_merge(v2)
|
10
10
|
elsif v1.is_a?(::Array) || v2.is_a?(::Array)
|
11
11
|
[v1, v2].flatten
|
12
12
|
else
|
data/lib/dapp/image/stage.rb
CHANGED
@@ -72,6 +72,8 @@ module Dapp
|
|
72
72
|
raise Error::Build, code: :built_id_not_defined if from.built_id.nil?
|
73
73
|
project.shellout!("docker run #{prepared_options} #{from.built_id} -ec '#{prepared_bash_command}'", log_verbose: true)
|
74
74
|
rescue Error::Shellout => error
|
75
|
+
project.log_warning(desc: { code: :launched_command, data: { command: prepared_commands.join(' && ') }, context: :container })
|
76
|
+
|
75
77
|
raise unless project.introspect_error? || project.introspect_before_error?
|
76
78
|
built_id = project.introspect_error? ? commit! : from.built_id
|
77
79
|
raise Exception::IntrospectImage, data: { built_id: built_id,
|
@@ -66,6 +66,22 @@ module Dapp
|
|
66
66
|
def log_proper_cache(&blk)
|
67
67
|
log_step_with_indent(:'proper cache', &blk)
|
68
68
|
end
|
69
|
+
|
70
|
+
def one_dimg!
|
71
|
+
raise Error::Project, code: :command_unexpected_dimgs_number, data: { dimgs_names: build_configs.map(&:_name).join(' ') } unless build_configs.one?
|
72
|
+
end
|
73
|
+
|
74
|
+
def push_format(dimg_name)
|
75
|
+
if dimg_name.nil?
|
76
|
+
spush_format
|
77
|
+
else
|
78
|
+
'%{repo}:%{dimg_name}-%{tag}'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def spush_format
|
83
|
+
'%{repo}:%{tag}'
|
84
|
+
end
|
69
85
|
end
|
70
86
|
end
|
71
87
|
end # Project
|
@@ -11,7 +11,7 @@ module Dapp
|
|
11
11
|
build_configs.each do |config|
|
12
12
|
log_dimg_name_with_indent(config) do
|
13
13
|
Dimg.new(config: config, project: self, ignore_git_fetch: true, should_be_built: true).tap do |dimg|
|
14
|
-
dimg.export!(repo, format:
|
14
|
+
dimg.export!(repo, format: push_format(config._name))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -6,7 +6,7 @@ module Dapp
|
|
6
6
|
# Run
|
7
7
|
module Run
|
8
8
|
def run(docker_options, command)
|
9
|
-
|
9
|
+
one_dimg!
|
10
10
|
Dimg.new(config: build_configs.first, project: self, ignore_git_fetch: true, should_be_built: true).run(docker_options, command)
|
11
11
|
end
|
12
12
|
end
|
@@ -7,9 +7,9 @@ module Dapp
|
|
7
7
|
module Spush
|
8
8
|
def spush(repo)
|
9
9
|
validate_repo_name(repo)
|
10
|
-
|
10
|
+
one_dimg!
|
11
11
|
Dimg.new(config: build_configs.first, project: self, ignore_git_fetch: true, should_be_built: true).tap do |dimg|
|
12
|
-
dimg.export!(repo, format:
|
12
|
+
dimg.export!(repo, format: spush_format)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -6,7 +6,7 @@ module Dapp
|
|
6
6
|
# StageImage
|
7
7
|
module StageImage
|
8
8
|
def stage_image
|
9
|
-
|
9
|
+
one_dimg!
|
10
10
|
puts Dimg.new(config: build_configs.first, project: self, ignore_git_fetch: true).stage_image_name(cli_options[:stage])
|
11
11
|
end
|
12
12
|
end
|
@@ -6,7 +6,7 @@ module Dapp
|
|
6
6
|
# Tag
|
7
7
|
module Tag
|
8
8
|
def tag(tag)
|
9
|
-
|
9
|
+
one_dimg!
|
10
10
|
raise Error::Project, code: :tag_command_incorrect_tag, data: { name: tag } unless Image::Docker.image_name?(tag)
|
11
11
|
Dimg.new(config: build_configs.first, project: self, ignore_git_fetch: true, should_be_built: true).tap do |app|
|
12
12
|
app.tag!(tag)
|
data/lib/dapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|