rbld 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cli/lib/bootstrap/re-build-bootstrap-utils +5 -0
- data/cli/lib/bootstrap/re-build-entry-point +5 -5
- data/cli/lib/rbld_engine.rb +78 -12
- data/cli/lib/rbld_registry.rb +10 -4
- metadata +23 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66ed29a4b4b1456efb41da115141609a37fb3f70
|
4
|
+
data.tar.gz: 0937787d9707983d1214f54f5df82a6d829abddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61f60ccdcf6a77545281e00a2ac315c7ae6aac5b88cf56df65eb152a16df0ffd5945cbb1f283fa32757f42f97e175266ed9aa007758b9755a3d3de97c19ccb21
|
7
|
+
data.tar.gz: ef7c3c6486866f460968808ca982e60cab407e2278b9d77055e36fb5d962e240ac9da7f3d0e29c88233e237f024349e9a011ce5dac5948d1baa45db05ff0ce94
|
@@ -16,9 +16,9 @@ rebuild_banner()
|
|
16
16
|
|
17
17
|
setup_users()
|
18
18
|
{
|
19
|
-
delete_user $REBUILD_USER_NAME
|
20
|
-
delete_group $REBUILD_USER_NAME
|
21
|
-
delete_group $REBUILD_GROUP_NAME
|
19
|
+
delete_user $REBUILD_USER_NAME 2>$DEBUG_OUTPUT
|
20
|
+
delete_group $REBUILD_USER_NAME 2>$DEBUG_OUTPUT
|
21
|
+
delete_group $REBUILD_GROUP_NAME 2>$DEBUG_OUTPUT
|
22
22
|
|
23
23
|
if has_app useradd; then
|
24
24
|
|
@@ -52,9 +52,9 @@ sudo_params()
|
|
52
52
|
echo "-n -H -E -g $REBUILD_GROUP_NAME -u $REBUILD_USER_NAME"
|
53
53
|
}
|
54
54
|
|
55
|
-
setup_users
|
55
|
+
setup_users
|
56
56
|
|
57
|
-
cd $REBUILD_PWD
|
57
|
+
cd $REBUILD_PWD 2>/dev/null
|
58
58
|
|
59
59
|
. /rebuild/rebuild.rc
|
60
60
|
|
data/cli/lib/rbld_engine.rb
CHANGED
@@ -2,6 +2,7 @@ require 'docker'
|
|
2
2
|
require 'etc'
|
3
3
|
require 'thread'
|
4
4
|
require 'forwardable'
|
5
|
+
require 'os'
|
5
6
|
require_relative 'rbld_log'
|
6
7
|
require_relative 'rbld_config'
|
7
8
|
require_relative 'rbld_utils'
|
@@ -310,6 +311,7 @@ module Rebuild::Engine
|
|
310
311
|
def with_gzip_writer
|
311
312
|
begin
|
312
313
|
File.open(@filename, 'w') do |f|
|
314
|
+
f.binmode
|
313
315
|
gz = Zlib::GzipWriter.new(f)
|
314
316
|
begin
|
315
317
|
yield gz
|
@@ -427,6 +429,45 @@ module Rebuild::Engine
|
|
427
429
|
private_class_method :new
|
428
430
|
end
|
429
431
|
|
432
|
+
class RunSettings
|
433
|
+
def initialize
|
434
|
+
@group_name = get_group_name
|
435
|
+
@user_name = Etc.getlogin
|
436
|
+
@home = get_home
|
437
|
+
@pwd = get_pwd
|
438
|
+
@uid = get_uid
|
439
|
+
@gid = get_gid
|
440
|
+
end
|
441
|
+
|
442
|
+
attr_reader :group_name, :home, :pwd, :user_name, :uid, :gid
|
443
|
+
|
444
|
+
private
|
445
|
+
|
446
|
+
def get_group_name
|
447
|
+
if group_info = Etc.getgrgid(Process.gid)
|
448
|
+
group_info[:name]
|
449
|
+
else
|
450
|
+
Etc.getlogin
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
def get_home
|
455
|
+
OS.windows? ? "/home/#{Etc.getlogin}" : Dir.home
|
456
|
+
end
|
457
|
+
|
458
|
+
def get_pwd
|
459
|
+
Dir.pwd.sub(Dir.home, home)
|
460
|
+
end
|
461
|
+
|
462
|
+
def get_uid
|
463
|
+
OS.windows? ? 1000 : Process.uid
|
464
|
+
end
|
465
|
+
|
466
|
+
def get_gid
|
467
|
+
OS.windows? ? 1000 : Process.gid
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
430
471
|
class API
|
431
472
|
extend Forwardable
|
432
473
|
|
@@ -434,6 +475,7 @@ module Rebuild::Engine
|
|
434
475
|
@docker_api, @cfg = docker_api, cfg
|
435
476
|
|
436
477
|
tweak_excon
|
478
|
+
tweak_docker_url
|
437
479
|
check_connectivity
|
438
480
|
@cache = PresentEnvironments.new
|
439
481
|
end
|
@@ -610,6 +652,12 @@ module Rebuild::Engine
|
|
610
652
|
Excon.defaults[:read_timeout] = 600
|
611
653
|
end
|
612
654
|
|
655
|
+
def tweak_docker_url
|
656
|
+
# Default unix pipe does not work with Docker for Windows
|
657
|
+
# Use TCP connection instead
|
658
|
+
Docker.url = 'tcp://127.0.0.1:2375' if OS.windows?
|
659
|
+
end
|
660
|
+
|
613
661
|
def check_connectivity
|
614
662
|
begin
|
615
663
|
@docker_api.validate_version!
|
@@ -630,19 +678,37 @@ module Rebuild::Engine
|
|
630
678
|
rbld_log.info( "External command returned with code #{@errno}" )
|
631
679
|
end
|
632
680
|
|
681
|
+
def run_user_group_name
|
682
|
+
if group_info = Etc.getgrgid(Process.gid)
|
683
|
+
group_info[:name]
|
684
|
+
else
|
685
|
+
Etc.getlogin
|
686
|
+
end
|
687
|
+
end
|
688
|
+
|
689
|
+
def trace_run_settings
|
690
|
+
if ENV['RBLD_BOOTSTRAP_TRACE'] && ENV['RBLD_BOOTSTRAP_TRACE'] == '1'
|
691
|
+
'-e REBUILD_TRACE=1'
|
692
|
+
else
|
693
|
+
''
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
633
697
|
def run_settings(env, cmd, opts = {})
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
698
|
+
rs = RunSettings.new
|
699
|
+
%Q{ -i #{STDIN.tty? ? '-t' : ''} \
|
700
|
+
-v #{Dir.home}:#{rs.home} \
|
701
|
+
-e REBUILD_USER_ID=#{rs.uid} \
|
702
|
+
-e REBUILD_GROUP_ID=#{rs.gid} \
|
703
|
+
-e REBUILD_USER_NAME=#{rs.user_name} \
|
704
|
+
-e REBUILD_GROUP_NAME=#{rs.group_name} \
|
705
|
+
-e REBUILD_USER_HOME=#{rs.home} \
|
706
|
+
-e REBUILD_PWD=#{rs.pwd} \
|
707
|
+
--security-opt label:disable \
|
708
|
+
#{trace_run_settings} \
|
709
|
+
#{opts[:rerun] ? env.rerun_img.id : env.img.id} \
|
710
|
+
"#{cmd.join(' ')}" \
|
711
|
+
}
|
646
712
|
end
|
647
713
|
|
648
714
|
def run_env_disposable(env, cmd)
|
data/cli/lib/rbld_registry.rb
CHANGED
@@ -62,8 +62,7 @@ module Rebuild
|
|
62
62
|
begin
|
63
63
|
rbld_log.info( "Pushing #{url.full}" )
|
64
64
|
api_obj.push(nil, :repo_tag => url.full) do |log|
|
65
|
-
|
66
|
-
rbld_print.inplace_trace(progress) if progress
|
65
|
+
trace_progress( log )
|
67
66
|
end
|
68
67
|
ensure
|
69
68
|
api_obj.remove( :name => url.full )
|
@@ -76,8 +75,7 @@ module Rebuild
|
|
76
75
|
begin
|
77
76
|
rbld_log.info( "Pulling #{url.full}" )
|
78
77
|
img = api_class.create(:fromImage => url.full) do |log|
|
79
|
-
|
80
|
-
rbld_print.inplace_trace(progress) if progress
|
78
|
+
trace_progress( log )
|
81
79
|
end
|
82
80
|
yield img
|
83
81
|
ensure
|
@@ -87,6 +85,14 @@ module Rebuild
|
|
87
85
|
|
88
86
|
private
|
89
87
|
|
88
|
+
def trace_progress(log_item)
|
89
|
+
begin
|
90
|
+
line = JSON.parse( log_item )["progress"]
|
91
|
+
rbld_print.inplace_trace( line ) if line
|
92
|
+
rescue
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
90
96
|
def parse_entry(internal_name)
|
91
97
|
begin
|
92
98
|
Entry.by_internal_name( internal_name )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Fleytman
|
8
8
|
autorequire:
|
9
9
|
bindir: cli/bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -112,6 +112,26 @@ dependencies:
|
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: 1.3.3
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: os
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0.9'
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.9.6
|
125
|
+
type: :runtime
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.9'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 0.9.6
|
115
135
|
- !ruby/object:Gem::Dependency
|
116
136
|
name: rake
|
117
137
|
requirement: !ruby/object:Gem::Requirement
|
@@ -289,6 +309,5 @@ rubyforge_project:
|
|
289
309
|
rubygems_version: 2.4.8
|
290
310
|
signing_key:
|
291
311
|
specification_version: 4
|
292
|
-
summary: rbld-1.0.
|
312
|
+
summary: rbld-1.0.1
|
293
313
|
test_files: []
|
294
|
-
has_rdoc:
|