vara 0.21.1 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vara/downloader.rb +1 -1
- data/lib/vara/git_inspector.rb +1 -1
- data/lib/vara/linter.rb +1 -1
- data/lib/vara/log.rb +1 -1
- data/lib/vara/metadata/compiled_packages.rb +1 -1
- data/lib/vara/product.rb +3 -3
- data/lib/vara/product_artifact_validator.rb +3 -3
- data/lib/vara/product_contents.rb +1 -1
- data/lib/vara/product_metadata_processor.rb +6 -6
- data/lib/vara/product_resource_downloader.rb +1 -1
- data/lib/vara/static_versioner.rb +8 -0
- data/lib/vara/tarball.rb +4 -4
- data/lib/vara/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: 53b15fc0f2bf249075d85c00adbcc4bd31a595ed
|
4
|
+
data.tar.gz: 884e2d22736c9c2cb6ad17eccf9e29aff93fcf9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a22c87efc0c7940a3e01d40ae6092c7fd6765ee6d7e9e9241708bee3beaa5b8845393926b6ba8b99c55f19b01d169cc89af65ebb23e1e7f09fbc074fd734044d
|
7
|
+
data.tar.gz: d791843f683c38eefd8078797daddf201650d1832c6d3cca7412f20f4215d9d37eca63bafbe7c8c8324fd37a816262195b8342502dc12b281784d0564046a03c
|
data/lib/vara/downloader.rb
CHANGED
@@ -7,7 +7,7 @@ module Vara
|
|
7
7
|
# @param source [String] The URL from which to download
|
8
8
|
# @param target [String] The path on disk for where to save the downloaded file
|
9
9
|
def self.download(metadata, target)
|
10
|
-
|
10
|
+
raise 'URL or AWS Config required to download!' unless metadata.url || metadata.aws
|
11
11
|
if metadata.aws
|
12
12
|
download_from_aws(metadata.aws, target)
|
13
13
|
elsif metadata.url
|
data/lib/vara/git_inspector.rb
CHANGED
@@ -14,7 +14,7 @@ module Vara
|
|
14
14
|
|
15
15
|
# @param repo_path [String] Path to the root of the repository to inspect
|
16
16
|
def initialize(repo_path)
|
17
|
-
|
17
|
+
raise "The directory #{repo_path} must be a git repo" unless self.class.git_repo?(repo_path)
|
18
18
|
@repo_path = repo_path
|
19
19
|
end
|
20
20
|
|
data/lib/vara/linter.rb
CHANGED
data/lib/vara/log.rb
CHANGED
@@ -59,7 +59,7 @@ module Vara
|
|
59
59
|
# @raise [RuntimeError] if the URL is not set.
|
60
60
|
# @return [String]
|
61
61
|
def url
|
62
|
-
@url ||
|
62
|
+
@url || raise("URL unknown for compiled_packages #{name}")
|
63
63
|
end
|
64
64
|
|
65
65
|
# @return [nil] the interface for downloader requires this method
|
data/lib/vara/product.rb
CHANGED
@@ -18,12 +18,12 @@ module Vara
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def metadata_file
|
21
|
-
@metadata_file ||= find_metadata_file ||
|
21
|
+
@metadata_file ||= find_metadata_file || raise('No metadata file found.')
|
22
22
|
end
|
23
23
|
|
24
24
|
def build
|
25
25
|
if metadata.explicit_stemcell? && metadata.stemcell_criteria?
|
26
|
-
|
26
|
+
raise 'binaries.yml includes both stemcell and stemcell criteria keys'
|
27
27
|
end
|
28
28
|
|
29
29
|
ProductArtifactZipper.new(path, ProductContents.from_metadata_path(metadata_file), @options).zip!
|
@@ -83,7 +83,7 @@ module Vara
|
|
83
83
|
when 1 then
|
84
84
|
files.first
|
85
85
|
else
|
86
|
-
|
86
|
+
raise("Found: #{files.map { |f| File.basename(f) }}. Vara supports one .yml file under metadata/")
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -3,7 +3,7 @@ require 'digest/md5'
|
|
3
3
|
module Vara
|
4
4
|
class ProductArtifactValidator
|
5
5
|
def self.validate_file_checksum(file_metadata, file_name)
|
6
|
-
|
6
|
+
raise "No checksum for file #{file_name}!" unless file_metadata.md5 || file_metadata.sha1
|
7
7
|
|
8
8
|
validate_md5(file_metadata, file_name) if file_metadata.md5
|
9
9
|
|
@@ -13,13 +13,13 @@ module Vara
|
|
13
13
|
def self.validate_sha1(file_metadata, file_name)
|
14
14
|
sha1_got = Digest::SHA1.file(file_name).hexdigest
|
15
15
|
sha1_expected = file_metadata.sha1
|
16
|
-
|
16
|
+
raise "sha1 mismatch for file #{file_name}, expected #{sha1_expected}, got #{sha1_got}" if sha1_got != sha1_expected
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.validate_md5(file_metadata, file_name)
|
20
20
|
md5_got = Digest::MD5.file(file_name).hexdigest
|
21
21
|
md5_expected = file_metadata.md5
|
22
|
-
|
22
|
+
raise "md5 mismatch for file #{file_name}, expected #{md5_expected}, got #{md5_got}" if md5_got != md5_expected
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -20,7 +20,7 @@ module Vara
|
|
20
20
|
# @return [String] The path to the content migration file on disk
|
21
21
|
def content_migrations_path
|
22
22
|
paths = Dir.glob(File.expand_path(File.join(root_path, 'content_migrations', '*.yml')))
|
23
|
-
|
23
|
+
raise "Exactly one content_migrations file is required in #{root_path}/content_migrations" if paths.size != 1
|
24
24
|
paths.first
|
25
25
|
end
|
26
26
|
|
@@ -59,7 +59,7 @@ module Vara
|
|
59
59
|
r['name'] == external_release['name']
|
60
60
|
end
|
61
61
|
|
62
|
-
|
62
|
+
raise "Specified release #{external_release['name']} does not exist in binaries.yml" unless replace
|
63
63
|
|
64
64
|
metadata['releases'][replace] = external_release
|
65
65
|
end
|
@@ -70,24 +70,24 @@ module Vara
|
|
70
70
|
missing_keys = REQUIRED_RELEASE_KEYS - external_release.keys.to_a
|
71
71
|
specified_release = "Specified release #{File.basename(external_release_path)} "
|
72
72
|
|
73
|
-
|
73
|
+
raise specified_release + "is missing required keywords: #{missing_keys}" unless missing_keys.empty?
|
74
74
|
|
75
75
|
exclusive_key_count = (EXCLUSIVE_KEYS - external_release.keys.to_a).length
|
76
76
|
case
|
77
77
|
when exclusive_key_count < 1
|
78
|
-
|
78
|
+
raise specified_release + "contains more than one of the following keys, but only one is allowed: #{EXCLUSIVE_KEYS}"
|
79
79
|
when exclusive_key_count > 1
|
80
|
-
|
80
|
+
raise specified_release + "requires one of the following keys: #{EXCLUSIVE_KEYS}"
|
81
81
|
end
|
82
82
|
|
83
83
|
if external_release.key?('aws')
|
84
84
|
missing_aws_keys = missing_aws_keys(external_release)
|
85
85
|
|
86
|
-
|
86
|
+
raise specified_release + "is missing required aws hash keywords: #{missing_aws_keys}" unless missing_aws_keys.empty?
|
87
87
|
end
|
88
88
|
|
89
89
|
extra_keys = external_release.keys.to_a - REQUIRED_RELEASE_KEYS - EXCLUSIVE_KEYS
|
90
|
-
|
90
|
+
raise specified_release + "has extra keywords: #{extra_keys}" unless extra_keys.empty?
|
91
91
|
external_release
|
92
92
|
end
|
93
93
|
# rubocop:enable CyclomaticComplexity
|
@@ -18,7 +18,7 @@ module Vara
|
|
18
18
|
|
19
19
|
def download
|
20
20
|
if product_metadata.explicit_stemcell? && product_metadata.stemcell_criteria?
|
21
|
-
|
21
|
+
raise 'binaries.yml includes both stemcell and stemcell criteria keys'
|
22
22
|
end
|
23
23
|
|
24
24
|
if product_metadata.explicit_stemcell?
|
@@ -1,4 +1,6 @@
|
|
1
1
|
module Vara
|
2
|
+
class VersionError < RuntimeError; end
|
3
|
+
|
2
4
|
class StaticVersioner
|
3
5
|
PRODUCT_VERSION_KEY = 'product_version'.freeze
|
4
6
|
TO_VERSION_KEY = 'to_version'.freeze
|
@@ -9,6 +11,12 @@ module Vara
|
|
9
11
|
# @param product_directory_path [String]
|
10
12
|
# @param version [String] the product version
|
11
13
|
def initialize(product_directory_path, version)
|
14
|
+
begin
|
15
|
+
Gem::Version.create(version)
|
16
|
+
rescue
|
17
|
+
raise Vara::VersionError, "Invalid version: #{version}"
|
18
|
+
end
|
19
|
+
|
12
20
|
@product_directory_path = product_directory_path
|
13
21
|
@version = version
|
14
22
|
end
|
data/lib/vara/tarball.rb
CHANGED
@@ -50,7 +50,7 @@ module Vara
|
|
50
50
|
stderr_string = stderr.read
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
raise "Invalid tarball: #{path_to_binary}. Tar command STDOUT: #{stdout_string}\n STDERR:#{stderr_string}" unless status.success?
|
54
54
|
|
55
55
|
log.info("Verified that #{path_to_binary} as a valid tar file")
|
56
56
|
end
|
@@ -58,7 +58,7 @@ module Vara
|
|
58
58
|
def validate_checksum
|
59
59
|
log.info("Beginning checksum validation of #{metadata}")
|
60
60
|
log.info("Path to File: #{path_to_binary}")
|
61
|
-
|
61
|
+
raise "Metadata doesn't include SHA1 or MD5 checksum!" unless metadata.md5 || metadata.sha1
|
62
62
|
validate_md5 if metadata.md5
|
63
63
|
validate_sha1 if metadata.sha1
|
64
64
|
log.info("#{metadata} checksum validation complete")
|
@@ -68,14 +68,14 @@ module Vara
|
|
68
68
|
log.info("Expected SHA1: #{metadata.sha1}")
|
69
69
|
actual_sha1 = Digest::SHA1.file(path_to_binary).hexdigest
|
70
70
|
log.info("Actual SHA1: #{actual_sha1}")
|
71
|
-
|
71
|
+
raise "SHA1 doesn't match expected value!" unless actual_sha1 == metadata.sha1
|
72
72
|
end
|
73
73
|
|
74
74
|
def validate_md5
|
75
75
|
log.info("Expected MD5: #{metadata.md5}")
|
76
76
|
actual_md5 = Digest::MD5.file(path_to_binary).hexdigest
|
77
77
|
log.info("Actual MD5: #{actual_md5}")
|
78
|
-
|
78
|
+
raise "MD5 doesn't match expected value!" unless actual_md5 == metadata.md5
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
data/lib/vara/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CF Release Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|