Closed alem0lars-yr closed 7 years ago
kitchen test
will run through all the steps (create, converge, verify, destroy). If you are actively working on a formula, just do kitchen converge
Or if you just want to check the verifier do a kitchen verify
neither of those steps will provision or destroy the VMs that get created. When you are all done, do a kitchen destroy
followed by a kitchen test
to ensure it passes your CI.
@cmarzullo is absolutely right on breaking down your development to converge
and verify
.
I use the vagrant driver, and one trick I use is to build my own vagrant boxes using packer. I pre-install the latest version of Salt, Chef, busser, and the busser modules I use—serverspec and bash. I have a Jenkins job setup to do this so whenever a new version of Salt comes out I can easily rebuild the boxes. For packer templates I highly recommend boxcutter project. I use the Ubuntu, macOS, and Windows projects to build my boxes. I don't know if this will help with your docker setup, but for others following this thread it may be a useful technique.
@barkingfoodog Do you have an example json file that you can share for building a machine with packer having salt preinstalled (and the relative .kitchen.yml
file using that box) ?
Thanks
@alem0lars-yoroi the boxcutter projects used to offer a CM_TOOL
setting that would pre-install Salt, Chef, Puppet, and Ansible. I've forked these to our internal Bitbucket server and use the same technique to install Salt. The current boxcutter projects, except Windows, designate a custom-script.sh
you can use to pre-install Salt or do anything else you want. But, you can still go back to those older versions to see how they installed Salt.
The last release for Ubuntu that supported pre-provisioning the box with Salt was 2.0.18. The macOS project doesn't have releases, but it looks like this commit was the last one to support CM_TOOL
. The Windows project still supports CM_TOOL
to pre-install Salt.
In short this technique adds a provisioner that runs a script to install Salt. It's included with others that install updates, guest additions for the VM provider, and so on. Here's an relevant excerpt of the packer json file from the 2.0.18 release for Ubuntu:
"provisioners": [
{
"environment_vars": [
"CM={{user `cm`}}",
"CM_VERSION={{user `cm_version`}}",
...
"no_proxy={{user `no_proxy`}}"
],
"execute_command": "echo '{{ user `ssh_password` }}' | {{.Vars}} sudo -E -S bash '{{.Path}}'",
"scripts": [
"script/update.sh",
...
"script/cmtool.sh",
...
"script/cleanup.sh"
],
"type": "shell"
}
On Ubuntu, script/cmtool.sh
simply calls the standard bootstrap installer:
wget -O - http://bootstrap.saltstack.org | sudo sh
On macOS, I install homebrew and use that to install Salt. If you need a copy of that script I'm happy to make it available.
The Windows build uses a cmtool.bat
script that downloaded the current installer and installs it. You can find a current copy on my boxcutter/windows fork.
I'm a little confused as to what you mean by pre-installing .kitchen.yml
. Normally you have .kitchen.yml
in your dev environment. Test Kitchen uses the settings in this file to create boxes and provision and test them using different providers, such as SaltStack. But, the .kitchen.yml
file isn't needed directly in the test environment.
@barkingfoodog Thanks very much.
Anyways, I'm going to close the issue (false positive)
Thanks everyone!
I'm using the following
.kitchen.yml
:However every time I run
bundle exec kitchen test
it will re-run the salt bootstrap. It takes sooo much time. Is it possible to cache that operation?Thanks