omnibus 9.0.8 → 9.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f05719c1cecdc2defbb5641b5a61517b84f88a844932ca0568e3b435997e6fd9
4
- data.tar.gz: 7593e4150d3222b368a722f84f92755a4f246e2a31fc8bdb72b8bc9495c42420
3
+ metadata.gz: f20cc7252db28fd200af4db5bda33950070e7156613c39009f03ca486eb0e20a
4
+ data.tar.gz: 9dcd4a140bf26997769e5f125f205411ca2cb99c0baff4d3c5f8a8f5f637e45a
5
5
  SHA512:
6
- metadata.gz: bb4cd2da9b1baab9d1b2555f498d0efdf71627a0a8686654ebdab0e1da8546004b48215ac907e768c964409f8f08caa0a91cd75d664de76d8b7607f509795c5c
7
- data.tar.gz: e1a6e11eac83c8e192c2468fbd457b20eacecca8d0aa7c2e286f77cdc1357cba4a9cb1618c0c03014fb7fdb4d7f9bfd346036abe277abed169d1b26f74f833e7
6
+ metadata.gz: aa23dc9ab959bf5d738ac6377b47b96f29a44ac447e0cb22bee1dcb019ca8278907986844c4333f747986dbc77eb916d513df2c22b51b6e2c8adf9a5b70a21e5
7
+ data.tar.gz: f89b0e7c0d3bb79b904084de8c1b00fe9e2f4fca318335158c58ac2472de51d945c6ff641bcdf33db38d15928b7e7d30419423505af93380f546f99fc935ac74
@@ -601,6 +601,18 @@ module Omnibus
601
601
  # @return [true, false]
602
602
  default(:fatal_transitive_dependency_licensing_warnings, false)
603
603
 
604
+ # Fail the build when health check does not succeed. This may only be set to false
605
+ # for very specific use-cases in the omnibus project. e.g. creating a wrapper installer
606
+ #
607
+ # @return [true, false]
608
+ default(:health_check, true)
609
+
610
+ # Use the internal_source URL when fetching software dependencies. e.g. when creating an
611
+ # omnibus package using artifactory as the source url.
612
+ #
613
+ # @return [true, false]
614
+ default(:use_internal_sources, false)
615
+
604
616
  # --------------------------------------------------
605
617
  # @!endgroup
606
618
  #
@@ -351,4 +351,15 @@ module Omnibus
351
351
  EOH
352
352
  end
353
353
  end
354
+
355
+ class InternalSourceMissing < Error
356
+ def initialize(software)
357
+ super <<~EOH
358
+ Internal source missing for #{software.name}.
359
+
360
+ When :use_internal_sources is set in the configuration you must specify an
361
+ internal_source for sources fetched from a url.
362
+ EOH
363
+ end
364
+ end
354
365
  end
@@ -147,6 +147,8 @@ module Omnibus
147
147
  def download_url
148
148
  if Config.use_s3_caching
149
149
  S3Cache.url_for(self)
150
+ elsif Config.use_internal_sources && !source[:internal]
151
+ raise InternalSourceMissing.new(self)
150
152
  else
151
153
  source[:url]
152
154
  end
@@ -64,6 +64,10 @@ module Omnibus
64
64
  # if the healthchecks pass
65
65
  #
66
66
  def run!
67
+ unless Config.health_check
68
+ log.info(log_key) { "Health check skipped as specified in config for #{project.name}" }
69
+ return true
70
+ end
67
71
  measure("Health check time") do
68
72
  log.info(log_key) { "Running health on #{project.name}" }
69
73
  bad_libs, good_libs =
@@ -336,7 +336,7 @@ module Omnibus
336
336
  extra_keys = val.keys - [
337
337
  :git, :file, :path, :url, # fetcher types
338
338
  :md5, :sha1, :sha256, :sha512, # hash type - common to all fetchers
339
- :cookie, :warning, :unsafe, :extract, :cached_name, :authorization, # used by net_fetcher
339
+ :cookie, :warning, :unsafe, :extract, :cached_name, :authorization, :internal, # used by net_fetcher
340
340
  :options, # used by path_fetcher
341
341
  :submodules # used by git_fetcher
342
342
  ]
@@ -351,8 +351,21 @@ module Omnibus
351
351
  "not include duplicate keys. Duplicate keys: #{duplicate_keys.inspect}")
352
352
  end
353
353
 
354
- @source ||= {}
355
- @source.merge!(val)
354
+ if Config.use_internal_sources && val[:url]
355
+ if internal_source_set? && val[:internal].nil?
356
+ # We only want to replace the hash types here
357
+ hash_types = %i{md5 sha1 sha256 sha512}
358
+ val.each_key do |key|
359
+ val.delete(key) unless hash_types.include?(key)
360
+ end
361
+ end
362
+
363
+ @source ||= {}
364
+ @source.merge!(val)
365
+ else
366
+ @source ||= {}
367
+ @source.merge!(val)
368
+ end
356
369
  end
357
370
 
358
371
  override = canonicalize_source(overrides[:source])
@@ -360,6 +373,22 @@ module Omnibus
360
373
  end
361
374
  expose :source
362
375
 
376
+ def internal_source_set?
377
+ @source && @source[:internal] == true
378
+ end
379
+
380
+ def internal_source(val = NULL)
381
+ unless val.is_a?(Hash)
382
+ raise InvalidValue.new(:internal_source,
383
+ "be a kind of `Hash', but was `#{val.class.inspect}'")
384
+ end
385
+ if Config.use_internal_sources
386
+ val[:internal] = true
387
+ source(val)
388
+ end
389
+ end
390
+ expose :internal_source
391
+
363
392
  #
364
393
  # Set or retrieve the {#default_version} of the software to build.
365
394
  #
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Omnibus
18
- VERSION = "9.0.8".freeze
18
+ VERSION = "9.0.12".freeze
19
19
  end
data/omnibus.gemspec CHANGED
@@ -20,12 +20,12 @@ Gem::Specification.new do |gem|
20
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
21
  gem.require_paths = ["lib"]
22
22
 
23
- gem.add_dependency "aws-sdk-s3", "~> 1"
23
+ gem.add_dependency "aws-sdk-s3", "~> 1.116.0"
24
24
  gem.add_dependency "chef-utils", ">= 15.4"
25
25
  gem.add_dependency "chef-cleanroom", "~> 1.0"
26
26
  gem.add_dependency "ffi-yajl", "~> 2.2"
27
27
  gem.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
28
- gem.add_dependency "ohai", ">= 15", "< 18"
28
+ gem.add_dependency "ohai", ">= 16", "< 19"
29
29
  gem.add_dependency "ruby-progressbar", "~> 1.7"
30
30
  gem.add_dependency "thor", ">= 0.18", "< 2.0"
31
31
  gem.add_dependency "license_scout", "~> 1.0"
@@ -173,6 +173,26 @@ module Omnibus
173
173
  end
174
174
  end
175
175
 
176
+ context "when use_internal_sources is true and no internal source url" do
177
+ before { Omnibus::Config.use_internal_sources(true) }
178
+
179
+ it "raises an exception" do
180
+ expect { fetch! }.to raise_error(InternalSourceMissing)
181
+ end
182
+ end
183
+
184
+ context "when use_internal_sources is true and internal source url given" do
185
+ before { Omnibus::Config.use_internal_sources(true) }
186
+ let(:source) do
187
+ { url: source_url, md5: source_md5, internal: true }
188
+ end
189
+
190
+ it "downloads the file" do
191
+ fetch!
192
+ expect(downloaded_file).to be_a_file
193
+ end
194
+ end
195
+
176
196
  context "source with sha1" do
177
197
  let(:source) do
178
198
  { url: source_url, sha1: source_sha1 }
@@ -45,6 +45,7 @@ module Omnibus
45
45
  include_examples "a configurable", :fetcher_read_timeout, 60
46
46
  include_examples "a configurable", :fetcher_retries, 5
47
47
  include_examples "a configurable", :fatal_licensing_warnings, false
48
+ include_examples "a configurable", :health_check, true
48
49
  include_examples "a configurable", :fips_mode, false
49
50
 
50
51
  describe "#workers" do
@@ -16,10 +16,18 @@ module Omnibus
16
16
  }
17
17
  end
18
18
 
19
+ let(:internal_source) do
20
+ {
21
+ url: "http://internal.com/",
22
+ md5: "efgh5678",
23
+ }
24
+ end
25
+
19
26
  let(:rel_path) { "software" }
20
27
 
21
28
  subject do
22
29
  local_source = source
30
+ local_internal_source = internal_source
23
31
  local_rel_path = rel_path
24
32
 
25
33
  described_class.new(project).evaluate do
@@ -27,6 +35,7 @@ module Omnibus
27
35
  default_version "1.2.3"
28
36
 
29
37
  source local_source
38
+ internal_source local_internal_source
30
39
  relative_path local_rel_path
31
40
  end
32
41
  end
@@ -592,6 +601,14 @@ module Omnibus
592
601
  end
593
602
  end
594
603
 
604
+ context "when software internal_source is given" do
605
+ before { Omnibus::Config.use_internal_sources(true) }
606
+
607
+ it "sets the source with internal: true" do
608
+ expect(subject.source).to eq(url: "http://internal.com/", md5: "efgh5678", internal: true)
609
+ end
610
+ end
611
+
595
612
  describe "#fetcher" do
596
613
  before do
597
614
  expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", source).and_return("1.2.8")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnibus
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.0.8
4
+ version: 9.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
19
+ version: 1.116.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.116.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-utils
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,20 +92,20 @@ dependencies:
92
92
  requirements:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: '15'
95
+ version: '16'
96
96
  - - "<"
97
97
  - !ruby/object:Gem::Version
98
- version: '18'
98
+ version: '19'
99
99
  type: :runtime
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
- version: '15'
105
+ version: '16'
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
- version: '18'
108
+ version: '19'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: ruby-progressbar
111
111
  requirement: !ruby/object:Gem::Requirement