bosh_cli 1.2847.0 → 1.2849.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cli.rb +1 -0
- data/lib/cli/archive_builder.rb +20 -6
- data/lib/cli/archive_repository.rb +2 -2
- data/lib/cli/commands/release/create_release.rb +72 -38
- data/lib/cli/errors.rb +1 -0
- data/lib/cli/release_builder.rb +60 -38
- data/lib/cli/release_compiler.rb +21 -2
- data/lib/cli/release_tarball.rb +7 -1
- data/lib/cli/resources/job.rb +4 -6
- data/lib/cli/resources/license.rb +52 -0
- data/lib/cli/resources/package.rb +1 -1
- data/lib/cli/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15572f106adf4372613bf2daf782092f696a5b28
|
4
|
+
data.tar.gz: 6aedb3168ea8c5f5fe762ed5380febfa65474567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 805c2d2a0d62d845ddcbea0baec28f33bc2b2994a91e02b34caf8ff6e3854e75fb874fb51105aca90349e4d9ba22a89bed6346c4b1b305a507ba880dc85c8dd1
|
7
|
+
data.tar.gz: e9cc95b1a3a407b14db8ab1dfaf230b28aa194b172032329eead4431f274a9714ceddf619564db7033354c0aa2b1e044c032754026bc78fadd183f3e790650d0
|
data/lib/cli.rb
CHANGED
@@ -81,6 +81,7 @@ require 'cli/archive_repository_provider'
|
|
81
81
|
require 'cli/archive_repository'
|
82
82
|
require 'cli/build_artifact'
|
83
83
|
require 'cli/resources/job'
|
84
|
+
require 'cli/resources/license'
|
84
85
|
require 'cli/resources/package'
|
85
86
|
require 'cli/changeset_helper'
|
86
87
|
require 'cli/deployment_manifest_compiler'
|
data/lib/cli/archive_builder.rb
CHANGED
@@ -15,6 +15,9 @@ module Bosh::Cli
|
|
15
15
|
with_indent(' ') do
|
16
16
|
artifact = locate_artifact(resource)
|
17
17
|
if artifact.nil?
|
18
|
+
return unless validate(resource)
|
19
|
+
|
20
|
+
say("No artifact found for #{resource.name}".make_red)
|
18
21
|
artifact = create_artifact(resource)
|
19
22
|
say("Generated version '#{artifact.fingerprint}'".make_green)
|
20
23
|
|
@@ -60,10 +63,7 @@ module Bosh::Cli
|
|
60
63
|
def locate_artifact(resource)
|
61
64
|
artifact = @archive_repository.lookup(resource)
|
62
65
|
|
63
|
-
if artifact.nil?
|
64
|
-
say("No artifact found for #{resource.name}".make_red)
|
65
|
-
return nil
|
66
|
-
end
|
66
|
+
return nil if artifact.nil?
|
67
67
|
|
68
68
|
if artifact.dev_artifact? && final? && !dry_run?
|
69
69
|
@archive_repository.promote_from_dev_to_final(artifact)
|
@@ -76,10 +76,10 @@ module Bosh::Cli
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def create_artifact(resource)
|
79
|
-
tarball_path = safe_temp_file(resource.name, '.tgz')
|
80
|
-
|
81
79
|
say('Generating...')
|
82
80
|
|
81
|
+
tarball_path = safe_temp_file(resource.name, '.tgz')
|
82
|
+
|
83
83
|
copy_files(resource)
|
84
84
|
resource.run_script(:pre_packaging, staging_dir)
|
85
85
|
|
@@ -94,6 +94,16 @@ module Bosh::Cli
|
|
94
94
|
|
95
95
|
sha1 = BuildArtifact.checksum(tarball_path)
|
96
96
|
BuildArtifact.new(resource.name, fingerprint, tarball_path, sha1, resource.dependencies, true, !final?)
|
97
|
+
ensure
|
98
|
+
cleanup
|
99
|
+
end
|
100
|
+
|
101
|
+
def validate(resource)
|
102
|
+
resource.validate!
|
103
|
+
true
|
104
|
+
rescue Bosh::Cli::MissingLicense => e
|
105
|
+
say("#{'Warning'.make_red}: #{e.message}")
|
106
|
+
false
|
97
107
|
end
|
98
108
|
|
99
109
|
def file_checksum(path)
|
@@ -115,5 +125,9 @@ module Bosh::Cli
|
|
115
125
|
File.open(tmpname, File::RDWR|File::CREAT|File::EXCL).close
|
116
126
|
end
|
117
127
|
end
|
128
|
+
|
129
|
+
def cleanup
|
130
|
+
FileUtils.rm_rf(staging_dir)
|
131
|
+
end
|
118
132
|
end
|
119
133
|
end
|
@@ -48,8 +48,8 @@ module Bosh::Cli
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
rescue Bosh::Blobstore::NotFound
|
52
|
-
raise BlobstoreError, "Final version of '#{name}' not found in blobstore"
|
51
|
+
rescue Bosh::Blobstore::NotFound => e
|
52
|
+
raise BlobstoreError, "Final version of '#{resource.name}' not found in blobstore: #{e}"
|
53
53
|
rescue Bosh::Blobstore::BlobstoreError => e
|
54
54
|
raise BlobstoreError, "Blobstore error: #{e}"
|
55
55
|
end
|
@@ -40,7 +40,7 @@ module Bosh::Cli::Command
|
|
40
40
|
release.save_config
|
41
41
|
end
|
42
42
|
rescue SemiSemantic::ParseError
|
43
|
-
err("Invalid version:
|
43
|
+
err("Invalid version: '#{version}'. Please specify a valid version (ex: 1.0.0 or 1.0-beta.2+dev.10).".make_red)
|
44
44
|
rescue Bosh::Cli::ReleaseVersionError => e
|
45
45
|
err(e.message.make_red)
|
46
46
|
end
|
@@ -55,13 +55,11 @@ module Bosh::Cli::Command
|
|
55
55
|
|
56
56
|
Bosh::Cli::Versions::MultiReleaseSupport.new(@work_dir, default_release_name, self).migrate
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
def create_from_spec(version)
|
60
|
-
final = options[:final]
|
61
60
|
force = options[:force]
|
62
61
|
name = options[:name]
|
63
62
|
manifest_only = !options[:with_tarball]
|
64
|
-
dry_run = options[:dry_run]
|
65
63
|
|
66
64
|
release.blobstore # prime & validate blobstore config
|
67
65
|
|
@@ -70,7 +68,7 @@ module Bosh::Cli::Command
|
|
70
68
|
raise_dirty_state_error if dirty_state? && !force
|
71
69
|
|
72
70
|
if final
|
73
|
-
confirm_final_release
|
71
|
+
confirm_final_release
|
74
72
|
unless name
|
75
73
|
save_final_release_name if release.final_name.blank?
|
76
74
|
name = release.final_name
|
@@ -86,14 +84,17 @@ module Bosh::Cli::Command
|
|
86
84
|
|
87
85
|
say("Release artifact cache: #{cache_dir}")
|
88
86
|
|
87
|
+
header('Building license')
|
88
|
+
license_artifacts = build_licenses
|
89
|
+
|
89
90
|
header('Building packages')
|
90
|
-
package_artifacts = build_packages
|
91
|
+
package_artifacts = build_packages
|
91
92
|
|
92
93
|
header('Building jobs')
|
93
|
-
job_artifacts = build_jobs(package_artifacts.map { |artifact| artifact.name }
|
94
|
+
job_artifacts = build_jobs(package_artifacts.map { |artifact| artifact.name })
|
94
95
|
|
95
96
|
header('Building release')
|
96
|
-
release_builder = build_release(
|
97
|
+
release_builder = build_release(job_artifacts, manifest_only, package_artifacts, license_artifacts, name, version)
|
97
98
|
|
98
99
|
header('Release summary')
|
99
100
|
show_summary(release_builder)
|
@@ -115,7 +116,7 @@ module Bosh::Cli::Command
|
|
115
116
|
release_builder.manifest_path
|
116
117
|
end
|
117
118
|
|
118
|
-
def confirm_final_release
|
119
|
+
def confirm_final_release
|
119
120
|
confirmed = non_interactive? || agree("Are you sure you want to generate #{'final'.make_red} version? ")
|
120
121
|
if !dry_run && !confirmed
|
121
122
|
say('Canceled release generation'.make_green)
|
@@ -135,9 +136,31 @@ module Bosh::Cli::Command
|
|
135
136
|
end
|
136
137
|
end
|
137
138
|
|
138
|
-
def
|
139
|
-
|
140
|
-
|
139
|
+
def archive_repository_provider
|
140
|
+
@archive_repository_provider ||= Bosh::Cli::ArchiveRepositoryProvider.new(work_dir, cache_dir, release.blobstore)
|
141
|
+
end
|
142
|
+
|
143
|
+
def build_release(job_artifacts, manifest_only, package_artifacts, license_artifacts, name, version)
|
144
|
+
license_artifact = license_artifacts.first
|
145
|
+
release_builder = Bosh::Cli::ReleaseBuilder.new(release, package_artifacts, job_artifacts, license_artifact, name,
|
146
|
+
final: final,
|
147
|
+
commit_hash: commit_hash,
|
148
|
+
version: version,
|
149
|
+
uncommitted_changes: dirty_state?
|
150
|
+
)
|
151
|
+
|
152
|
+
unless dry_run
|
153
|
+
if manifest_only
|
154
|
+
release_builder.build(:generate_tarball => false)
|
155
|
+
else
|
156
|
+
release_builder.build(:generate_tarball => true)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
release_builder
|
161
|
+
end
|
162
|
+
|
163
|
+
def build_packages
|
141
164
|
packages = Bosh::Cli::Resources::Package.discover(work_dir)
|
142
165
|
artifacts = packages.map do |package|
|
143
166
|
say("Building #{package.name.make_green}...")
|
@@ -163,32 +186,7 @@ module Bosh::Cli::Command
|
|
163
186
|
artifacts
|
164
187
|
end
|
165
188
|
|
166
|
-
def
|
167
|
-
@archive_repository_provider ||= Bosh::Cli::ArchiveRepositoryProvider.new(work_dir, cache_dir, release.blobstore)
|
168
|
-
end
|
169
|
-
|
170
|
-
def build_release(dry_run, final, job_artifacts, manifest_only, package_artifacts, name, version)
|
171
|
-
release_builder = Bosh::Cli::ReleaseBuilder.new(release, package_artifacts, job_artifacts, name,
|
172
|
-
final: final,
|
173
|
-
commit_hash: commit_hash,
|
174
|
-
version: version,
|
175
|
-
uncommitted_changes: dirty_state?
|
176
|
-
)
|
177
|
-
|
178
|
-
unless dry_run
|
179
|
-
if manifest_only
|
180
|
-
release_builder.build(:generate_tarball => false)
|
181
|
-
else
|
182
|
-
release_builder.build(:generate_tarball => true)
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
release_builder
|
187
|
-
end
|
188
|
-
|
189
|
-
def build_jobs(packages, dry_run, final)
|
190
|
-
archive_builder = Bosh::Cli::ArchiveBuilder.new(archive_repository_provider,
|
191
|
-
:final => final, :dry_run => dry_run)
|
189
|
+
def build_jobs(packages)
|
192
190
|
jobs = Bosh::Cli::Resources::Job.discover(work_dir, packages)
|
193
191
|
artifacts = jobs.map do |job|
|
194
192
|
say("Building #{job.name.make_green}...")
|
@@ -200,6 +198,23 @@ module Bosh::Cli::Command
|
|
200
198
|
artifacts
|
201
199
|
end
|
202
200
|
|
201
|
+
def build_licenses
|
202
|
+
licenses = Bosh::Cli::Resources::License.discover(work_dir)
|
203
|
+
artifacts = licenses.map do |license|
|
204
|
+
say("Building #{'license'.make_green}...")
|
205
|
+
artifact = archive_builder.build(license)
|
206
|
+
nl
|
207
|
+
artifact
|
208
|
+
end.compact
|
209
|
+
|
210
|
+
artifacts
|
211
|
+
end
|
212
|
+
|
213
|
+
def archive_builder
|
214
|
+
@archive_builder ||= Bosh::Cli::ArchiveBuilder.new(archive_repository_provider,
|
215
|
+
:final => final, :dry_run => dry_run)
|
216
|
+
end
|
217
|
+
|
203
218
|
def save_final_release_name
|
204
219
|
release.final_name = DEFAULT_RELEASE_NAME
|
205
220
|
if interactive?
|
@@ -236,6 +251,17 @@ module Bosh::Cli::Command
|
|
236
251
|
end
|
237
252
|
end
|
238
253
|
|
254
|
+
if builder.license_artifact
|
255
|
+
license_table = table do |t|
|
256
|
+
t.headings = %w(Name Version Notes)
|
257
|
+
t << artifact_summary(builder.license_artifact)
|
258
|
+
end
|
259
|
+
|
260
|
+
say('License')
|
261
|
+
say(license_table)
|
262
|
+
nl
|
263
|
+
end
|
264
|
+
|
239
265
|
say('Packages')
|
240
266
|
say(packages_table)
|
241
267
|
nl
|
@@ -273,6 +299,14 @@ module Bosh::Cli::Command
|
|
273
299
|
rescue Bosh::Exec::Error
|
274
300
|
'00000000'
|
275
301
|
end
|
302
|
+
|
303
|
+
def dry_run
|
304
|
+
dry_run ||= options[:dry_run]
|
305
|
+
end
|
306
|
+
|
307
|
+
def final
|
308
|
+
final ||= options[:final]
|
309
|
+
end
|
276
310
|
end
|
277
311
|
end
|
278
312
|
end
|
data/lib/cli/errors.rb
CHANGED
@@ -34,6 +34,7 @@ module Bosh::Cli
|
|
34
34
|
|
35
35
|
class InvalidPackage < CliError; error_code(500); end
|
36
36
|
class InvalidJob < CliError; error_code(501); end
|
37
|
+
class MissingLicense < CliError; error_code(502); end
|
37
38
|
class InvalidRelease < CliError; error_code(503); end
|
38
39
|
class MissingDependency < CliError; error_code(504); end
|
39
40
|
class CircularDependency < CliError; error_code(505); end
|
data/lib/cli/release_builder.rb
CHANGED
@@ -2,19 +2,30 @@ module Bosh::Cli
|
|
2
2
|
class ReleaseBuilder
|
3
3
|
include Bosh::Cli::DependencyHelper
|
4
4
|
|
5
|
-
attr_reader
|
5
|
+
attr_reader(
|
6
|
+
:release,
|
7
|
+
:license_artifact,
|
8
|
+
:packages,
|
9
|
+
:jobs,
|
10
|
+
:name,
|
11
|
+
:version,
|
12
|
+
:build_dir,
|
13
|
+
:commit_hash,
|
14
|
+
:uncommitted_changes
|
15
|
+
)
|
6
16
|
|
7
17
|
# @param [Bosh::Cli::Release] release Current release
|
8
18
|
# @param [Array<Bosh::Cli::BuildArtifact>] package_artifacts Built packages
|
9
19
|
# @param [Array<Bosh::Cli::BuildArtifact>] job_artifacts Built jobs
|
10
20
|
# @param [Hash] options Release build options
|
11
|
-
def initialize(release, package_artifacts, job_artifacts, name, options = { })
|
21
|
+
def initialize(release, package_artifacts, job_artifacts, license_artifact, name, options = { })
|
12
22
|
@release = release
|
13
23
|
@final = options.has_key?(:final) ? !!options[:final] : false
|
14
24
|
@commit_hash = options.fetch(:commit_hash, '00000000')
|
15
25
|
@uncommitted_changes = options.fetch(:uncommitted_changes, true)
|
16
26
|
@packages = package_artifacts # todo
|
17
27
|
@jobs = job_artifacts # todo
|
28
|
+
@license_artifact = license_artifact
|
18
29
|
@name = name
|
19
30
|
raise 'Release name is blank' if name.blank?
|
20
31
|
|
@@ -84,32 +95,6 @@ module Bosh::Cli
|
|
84
95
|
@build_complete = true
|
85
96
|
end
|
86
97
|
|
87
|
-
# Copies packages into release
|
88
|
-
def copy_packages
|
89
|
-
packages.each do |package_artifact|
|
90
|
-
name = package_artifact.name
|
91
|
-
tarball_path = package_artifact.tarball_path
|
92
|
-
say("%-40s %s" % [name.make_green, pretty_size(tarball_path)])
|
93
|
-
FileUtils.cp(tarball_path,
|
94
|
-
File.join(build_dir, "packages", "#{name}.tgz"),
|
95
|
-
:preserve => true)
|
96
|
-
end
|
97
|
-
@packages_copied = true
|
98
|
-
end
|
99
|
-
|
100
|
-
# Copies jobs into release todo DRY vs copy_packages
|
101
|
-
def copy_jobs
|
102
|
-
jobs.each do |job_artifact|
|
103
|
-
name = job_artifact.name
|
104
|
-
tarball_path = job_artifact.tarball_path
|
105
|
-
say("%-40s %s" % [name.make_green, pretty_size(tarball_path)])
|
106
|
-
FileUtils.cp(tarball_path,
|
107
|
-
File.join(build_dir, "jobs", "#{name}.tgz"),
|
108
|
-
:preserve => true)
|
109
|
-
end
|
110
|
-
@jobs_copied = true
|
111
|
-
end
|
112
|
-
|
113
98
|
# Generates release manifest
|
114
99
|
def generate_manifest
|
115
100
|
manifest = {}
|
@@ -122,6 +107,7 @@ module Bosh::Cli
|
|
122
107
|
'dependencies' => build_artifact.dependencies,
|
123
108
|
}
|
124
109
|
end
|
110
|
+
|
125
111
|
manifest['jobs'] = jobs.map do |build_artifact|
|
126
112
|
{
|
127
113
|
'name' => build_artifact.name,
|
@@ -131,6 +117,14 @@ module Bosh::Cli
|
|
131
117
|
}
|
132
118
|
end
|
133
119
|
|
120
|
+
unless @license_artifact.nil?
|
121
|
+
manifest['license'] = {
|
122
|
+
'version' => @license_artifact.version,
|
123
|
+
'fingerprint' => @license_artifact.fingerprint,
|
124
|
+
'sha1' => @license_artifact.sha1,
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
134
128
|
manifest['commit_hash'] = commit_hash
|
135
129
|
manifest['uncommitted_changes'] = uncommitted_changes
|
136
130
|
|
@@ -162,16 +156,9 @@ module Bosh::Cli
|
|
162
156
|
generate_manifest unless @manifest_generated
|
163
157
|
return if @release_storage.has_file?(release_filename)
|
164
158
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
nl
|
169
|
-
end
|
170
|
-
unless @packages_copied
|
171
|
-
header("Copying packages...")
|
172
|
-
copy_packages
|
173
|
-
nl
|
174
|
-
end
|
159
|
+
copy_jobs
|
160
|
+
copy_packages
|
161
|
+
copy_license
|
175
162
|
|
176
163
|
FileUtils.mkdir_p(File.dirname(tarball_path))
|
177
164
|
|
@@ -206,6 +193,41 @@ module Bosh::Cli
|
|
206
193
|
|
207
194
|
private
|
208
195
|
|
196
|
+
# Copies packages into release
|
197
|
+
def copy_packages
|
198
|
+
header("Copying packages...")
|
199
|
+
packages.each do |package_artifact|
|
200
|
+
copy_artifact(package_artifact, 'packages')
|
201
|
+
end
|
202
|
+
nl
|
203
|
+
end
|
204
|
+
|
205
|
+
# Copies jobs into release todo DRY vs copy_packages
|
206
|
+
def copy_jobs
|
207
|
+
header("Copying jobs...")
|
208
|
+
jobs.each do |job_artifact|
|
209
|
+
copy_artifact(job_artifact, 'jobs')
|
210
|
+
end
|
211
|
+
nl
|
212
|
+
end
|
213
|
+
|
214
|
+
def copy_license
|
215
|
+
return if @license_artifact.nil?
|
216
|
+
|
217
|
+
header("Copying license...")
|
218
|
+
copy_artifact(@license_artifact)
|
219
|
+
nl
|
220
|
+
end
|
221
|
+
|
222
|
+
def copy_artifact(artifact, dest = nil)
|
223
|
+
name = artifact.name
|
224
|
+
tarball_path = artifact.tarball_path
|
225
|
+
say("%-40s %s" % [name.make_green, pretty_size(tarball_path)])
|
226
|
+
FileUtils.cp(tarball_path,
|
227
|
+
File.join([build_dir, dest, "#{name}.tgz"].compact),
|
228
|
+
:preserve => true)
|
229
|
+
end
|
230
|
+
|
209
231
|
def assign_version
|
210
232
|
latest_final_version = Versions::ReleaseVersionsIndex.new(@final_index).latest_version
|
211
233
|
latest_final_version ||= Bosh::Common::Version::ReleaseVersion.parse('0')
|
data/lib/cli/release_compiler.rb
CHANGED
@@ -37,8 +37,9 @@ module Bosh::Cli
|
|
37
37
|
|
38
38
|
@name = @manifest["name"]
|
39
39
|
@version = @manifest["version"]
|
40
|
-
@packages = @manifest
|
41
|
-
@jobs = @manifest
|
40
|
+
@packages = @manifest.fetch("packages", []).map { |pkg| OpenStruct.new(pkg) }
|
41
|
+
@jobs = @manifest.fetch("jobs", []).map { |job| OpenStruct.new(job) }
|
42
|
+
@license = @manifest["license"] ? OpenStruct.new(@manifest["license"]) : nil
|
42
43
|
end
|
43
44
|
|
44
45
|
def compile
|
@@ -55,6 +56,7 @@ module Bosh::Cli
|
|
55
56
|
say("SKIP".make_yellow)
|
56
57
|
next
|
57
58
|
end
|
59
|
+
nl
|
58
60
|
package_file_path = find_package(package)
|
59
61
|
FileUtils.cp(package_file_path,
|
60
62
|
File.join(@packages_dir, "#{package.name}.tgz"),
|
@@ -68,12 +70,21 @@ module Bosh::Cli
|
|
68
70
|
say("SKIP".make_yellow)
|
69
71
|
next
|
70
72
|
end
|
73
|
+
nl
|
71
74
|
job_file_path = find_job(job)
|
72
75
|
FileUtils.cp(job_file_path,
|
73
76
|
File.join(@jobs_dir, "#{job.name}.tgz"),
|
74
77
|
:preserve => true)
|
75
78
|
end
|
76
79
|
|
80
|
+
header("Copying license")
|
81
|
+
if @license
|
82
|
+
say("license (#{@license.version})".ljust(30), " ")
|
83
|
+
nl
|
84
|
+
license_file_path = find_license(@license)
|
85
|
+
FileUtils.cp(license_file_path, File.join(@build_dir, 'license.tgz'), preserve: true)
|
86
|
+
end
|
87
|
+
|
77
88
|
header("Building tarball")
|
78
89
|
Dir.chdir(@build_dir) do
|
79
90
|
tar_out = `tar -czf #{tarball_path} . 2>&1`
|
@@ -112,6 +123,14 @@ module Bosh::Cli
|
|
112
123
|
find_in_indices(final_index, dev_index, job, 'job')
|
113
124
|
end
|
114
125
|
|
126
|
+
def find_license(license)
|
127
|
+
final_dir = File.join(@release_source, '.final_builds', 'license')
|
128
|
+
final_index = Versions::VersionsIndex.new(final_dir)
|
129
|
+
dev_dir = File.join(@release_source, '.dev_builds', 'license')
|
130
|
+
dev_index = Versions::VersionsIndex.new(dev_dir)
|
131
|
+
find_in_indices(final_index, dev_index, license, 'license')
|
132
|
+
end
|
133
|
+
|
115
134
|
def find_version_by_sha1(index, sha1)
|
116
135
|
index.select{ |_, build| build['sha1'] == sha1 }.values.first
|
117
136
|
end
|
data/lib/cli/release_tarball.rb
CHANGED
@@ -281,8 +281,14 @@ module Bosh::Cli
|
|
281
281
|
for job in manifest["jobs"]
|
282
282
|
say(" - #{job["name"]} (#{job["version"]})")
|
283
283
|
end
|
284
|
-
end
|
285
284
|
|
285
|
+
say("\nLicense")
|
286
|
+
if manifest["license"].nil? || manifest["license"].empty?
|
287
|
+
say(" - none")
|
288
|
+
else
|
289
|
+
say(" - license (#{manifest["license"]["version"]})")
|
290
|
+
end
|
291
|
+
end
|
286
292
|
end
|
287
293
|
end
|
288
294
|
|
data/lib/cli/resources/job.rb
CHANGED
@@ -28,6 +28,10 @@ module Bosh::Cli::Resources
|
|
28
28
|
spec['name']
|
29
29
|
end
|
30
30
|
|
31
|
+
def additional_fingerprints
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
|
31
35
|
def dependencies
|
32
36
|
package_dependencies #TODO: should this be packages or package_dependencies?
|
33
37
|
end
|
@@ -41,8 +45,6 @@ module Bosh::Cli::Resources
|
|
41
45
|
end
|
42
46
|
|
43
47
|
def files
|
44
|
-
validate!
|
45
|
-
|
46
48
|
files = (templates_files + monit_files).map { |absolute_path| [absolute_path, relative_path(absolute_path)] }
|
47
49
|
files << [File.join(job_base, 'spec'), 'job.MF']
|
48
50
|
files
|
@@ -85,10 +87,6 @@ module Bosh::Cli::Resources
|
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
88
|
-
def additional_fingerprints
|
89
|
-
[]
|
90
|
-
end
|
91
|
-
|
92
90
|
def format_fingerprint(digest, filename, name, file_mode)
|
93
91
|
"%s%s%s" % [File.basename(filename), digest, file_mode]
|
94
92
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Bosh::Cli::Resources
|
2
|
+
class License
|
3
|
+
# @param [String] directory base Release directory
|
4
|
+
def self.discover(release_base)
|
5
|
+
[new(release_base)]
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader :release_base
|
9
|
+
|
10
|
+
def initialize(release_base)
|
11
|
+
@release_base = Pathname.new(release_base)
|
12
|
+
end
|
13
|
+
|
14
|
+
def singular_type
|
15
|
+
'license'
|
16
|
+
end
|
17
|
+
|
18
|
+
def plural_type
|
19
|
+
''
|
20
|
+
end
|
21
|
+
|
22
|
+
def name
|
23
|
+
'license'
|
24
|
+
end
|
25
|
+
|
26
|
+
def files
|
27
|
+
Dir[File.join(release_base, "{LICENSE,NOTICE}{,.*}")].map { |entry| [entry, File.basename(entry)] }
|
28
|
+
end
|
29
|
+
|
30
|
+
def validate!
|
31
|
+
if files.empty?
|
32
|
+
raise Bosh::Cli::MissingLicense, "Missing LICENSE or NOTICE in #{release_base.to_s}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def format_fingerprint(digest, filename, name, file_mode)
|
37
|
+
"%s%s" % [File.basename(filename), digest]
|
38
|
+
end
|
39
|
+
|
40
|
+
def additional_fingerprints
|
41
|
+
[]
|
42
|
+
end
|
43
|
+
|
44
|
+
def dependencies
|
45
|
+
[]
|
46
|
+
end
|
47
|
+
|
48
|
+
def run_script(script_name, *args)
|
49
|
+
# no-op
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2849.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bosh_common
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.2849.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.2849.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bosh-template
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.2849.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.2849.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: json_pure
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.2849.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.2849.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: net-ssh
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,7 +194,7 @@ dependencies:
|
|
194
194
|
version: 0.5.4
|
195
195
|
description: |-
|
196
196
|
BOSH CLI
|
197
|
-
|
197
|
+
4f117d
|
198
198
|
email: support@cloudfoundry.com
|
199
199
|
executables:
|
200
200
|
- bosh
|
@@ -278,6 +278,7 @@ files:
|
|
278
278
|
- lib/cli/release_compiler.rb
|
279
279
|
- lib/cli/release_tarball.rb
|
280
280
|
- lib/cli/resources/job.rb
|
281
|
+
- lib/cli/resources/license.rb
|
281
282
|
- lib/cli/resources/package.rb
|
282
283
|
- lib/cli/resurrection.rb
|
283
284
|
- lib/cli/runner.rb
|