Michael Kutý | f0c0aa7 | 2015-11-19 21:51:21 +0100 | [diff] [blame] | 1 | cookiecutter-salt-formula |
| 2 | ========================= |
Ales Komarek | 7792c70 | 2015-10-19 20:41:02 +0200 | [diff] [blame] | 3 | |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 4 | A cookiecutter template for Salt Formula. |
Ales Komarek | 7792c70 | 2015-10-19 20:41:02 +0200 | [diff] [blame] | 5 | |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 6 | Installation |
Michael Kutý | f0c0aa7 | 2015-11-19 21:51:21 +0100 | [diff] [blame] | 7 | ============ |
Ales Komarek | 7792c70 | 2015-10-19 20:41:02 +0200 | [diff] [blame] | 8 | |
Michael Kutý | f0c0aa7 | 2015-11-19 21:51:21 +0100 | [diff] [blame] | 9 | .. code-block:: bash |
Ales Komarek | 7792c70 | 2015-10-19 20:41:02 +0200 | [diff] [blame] | 10 | |
Petr Michalec | 84d2504 | 2016-11-15 23:42:12 +0100 | [diff] [blame] | 11 | pip install cookiecutter |
Petr Michalec | d1ff7bd | 2016-07-14 10:43:13 +0200 | [diff] [blame] | 12 | |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 13 | cd cookiecutter |
Petr Michalec | d1ff7bd | 2016-07-14 10:43:13 +0200 | [diff] [blame] | 14 | |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 15 | cookiecutter salt-formula |
| 16 | |
| 17 | |
| 18 | Init Test Kitchen configuration |
| 19 | =============================== |
| 20 | |
| 21 | Follow the `salt formula testing <https://salt-formulas.readthedocs.io/en/latest/develop/testing-formulas.html>`_ guidelines and |
| 22 | automated CI in the main `documentation <https://salt-formulas.readthedocs.io/en/latest/develop/testing.html>`_. |
| 23 | |
| 24 | To 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 Michalec | d1ff7bd | 2016-07-14 10:43:13 +0200 | [diff] [blame] | 30 | |
| 31 | pip install envtpl |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 32 | gem install kitchen-docker kitchen-salt [kitchen-openstack kitchen-vagrant kitchen-inspec busser-serverspec] |
Petr Michalec | d1ff7bd | 2016-07-14 10:43:13 +0200 | [diff] [blame] | 33 | |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 34 | Once you create your `tests/pillar` structure (required if you want to auto-populate kitchen yaml with test suites) |
Petr Michalec | d1ff7bd | 2016-07-14 10:43:13 +0200 | [diff] [blame] | 35 | |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 36 | .. code-block:: shell |
Petr Michalec | d1ff7bd | 2016-07-14 10:43:13 +0200 | [diff] [blame] | 37 | |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 38 | # cd <formula repository> |
| 39 | ../kitchen-init.sh |
| 40 | |
| 41 | Instantly, to add kitchen configuration into existing repository: |
| 42 | |
| 43 | .. code-block:: shell |
| 44 | |
| 45 | # cd <formula repository> |
Filip Pytloun | 80ff5b0 | 2018-01-18 13:28:43 +0100 | [diff] [blame] | 46 | curl -skL "https://raw.githubusercontent.com/salt-formulas/cookiecutter-salt-formula/master/kitchen-init.sh" | bash -s -- |
Filip Pytloun | 38c74a3 | 2018-01-18 13:03:41 +0100 | [diff] [blame] | 47 | |
Petr Ruzicka | 8ebb5c7 | 2018-01-19 13:32:43 +0100 | [diff] [blame] | 48 | |
| 49 | Docker way |
| 50 | =============================== |
| 51 | |
| 52 | .. code-block:: bash |
| 53 | |
Petr Ruzicka | 9d1d97c | 2018-01-30 16:07:07 +0100 | [diff] [blame] | 54 | MY_NEW_SALT_FORMULA_DIR="watchdog" |
Petr Ruzicka | 8ebb5c7 | 2018-01-19 13:32:43 +0100 | [diff] [blame] | 55 | 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 Ruzicka | 9d1d97c | 2018-01-30 16:07:07 +0100 | [diff] [blame] | 58 | 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 |