indocker 0.1.2 → 0.1.7
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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/indocker/configuration_deployer.rb +29 -25
- data/lib/indocker/context_args.rb +4 -3
- data/lib/indocker/repositories/clonner.rb +3 -1
- data/lib/indocker/repositories/git.rb +5 -2
- data/lib/indocker/server.rb +10 -0
- data/lib/indocker/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 405310bd24a8adfa838f82a3cac79f2fa125083ebcb4cf788d27332875d52353
|
4
|
+
data.tar.gz: 12103e2edb743e5024f50496962883f271c095bcd6264934c3295309fbf8e762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd602a0202c99b48303ee69a129b9f8cbfa9d621a7d2ea3f84b1446613ed8210b7ad103005967ce0459407a49482fcababf1b72f27254b1e6d5fcc29175c2ceb
|
7
|
+
data.tar.gz: 67f12a6d6b2715bde6034dbbc1b6e0a2c42bcc7c27a5e66fe40bde489db8f50cd42fb1805e03e04e35a76dd9a1f82bb754e942beba68a9fba5a4751614644dbb
|
data/Gemfile.lock
CHANGED
@@ -67,13 +67,15 @@ class Indocker::ConfigurationDeployer
|
|
67
67
|
)
|
68
68
|
|
69
69
|
remote_operations = sync_indocker(servers)
|
70
|
+
wait_remote_operations(remote_operations)
|
70
71
|
|
72
|
+
remote_operations = sync_env_files(deploy_servers, configuration.env_files)
|
71
73
|
wait_remote_operations(remote_operations)
|
72
74
|
|
73
|
-
remote_operations
|
74
|
-
remote_operations
|
75
|
-
remote_operations += sync_artifacts(clonner, configuration.artifact_servers)
|
75
|
+
remote_operations = pull_repositories(clonner, build_servers, configuration.repositories)
|
76
|
+
wait_remote_operations(remote_operations)
|
76
77
|
|
78
|
+
remote_operations = sync_artifacts(clonner, configuration.artifact_servers)
|
77
79
|
wait_remote_operations(remote_operations)
|
78
80
|
|
79
81
|
update_crontab_redeploy_rules(configuration, build_servers.first)
|
@@ -380,33 +382,35 @@ class Indocker::ConfigurationDeployer
|
|
380
382
|
@progress.start_syncing_artifact(server, artifact)
|
381
383
|
|
382
384
|
thread = Thread.new do
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
385
|
+
server.synchronize do
|
386
|
+
session = Indocker::SshSession.new(
|
387
|
+
host: server.host,
|
388
|
+
user: server.user,
|
389
|
+
port: server.port,
|
390
|
+
logger: @logger
|
391
|
+
)
|
389
392
|
|
390
|
-
|
391
|
-
|
393
|
+
@logger.info("Pulling git artifact #{artifact.name.to_s.green} for #{server.user}@#{server.host}")
|
394
|
+
result = clonner.clone(session, artifact.repository)
|
392
395
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
396
|
+
if result.exit_code != 0
|
397
|
+
@logger.error("Artifact repository :#{artifact.repository.name} was not clonned")
|
398
|
+
@logger.error(result.stderr_data)
|
399
|
+
exit 1
|
400
|
+
end
|
398
401
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
+
source_path = File.join(artifact.repository.clone_path, artifact.source_path)
|
403
|
+
result = session.exec!("mkdir -p #{artifact.target_path}")
|
404
|
+
result = session.exec!("cp -r #{source_path} #{artifact.target_path}")
|
402
405
|
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
406
|
+
if !result.success?
|
407
|
+
@logger.error(result.stdout_data)
|
408
|
+
@logger.error(result.stderr_data)
|
409
|
+
exit 1
|
410
|
+
end
|
408
411
|
|
409
|
-
|
412
|
+
@progress.finish_syncing_artifact(server, artifact)
|
413
|
+
end
|
410
414
|
end
|
411
415
|
|
412
416
|
RemoteOperation.new(thread, server, :artifact_sync)
|
@@ -14,9 +14,10 @@ class Indocker::ContextArgs
|
|
14
14
|
end
|
15
15
|
|
16
16
|
value = @context_args.fetch(name) do
|
17
|
-
Indocker.logger.
|
18
|
-
Indocker.logger.
|
19
|
-
|
17
|
+
Indocker.logger.warn("build arg '#{format_arg(name)}' is not defined#{@container ? " for container :#{@container.name}" : ""}")
|
18
|
+
Indocker.logger.warn("available args: #{@context_args.inspect}")
|
19
|
+
|
20
|
+
nil
|
20
21
|
end
|
21
22
|
|
22
23
|
if value.is_a?(Hash)
|
@@ -10,6 +10,8 @@ class Indocker::Repositories::Clonner
|
|
10
10
|
raise ArgumenError.new("only git repositories should be clonned") if !repository.is_git?
|
11
11
|
|
12
12
|
session.exec!("rm -rf #{repository.clone_path} && mkdir -p #{repository.clone_path}")
|
13
|
-
|
13
|
+
|
14
|
+
git_command = "git clone -b #{repository.branch} --depth 1 #{repository.remote_url} #{repository.clone_path}"
|
15
|
+
session.exec!("ssh-agent bash -c 'ssh-add ~/.ssh/#{repository.ssh_key}; #{git_command}'")
|
14
16
|
end
|
15
17
|
end
|
@@ -1,13 +1,16 @@
|
|
1
1
|
class Indocker::Repositories::Git < Indocker::Repositories::Abstract
|
2
|
-
attr_reader :remote_url, :remote_name, :email, :password, :branch
|
2
|
+
attr_reader :remote_url, :remote_name, :email, :password, :branch, :ssh_key
|
3
3
|
|
4
|
-
|
4
|
+
DEFAULT_SSH_KEY = "id_rsa"
|
5
|
+
|
6
|
+
def setup(remote_name:, remote_url:, email: nil, password: nil, branch:, clone_path: nil, ssh_key: DEFAULT_SSH_KEY)
|
5
7
|
@remote_name = remote_name
|
6
8
|
@remote_url = remote_url
|
7
9
|
@email = email
|
8
10
|
@password = password
|
9
11
|
@branch = branch
|
10
12
|
@clone_path = clone_path
|
13
|
+
@ssh_key = ssh_key
|
11
14
|
self
|
12
15
|
end
|
13
16
|
|
data/lib/indocker/server.rb
CHANGED
data/lib/indocker/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
8
8
|
- Iskander Khaziev
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -159,7 +159,7 @@ homepage: https://github.com/ArtStation/indocker
|
|
159
159
|
licenses:
|
160
160
|
- MIT
|
161
161
|
metadata: {}
|
162
|
-
post_install_message:
|
162
|
+
post_install_message:
|
163
163
|
rdoc_options: []
|
164
164
|
require_paths:
|
165
165
|
- lib
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubygems_version: 3.0.8
|
178
|
-
signing_key:
|
178
|
+
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Docker Containers Deployment
|
181
181
|
test_files: []
|