kidbrax
kidbrax

Reputation: 2434

In Packer, can you specify a path in a git repo for the Inspec provisioner?

I would like to reference an inspec profile in a folder in the git repo. Something similar to what you can do in Kitchen:

  inspec_tests:
    - name: profile-name
      git: https://[email protected]/org/my_repo.git
      relative_path: inspec/sdp-base

Upvotes: 0

Views: 453

Answers (2)

Yegolev
Yegolev

Reputation: 13

I eventually got it to work like this using local files:

### Inspec testing
  provisioner "shell-local" {
    inline_shebang = "/usr/local/bin/zsh -e"
    environment_vars = ["RUBYOPT=-W0"]
    inline = [
      "print -- \"${build.SSHPrivateKey}\" > pkr_build_key",
      "chmod 0600 pkr_build_key",
      "inspec exec --sudo -i pkr_build_key -t ssh://${build.User}@${build.Host} test/inspec"
      ]
  }

My test files are in ./test/inspec using the standard config. So, I don't know how to do it from a URL but the workaround is obviously to have a local clone somewhere. I find that useful anyway.

Upvotes: 0

deric4
deric4

Reputation: 1326

As of January 2021, it doesn't seem to be possible from the CLI: https://github.com/inspec/inspec/issues/1237#issuecomment-767672074

But you could make a local "wrapper" profile that declares the relative path of the remote profile:

https://docs.chef.io/inspec/profiles/#git

Upvotes: 0

Related Questions