omnibus 9.0.8 → 9.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/omnibus/config.rb +12 -0
- data/lib/omnibus/exceptions.rb +11 -0
- data/lib/omnibus/fetchers/net_fetcher.rb +2 -0
- data/lib/omnibus/health_check.rb +4 -0
- data/lib/omnibus/software.rb +32 -3
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +2 -2
- data/spec/functional/fetchers/net_fetcher_spec.rb +20 -0
- data/spec/unit/config_spec.rb +1 -0
- data/spec/unit/software_spec.rb +17 -0
- metadata +8 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f20cc7252db28fd200af4db5bda33950070e7156613c39009f03ca486eb0e20a
         | 
| 4 | 
            +
              data.tar.gz: 9dcd4a140bf26997769e5f125f205411ca2cb99c0baff4d3c5f8a8f5f637e45a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: aa23dc9ab959bf5d738ac6377b47b96f29a44ac447e0cb22bee1dcb019ca8278907986844c4333f747986dbc77eb916d513df2c22b51b6e2c8adf9a5b70a21e5
         | 
| 7 | 
            +
              data.tar.gz: f89b0e7c0d3bb79b904084de8c1b00fe9e2f4fca318335158c58ac2472de51d945c6ff641bcdf33db38d15928b7e7d30419423505af93380f546f99fc935ac74
         | 
    
        data/lib/omnibus/config.rb
    CHANGED
    
    | @@ -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 | 
             
                #
         | 
    
        data/lib/omnibus/exceptions.rb
    CHANGED
    
    | @@ -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
         | 
    
        data/lib/omnibus/health_check.rb
    CHANGED
    
    | @@ -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 =
         | 
    
        data/lib/omnibus/software.rb
    CHANGED
    
    | @@ -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 | 
            -
                     | 
| 355 | 
            -
             | 
| 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 | 
             
                #
         | 
    
        data/lib/omnibus/version.rb
    CHANGED
    
    
    
        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",             ">=  | 
| 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 }
         | 
    
        data/spec/unit/config_spec.rb
    CHANGED
    
    | @@ -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
         | 
    
        data/spec/unit/software_spec.rb
    CHANGED
    
    | @@ -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. | 
| 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- | 
| 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:  | 
| 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:  | 
| 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: ' | 
| 95 | 
            +
                    version: '16'
         | 
| 96 96 | 
             
                - - "<"
         | 
| 97 97 | 
             
                  - !ruby/object:Gem::Version
         | 
| 98 | 
            -
                    version: ' | 
| 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: ' | 
| 105 | 
            +
                    version: '16'
         | 
| 106 106 | 
             
                - - "<"
         | 
| 107 107 | 
             
                  - !ruby/object:Gem::Version
         | 
| 108 | 
            -
                    version: ' | 
| 108 | 
            +
                    version: '19'
         | 
| 109 109 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 110 110 | 
             
              name: ruby-progressbar
         | 
| 111 111 | 
             
              requirement: !ruby/object:Gem::Requirement
         |