manifest-builder 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -10
- data/lib/cicd/builder/manifest/mixlib/build.rb +45 -4
- data/lib/cicd/builder/manifest/version.rb +1 -1
- data/manifest-builder.gemspec +5 -3
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83f96eb0423c63a8357b5529aea9f4a1ad1ff3e1
|
4
|
+
data.tar.gz: bbe9643b6d76a6f284866bceae3acb9da4b49c60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5f96204ef9df55d3687300e422a12608989bc10c2d385b609277306412dc82d4a6a21b6690b71c593909b3dbac7202f290df2d34b51f13a572e45ce5ed8d790
|
7
|
+
data.tar.gz: cdfa0ce753ddb1206a2e8dd9059772d975b003af8c4d92de974e89d698cd04dbba858527b3105041897f11cc6a70bb5f5b2016cb0b0bf271bc4df2d89e4cdf6e
|
data/Gemfile.lock
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
manifest-builder (0.
|
5
|
-
ansiblerepo-builder (>= 0.3.
|
6
|
-
|
7
|
-
|
4
|
+
manifest-builder (0.2.0)
|
5
|
+
ansiblerepo-builder (>= 0.3.6, < 0.5)
|
6
|
+
archive-tar-minitar (= 0.5.2)
|
7
|
+
chefrepo-builder (>= 0.9.26, < 1.1)
|
8
|
+
cicd-builder (>= 0.9.32, < 1.1)
|
8
9
|
json (>= 1.8.1, < 1.9)
|
9
10
|
s3etag (>= 0.0.1, < 0.1.0)
|
10
11
|
|
11
12
|
PATH
|
12
13
|
remote: ../chefrepo-builder
|
13
14
|
specs:
|
14
|
-
chefrepo-builder (0.9.
|
15
|
-
cicd-builder (>= 0.9.
|
15
|
+
chefrepo-builder (0.9.26)
|
16
|
+
cicd-builder (>= 0.9.32, < 1.1)
|
16
17
|
json (= 1.8.1)
|
17
18
|
|
18
19
|
PATH
|
19
20
|
remote: ../cicd-builder
|
20
21
|
specs:
|
21
|
-
cicd-builder (0.9.
|
22
|
+
cicd-builder (0.9.32)
|
22
23
|
artifactory (>= 2.2.1, < 2.3)
|
23
24
|
awesome_print (>= 1.6, < 2.0)
|
24
25
|
aws-sdk (>= 2.0, < 2.1)
|
@@ -33,10 +34,11 @@ PATH
|
|
33
34
|
GEM
|
34
35
|
remote: https://rubygems.org/
|
35
36
|
specs:
|
36
|
-
ansiblerepo-builder (0.3.
|
37
|
-
chefrepo-builder (>= 0.9.
|
38
|
-
cicd-builder (>= 0.9.
|
37
|
+
ansiblerepo-builder (0.3.6)
|
38
|
+
chefrepo-builder (>= 0.9.26, < 1.1)
|
39
|
+
cicd-builder (>= 0.9.32, < 1.1)
|
39
40
|
json (= 1.8.1)
|
41
|
+
archive-tar-minitar (0.5.2)
|
40
42
|
artifactory (2.2.1)
|
41
43
|
awesome_print (1.6.1)
|
42
44
|
aws-sdk (2.0.28)
|
@@ -99,6 +99,13 @@ module CiCd
|
|
99
99
|
end
|
100
100
|
if version.empty?
|
101
101
|
version = @vars[:build_ver]
|
102
|
+
else
|
103
|
+
uri,ver = File.split(path)
|
104
|
+
if version =~ %r'^#{ver}' and version =~ %r'^(\d+\.){3}'
|
105
|
+
build = version.dup
|
106
|
+
version = ver
|
107
|
+
build = build.gsub(%r'^#{version}(\.|-)*','')
|
108
|
+
end
|
102
109
|
end
|
103
110
|
if build == 0 or build.empty?
|
104
111
|
build = @vars[:build_num]
|
@@ -123,6 +130,7 @@ module CiCd
|
|
123
130
|
if @vars[:return_code] == 0
|
124
131
|
lines = []
|
125
132
|
@vars[:artifacts] = []
|
133
|
+
# Deal with all artifacts of each component
|
126
134
|
@vars[:components].each { |comp|
|
127
135
|
artifact, path, version, build = parseComponent(comp)
|
128
136
|
|
@@ -139,13 +147,16 @@ module CiCd
|
|
139
147
|
objects << object
|
140
148
|
end
|
141
149
|
end
|
150
|
+
local_dir = File.join(@vars[:local_dirs]['artifacts'],comp[0], '')
|
151
|
+
Dir.mkdir(local_dir, 0700) unless File.directory?(local_dir)
|
152
|
+
artifacts = []
|
153
|
+
changed = false
|
154
|
+
# 1 or more objects on the key/ path
|
142
155
|
if objects.size > 0
|
143
156
|
lines << "#{comp[0]}:#{artifact} v#{version} b#{build} - #{path}"
|
144
157
|
# When we start pulling the artifacts then everything that is build 0 get this build number, in fact all artifacts get this build number!
|
145
158
|
objects.each do |object|
|
146
159
|
@logger.info "\t#{object.key}"
|
147
|
-
local_dir = File.join(@vars[:local_dirs]['artifacts'],comp[0], '')
|
148
|
-
Dir.mkdir(local_dir, 0700) unless File.directory?(local_dir)
|
149
160
|
local = File.join(local_dir,File.basename(object.key))
|
150
161
|
etag = object.etag.gsub(%r/['"]/, '')
|
151
162
|
download = if File.exists?(local)
|
@@ -170,12 +181,42 @@ module CiCd
|
|
170
181
|
# IO.binwrite(local, body)
|
171
182
|
@logger.info "\t\tdone"
|
172
183
|
check = calcLocalETag(etag, local)
|
173
|
-
|
184
|
+
unless check.eql?(etag)
|
185
|
+
@logger.info "\tETag different: #{etag} != #{check}"
|
186
|
+
changed = true
|
187
|
+
end
|
174
188
|
else
|
175
189
|
@logger.info "\t\tunchanged"
|
176
190
|
end
|
177
|
-
|
191
|
+
artifacts << local
|
178
192
|
end
|
193
|
+
# The local file will be 1 artifact or an archive of the local artifacts when artifacts.size > 1
|
194
|
+
local = if artifacts.size > 0
|
195
|
+
if artifacts.size > 1
|
196
|
+
begin
|
197
|
+
require 'zlib'
|
198
|
+
require 'archive/tar/minitar'
|
199
|
+
file = File.join(local_dir, "#{comp[0]}-#{version}.tar.gz")
|
200
|
+
if changed or not File.exists?(file)
|
201
|
+
output = File.open(file, 'wb')
|
202
|
+
output = Zlib::GzipWriter.new(output, Zlib::BEST_COMPRESSION, Zlib::RLE)
|
203
|
+
Dir.chdir(local_dir) do
|
204
|
+
Archive::Tar::Minitar.pack(artifacts.map{|f| f.gsub(%r'^#{local_dir}','')}, output, false )
|
205
|
+
end
|
206
|
+
end
|
207
|
+
file
|
208
|
+
rescue Exception => e
|
209
|
+
@logger.error "Artifact error: #{file} #{e.class.name} #{e.message}"
|
210
|
+
raise e
|
211
|
+
ensure
|
212
|
+
output.close if output and not output.closed?
|
213
|
+
end
|
214
|
+
else
|
215
|
+
artifacts[0]
|
216
|
+
end
|
217
|
+
else
|
218
|
+
end
|
219
|
+
addArtifact(@vars[:artifacts], local, local_dir, { name: comp[0], build: build, version: version, file: local})
|
179
220
|
else
|
180
221
|
@logger.fatal "Artifact not found: s3://#{name}/#{key}#{artifact}"
|
181
222
|
@vars[:return_code] = Errors::ARTIFACT_NOT_FOUND
|
data/manifest-builder.gemspec
CHANGED
@@ -17,11 +17,13 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.add_dependency 'cicd-builder', '>= 0.9.
|
21
|
-
gem.add_dependency 'chefrepo-builder', '>= 0.9.
|
22
|
-
gem.add_dependency 'ansiblerepo-builder', '>= 0.3.
|
20
|
+
gem.add_dependency 'cicd-builder', '>= 0.9.32', '< 1.1'
|
21
|
+
gem.add_dependency 'chefrepo-builder', '>= 0.9.26', '< 1.1'
|
22
|
+
gem.add_dependency 'ansiblerepo-builder', '>= 0.3.6', '< 0.5'
|
23
23
|
gem.add_dependency 'json', '>= 1.8.1', '< 1.9'
|
24
24
|
gem.add_dependency 's3etag', '>= 0.0.1', '< 0.1.0'
|
25
|
+
gem.add_dependency 'archive-tar-minitar', '= 0.5.2'
|
26
|
+
# gem.add_dependency 'zlib'
|
25
27
|
|
26
28
|
gem.add_development_dependency 'bundler', '>= 1.7', '< 2.0'
|
27
29
|
gem.add_development_dependency 'rake', '>= 10.3', '< 11'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manifest-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christo De Lange
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cicd-builder
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.9.
|
19
|
+
version: 0.9.32
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '1.1'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.9.
|
29
|
+
version: 0.9.32
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '1.1'
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 0.9.
|
39
|
+
version: 0.9.26
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '1.1'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.9.
|
49
|
+
version: 0.9.26
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '1.1'
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.3.
|
59
|
+
version: 0.3.6
|
60
60
|
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0.5'
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.3.
|
69
|
+
version: 0.3.6
|
70
70
|
- - "<"
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0.5'
|
@@ -110,6 +110,20 @@ dependencies:
|
|
110
110
|
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 0.1.0
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: archive-tar-minitar
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: 0.5.2
|
120
|
+
type: :runtime
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - '='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 0.5.2
|
113
127
|
- !ruby/object:Gem::Dependency
|
114
128
|
name: bundler
|
115
129
|
requirement: !ruby/object:Gem::Requirement
|