inspec / inspec-azure

InSpec Azure Resource Pack
https://www.inspec.io/
Other
97 stars 80 forks source link

Vendoring a control with `inspec-azure` fails with a missing file error for `release-dates.json` #660

Open russellseymour opened 2 years ago

russellseymour commented 2 years ago

Describe the problem

When trying to vendor a new control for testing Azure resources I get the following error trace:

Traceback (most recent call last):
        19: from C:/opscode/inspec/bin/inspec:304:in `<main>'
        18: from C:/opscode/inspec/bin/inspec:304:in `load'
        17: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-bin-5.17.4/bin/inspec:11:in `<top (required)>'
        16: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/base_cli.rb:35:in `start'
        15: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
        14: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        13: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        12: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        11: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/cli.rb:175:in `vendor'
        10: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/base_cli.rb:345:in `vendor_deps'
         9: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile_vendor.rb:13:in `vendor!'
         8: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile_vendor.rb:59:in `vendor_dependencies!'
         7: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile_vendor.rb:68:in `extract_archives'
         6: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile_vendor.rb:68:in `each'
         5: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile_vendor.rb:79:in `block in extract_archives'
         4: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:195:in `extract'
         3: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:195:in `each'
         2: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:199:in `block in extract'
         1: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:199:in `open'
C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:199:in `initialize': No such file or directory @ rb_sysopen - C:/Users/RussellSeymour/workspaces/stacks/stacks-ancillary-resources/src/ancillary_resources/tests/azure/vendor/1cafe26108ae70daf5e8fe33e10a9c602c453cfbd1355ea1f8e3fc77064e3c41/inspec-azure-1.118.5/docs-chef-io/assets/release-notes/inspec-azure/release-dates.json (Errno::ENOENT)

The relevant excerpt from my inspec.yml file is:

depends:
  - name: inspec-azure
    url: https://github.com/inspec/inspec-azure/archive/v1.118.5.tar.gz
supports:
  - platform: azure

I have tried several different tag versions v1.118.5, v.118.0 and v1.117.0 and I get the same error.

To get around this I clone the v1.118.5 tagged repository and make a reference to it in the inspec.yml file, but I got this error:

Traceback (most recent call last):
        28: from C:/opscode/inspec/bin/inspec:304:in `<main>'
        27: from C:/opscode/inspec/bin/inspec:304:in `load'
        26: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-bin-5.17.4/bin/inspec:11:in `<top (required)>'
        25: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/base_cli.rb:35:in `start'
        24: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
        23: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
        22: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
        21: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
        20: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/cli.rb:175:in `vendor'
        19: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/base_cli.rb:345:in `vendor_deps'
        18: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile_vendor.rb:13:in `vendor!'
        17: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile_vendor.rb:58:in `vendor_dependencies!'
        16: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/profile.rb:775:in `generate_lockfile'
        15: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/dependencies/dependency_set.rb:90:in `vendor'
        14: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/dependencies/resolver.rb:30:in `resolve'
        13: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/dependencies/resolver.rb:59:in `resolve'
        12: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/dependencies/resolver.rb:59:in `each'
        11: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/dependencies/resolver.rb:77:in `block in resolve'
        10: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/dependencies/requirement.rb:83:in `resolved_source'
         9: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/cached_fetcher.rb:21:in `resolved_source'
         8: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/cached_fetcher.rb:47:in `fetch'
         7: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/fetcher/local.rb:57:in `fetch'
         6: from C:/opscode/inspec/embedded/lib/ruby/2.7.0/tmpdir.rb:89:in `mktmpdir'
         5: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/fetcher/local.rb:70:in `block in fetch'
         4: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:195:in `extract'
         3: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:195:in `each'
         2: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:199:in `block in extract'
         1: from C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:199:in `open'
C:/opscode/inspec/embedded/lib/ruby/gems/2.7.0/gems/inspec-core-5.17.4/lib/inspec/file_provider.rb:199:in `initialize': No such file or directory @ rb_sysopen - C:/Users/RussellSeymour/workspaces/stacks/stacks-ancillary-resources/src/ancillary_resources/tests/azure/vendor/120cd3c6d6d52b1100a5a5117514fdde6c4ceca57e47295e0769c0df65f7fda9/docs-chef-io/content/inspec/resources/azure_resource_health_availability_statuses.md (Errno::ENOENT)

The only way I got this to work was to overwrite the vendor directory manually with the contents of the clone repo, then I was able to get things working. Obviously this is not going to work well in a CI/CD environment. I have not tried this on a Linux environment yet.

OS: Windows 11 Inspec: 5.17.4