Skip to content

Commit cf18e95

Browse files
authored
Merge branch 'saltstack-formulas:master' into master
2 parents 11fb54e + 9c69a4e commit cf18e95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+11364
-713
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
name: 'Kitchen Vagrant (FreeBSD)'
5+
'on': ['push', 'pull_request']
6+
7+
env:
8+
KITCHEN_LOCAL_YAML: 'kitchen.vagrant.yml'
9+
10+
jobs:
11+
test:
12+
runs-on: 'macos-10.15'
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
instance:
17+
- freebsd-freebsd-130-master-py3
18+
- freebsd-freebsd-123-master-py3
19+
# - freebsd-freebsd-130-3004-0-py3
20+
# - freebsd-freebsd-123-3004-0-py3
21+
steps:
22+
- name: 'Check out code'
23+
uses: 'actions/checkout@v2'
24+
- name: 'Set up Bundler cache'
25+
uses: 'actions/cache@v1'
26+
with:
27+
path: 'vendor/bundle'
28+
key: "${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}"
29+
restore-keys: "${{ runner.os }}-gems-"
30+
- name: 'Run Bundler'
31+
run: |
32+
ruby --version
33+
bundle config path vendor/bundle
34+
bundle install --jobs 4 --retry 3
35+
- name: 'Run Test Kitchen'
36+
run: 'bundle exec kitchen verify ${{ matrix.instance }}'

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ celerybeat-schedule
9191
venv/
9292
ENV/
9393

94+
# visual studio
95+
.vs/
96+
9497
# Spyder project settings
9598
.spyderproject
9699
.spyproject
@@ -120,3 +123,12 @@ docs/*.md
120123
Dockerfile.*_*
121124
ignore/
122125
tmp/
126+
127+
# `salt-formula` -- Vagrant Specific files
128+
.vagrant
129+
top.sls
130+
!test/salt/pillar/top.sls
131+
132+
# `suricata-formula` -- Platform binaries
133+
*.rpm
134+
*.deb

.gitlab-ci.yml

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
###############################################################################
5+
# Define all YAML node anchors
6+
###############################################################################
7+
.node_anchors:
8+
# `only` (also used for `except` where applicable)
9+
only_branch_master_parent_repo: &only_branch_master_parent_repo
10+
- 'master@saltstack-formulas/php-formula'
11+
# `stage`
12+
stage_lint: &stage_lint 'lint'
13+
stage_release: &stage_release 'release'
14+
stage_test: &stage_test 'test'
15+
# `image`
16+
image_commitlint: &image_commitlint 'myii/ssf-commitlint:11'
17+
image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3'
18+
image_precommit: &image_precommit
19+
name: 'myii/ssf-pre-commit:2.9.2'
20+
entrypoint: ['/bin/bash', '-c']
21+
image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest'
22+
image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14'
23+
# `services`
24+
services_docker_dind: &services_docker_dind
25+
- 'docker:dind'
26+
# `variables`
27+
# https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3
28+
# https://bundler.io/v1.16/bundle_config.html
29+
variables_bundler: &variables_bundler
30+
BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler'
31+
BUNDLE_WITHOUT: 'production'
32+
# `cache`
33+
cache_bundler: &cache_bundler
34+
key: '${CI_JOB_STAGE}'
35+
paths:
36+
- '${BUNDLE_CACHE_PATH}'
37+
38+
###############################################################################
39+
# Define stages and global variables
40+
###############################################################################
41+
stages:
42+
- *stage_lint
43+
- *stage_test
44+
- *stage_release
45+
variables:
46+
DOCKER_DRIVER: 'overlay2'
47+
48+
###############################################################################
49+
# `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed)
50+
###############################################################################
51+
commitlint:
52+
stage: *stage_lint
53+
image: *image_commitlint
54+
script:
55+
# Add `upstream` remote to get access to `upstream/master`
56+
- 'git remote add upstream
57+
https://gitlab.com/saltstack-formulas/php-formula.git'
58+
- 'git fetch --all'
59+
# Set default commit hashes for `--from` and `--to`
60+
- 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"'
61+
- 'export COMMITLINT_TO="${CI_COMMIT_SHA}"'
62+
# `coqbot` adds a merge commit to test PRs on top of the latest commit in
63+
# the repo; amend this merge commit message to avoid failure
64+
- |
65+
if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \
66+
&& [ "${CI_COMMIT_BRANCH}" != "master" ]; then
67+
git commit --amend -m \
68+
'chore: reword coqbot merge commit message for commitlint'
69+
export COMMITLINT_TO=HEAD
70+
fi
71+
# Run `commitlint`
72+
- 'commitlint --from "${COMMITLINT_FROM}"
73+
--to "${COMMITLINT_TO}"
74+
--verbose'
75+
76+
pre-commit:
77+
stage: *stage_lint
78+
image: *image_precommit
79+
# https://pre-commit.com/#gitlab-ci-example
80+
variables:
81+
PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit'
82+
cache:
83+
key: '${CI_JOB_NAME}'
84+
paths:
85+
- '${PRE_COMMIT_HOME}'
86+
script:
87+
- 'pre-commit run --all-files --color always --verbose'
88+
89+
# Use a separate job for `rubocop` other than the one potentially run by `pre-commit`
90+
# - The `pre-commit` check will only be available for formulas that pass the default
91+
# `rubocop` check -- and must continue to do so
92+
# - This job is allowed to fail, so can be used for all formulas
93+
# - Furthermore, this job uses all of the latest `rubocop` features & cops,
94+
# which will help when upgrading the `rubocop` linter used in `pre-commit`
95+
rubocop:
96+
allow_failure: true
97+
stage: *stage_lint
98+
image: *image_rubocop
99+
script:
100+
- 'rubocop -d -P -S --enable-pending-cops'
101+
102+
###############################################################################
103+
# Define `test` template
104+
###############################################################################
105+
.test_instance: &test_instance
106+
stage: *stage_test
107+
image: *image_dindruby
108+
services: *services_docker_dind
109+
variables: *variables_bundler
110+
cache: *cache_bundler
111+
before_script:
112+
# TODO: This should work from the env vars above automatically
113+
- 'bundle config set path "${BUNDLE_CACHE_PATH}"'
114+
- 'bundle config set without "${BUNDLE_WITHOUT}"'
115+
- 'bundle install'
116+
script:
117+
# Alternative value to consider: `${CI_JOB_NAME}`
118+
- 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'
119+
120+
###############################################################################
121+
# Define `test` template (`allow_failure: true`)
122+
###############################################################################
123+
.test_instance_failure_permitted:
124+
<<: *test_instance
125+
allow_failure: true
126+
127+
###############################################################################
128+
# `test` stage: each instance below uses the `test` template above
129+
###############################################################################
130+
## Define the rest of the matrix based on Kitchen testing
131+
# Make sure the instances listed below match up with
132+
# the `platforms` defined in `kitchen.yml`
133+
# yamllint disable rule:line-length
134+
# debian-debian-11-tiamat-py3: {extends: '.test_instance'}
135+
# debian-debian-10-tiamat-py3: {extends: '.test_instance'}
136+
# debian-debian-9-tiamat-py3: {extends: '.test_instance'}
137+
# ubuntu-ubuntu-2204-tiamat-py3: {extends: '.test_instance_failure_permitted'}
138+
# ubuntu-ubuntu-2004-tiamat-py3: {extends: '.test_instance'}
139+
# ubuntu-ubuntu-1804-tiamat-py3: {extends: '.test_instance'}
140+
# redhat-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'}
141+
# redhat-centos-7-tiamat-py3: {extends: '.test_instance'}
142+
# redhat-amazonlinux-2-tiamat-py3: {extends: '.test_instance'}
143+
# redhat-oraclelinux-8-tiamat-py3: {extends: '.test_instance'}
144+
# redhat-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
145+
# redhat-almalinux-8-tiamat-py3: {extends: '.test_instance'}
146+
# redhat-rockylinux-8-tiamat-py3: {extends: '.test_instance'}
147+
debian-debian-11-master-py3: {extends: '.test_instance'}
148+
debian-debian-10-master-py3: {extends: '.test_instance'}
149+
debian-debian-9-master-py3: {extends: '.test_instance'}
150+
ubuntu-ubuntu-2204-master-py3: {extends: '.test_instance_failure_permitted'}
151+
ubuntu-ubuntu-2004-master-py3: {extends: '.test_instance'}
152+
ubuntu-ubuntu-1804-master-py3: {extends: '.test_instance'}
153+
redhat-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'}
154+
redhat-centos-7-master-py3: {extends: '.test_instance'}
155+
redhat-fedora-36-master-py3: {extends: '.test_instance_failure_permitted'}
156+
redhat-fedora-35-master-py3: {extends: '.test_instance'}
157+
suse-opensuse-leap-153-master-py3: {extends: '.test_instance'}
158+
suse-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'}
159+
redhat-amazonlinux-2-master-py3: {extends: '.test_instance'}
160+
redhat-oraclelinux-8-master-py3: {extends: '.test_instance'}
161+
redhat-oraclelinux-7-master-py3: {extends: '.test_instance'}
162+
redhat-almalinux-8-master-py3: {extends: '.test_instance'}
163+
redhat-rockylinux-8-master-py3: {extends: '.test_instance'}
164+
# debian-debian-11-3004-1-py3: {extends: '.test_instance'}
165+
# debian-debian-10-3004-1-py3: {extends: '.test_instance'}
166+
# debian-debian-9-3004-1-py3: {extends: '.test_instance'}
167+
# ubuntu-ubuntu-2204-3004-1-py3: {extends: '.test_instance_failure_permitted'}
168+
# ubuntu-ubuntu-2004-3004-1-py3: {extends: '.test_instance'}
169+
# ubuntu-ubuntu-1804-3004-1-py3: {extends: '.test_instance'}
170+
# redhat-centos-stream8-3004-1-py3: {extends: '.test_instance_failure_permitted'}
171+
# redhat-centos-7-3004-1-py3: {extends: '.test_instance'}
172+
# redhat-fedora-36-3004-1-py3: {extends: '.test_instance_failure_permitted'}
173+
# redhat-fedora-35-3004-1-py3: {extends: '.test_instance'}
174+
# redhat-amazonlinux-2-3004-1-py3: {extends: '.test_instance'}
175+
# redhat-oraclelinux-8-3004-1-py3: {extends: '.test_instance'}
176+
# redhat-oraclelinux-7-3004-1-py3: {extends: '.test_instance'}
177+
# redhat-almalinux-8-3004-1-py3: {extends: '.test_instance'}
178+
# redhat-rockylinux-8-3004-1-py3: {extends: '.test_instance'}
179+
# suse-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'}
180+
# suse-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'}
181+
# debian-debian-10-3003-4-py3: {extends: '.test_instance'}
182+
# debian-debian-9-3003-4-py3: {extends: '.test_instance'}
183+
# ubuntu-ubuntu-2004-3003-4-py3: {extends: '.test_instance'}
184+
# ubuntu-ubuntu-1804-3003-4-py3: {extends: '.test_instance'}
185+
# redhat-centos-stream8-3003-4-py3: {extends: '.test_instance_failure_permitted'}
186+
# redhat-centos-7-3003-4-py3: {extends: '.test_instance'}
187+
# redhat-amazonlinux-2-3003-4-py3: {extends: '.test_instance'}
188+
# redhat-oraclelinux-8-3003-4-py3: {extends: '.test_instance'}
189+
# redhat-oraclelinux-7-3003-4-py3: {extends: '.test_instance'}
190+
# redhat-almalinux-8-3003-4-py3: {extends: '.test_instance'}
191+
# yamllint enable rule:line-length
192+
193+
###############################################################################
194+
# `release` stage: `semantic-release`
195+
###############################################################################
196+
semantic-release:
197+
only: *only_branch_master_parent_repo
198+
stage: *stage_release
199+
image: *image_semanticrelease
200+
variables:
201+
MAINTAINER_TOKEN: '${GH_TOKEN}'
202+
script:
203+
# Update `AUTHORS.md`
204+
- '${HOME}/go/bin/maintainer contributor'
205+
# Run `semantic-release`
206+
- 'semantic-release'

.pre-commit-config.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
# See https://pre-commit.com for more information
5+
# See https://pre-commit.com/hooks.html for more hooks
6+
ci:
7+
autofix_commit_msg: |
8+
ci(pre-commit.ci): apply auto fixes from pre-commit.com hooks
9+
10+
For more information, see https://pre-commit.ci
11+
autofix_prs: true
12+
autoupdate_branch: ''
13+
autoupdate_commit_msg: |
14+
ci(pre-commit.ci): perform `pre-commit` autoupdate
15+
autoupdate_schedule: quarterly
16+
skip: []
17+
submodules: false
18+
default_stages: [commit]
19+
repos:
20+
- repo: https://github.com/dafyddj/commitlint-pre-commit-hook
21+
rev: v2.3.0
22+
hooks:
23+
- id: commitlint
24+
name: Check commit message using commitlint
25+
description: Lint commit message against @commitlint/config-conventional rules
26+
stages: [commit-msg]
27+
additional_dependencies: ['@commitlint/[email protected]']
28+
- id: commitlint-travis
29+
stages: [manual]
30+
additional_dependencies: ['@commitlint/[email protected]']
31+
always_run: true
32+
- repo: https://github.com/rubocop-hq/rubocop
33+
rev: v1.30.1
34+
hooks:
35+
- id: rubocop
36+
name: Check Ruby files with rubocop
37+
args: [--debug]
38+
always_run: true
39+
pass_filenames: false
40+
- repo: https://github.com/shellcheck-py/shellcheck-py
41+
rev: v0.8.0.4
42+
hooks:
43+
- id: shellcheck
44+
name: Check shell scripts with shellcheck
45+
files: ^.*\.(sh|bash|ksh)$
46+
types: []
47+
- repo: https://github.com/adrienverge/yamllint
48+
rev: v1.26.3
49+
hooks:
50+
- id: yamllint
51+
name: Check YAML syntax with yamllint
52+
args: [--strict, '.']
53+
always_run: true
54+
pass_filenames: false
55+
- repo: https://github.com/warpnet/salt-lint
56+
rev: v0.8.0
57+
hooks:
58+
- id: salt-lint
59+
name: Check Salt files using salt-lint
60+
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
61+
- repo: https://github.com/myint/rstcheck
62+
rev: 3f929574
63+
hooks:
64+
- id: rstcheck
65+
name: Check reST files using rstcheck
66+
exclude: 'docs/CHANGELOG.rst'
67+
- repo: https://github.com/saltstack-formulas/mirrors-rst-lint
68+
rev: v1.3.2
69+
hooks:
70+
- id: rst-lint
71+
name: Check reST files using rst-lint
72+
exclude: |
73+
(?x)^(
74+
docs/CHANGELOG.rst|
75+
docs/TOFS_pattern.rst|
76+
)$
77+
additional_dependencies: [pygments==2.9.0]

.rstcheck.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[rstcheck]
2+
report=info
3+
ignore_language=rst
4+
ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$)

.rubocop.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ Layout/LineLength:
77
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
88
Max: 88
99
Metrics/BlockLength:
10-
ExcludedMethods:
10+
IgnoredMethods:
1111
- control
1212
- describe
1313
# Increase from default of `25`
1414
Max: 30
15+
Security/YAMLLoad:
16+
Exclude:
17+
- test/integration/**/_mapdata.rb
18+
19+
# General settings across all cops in this formula
20+
AllCops:
21+
NewCops: enable
1522

1623
# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config`

0 commit comments

Comments
 (0)