-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
793 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,122 @@ | ||
.idea | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a packager | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.kitchen | ||
.kitchen.local.yml | ||
kitchen.local.yml | ||
junit-*.xml | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
# Bundler | ||
Gemfile.lock | ||
|
||
# copied `.md` files used for conversion to `.rst` using `m2r` | ||
docs/*.md | ||
|
||
# Vim | ||
*.sw? | ||
|
||
## Collected when centralising formulas (check and sort) | ||
# `collectd-formula` | ||
.pytest_cache/ | ||
/.idea/ | ||
Dockerfile.*_* | ||
ignore/ | ||
tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
# General overrides used across formulas in the org | ||
Metrics/LineLength: | ||
# Increase from default of `80` | ||
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) | ||
Max: 88 | ||
|
||
# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config` | ||
# <REMOVEME | ||
Metrics/BlockLength: | ||
Max: 36 | ||
# REMOVEME> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
## Machine config | ||
os: 'linux' | ||
arch: 'amd64' | ||
dist: 'bionic' | ||
version: '~> 1.0' | ||
|
||
## Language and cache config | ||
language: 'ruby' | ||
cache: 'bundler' | ||
|
||
## Services config | ||
services: | ||
- docker | ||
|
||
## Script to run for the test stage | ||
script: | ||
- bin/kitchen verify "${INSTANCE}" | ||
|
||
## Stages and jobs matrix | ||
stages: | ||
- test | ||
- name: 'release' | ||
if: 'branch = master AND type != pull_request' | ||
jobs: | ||
include: | ||
## Define the test stage that runs the linters (and testing matrix, if applicable) | ||
|
||
# Run all of the linters in a single job | ||
- language: 'node_js' | ||
node_js: 'lts/*' | ||
env: 'Lint' | ||
name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' | ||
before_install: 'skip' | ||
script: | ||
# Install and run `salt-lint` | ||
- pip install --user salt-lint | ||
- git ls-files -- '*.sls' '*.jinja' '*.j2' '*.tmpl' '*.tst' | ||
| xargs salt-lint | ||
# Install and run `yamllint` | ||
# Need at least `v1.17.0` for the `yaml-files` setting | ||
- pip install --user yamllint>=1.17.0 | ||
- yamllint -s . | ||
# Install and run `rubocop` | ||
- gem install rubocop | ||
- rubocop -d | ||
# Run `shellcheck` (already pre-installed in Travis) | ||
- shellcheck --version | ||
- git ls-files -- '*.sh' '*.bash' '*.ksh' | ||
| xargs shellcheck | ||
# Install and run `commitlint` | ||
- npm i -D @commitlint/config-conventional | ||
@commitlint/travis-cli | ||
- commitlint-travis | ||
|
||
## Define the rest of the matrix based on Kitchen testing | ||
# Make sure the instances listed below match up with | ||
# the `platforms` defined in `kitchen.yml` | ||
# NOTE: Please try to select up to six instances that add some meaningful | ||
# testing of the formula's behaviour. If possible, try to refrain from | ||
# the classical "chosing all the instances because I want to test on | ||
# another/all distro/s" trap: it will just add time to the testing (see | ||
# the discussion on #121). As an example, the set chosen below covers | ||
# the most used distros families, systemd and non-systemd and the latest | ||
# three supported Saltstack versions with python2 and 3. | ||
# As for `kitchen.yml`, that should still contain all of the platforms, | ||
# to allow for comprehensive local testing | ||
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118 | ||
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121 | ||
- env: INSTANCE=default-debian-10-master-py3 | ||
# - env: INSTANCE=default-ubuntu-1804-master-py3 | ||
# - env: INSTANCE=default-centos-8-master-py3 | ||
# - env: INSTANCE=default-fedora-31-master-py3 | ||
# - env: INSTANCE=default-opensuse-leap-151-master-py3 | ||
# - env: INSTANCE=default-amazonlinux-2-master-py2 | ||
# - env: INSTANCE=default-arch-base-latest-master-py2 | ||
# - env: INSTANCE=default-debian-10-2019-2-py3 | ||
# - env: INSTANCE=default-debian-9-2019-2-py3 | ||
- env: INSTANCE=default-ubuntu-1804-2019-2-py3 | ||
# - env: INSTANCE=default-centos-8-2019-2-py3 | ||
# - env: INSTANCE=default-fedora-31-2019-2-py3 | ||
# - env: INSTANCE=default-opensuse-leap-151-2019-2-py3 | ||
# - env: INSTANCE=default-centos-7-2019-2-py2 | ||
- env: INSTANCE=default-amazonlinux-2-2019-2-py2 | ||
- env: INSTANCE=default-arch-base-latest-2019-2-py2 | ||
- env: INSTANCE=default-fedora-30-2018-3-py3 | ||
# - env: INSTANCE=default-debian-9-2018-3-py2 | ||
# - env: INSTANCE=default-ubuntu-1604-2018-3-py2 | ||
# - env: INSTANCE=default-centos-7-2018-3-py2 | ||
- env: INSTANCE=default-opensuse-leap-151-2018-3-py2 | ||
# - env: INSTANCE=default-amazonlinux-2-2018-3-py2 | ||
# - env: INSTANCE=default-arch-base-latest-2018-3-py2 | ||
# - env: INSTANCE=default-debian-8-2017-7-py2 | ||
# - env: INSTANCE=default-ubuntu-1604-2017-7-py2 | ||
- env: INSTANCE=centos6-centos-6-2017-7-py2 | ||
# - env: INSTANCE=default-fedora-30-2017-7-py2 | ||
# - env: INSTANCE=default-opensuse-leap-151-2017-7-py2 | ||
# - env: INSTANCE=default-amazonlinux-2-2017-7-py2 | ||
# - env: INSTANCE=default-arch-base-latest-2017-7-py2 | ||
|
||
## Define the release stage that runs `semantic-release` | ||
- stage: 'release' | ||
language: 'node_js' | ||
node_js: 'lts/*' | ||
env: 'Release' | ||
name: 'Run semantic-release inc. file updates to AUTHORS, CHANGELOG & FORMULA' | ||
before_install: 'skip' | ||
script: | ||
# Update `AUTHORS.md` | ||
- export MAINTAINER_TOKEN=${GH_TOKEN} | ||
- go get github.com/myii/maintainer | ||
- maintainer contributor | ||
|
||
# Install all dependencies required for `semantic-release` | ||
- npm i -D @semantic-release/changelog@3 | ||
@semantic-release/exec@3 | ||
@semantic-release/git@7 | ||
deploy: | ||
provider: 'script' | ||
# Opt-in to `dpl v2` to complete the Travis build config validation (beta) | ||
# * https://docs.travis-ci.com/user/build-config-validation | ||
# Deprecated `skip_cleanup` can now be avoided, `cleanup: false` is by default | ||
edge: true | ||
# Run `semantic-release` | ||
script: 'npx semantic-release@15.14' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
# Extend the `default` configuration provided by `yamllint` | ||
extends: default | ||
|
||
# Files to ignore completely | ||
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run | ||
# 2. Any SLS files under directory `test/`, which are actually state files | ||
# 3. Any YAML files under directory `.kitchen/`, introduced during local testing | ||
ignore: | | ||
node_modules/ | ||
test/**/states/**/*.sls | ||
.kitchen/ | ||
yaml-files: | ||
# Default settings | ||
- '*.yaml' | ||
- '*.yml' | ||
- .salt-lint | ||
- .yamllint | ||
# SaltStack Formulas additional settings | ||
- '*.example' | ||
- test/**/*.sls | ||
|
||
rules: | ||
empty-values: | ||
forbid-in-block-mappings: true | ||
forbid-in-flow-mappings: true | ||
line-length: | ||
# Increase from default of `80` | ||
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) | ||
max: 88 | ||
octal-values: | ||
forbid-implicit-octal: true | ||
forbid-explicit-octal: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: hostsfile | ||
os: Debian, Ubuntu, Raspbian, RedHat, Fedora, CentOS, Suse, openSUSE | ||
os_family: Debian, RedHat, Suse, Gentoo, Arch | ||
version: 0.1 | ||
release: 1 | ||
minimum_version: 2017.7 | ||
summary: hostsfile formula | ||
description: Formula to set up name resolution with /etc/hosts | ||
top_level_dir: hostsfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'kitchen-docker', '>= 2.9' | ||
gem 'kitchen-inspec', '>= 1.1' | ||
gem 'kitchen-salt', '>= 0.6.0' | ||
# Latest versions of `train` cause failure when running `kitchen verify` | ||
# Downgrading to `3.2.0` until this is fixed upstream | ||
# https://github.com/inspec/train/pull/544#issuecomment-566055052 | ||
gem 'train', '3.2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright (c) 2014 Salt Stack Formulas | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env sh | ||
set -o nounset # Treat unset variables as an error and immediately exit | ||
set -o errexit # If a command fails exit the whole script | ||
|
||
if [ "${DEBUG:-false}" = "true" ]; then | ||
set -x # Run the entire script in debug mode | ||
fi | ||
|
||
usage() { | ||
echo "usage: $(basename "$0") <new-formula-name>" 1>&2 | ||
echo 1>&2 | ||
echo "Convert template-formula to <new-formula-name>-formula." 1>&2 | ||
echo "<new-formula-name> should be a string of lowercase characters and numbers only." 1>&2 | ||
echo "<new-formula-name> should not be any of 'bin' 'docs' 'test'." 1>&2 | ||
} | ||
|
||
args() { | ||
if [ $# -ne 1 ]; then | ||
usage | ||
exit 1 | ||
fi | ||
NEW_NAME=$1 | ||
if echo "$NEW_NAME" | grep -E --quiet --invert-match '^[a-z0-9]+$'; then | ||
usage | ||
exit 1 | ||
fi | ||
if echo bin docs test | grep --quiet --word-regexp "$NEW_NAME"; then | ||
usage | ||
exit 1 | ||
fi | ||
} | ||
|
||
convert_formula() { | ||
# Empty history and make commit message `semantic-release`-compliant | ||
# Works for forks of `template-formula` as well as GitHub "Use this template" | ||
# See https://stackoverflow.com/a/15572071/5009408 | ||
git reset \ | ||
"$(echo 'feat: initial commit' \ | ||
| git commit-tree 'HEAD^{tree}')" | ||
git rm --quiet bin/convert-formula.sh AUTHORS.md CHANGELOG.md \ | ||
docs/_static/css/custom.css docs/AUTHORS.rst docs/CHANGELOG.rst \ | ||
docs/conf.py docs/CONTRIBUTING_DOCS.rst docs/index.rst | ||
git mv TEMPLATE "${NEW_NAME}" | ||
grep --recursive --files-with-matches --exclude-dir=.git TEMPLATE . \ | ||
| xargs -L 1 ex -u NONE -sc '%s/TEMPLATE/'"${NEW_NAME}"'/g|x' | ||
# Searching across multiple lines. | ||
# See https://vim.fandom.com/wiki/Search_across_multiple_lines | ||
ex -u NONE -sc '%s/^.. <REMOVEME\_.\{-}.. REMOVEME>/None/g|x' docs/README.rst | ||
ex -u NONE -sc '%s/^\s*# <REMOVEME\_.\{-}# REMOVEME>\n//g|x' .travis.yml | ||
ex -u NONE -sc '%s/^\s*# <REMOVEME\_.\{-}# REMOVEME>\n//g|x' .rubocop.yml | ||
ex -u NONE -sc '%s/^\(version:\).*/\1 1.0.0/g|x' FORMULA | ||
# shellcheck disable=SC2016 # Expressions don't expand in single quotes | ||
git commit --quiet --all \ | ||
--message 'feat: convert `template-formula` to `'"${NEW_NAME}"'-formula`' \ | ||
--message 'BREAKING CHANGE: changed all state names and ids' | ||
} | ||
|
||
args "$@" | ||
convert_formula |
Oops, something went wrong.