Skip to content

Commit 820c15d

Browse files
authored
Merge pull request #102 from alxwr/tigpas-add-kitchen-fix-log
Fix logging, minor bugs & kitchen testing
2 parents d63581a + 15bea7b commit 820c15d

29 files changed

+991
-91
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
*.swp
2+
.kitchen
3+
.kitchen.local.yml
4+
.cache
5+
junit-*.xml
6+
__pycache__

.travis.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
stages:
2+
- test
3+
- commitlint
4+
- name: release
5+
if: branch = master AND type != pull_request
6+
7+
sudo: required
8+
cache: bundler
9+
language: ruby
10+
11+
services:
12+
- docker
13+
14+
# Make sure the instances listed below match up with
15+
# the `platforms` defined in `kitchen.yml`
16+
# NOTE: Please try to select up to six instances that add some meaningful
17+
# testing of the formula's behaviour. If possible, try to refrain from
18+
# the classical "chosing all the instances because I want to test on
19+
# another/all distro/s" trap: it will just add time to the testing (see
20+
# the discussion on #121). As an example, the set chosen below covers
21+
# the most used distros families, systemd and non-systemd and the latest
22+
# three supported Saltstack versions with python2 and 3."
23+
# As for `kitchen.yml`, that should still contain all of the platforms,
24+
# to allow for comprehensive local testing
25+
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
26+
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
27+
env:
28+
matrix:
29+
- INSTANCE: default-debian-9-develop-py3
30+
- INSTANCE: default-debian-9-2019-2-py3
31+
- INSTANCE: default-ubuntu-1804-2019-2-py3
32+
- INSTANCE: default-centos-7-2019-2-py3
33+
# - INSTANCE: default-fedora-29-2019-2-py3
34+
# - INSTANCE: default-opensuse-leap-15-2019-2-py3
35+
# - INSTANCE: default-debian-9-2018-3-py2
36+
# - INSTANCE: default-ubuntu-1604-2018-3-py2
37+
# - INSTANCE: default-centos-7-2018-3-py2
38+
# Currently fails with "Cipher 'AES-256-GCM' mode not supported"
39+
#- INSTANCE: default-fedora-29-2018-3-py2
40+
# TODO: Use this when fixed instead of `opensuse-leap-42`
41+
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
42+
# - INSTANCE: default-opensuse-leap-15-2018-3-py2
43+
#- INSTANCE: default-opensuse-leap-42-2018-3-py2
44+
# - INSTANCE: default-debian-8-2017-7-py2
45+
# - INSTANCE: default-ubuntu-1604-2017-7-py2
46+
# TODO: Enable after improving the formula to work with other than `systemd`
47+
- INSTANCE: default-centos-6-2017-7-py2
48+
# - INSTANCE: default-fedora-28-2017-7-py2
49+
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
50+
51+
script:
52+
- bundle exec kitchen verify ${INSTANCE}
53+
54+
jobs:
55+
include:
56+
# Define the commitlint stage
57+
- stage: commitlint
58+
language: node_js
59+
node_js: lts/*
60+
before_install: skip
61+
script:
62+
- npm install @commitlint/config-conventional -D
63+
- npm install @commitlint/travis-cli -D
64+
- commitlint-travis
65+
# Define the release stage that runs semantic-release
66+
- stage: release
67+
language: node_js
68+
node_js: lts/*
69+
before_install: skip
70+
script:
71+
# Update `AUTHORS.md`
72+
- export MAINTAINER_TOKEN=${GH_TOKEN}
73+
- go get github.com/myii/maintainer
74+
- maintainer contributor
75+
76+
# Install all dependencies required for `semantic-release`
77+
- npm install @semantic-release/changelog@3 -D
78+
- npm install @semantic-release/exec@3 -D
79+
- npm install @semantic-release/git@7 -D
80+
deploy:
81+
provider: script
82+
skip_cleanup: true
83+
script:
84+
# Run `semantic-release`
85+
- npx semantic-release@15

FORMULA

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: template
2+
os: Debian, Ubuntu, Raspbian, RedHat, Fedora, CentOS, Suse, openSUSE, Gentoo, Funtoo, Arch, Manjaro, Alpine, FreeBSD, OpenBSD, Solaris, SmartOS, Windows, MacOS
3+
os_family: Debian, RedHat, Suse, Gentoo, Arch, Alpine, FreeBSD, OpenBSD, Solaris, Windows, MacOS
4+
version: 1.0.0
5+
release: 1
6+
minimum_version: 2018.3
7+
summary: OpenVPN formula
8+
description: Formula to use manage OpenVPN
9+
top_level_dir: openvpn

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
gem 'kitchen-docker', '>= 2.9'
4+
gem 'kitchen-salt', '>= 0.6.0'
5+
gem 'kitchen-inspec', '>= 1.1'
6+

README.rst

Lines changed: 0 additions & 56 deletions
This file was deleted.

bin/kitchen

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'kitchen' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("test-kitchen", "kitchen")

commitlint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
};

docs/CONTRIBUTING.rst

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
.. _contributing:
2+
3+
How to contribute
4+
=================
5+
6+
This document will eventually outline all aspects of guidance to make your contributing experience a fruitful and enjoyable one.
7+
What it already contains is information about *commit message formatting* and how that directly affects the numerous automated processes that are used for this repo.
8+
It also covers how to contribute to this *formula's documentation*.
9+
10+
.. contents:: **Table of Contents**
11+
12+
Overview
13+
--------
14+
15+
Submitting a pull request is more than just code!
16+
To achieve a quality product, the *tests* and *documentation* need to be updated as well.
17+
An excellent pull request will include these in the changes, wherever relevant.
18+
19+
Commit message formatting
20+
-------------------------
21+
22+
Since every type of change requires making Git commits,
23+
we will start by covering the importance of ensuring that all of your commit
24+
messages are in the correct format.
25+
26+
Automation of multiple processes
27+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28+
29+
This formula uses `semantic-release <https://github.com/semantic-release/semantic-release>`_ for automating numerous processes such as bumping the version number appropriately, creating new tags/releases and updating the changelog.
30+
The entire process relies on the structure of commit messages to determine the version bump, which is then used for the rest of the automation.
31+
32+
Full details are available in the upstream docs regarding the `Angular Commit Message Conventions <https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines>`_.
33+
The key factor is that the first line of the commit message must follow this format:
34+
35+
.. code-block::
36+
37+
type(scope): subject
38+
39+
40+
* E.g. ``docs(contributing): add commit message formatting instructions``.
41+
42+
Besides the version bump, the changelog and release notes are formatted accordingly.
43+
So based on the example above:
44+
45+
..
46+
47+
.. raw:: html
48+
49+
<h3>Documentation</h3>
50+
51+
* **contributing:** add commit message formatting instructions
52+
53+
54+
* The ``type`` translates into a ``Documentation`` sub-heading.
55+
* The ``(scope):`` will be shown in bold text without the brackets.
56+
* The ``subject`` follows the ``scope`` as standard text.
57+
58+
Linting commit messages in Travis CI
59+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60+
61+
This formula uses `commitlint <https://github.com/conventional-changelog/commitlint>`_ for checking commit messages during CI testing.
62+
This ensures that they are in accordance with the ``semantic-release`` settings.
63+
64+
For more details about the default settings, refer back to the ``commitlint`` `reference rules <https://conventional-changelog.github.io/commitlint/#/reference-rules>`_.
65+
66+
Relationship between commit type and version bump
67+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68+
69+
This formula applies some customisations to the defaults, as outlined in the table below,
70+
based upon the `type <https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#type>`_ of the commit:
71+
72+
.. list-table::
73+
:name: commit-type-vs-version-bump
74+
:header-rows: 1
75+
:stub-columns: 0
76+
:widths: 1,2,3,1,1
77+
78+
* - Type
79+
- Heading
80+
- Description
81+
- Bump (default)
82+
- Bump (custom)
83+
* - ``build``
84+
- Build System
85+
- Changes related to the build system
86+
- –
87+
-
88+
* - ``chore``
89+
- –
90+
- Changes to the build process or auxiliary tools and libraries such as
91+
documentation generation
92+
- –
93+
-
94+
* - ``ci``
95+
- Continuous Integration
96+
- Changes to the continuous integration configuration
97+
- –
98+
-
99+
* - ``docs``
100+
- Documentation
101+
- Documentation only changes
102+
- –
103+
- 0.0.1
104+
* - ``feat``
105+
- Features
106+
- A new feature
107+
- 0.1.0
108+
-
109+
* - ``fix``
110+
- Bug Fixes
111+
- A bug fix
112+
- 0.0.1
113+
-
114+
* - ``perf``
115+
- Performance Improvements
116+
- A code change that improves performance
117+
- 0.0.1
118+
-
119+
* - ``refactor``
120+
- Code Refactoring
121+
- A code change that neither fixes a bug nor adds a feature
122+
- –
123+
- 0.0.1
124+
* - ``revert``
125+
- Reverts
126+
- A commit used to revert a previous commit
127+
- –
128+
- 0.0.1
129+
* - ``style``
130+
- Styles
131+
- Changes that do not affect the meaning of the code (white-space,
132+
formatting, missing semi-colons, etc.)
133+
- –
134+
- 0.0.1
135+
* - ``test``
136+
- Tests
137+
- Adding missing or correcting existing tests
138+
- –
139+
- 0.0.1
140+
141+
Use ``BREAKING CHANGE`` to trigger a ``major`` version change
142+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143+
144+
Adding ``BREAKING CHANGE`` to the footer of the extended description of the commit message will **always** trigger a ``major`` version change, no matter which type has been used.
145+
This will be appended to the changelog and release notes as well.
146+
To preserve good formatting of these notes, the following format is prescribed:
147+
148+
* ``BREAKING CHANGE: <explanation in paragraph format>.``
149+
150+
An example of that:
151+
152+
.. code-block:: git
153+
154+
...
155+
156+
BREAKING CHANGE: With the removal of all of the `.sls` files under
157+
`openvpn/package`, this formula no longer supports the installation of
158+
packages.
159+

0 commit comments

Comments
 (0)