blob: 4942758020635b15f6f6735bb01e574e9c29e6d2 [file] [log] [blame]
Michael Kutýf0c0aa72015-11-19 21:51:21 +01001cookiecutter-salt-formula
2=========================
Ales Komarek7792c702015-10-19 20:41:02 +02003
Filip Pytloun38c74a32018-01-18 13:03:41 +01004A cookiecutter template for Salt Formula.
Ales Komarek7792c702015-10-19 20:41:02 +02005
Filip Pytloun38c74a32018-01-18 13:03:41 +01006Installation
Michael Kutýf0c0aa72015-11-19 21:51:21 +01007============
Ales Komarek7792c702015-10-19 20:41:02 +02008
Michael Kutýf0c0aa72015-11-19 21:51:21 +01009.. code-block:: bash
Ales Komarek7792c702015-10-19 20:41:02 +020010
Petr Michalec84d25042016-11-15 23:42:12 +010011 pip install cookiecutter
Petr Michalecd1ff7bd2016-07-14 10:43:13 +020012
Filip Pytloun38c74a32018-01-18 13:03:41 +010013 cd cookiecutter
Petr Michalecd1ff7bd2016-07-14 10:43:13 +020014
Filip Pytloun38c74a32018-01-18 13:03:41 +010015 cookiecutter salt-formula
16
17
18Init Test Kitchen configuration
19===============================
20
21Follow the `salt formula testing <https://salt-formulas.readthedocs.io/en/latest/develop/testing-formulas.html>`_ guidelines and
22automated CI in the main `documentation <https://salt-formulas.readthedocs.io/en/latest/develop/testing.html>`_.
23
24To generate ``.kitchen.yml`` for new or existing project:
25
26- install `envtpl`, renders jinja2 templates with shell environment variables
27- install required gems, it depends on drivers configured to be used (docker by default)
28
29.. code-block:: shell
Petr Michalecd1ff7bd2016-07-14 10:43:13 +020030
31 pip install envtpl
Filip Pytloun38c74a32018-01-18 13:03:41 +010032 gem install kitchen-docker kitchen-salt [kitchen-openstack kitchen-vagrant kitchen-inspec busser-serverspec]
Petr Michalecd1ff7bd2016-07-14 10:43:13 +020033
Filip Pytloun38c74a32018-01-18 13:03:41 +010034Once you create your `tests/pillar` structure (required if you want to auto-populate kitchen yaml with test suites)
Petr Michalecd1ff7bd2016-07-14 10:43:13 +020035
Filip Pytloun38c74a32018-01-18 13:03:41 +010036.. code-block:: shell
Petr Michalecd1ff7bd2016-07-14 10:43:13 +020037
Filip Pytloun38c74a32018-01-18 13:03:41 +010038 # cd <formula repository>
39 ../kitchen-init.sh
40
41Instantly, to add kitchen configuration into existing repository:
42
43.. code-block:: shell
44
45 # cd <formula repository>
Filip Pytloun80ff5b02018-01-18 13:28:43 +010046 curl -skL "https://raw.githubusercontent.com/salt-formulas/cookiecutter-salt-formula/master/kitchen-init.sh" | bash -s --
Filip Pytloun38c74a32018-01-18 13:03:41 +010047
Petr Ruzicka8ebb5c72018-01-19 13:32:43 +010048
49Docker way
50===============================
51
52.. code-block:: bash
53
Petr Ruzicka9d1d97c2018-01-30 16:07:07 +010054 MY_NEW_SALT_FORMULA_DIR="watchdog"
Petr Ruzicka8ebb5c72018-01-19 13:32:43 +010055 mkdir $MY_NEW_SALT_FORMULA_DIR
56 git clone https://github.com/salt-formulas/cookiecutter-salt-formula.git
57 docker run --rm -it -u $(id -u):$(id -g) --env HOME=/$MY_NEW_SALT_FORMULA_DIR -v $PWD/$MY_NEW_SALT_FORMULA_DIR:/$MY_NEW_SALT_FORMULA_DIR -v $PWD/cookiecutter-salt-formula:/cookiecutter-salt-formula:ro cookiecutter/cookiecutter /cookiecutter-salt-formula --output-dir /$MY_NEW_SALT_FORMULA_DIR
Petr Ruzicka9d1d97c2018-01-30 16:07:07 +010058 service_name [some_service]: watchdog
59 role_name [server]:
60 initial_version [2018.1]:
61 copyright_year [2018]:
62 copyright_holder [Your Name et al.]: Mirantis, Inc.
63 author_name [John Doe]: Petr Ruzicka
64 author_contact [jdoe@domain.com]: pruzicka@mirantis.com
65 homepage [https://github.com/salt-formulas]:
66 debian_version [xenial]:
67 kitchen_driver [docker]:
68 kitchen_verifier [inspec]:
69 kitchen_formula [watchdog]:
70 kitchen_suites []: server