InSpec dependencies with relative path


#1

Hi,

I have a problem using relative path on an profile dependency . It works with inspec check but complains not found, trying a "wrong" path when i run kitchen verify.

My suite is called server so my main profile. Then i have secondary profile called profile1 and i have this lines on tes/integration/server/inspec.yml:

depends:
  - name: profile1
    path: ../profile1

The path should be relative to inspec.yml but kitchen verify looks for the profile relative to the cookbook path. Complaining with:

No such file or directory

This worked before, and cant find any doc about how to implement relative path on dependencies between profiles.


#2

I do relative dependencies in my .kitchen.yml using the path array under verifier/inspec_tests like so:

suites:
  - name: default
    run_list:
      - recipe[my_cookbook]
    verifier:
      inspec_tests:
        - path: ../../healthcheck/profile1
        - path: ../../healthcheck/profile2
        …
    attributes:

This was buried somewhere in the inspec docs I think. In the opposite direction by listing multiple relative paths in my .kitchen.yml


#3

I do see there was a bug filed against this with the same issue awhile ago: https://github.com/inspec/inspec/issues/2120

It doesn’t look like it landed.

I believe I remember noticing the same difference as well, so I inverted my dependencies to control them from Test Kitchen.


#4

I finally figured it out. Dont know why (until now it was working) you have to vendor the profile that have the dependecy defined on inspec.yml:

inspec vendor --overwrite test/integration/myprofile

Once that is done, a test/integration/myprofile/inspec.lock file is created and kitchen verify mysuite worked like a charm.

Thanks to @frezbo on #inspec channel at slack!


#5

Awesome!