From d2699428f03c7afbf937402201df5be0d67efd3a Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Mon, 30 Jan 2023 11:48:59 +0100 Subject: [PATCH 01/24] feat(formula): add missing standard files This is the base files for standard community formulas. Reset the `pillar.example` for new values --- .gitignore | 134 +++++++ .gitlab-ci.yml | 213 ++++++++++ .pre-commit-config.yaml | 79 ++++ .rstcheck.cfg | 4 + .rubocop.yml | 23 ++ .salt-lint | 14 + .yamllint | 44 +++ CODEOWNERS | 53 +++ FORMULA | 9 + Gemfile | 19 + Gemfile.lock | 675 ++++++++++++++++++++++++++++++++ bin/install-hooks | 16 + bin/kitchen | 32 ++ commitlint.config.js | 8 + kitchen.yml | 281 +++++++++++++ moosefs/_mapdata/_mapdata.jinja | 13 + moosefs/_mapdata/init.sls | 22 ++ pillar.example | 95 +---- pre-commit_semantic-release.sh | 30 ++ release-rules.js | 18 + release.config.js | 107 +++++ 21 files changed, 1800 insertions(+), 89 deletions(-) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml create mode 100644 .pre-commit-config.yaml create mode 100644 .rstcheck.cfg create mode 100644 .rubocop.yml create mode 100644 .salt-lint create mode 100644 .yamllint create mode 100644 CODEOWNERS create mode 100644 FORMULA create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100755 bin/install-hooks create mode 100755 bin/kitchen create mode 100644 commitlint.config.js create mode 100644 kitchen.yml create mode 100644 moosefs/_mapdata/_mapdata.jinja create mode 100644 moosefs/_mapdata/init.sls create mode 100755 pre-commit_semantic-release.sh create mode 100644 release-rules.js create mode 100644 release.config.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39752a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,134 @@ +# 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/ + +# visual studio +.vs/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# Bundler +.bundle/ + +# 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/ + +# `salt-formula` -- Vagrant Specific files +.vagrant +top.sls +!test/salt/pillar/top.sls + +# `suricata-formula` -- Platform binaries +*.rpm +*.deb diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..0fc702f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,213 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +############################################################################### +# Define all YAML node anchors +############################################################################### +.node_anchors: + # `only` (also used for `except` where applicable) + only_branch_master_parent_repo: &only_branch_master_parent_repo + - 'master@saltstack-formulas/moosefs-formula' + # `stage` + stage_lint: &stage_lint 'lint' + stage_release: &stage_release 'release' + stage_test: &stage_test 'test' + # `image` + image_commitlint: &image_commitlint 'myii/ssf-commitlint:11' + image_dindruby: &image_dindruby 'myii/ssf-dind-ruby:2.7.1-r3' + image_dindrubybionic: &image_dindrubybionic 'myii/ssf-dind-ruby-bionic:2.7.5-1bbox1' + image_precommit: &image_precommit + name: 'myii/ssf-pre-commit:2.9.2' + entrypoint: ['/bin/bash', '-c'] + image_rubocop: &image_rubocop 'pipelinecomponents/rubocop:latest' + image_semantic-release: &image_semanticrelease 'myii/ssf-semantic-release:15.14' + # `services` + services_docker_dind: &services_docker_dind + - 'docker:dind' + # `variables` + # https://forum.gitlab.com/t/gitlab-com-ci-caching-rubygems/5627/3 + # https://bundler.io/v1.16/bundle_config.html + variables_bundler: &variables_bundler + BUNDLE_CACHE_PATH: '${CI_PROJECT_DIR}/.cache/bundler' + BUNDLE_WITHOUT: 'production' + # `cache` + cache_bundler: &cache_bundler + key: '${CI_JOB_STAGE}' + paths: + - '${BUNDLE_CACHE_PATH}' + +############################################################################### +# Define stages and global variables +############################################################################### +stages: + - *stage_lint + - *stage_test + - *stage_release +variables: + DOCKER_DRIVER: 'overlay2' + +############################################################################### +# `lint` stage: `commitlint`, `pre-commit` & `rubocop` (latest, failure allowed) +############################################################################### +commitlint: + stage: *stage_lint + image: *image_commitlint + script: + # Add `upstream` remote to get access to `upstream/master` + - 'git remote add upstream + https://gitlab.com/saltstack-formulas/moosefs-formula.git' + - 'git fetch --all' + # Set default commit hashes for `--from` and `--to` + - 'export COMMITLINT_FROM="$(git merge-base upstream/master HEAD)"' + - 'export COMMITLINT_TO="${CI_COMMIT_SHA}"' + # `coqbot` adds a merge commit to test PRs on top of the latest commit in + # the repo; amend this merge commit message to avoid failure + - | + if [ "${GITLAB_USER_LOGIN}" = "coqbot" ] \ + && [ "${CI_COMMIT_BRANCH}" != "master" ]; then + git commit --amend -m \ + 'chore: reword coqbot merge commit message for commitlint' + export COMMITLINT_TO=HEAD + fi + # Run `commitlint` + - 'commitlint --from "${COMMITLINT_FROM}" + --to "${COMMITLINT_TO}" + --verbose' + +pre-commit: + stage: *stage_lint + image: *image_precommit + # https://pre-commit.com/#gitlab-ci-example + variables: + PRE_COMMIT_HOME: '${CI_PROJECT_DIR}/.cache/pre-commit' + cache: + key: '${CI_JOB_NAME}' + paths: + - '${PRE_COMMIT_HOME}' + script: + - 'pre-commit run --all-files --color always --verbose' + +# Use a separate job for `rubocop` other than the one potentially run by `pre-commit` +# - The `pre-commit` check will only be available for formulas that pass the default +# `rubocop` check -- and must continue to do so +# - This job is allowed to fail, so can be used for all formulas +# - Furthermore, this job uses all of the latest `rubocop` features & cops, +# which will help when upgrading the `rubocop` linter used in `pre-commit` +rubocop: + allow_failure: true + stage: *stage_lint + image: *image_rubocop + script: + - 'rubocop -d -P -S --enable-pending-cops' + +############################################################################### +# Define `test` template +############################################################################### +.test_instance: &test_instance + stage: *stage_test + image: *image_dindruby + services: *services_docker_dind + variables: *variables_bundler + cache: *cache_bundler + before_script: + # TODO: This should work from the env vars above automatically + - 'bundle config set path "${BUNDLE_CACHE_PATH}"' + - 'bundle config set without "${BUNDLE_WITHOUT}"' + - 'bundle install' + script: + # Alternative value to consider: `${CI_JOB_NAME}` + - 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"' + +############################################################################### +# Define `test` template (`allow_failure: true`) +############################################################################### +.test_instance_failure_permitted: + <<: *test_instance + allow_failure: true + +############################################################################### +# `test` stage: each instance below uses the `test` template above +############################################################################### +## 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` +# yamllint disable rule:line-length +# default-debian-11-tiamat-py3: {extends: '.test_instance'} +# default-debian-10-tiamat-py3: {extends: '.test_instance'} +# default-debian-9-tiamat-py3: {extends: '.test_instance'} +# default-ubuntu-2204-tiamat-py3: {extends: '.test_instance_failure_permitted'} +# default-ubuntu-2004-tiamat-py3: {extends: '.test_instance'} +# default-ubuntu-1804-tiamat-py3: {extends: '.test_instance'} +# default-centos-stream8-tiamat-py3: {extends: '.test_instance_failure_permitted'} +# default-centos-7-tiamat-py3: {extends: '.test_instance'} +# default-amazonlinux-2-tiamat-py3: {extends: '.test_instance'} +# default-oraclelinux-8-tiamat-py3: {extends: '.test_instance'} +# default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'} +# default-almalinux-8-tiamat-py3: {extends: '.test_instance'} +# default-rockylinux-8-tiamat-py3: {extends: '.test_instance'} +default-debian-11-master-py3: {extends: '.test_instance'} +# default-debian-10-master-py3: {extends: '.test_instance'} +# default-debian-9-master-py3: {extends: '.test_instance'} +default-ubuntu-2204-master-py3: {extends: '.test_instance'} +# default-ubuntu-2004-master-py3: {extends: '.test_instance'} +# default-ubuntu-1804-master-py3: {extends: '.test_instance'} +# default-centos-stream8-master-py3: {extends: '.test_instance_failure_permitted'} +# default-centos-7-master-py3: {extends: '.test_instance'} +# default-fedora-36-master-py3: {extends: '.test_instance_failure_permitted'} +# default-fedora-35-master-py3: {extends: '.test_instance'} +# default-opensuse-leap-153-master-py3: {extends: '.test_instance'} +# default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance_failure_permitted'} +# default-amazonlinux-2-master-py3: {extends: '.test_instance'} +# default-oraclelinux-8-master-py3: {extends: '.test_instance'} +# default-oraclelinux-7-master-py3: {extends: '.test_instance'} +# default-arch-base-latest-master-py3: {extends: '.test_instance'} +# default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'} +# default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'} +# default-almalinux-8-master-py3: {extends: '.test_instance'} +# default-rockylinux-8-master-py3: {extends: '.test_instance'} +default-debian-11-3004-1-py3: {extends: '.test_instance'} +# default-debian-10-3004-1-py3: {extends: '.test_instance'} +# default-debian-9-3004-1-py3: {extends: '.test_instance'} +default-ubuntu-2204-3004-1-py3: {extends: '.test_instance'} +# default-ubuntu-2004-3004-1-py3: {extends: '.test_instance'} +# default-ubuntu-1804-3004-1-py3: {extends: '.test_instance'} +# default-centos-stream8-3004-1-py3: {extends: '.test_instance_failure_permitted'} +# default-centos-7-3004-1-py3: {extends: '.test_instance'} +# default-fedora-36-3004-1-py3: {extends: '.test_instance_failure_permitted'} +# default-fedora-35-3004-1-py3: {extends: '.test_instance'} +# default-amazonlinux-2-3004-1-py3: {extends: '.test_instance'} +# default-oraclelinux-8-3004-1-py3: {extends: '.test_instance'} +# default-oraclelinux-7-3004-1-py3: {extends: '.test_instance'} +# default-arch-base-latest-3004-1-py3: {extends: '.test_instance'} +# default-gentoo-stage3-latest-3004-1-py3: {extends: '.test_instance'} +# default-gentoo-stage3-systemd-3004-1-py3: {extends: '.test_instance'} +# default-almalinux-8-3004-1-py3: {extends: '.test_instance'} +# default-rockylinux-8-3004-1-py3: {extends: '.test_instance'} +# default-opensuse-leap-153-3004-0-py3: {extends: '.test_instance'} +# default-opensuse-tmbl-latest-3004-0-py3: {extends: '.test_instance_failure_permitted'} +# default-debian-10-3003-4-py3: {extends: '.test_instance'} +# default-debian-9-3003-4-py3: {extends: '.test_instance'} +# default-ubuntu-2004-3003-4-py3: {extends: '.test_instance'} +# default-ubuntu-1804-3003-4-py3: {extends: '.test_instance'} +# default-centos-stream8-3003-4-py3: {extends: '.test_instance_failure_permitted'} +# default-centos-7-3003-4-py3: {extends: '.test_instance'} +# default-amazonlinux-2-3003-4-py3: {extends: '.test_instance'} +# default-oraclelinux-8-3003-4-py3: {extends: '.test_instance'} +# default-oraclelinux-7-3003-4-py3: {extends: '.test_instance'} +# default-almalinux-8-3003-4-py3: {extends: '.test_instance'} +# yamllint enable rule:line-length + +############################################################################### +# `release` stage: `semantic-release` +############################################################################### +semantic-release: + only: *only_branch_master_parent_repo + stage: *stage_release + image: *image_semanticrelease + variables: + MAINTAINER_TOKEN: '${GH_TOKEN}' + script: + # Update `AUTHORS.md` + - '${HOME}/go/bin/maintainer contributor' + # Run `semantic-release` + - 'semantic-release' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..068fa29 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +ci: + autofix_commit_msg: | + ci(pre-commit.ci): apply auto fixes from pre-commit.com hooks + + For more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_branch: '' + autoupdate_commit_msg: | + ci(pre-commit.ci): perform `pre-commit` autoupdate + autoupdate_schedule: quarterly + skip: [] + submodules: false +default_stages: [commit] +repos: + - repo: https://github.com/dafyddj/commitlint-pre-commit-hook + rev: v2.3.0 + hooks: + - id: commitlint + name: Check commit message using commitlint + description: Lint commit message against @commitlint/config-conventional rules + stages: [commit-msg] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + - id: commitlint-travis + stages: [manual] + additional_dependencies: ['@commitlint/config-conventional@8.3.4'] + always_run: true + - repo: https://github.com/rubocop-hq/rubocop + rev: v1.30.1 + hooks: + - id: rubocop + name: Check Ruby files with rubocop + args: [--debug] + always_run: true + pass_filenames: false + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.8.0.4 + hooks: + - id: shellcheck + name: Check shell scripts with shellcheck + files: ^.*\.(sh|bash|ksh)$ + types: [] + - repo: https://github.com/adrienverge/yamllint + rev: v1.26.3 + hooks: + - id: yamllint + name: Check YAML syntax with yamllint + args: [--strict, '.'] + always_run: true + pass_filenames: false + - repo: https://github.com/warpnet/salt-lint + rev: v0.8.0 + hooks: + - id: salt-lint + name: Check Salt files using salt-lint + files: ^.*\.(sls|jinja|j2|tmpl|tst)$ + - repo: https://github.com/myint/rstcheck + rev: 3f929574 + hooks: + - id: rstcheck + name: Check reST files using rstcheck + exclude: 'docs/CHANGELOG.rst' + - repo: https://github.com/saltstack-formulas/mirrors-rst-lint + rev: v1.3.2 + hooks: + - id: rst-lint + name: Check reST files using rst-lint + exclude: | + (?x)^( + docs/CHANGELOG.rst| + docs/TOFS_pattern.rst| + docs/CONTRIBUTING_DOCS.rst| + docs/index.rst| + )$ + additional_dependencies: [pygments==2.9.0] diff --git a/.rstcheck.cfg b/.rstcheck.cfg new file mode 100644 index 0000000..5383623 --- /dev/null +++ b/.rstcheck.cfg @@ -0,0 +1,4 @@ +[rstcheck] +report=info +ignore_language=rst +ignore_messages=(Duplicate (ex|im)plicit target.*|Hyperlink target ".*" is not referenced\.$) diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..bf4d107 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# General overrides used across formulas in the org +Layout/LineLength: + # Increase from default of `80` + # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) + Max: 88 +Metrics/BlockLength: + IgnoredMethods: + - control + - describe + # Increase from default of `25` + Max: 30 +Security/YAMLLoad: + Exclude: + - test/integration/**/_mapdata.rb + +# General settings across all cops in this formula +AllCops: + NewCops: enable + +# Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config` diff --git a/.salt-lint b/.salt-lint new file mode 100644 index 0000000..3715677 --- /dev/null +++ b/.salt-lint @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +exclude_paths: [] +rules: {} +skip_list: + # Using `salt-lint` for linting other files as well, such as Jinja macros/templates + - 205 # Use ".sls" as a Salt State file extension + # Skipping `207` and `208` because `210` is sufficient, at least for the time-being + # I.e. Allows 3-digit unquoted codes to still be used, such as `644` and `755` + - 207 # File modes should always be encapsulated in quotation marks + - 208 # File modes should always contain a leading zero +tags: [] +verbosity: 1 diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..716baaf --- /dev/null +++ b/.yamllint @@ -0,0 +1,44 @@ +# -*- 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 `.bundle/`, introduced if gems are installed locally +# 2. All YAML files under directory `.cache/`, introduced during the CI run +# 3. All YAML files under directory `.git/` +# 4. All YAML files under directory `node_modules/`, introduced during the CI run +# 5. Any SLS files under directory `test/`, which are actually state files +# 6. Any YAML files under directory `.kitchen/`, introduced during local testing +# 7. `kitchen.vagrant.yml`, which contains Embedded Ruby (ERB) template syntax +ignore: | + .bundle/ + .cache/ + .git/ + node_modules/ + test/**/states/**/*.sls + .kitchen/ + kitchen.vagrant.yml + +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 diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..d14bb9b --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,53 @@ +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners + +# SECTION: Owner(s) for everything in the repo, unless a later match takes precedence +# FILE PATTERN OWNER(S) +* @saltstack-formulas/wg + +# SECTION: Owner(s) for specific directories +# FILE PATTERN OWNER(S) + +# SECTION: Owner(s) for files/directories related to `semantic-release` +# FILE PATTERN OWNER(S) +/.github/workflows/ @saltstack-formulas/ssf +/bin/install-hooks @saltstack-formulas/ssf +/bin/kitchen @saltstack-formulas/ssf +/docs/AUTHORS.rst @saltstack-formulas/ssf +/docs/CHANGELOG.rst @saltstack-formulas/ssf +/docs/TOFS_pattern.rst @saltstack-formulas/ssf +/*/_mapdata/ @saltstack-formulas/ssf +/*/libmapstack.jinja @saltstack-formulas/ssf +/*/libmatchers.jinja @saltstack-formulas/ssf +/*/libsaltcli.jinja @saltstack-formulas/ssf +/*/libtofs.jinja @saltstack-formulas/ssf +/*/map.jinja @saltstack-formulas/ssf +/test/integration/**/_mapdata.rb @saltstack-formulas/ssf +/test/integration/**/libraries/system.rb @saltstack-formulas/ssf +/test/integration/**/inspec.yml @saltstack-formulas/ssf +/test/integration/**/README.md @saltstack-formulas/ssf +/test/salt/pillar/top.sls @saltstack-formulas/ssf +/.gitignore @saltstack-formulas/ssf +/.cirrus.yml @saltstack-formulas/ssf +/.gitlab-ci.yml @saltstack-formulas/ssf +/.pre-commit-config.yaml @saltstack-formulas/ssf +/.rstcheck.cfg @saltstack-formulas/ssf +/.rubocop.yml @saltstack-formulas/ssf +/.salt-lint @saltstack-formulas/ssf +/.travis.yml @saltstack-formulas/ssf +/.yamllint @saltstack-formulas/ssf +/AUTHORS.md @saltstack-formulas/ssf +/CHANGELOG.md @saltstack-formulas/ssf +/CODEOWNERS @saltstack-formulas/ssf +/commitlint.config.js @saltstack-formulas/ssf +/FORMULA @saltstack-formulas/ssf +/Gemfile @saltstack-formulas/ssf +/Gemfile.lock @saltstack-formulas/ssf +/kitchen.yml @saltstack-formulas/ssf +/kitchen.vagrant.yml @saltstack-formulas/ssf +/kitchen.windows.yml @saltstack-formulas/ssf +/pre-commit_semantic-release.sh @saltstack-formulas/ssf +/release-rules.js @saltstack-formulas/ssf +/release.config.js @saltstack-formulas/ssf + +# SECTION: Owner(s) for specific files +# FILE PATTERN OWNER(S) diff --git a/FORMULA b/FORMULA new file mode 100644 index 0000000..eab0fbf --- /dev/null +++ b/FORMULA @@ -0,0 +1,9 @@ +name: moosefs +os: Debian, Ubuntu, Raspbian, Arch, FreeBSD +os_family: Debian, Arch, FreeBSD +version: 1 +release: 1 +minimum_version: 2019.2 +summary: MooseFS formula +description: Formula to setup and configure MooseFS +top_level_dir: moosefs diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..12d9b1d --- /dev/null +++ b/Gemfile @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +source ENV.fetch('PROXY_RUBYGEMSORG', 'https://rubygems.org') + +# Install the `inspec` gem using `git` because versions after `4.22.22` +# suppress diff output; this version fixes this for our uses. +# rubocop:disable Layout/LineLength +gem 'inspec', git: 'https://gitlab.com/saltstack-formulas/infrastructure/inspec', branch: 'ssf' +# rubocop:enable Layout/LineLength + +# Install the `kitchen-docker` gem using `git` in order to gain a performance +# improvement: avoid package installations which are already covered by the +# `salt-image-builder` (i.e. the pre-salted images that we're using) +# rubocop:disable Layout/LineLength +gem 'kitchen-docker', git: 'https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker', branch: 'ssf' +# rubocop:enable Layout/LineLength + +gem 'kitchen-inspec', '>= 2.5.0' +gem 'kitchen-salt', '>= 0.7.2' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..471bb68 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,675 @@ +GIT + remote: https://gitlab.com/saltstack-formulas/infrastructure/inspec + revision: aaef842906a5666f0fc0b4f186b4dd3498f5b28c + branch: ssf + specs: + inspec (5.18.15) + cookstyle + faraday_middleware (>= 0.12.2, < 1.1) + inspec-core (= 5.18.15) + mongo (= 2.13.2) + progress_bar (~> 1.3.3) + rake + train (~> 3.10) + train-aws (~> 0.2) + train-habitat (~> 0.1) + train-winrm (~> 0.2) + inspec-core (5.18.15) + addressable (~> 2.4) + chef-telemetry (~> 1.0, >= 1.0.8) + faraday (>= 0.9.0, < 1.5) + faraday_middleware (~> 1.0) + hashie (>= 3.4, < 5.0) + license-acceptance (>= 0.2.13, < 3.0) + method_source (>= 0.8, < 2.0) + mixlib-log (~> 3.0) + multipart-post (~> 2.0) + parallel (~> 1.9) + parslet (>= 1.5, < 2.0) + pry (~> 0.13) + rspec (>= 3.9, <= 3.11) + rspec-its (~> 1.2) + rubyzip (>= 1.2.2, < 3.0) + semverse (~> 3.0) + sslshake (~> 1.2) + thor (>= 0.20, < 2.0) + tomlrb (>= 1.2, < 2.1) + train-core (~> 3.10) + tty-prompt (~> 0.17) + tty-table (~> 0.10) + +GIT + remote: https://gitlab.com/saltstack-formulas/infrastructure/kitchen-docker + revision: 9a09bc1e571e25f3ccabf4725ca2048d970fff82 + branch: ssf + specs: + kitchen-docker (2.12.0) + test-kitchen (>= 1.0.0) + +GEM + remote: https://rubygems.org/ + specs: + activesupport (7.0.3.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + ast (2.4.2) + aws-eventstream (1.2.0) + aws-partitions (1.607.0) + aws-sdk-alexaforbusiness (1.56.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-amplify (1.32.0) + aws-sdk-core (~> 3, >= 3.120.0) + aws-sigv4 (~> 1.1) + aws-sdk-apigateway (1.78.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-apigatewayv2 (1.42.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-applicationautoscaling (1.51.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-athena (1.55.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-autoscaling (1.63.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-batch (1.47.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-budgets (1.50.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudformation (1.70.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudfront (1.65.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudhsm (1.39.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudhsmv2 (1.42.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudtrail (1.49.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudwatch (1.64.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudwatchevents (1.46.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-cloudwatchlogs (1.53.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-codecommit (1.51.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-codedeploy (1.49.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-codepipeline (1.53.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-cognitoidentity (1.31.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-cognitoidentityprovider (1.53.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-configservice (1.79.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-core (3.131.2) + aws-eventstream (~> 1, >= 1.0.2) + aws-partitions (~> 1, >= 1.525.0) + aws-sigv4 (~> 1.1) + jmespath (~> 1, >= 1.6.1) + aws-sdk-costandusagereportservice (1.40.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-databasemigrationservice (1.53.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-dynamodb (1.75.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-ec2 (1.322.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-ecr (1.56.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-ecrpublic (1.12.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-ecs (1.100.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-efs (1.54.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-eks (1.75.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticache (1.78.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticbeanstalk (1.51.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticloadbalancing (1.40.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticloadbalancingv2 (1.78.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-elasticsearchservice (1.65.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-emr (1.53.0) + aws-sdk-core (~> 3, >= 3.121.2) + aws-sigv4 (~> 1.1) + aws-sdk-eventbridge (1.24.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-firehose (1.48.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-glue (1.88.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-guardduty (1.58.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-iam (1.69.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-kafka (1.50.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-kinesis (1.41.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-kms (1.57.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-lambda (1.84.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-mq (1.40.0) + aws-sdk-core (~> 3, >= 3.120.0) + aws-sigv4 (~> 1.1) + aws-sdk-networkfirewall (1.17.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-networkmanager (1.24.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-organizations (1.59.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-ram (1.26.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-rds (1.148.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-redshift (1.84.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53 (1.63.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53domains (1.40.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-route53resolver (1.37.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.114.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.4) + aws-sdk-s3control (1.43.0) + aws-sdk-core (~> 3, >= 3.122.0) + aws-sigv4 (~> 1.1) + aws-sdk-secretsmanager (1.46.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-securityhub (1.67.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-servicecatalog (1.60.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-ses (1.41.0) + aws-sdk-core (~> 3, >= 3.120.0) + aws-sigv4 (~> 1.1) + aws-sdk-shield (1.48.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-signer (1.32.0) + aws-sdk-core (~> 3, >= 3.120.0) + aws-sigv4 (~> 1.1) + aws-sdk-simpledb (1.29.0) + aws-sdk-core (~> 3, >= 3.120.0) + aws-sigv2 (~> 1.0) + aws-sdk-sms (1.40.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-sns (1.53.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-sqs (1.51.1) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-ssm (1.137.0) + aws-sdk-core (~> 3, >= 3.127.0) + aws-sigv4 (~> 1.1) + aws-sdk-states (1.39.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-synthetics (1.19.0) + aws-sdk-core (~> 3, >= 3.121.2) + aws-sigv4 (~> 1.1) + aws-sdk-transfer (1.34.0) + aws-sdk-core (~> 3, >= 3.112.0) + aws-sigv4 (~> 1.1) + aws-sdk-waf (1.43.0) + aws-sdk-core (~> 3, >= 3.122.0) + aws-sigv4 (~> 1.1) + aws-sigv2 (1.1.0) + aws-sigv4 (1.5.0) + aws-eventstream (~> 1, >= 1.0.2) + azure_graph_rbac (0.17.2) + ms_rest_azure (~> 0.12.0) + azure_mgmt_key_vault (0.17.7) + ms_rest_azure (~> 0.12.0) + azure_mgmt_resources (0.18.2) + ms_rest_azure (~> 0.12.0) + azure_mgmt_security (0.19.0) + ms_rest_azure (~> 0.12.0) + azure_mgmt_storage (0.23.0) + ms_rest_azure (~> 0.12.0) + bcrypt_pbkdf (1.1.0) + bson (4.15.0) + builder (3.2.4) + chef-config (17.10.0) + addressable + chef-utils (= 17.10.0) + fuzzyurl + mixlib-config (>= 2.2.12, < 4.0) + mixlib-shellout (>= 2.0, < 4.0) + tomlrb (~> 1.2) + chef-telemetry (1.1.1) + chef-config + concurrent-ruby (~> 1.0) + chef-utils (17.10.0) + concurrent-ruby + coderay (1.1.3) + concurrent-ruby (1.1.10) + cookstyle (7.32.1) + rubocop (= 1.25.1) + declarative (0.0.20) + diff-lcs (1.5.0) + docker-api (2.2.0) + excon (>= 0.47.0) + multi_json + domain_name (0.5.20190701) + unf (>= 0.0.5, < 1.0.0) + ed25519 (1.3.0) + erubi (1.10.0) + excon (0.92.3) + faraday (1.4.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) + multipart-post (>= 1.2, < 3) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday_middleware (1.0.0) + faraday (~> 1.0) + ffi (1.15.5) + fuzzyurl (0.9.0) + google-api-client (0.52.0) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 0.9) + httpclient (>= 2.8.1, < 3.0) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + rexml + signet (~> 0.12) + googleauth (0.14.0) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (~> 0.14) + gssapi (1.3.1) + ffi (>= 1.0.1) + gyoku (1.4.0) + builder (>= 2.1.2) + rexml (~> 3.0) + hashie (4.1.0) + highline (2.0.3) + http-cookie (1.0.5) + domain_name (~> 0.5) + httpclient (2.8.3) + i18n (1.12.0) + concurrent-ruby (~> 1.0) + inifile (3.0.0) + jmespath (1.6.1) + json (2.6.2) + jwt (2.4.1) + kitchen-inspec (2.6.1) + hashie (>= 3.4, <= 5.0) + inspec (>= 2.2.64, < 7.0) + test-kitchen (>= 2.7, < 4) + kitchen-salt (0.7.2) + hashie (>= 3.5) + test-kitchen (>= 1.4) + license-acceptance (2.1.13) + pastel (~> 0.7) + tomlrb (>= 1.2, < 3.0) + tty-box (~> 0.6) + tty-prompt (~> 0.20) + little-plugger (1.1.4) + logging (2.3.1) + little-plugger (~> 1.1) + multi_json (~> 1.14) + memoist (0.16.2) + method_source (1.0.0) + mini_mime (1.1.2) + minitest (5.16.2) + mixlib-config (3.0.27) + tomlrb + mixlib-install (3.12.19) + mixlib-shellout + mixlib-versioning + thor + mixlib-log (3.0.9) + mixlib-shellout (3.2.7) + chef-utils + mixlib-versioning (1.2.12) + mongo (2.13.2) + bson (>= 4.8.2, < 5.0.0) + ms_rest (0.7.6) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + timeliness (~> 0.3.10) + ms_rest_azure (0.12.0) + concurrent-ruby (~> 1.0) + faraday (>= 0.9, < 2.0.0) + faraday-cookie_jar (~> 0.0.6) + ms_rest (~> 0.7.6) + multi_json (1.15.0) + multipart-post (2.2.3) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) + net-ssh-gateway (2.0.0) + net-ssh (>= 4.0.0) + nori (2.6.0) + options (2.3.2) + os (1.1.4) + parallel (1.22.1) + parser (3.1.2.0) + ast (~> 2.4.1) + parslet (1.8.2) + pastel (0.8.0) + tty-color (~> 0.5) + progress_bar (1.3.3) + highline (>= 1.6, < 3) + options (~> 2.3.0) + pry (0.14.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.7) + rainbow (3.1.1) + rake (13.0.6) + regexp_parser (2.5.0) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.2.5) + rspec (3.11.0) + rspec-core (~> 3.11.0) + rspec-expectations (~> 3.11.0) + rspec-mocks (~> 3.11.0) + rspec-core (3.11.0) + rspec-support (~> 3.11.0) + rspec-expectations (3.11.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.11.0) + rspec-its (1.3.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.11.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.11.0) + rspec-support (3.11.0) + rubocop (1.25.1) + parallel (~> 1.10) + parser (>= 3.1.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.15.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.19.1) + parser (>= 3.1.1.0) + ruby-progressbar (1.11.0) + ruby2_keywords (0.0.5) + rubyntlm (0.6.3) + rubyzip (2.3.2) + semverse (3.0.2) + signet (0.17.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + sslshake (1.3.1) + strings (0.2.1) + strings-ansi (~> 0.2) + unicode-display_width (>= 1.5, < 3.0) + unicode_utils (~> 1.4) + strings-ansi (0.2.0) + test-kitchen (3.3.1) + bcrypt_pbkdf (~> 1.0) + chef-utils (>= 16.4.35) + ed25519 (~> 1.2) + license-acceptance (>= 1.0.11, < 3.0) + mixlib-install (~> 3.6) + mixlib-shellout (>= 1.2, < 4.0) + net-scp (>= 1.1, < 4.0) + net-ssh (>= 2.9, < 7.0) + net-ssh-gateway (>= 1.2, < 3.0) + thor (>= 0.19, < 2.0) + winrm (~> 2.0) + winrm-elevated (~> 1.0) + winrm-fs (~> 1.1) + thor (1.2.1) + timeliness (0.3.10) + tomlrb (1.3.0) + trailblazer-option (0.1.2) + train (3.10.1) + activesupport (>= 6.0.3.1) + azure_graph_rbac (~> 0.16) + azure_mgmt_key_vault (~> 0.17) + azure_mgmt_resources (~> 0.15) + azure_mgmt_security (~> 0.18) + azure_mgmt_storage (~> 0.18) + docker-api (>= 1.26, < 3.0) + google-api-client (>= 0.23.9, <= 0.52.0) + googleauth (>= 0.6.6, <= 0.14.0) + inifile (~> 3.0) + train-core (= 3.10.1) + train-winrm (~> 0.2) + train-aws (0.2.24) + aws-sdk-alexaforbusiness (~> 1.0) + aws-sdk-amplify (~> 1.32.0) + aws-sdk-apigateway (~> 1.0) + aws-sdk-apigatewayv2 (~> 1.0) + aws-sdk-applicationautoscaling (>= 1.46, < 1.52) + aws-sdk-athena (~> 1.0) + aws-sdk-autoscaling (>= 1.22, < 1.64) + aws-sdk-batch (>= 1.36, < 1.48) + aws-sdk-budgets (~> 1.0) + aws-sdk-cloudformation (~> 1.0) + aws-sdk-cloudfront (~> 1.0) + aws-sdk-cloudhsm (~> 1.0) + aws-sdk-cloudhsmv2 (~> 1.0) + aws-sdk-cloudtrail (~> 1.8) + aws-sdk-cloudwatch (~> 1.13) + aws-sdk-cloudwatchevents (>= 1.36, < 1.47) + aws-sdk-cloudwatchlogs (~> 1.13) + aws-sdk-codecommit (~> 1.0) + aws-sdk-codedeploy (~> 1.0) + aws-sdk-codepipeline (~> 1.0) + aws-sdk-cognitoidentity (>= 1.26, < 1.32) + aws-sdk-cognitoidentityprovider (>= 1.46, < 1.54) + aws-sdk-configservice (~> 1.21) + aws-sdk-core (~> 3.0) + aws-sdk-costandusagereportservice (~> 1.6) + aws-sdk-databasemigrationservice (>= 1.42, < 1.54) + aws-sdk-dynamodb (~> 1.31) + aws-sdk-ec2 (~> 1.70) + aws-sdk-ecr (~> 1.18) + aws-sdk-ecrpublic (~> 1.3) + aws-sdk-ecs (~> 1.30) + aws-sdk-efs (~> 1.0) + aws-sdk-eks (~> 1.9) + aws-sdk-elasticache (~> 1.0) + aws-sdk-elasticbeanstalk (~> 1.0) + aws-sdk-elasticloadbalancing (~> 1.8) + aws-sdk-elasticloadbalancingv2 (~> 1.0) + aws-sdk-elasticsearchservice (~> 1.0) + aws-sdk-emr (~> 1.53.0) + aws-sdk-eventbridge (~> 1.24.0) + aws-sdk-firehose (~> 1.0) + aws-sdk-glue (>= 1.71, < 1.89) + aws-sdk-guardduty (~> 1.31) + aws-sdk-iam (~> 1.13) + aws-sdk-kafka (~> 1.0) + aws-sdk-kinesis (~> 1.0) + aws-sdk-kms (~> 1.13) + aws-sdk-lambda (~> 1.0) + aws-sdk-mq (~> 1.40.0) + aws-sdk-networkfirewall (>= 1.6.0) + aws-sdk-networkmanager (>= 1.13.0) + aws-sdk-organizations (>= 1.17, < 1.60) + aws-sdk-ram (>= 1.21, < 1.27) + aws-sdk-rds (~> 1.43) + aws-sdk-redshift (~> 1.0) + aws-sdk-route53 (~> 1.0) + aws-sdk-route53domains (~> 1.0) + aws-sdk-route53resolver (~> 1.0) + aws-sdk-s3 (~> 1.30) + aws-sdk-s3control (~> 1.43.0) + aws-sdk-secretsmanager (>= 1.42, < 1.47) + aws-sdk-securityhub (~> 1.0) + aws-sdk-servicecatalog (>= 1.48, < 1.61) + aws-sdk-ses (~> 1.41.0) + aws-sdk-shield (~> 1.30) + aws-sdk-signer (~> 1.32.0) + aws-sdk-simpledb (~> 1.29.0) + aws-sdk-sms (~> 1.0) + aws-sdk-sns (~> 1.9) + aws-sdk-sqs (~> 1.10) + aws-sdk-ssm (~> 1.0) + aws-sdk-states (>= 1.35, < 1.40) + aws-sdk-synthetics (~> 1.19.0) + aws-sdk-transfer (>= 1.26, < 1.35) + aws-sdk-waf (~> 1.43.0) + train-core (3.10.1) + addressable (~> 2.5) + ffi (!= 1.13.0) + json (>= 1.8, < 3.0) + mixlib-shellout (>= 2.0, < 4.0) + net-scp (>= 1.2, < 4.0) + net-ssh (>= 2.9, < 7.0) + train-habitat (0.2.22) + train-winrm (0.2.13) + winrm (>= 2.3.6, < 3.0) + winrm-elevated (~> 1.2.2) + winrm-fs (~> 1.0) + tty-box (0.7.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-cursor (~> 0.7) + tty-color (0.6.0) + tty-cursor (0.7.1) + tty-prompt (0.23.1) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.9.0) + tty-cursor (~> 0.7) + tty-screen (~> 0.8) + wisper (~> 2.0) + tty-screen (0.8.1) + tty-table (0.12.0) + pastel (~> 0.8) + strings (~> 0.2.0) + tty-screen (~> 0.8) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.8.2) + unicode-display_width (2.2.0) + unicode_utils (1.4.0) + winrm (2.3.6) + builder (>= 2.1.2) + erubi (~> 1.8) + gssapi (~> 1.2) + gyoku (~> 1.0) + httpclient (~> 2.2, >= 2.2.0.2) + logging (>= 1.6.1, < 3.0) + nori (~> 2.0) + rubyntlm (~> 0.6.0, >= 0.6.3) + winrm-elevated (1.2.3) + erubi (~> 1.8) + winrm (~> 2.0) + winrm-fs (~> 1.0) + winrm-fs (1.3.5) + erubi (~> 1.8) + logging (>= 1.6.1, < 3.0) + rubyzip (~> 2.0) + winrm (~> 2.0) + wisper (2.0.1) + +PLATFORMS + ruby + +DEPENDENCIES + inspec! + kitchen-docker! + kitchen-inspec (>= 2.5.0) + kitchen-salt (>= 0.7.2) + +BUNDLED WITH + 2.1.2 diff --git a/bin/install-hooks b/bin/install-hooks new file mode 100755 index 0000000..840bb6c --- /dev/null +++ b/bin/install-hooks @@ -0,0 +1,16 @@ +#!/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 + +if ! command -v pre-commit >/dev/null 2>&1; then + echo "pre-commit not found: please install or check your PATH" >&2 + echo "See https://pre-commit.com/#installation" >&2 + exit 1 +fi + +pre-commit install --install-hooks +pre-commit install --hook-type commit-msg --install-hooks diff --git a/bin/kitchen b/bin/kitchen new file mode 100755 index 0000000..5d5663e --- /dev/null +++ b/bin/kitchen @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'kitchen' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', + Pathname.new(__FILE__).realpath) + +bundle_binstub = File.expand_path('bundle', __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort( + 'Your `bin/bundle` was not generated by Bundler, ' \ + 'so this binstub cannot run. Replace `bin/bundle` by running ' \ + '`bundle binstubs bundler --force`, then run this command again.' + ) + end +end + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('test-kitchen', 'kitchen') diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..4eb37f4 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,8 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'body-max-line-length': [2, 'always', 120], + 'footer-max-line-length': [2, 'always', 120], + 'header-max-length': [2, 'always', 72], + }, +}; diff --git a/kitchen.yml b/kitchen.yml new file mode 100644 index 0000000..9c2a94a --- /dev/null +++ b/kitchen.yml @@ -0,0 +1,281 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# For help on this file's format, see https://kitchen.ci/ +driver: + name: docker + use_sudo: false + privileged: true + run_command: /usr/lib/systemd/systemd + +provisioner: + name: salt_solo + log_level: debug + salt_install: none + require_chef: false + formula: moosefs + salt_copy_filter: + - .kitchen + - .git + pillars_from_directories: + - test/salt/pillar + +platforms: + ## SALT `tiamat` + - name: debian-11-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:debian-11 + run_command: /lib/systemd/systemd + - name: debian-10-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:debian-10 + run_command: /lib/systemd/systemd + - name: debian-9-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:debian-9 + run_command: /lib/systemd/systemd + - name: ubuntu-2204-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:ubuntu-22.04 + run_command: /lib/systemd/systemd + - name: ubuntu-2004-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:ubuntu-20.04 + run_command: /lib/systemd/systemd + - name: ubuntu-1804-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:ubuntu-18.04 + run_command: /lib/systemd/systemd + - name: centos-stream8-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:centos-stream8 + - name: centos-7-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:centos-7 + - name: amazonlinux-2-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:amazonlinux-2 + - name: oraclelinux-8-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:oraclelinux-8 + - name: oraclelinux-7-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:oraclelinux-7 + - name: almalinux-8-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:almalinux-8 + - name: rockylinux-8-tiamat-py3 + driver: + image: saltimages/salt-tiamat-py3:rockylinux-8 + + ## SALT `master` + - name: debian-11-master-py3 + driver: + image: saltimages/salt-master-py3:debian-11 + run_command: /lib/systemd/systemd + - name: debian-10-master-py3 + driver: + image: saltimages/salt-master-py3:debian-10 + run_command: /lib/systemd/systemd + - name: debian-9-master-py3 + driver: + image: saltimages/salt-master-py3:debian-9 + run_command: /lib/systemd/systemd + - name: ubuntu-2204-master-py3 + driver: + image: saltimages/salt-master-py3:ubuntu-22.04 + run_command: /lib/systemd/systemd + - name: ubuntu-2004-master-py3 + driver: + image: saltimages/salt-master-py3:ubuntu-20.04 + run_command: /lib/systemd/systemd + - name: ubuntu-1804-master-py3 + driver: + image: saltimages/salt-master-py3:ubuntu-18.04 + run_command: /lib/systemd/systemd + - name: centos-stream8-master-py3 + driver: + image: saltimages/salt-master-py3:centos-stream8 + - name: centos-7-master-py3 + driver: + image: saltimages/salt-master-py3:centos-7 + - name: fedora-36-master-py3 + driver: + image: saltimages/salt-master-py3:fedora-36 + - name: fedora-35-master-py3 + driver: + image: saltimages/salt-master-py3:fedora-35 + - name: opensuse-leap-153-master-py3 + driver: + image: saltimages/salt-master-py3:opensuse-leap-15.3 + # Workaround to avoid intermittent failures on `opensuse-leap-15.3`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + - name: opensuse-tmbl-latest-master-py3 + driver: + image: saltimages/salt-master-py3:opensuse-tumbleweed-latest + # Workaround to avoid intermittent failures on `opensuse-tumbleweed`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + - name: amazonlinux-2-master-py3 + driver: + image: saltimages/salt-master-py3:amazonlinux-2 + - name: oraclelinux-8-master-py3 + driver: + image: saltimages/salt-master-py3:oraclelinux-8 + - name: oraclelinux-7-master-py3 + driver: + image: saltimages/salt-master-py3:oraclelinux-7 + - name: arch-base-latest-master-py3 + driver: + image: saltimages/salt-master-py3:arch-base-latest + - name: gentoo-stage3-latest-master-py3 + driver: + image: saltimages/salt-master-py3:gentoo-stage3-latest + run_command: /sbin/init + - name: gentoo-stage3-systemd-master-py3 + driver: + image: saltimages/salt-master-py3:gentoo-stage3-systemd + - name: almalinux-8-master-py3 + driver: + image: saltimages/salt-master-py3:almalinux-8 + - name: rockylinux-8-master-py3 + driver: + image: saltimages/salt-master-py3:rockylinux-8 + + ## SALT `3004.1` + - name: debian-11-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:debian-11 + run_command: /lib/systemd/systemd + - name: debian-10-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:debian-10 + run_command: /lib/systemd/systemd + - name: debian-9-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:debian-9 + run_command: /lib/systemd/systemd + - name: ubuntu-2204-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:ubuntu-22.04 + run_command: /lib/systemd/systemd + - name: ubuntu-2004-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:ubuntu-20.04 + run_command: /lib/systemd/systemd + - name: ubuntu-1804-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:ubuntu-18.04 + run_command: /lib/systemd/systemd + - name: centos-stream8-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:centos-stream8 + - name: centos-7-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:centos-7 + - name: fedora-36-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:fedora-36 + - name: fedora-35-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:fedora-35 + - name: amazonlinux-2-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:amazonlinux-2 + - name: oraclelinux-8-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:oraclelinux-8 + - name: oraclelinux-7-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:oraclelinux-7 + - name: arch-base-latest-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:arch-base-latest + - name: gentoo-stage3-latest-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:gentoo-stage3-latest + run_command: /sbin/init + - name: gentoo-stage3-systemd-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:gentoo-stage3-systemd + - name: almalinux-8-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:almalinux-8 + - name: rockylinux-8-3004-1-py3 + driver: + image: saltimages/salt-3004.1-py3:rockylinux-8 + + ## SALT `3004.0` + - name: opensuse-leap-153-3004-0-py3 + driver: + image: saltimages/salt-3004.0-py3:opensuse-leap-15.3 + # Workaround to avoid intermittent failures on `opensuse-leap-15.3`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + - name: opensuse-tmbl-latest-3004-0-py3 + driver: + image: saltimages/salt-3004.0-py3:opensuse-tumbleweed-latest + # Workaround to avoid intermittent failures on `opensuse-tumbleweed`: + # => SCP did not finish successfully (255): (Net::SCP::Error) + transport: + max_ssh_sessions: 1 + + ## SALT `3003.4` + - name: debian-10-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:debian-10 + run_command: /lib/systemd/systemd + - name: debian-9-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:debian-9 + run_command: /lib/systemd/systemd + - name: ubuntu-2004-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:ubuntu-20.04 + run_command: /lib/systemd/systemd + - name: ubuntu-1804-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:ubuntu-18.04 + run_command: /lib/systemd/systemd + - name: centos-stream8-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:centos-stream8 + - name: centos-7-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:centos-7 + - name: amazonlinux-2-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:amazonlinux-2 + - name: oraclelinux-8-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:oraclelinux-8 + - name: oraclelinux-7-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:oraclelinux-7 + - name: almalinux-8-3003-4-py3 + driver: + image: saltimages/salt-3003.4-py3:almalinux-8 + +verifier: + # https://www.inspec.io/ + name: inspec + sudo: true + reporter: + # cli, documentation, html, progress, json, json-min, json-rspec, junit + - cli + +suites: + - name: default + provisioner: + state_top: + base: + '*': + - moosefs._mapdata + - moosefs + verifier: + inspec_tests: + - path: test/integration/default diff --git a/moosefs/_mapdata/_mapdata.jinja b/moosefs/_mapdata/_mapdata.jinja new file mode 100644 index 0000000..aa9649c --- /dev/null +++ b/moosefs/_mapdata/_mapdata.jinja @@ -0,0 +1,13 @@ +# yamllint disable rule:indentation rule:line-length +# {{ grains.get("osfinger", grains.os) }} +--- +{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #} +{{ salt["slsutil.serialize"]( + "yaml", + map, + default_flow_style=False, + allow_unicode=True, + ) + | regex_replace("^\s+'$", "'", multiline=True) + | trim +}} diff --git a/moosefs/_mapdata/init.sls b/moosefs/_mapdata/init.sls new file mode 100644 index 0000000..4868e61 --- /dev/null +++ b/moosefs/_mapdata/init.sls @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +--- +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split("/")[0] %} +{%- from tplroot ~ "/libs/map.jinja" import mapdata with context %} + +{%- set _mapdata = { + "values": mapdata, + } %} +{%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %} + +{%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %} +{%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %} + +{{ tplroot }}-mapdata-dump: + file.managed: + - name: {{ output_file }} + - source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja + - template: jinja + - context: + map: {{ _mapdata | yaml }} diff --git a/pillar.example b/pillar.example index 2577076..da4e02d 100644 --- a/pillar.example +++ b/pillar.example @@ -1,89 +1,6 @@ -mfsmetalogger_config: - MASTER_HOST: "mfsmaster" - MASTER_PORT: 9419 - MASTER_TIMEOUT: 60 - WORKING_USER: "mfs" - WORKING_GROUP: "mfs" - SYSLOG_IDENT: "mfsmetalogger" - LOCK_MEMORY: 0 - NICE_LEVEL: -19 - DATA_PATH: "/var/lib/mfs" - BACK_LOGS: 50 - BACK_META_KEEP_PREVIOUS: 3 - META_DOWNLOAD_FREQ: 24 - MASTER_RECONNECTION_DELAY: 5 -mfsmaster_config: - WORKING_USER: "mfs" - WORKING_GROUP: "mfs" - SYSLOG_IDENT: "mfsmaster" - LOCK_MEMORY: 0 - NICE_LEVEL: -19 - EXPORTS_FILENAME: "/etc/moosefs/mfs/mfsexports.cfg" - TOPOLOGY_FILENAME: "/etc/moosefs/mfs/mfstopology.cfg" - DATA_PATH: "/var/lib/mfs" - BACK_LOGS: 50 - BACK_META_KEEP_PREVIOUS: 1 - REPLICATIONS_DELAY_INIT: 300 - REPLICATIONS_DELAY_DISCONNECT: 3600 - MATOML_LISTEN_HOST: "*" - MATOML_LISTEN_PORT: 9419 - MATOML_LOG_PRESERVE_SECONDS: 600 - MATOCS_LISTEN_HOST: "*" - MATOCS_LISTEN_PORT: 9420 - MATOCL_LISTEN_HOST: "*" - MATOCL_LISTEN_PORT: 9421 - CHUNKS_LOOP_MAX_CPS: 100000 - CHUNKS_LOOP_MIN_TIME: 300 - CHUNKS_SOFT_DEL_LIMIT: 10 - CHUNKS_HARD_DEL_LIMIT: 25 - CHUNKS_WRITE_REP_LIMIT: 2 - CHUNKS_READ_REP_LIMIT: 10 - ACCEPTABLE_DIFFERENCE: 0.1 - SESSION_SUSTAIN_TIME: 86400 - REJECT_OLD_CLIENTS: 0 -mfstopology_config: | - 192.168.1.0/24 1 -mfsexports_config: | - * / rw,alldirs,maproot=0 - * . rw -mfschunkserver_config: - MASTER_HOST: "mfsmaster" - HDD_CONF_FILENAME: "/etc/moosefs/mfs/mfshdd.cfg" - WORKING_USER: "mfs" - WORKING_GROUP: "mfs" - SYSLOG_IDENT: "mfschunkserver" - LOCK_MEMORY: 0 - NICE_LEVEL: -19 - DATA_PATH: "/var/lib/mfs" - MASTER_RECONNECTION_DELAY: 5 - BIND_HOST: "*" - MASTER_PORT: 9420 - MASTER_TIMEOUT: 60 - CSSERV_LISTEN_HOST: "*" - CSSERV_LISTEN_PORT: 9422 - HDD_TEST_FREQ: 10 -mfshdd_config: - - '/mnt/mfschunks1' - - '/mnt/mfschunks2' -mfsmount_config: - mfsmaster: "HOST" - mfsport: 9420 - mfsbind: "*" - mfssubfolder: "/some/folder" - mfspassword: "" - mfsmd5pass: "MD5" - mfsdelayedinit: True - mfsdebug: True - mfsmeta: True - mfsdonotrememberpassword: True - mfsmkdircopysgid: 1 - mfssugidclearmode: "NEVER","ALWAYS","OSX","BSD","EXT","XFS" - mfscachemode: "True,YES,ALWAYS","False,NO,NONE,NEVER","AUTO" - mfsattrcacheto: 300 - mfsentrycacheto: 300 - mfsdirentrycacheto: 300 - mfsrlimitnofile: 1 - mfsnice: -19 - mfswritecachesize: 1 - mfsioretries: 2 - mount_point: [ '/mnt/moose' , '/media/test' ] +# -*- coding: utf-8 -*- +# vim: ft=yaml +# +# A simple example where every components are installed on the same machine +--- +... diff --git a/pre-commit_semantic-release.sh b/pre-commit_semantic-release.sh new file mode 100755 index 0000000..80f46e2 --- /dev/null +++ b/pre-commit_semantic-release.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +############################################################################### +# (A) Update `FORMULA` with `${nextRelease.version}` +############################################################################### +sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA + + +############################################################################### +# (B) Use `m2r2` to convert automatically produced `.md` docs to `.rst` +############################################################################### + +# Install `m2r2` +pip3 install m2r2 + +# Copy and then convert the `.md` docs +cp ./*.md docs/ +cd docs/ || exit +m2r2 --overwrite ./*.md + +# Change excess `H1` headings to `H2` in converted `CHANGELOG.rst` +sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst +sed -i -e '1,4s/-/=/g' CHANGELOG.rst + +# Use for debugging output, when required +# cat AUTHORS.rst +# cat CHANGELOG.rst + +# Return back to the main directory +cd .. diff --git a/release-rules.js b/release-rules.js new file mode 100644 index 0000000..c63c850 --- /dev/null +++ b/release-rules.js @@ -0,0 +1,18 @@ +// No release is triggered for the types commented out below. +// Commits using these types will be incorporated into the next release. +// +// NOTE: Any changes here must be reflected in `CONTRIBUTING.md`. +module.exports = [ + {breaking: true, release: 'major'}, + // {type: 'build', release: 'patch'}, + // {type: 'chore', release: 'patch'}, + // {type: 'ci', release: 'patch'}, + {type: 'docs', release: 'patch'}, + {type: 'feat', release: 'minor'}, + {type: 'fix', release: 'patch'}, + {type: 'perf', release: 'patch'}, + {type: 'refactor', release: 'patch'}, + {type: 'revert', release: 'patch'}, + {type: 'style', release: 'patch'}, + {type: 'test', release: 'patch'}, +]; diff --git a/release.config.js b/release.config.js new file mode 100644 index 0000000..076cbd0 --- /dev/null +++ b/release.config.js @@ -0,0 +1,107 @@ +module.exports = { + branch: 'master', + repositoryUrl: 'https://github.com/saltstack-formulas/moosefs-formula', + plugins: [ + ['@semantic-release/commit-analyzer', { + preset: 'angular', + releaseRules: './release-rules.js', + }], + '@semantic-release/release-notes-generator', + ['@semantic-release/changelog', { + changelogFile: 'CHANGELOG.md', + changelogTitle: '# Changelog', + }], + ['@semantic-release/exec', { + prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}', + }], + ['@semantic-release/git', { + assets: ['*.md', 'docs/*.rst', 'FORMULA'], + }], + '@semantic-release/github', + ], + generateNotes: { + preset: 'angular', + writerOpts: { + // Required due to upstream bug preventing all types being displayed. + // Bug: https://github.com/conventional-changelog/conventional-changelog/issues/317 + // Fix: https://github.com/conventional-changelog/conventional-changelog/pull/410 + transform: (commit, context) => { + const issues = [] + + commit.notes.forEach(note => { + note.title = `BREAKING CHANGES` + }) + + // NOTE: Any changes here must be reflected in `CONTRIBUTING.md`. + if (commit.type === `feat`) { + commit.type = `Features` + } else if (commit.type === `fix`) { + commit.type = `Bug Fixes` + } else if (commit.type === `perf`) { + commit.type = `Performance Improvements` + } else if (commit.type === `revert`) { + commit.type = `Reverts` + } else if (commit.type === `docs`) { + commit.type = `Documentation` + } else if (commit.type === `style`) { + commit.type = `Styles` + } else if (commit.type === `refactor`) { + commit.type = `Code Refactoring` + } else if (commit.type === `test`) { + commit.type = `Tests` + } else if (commit.type === `build`) { + commit.type = `Build System` + // } else if (commit.type === `chore`) { + // commit.type = `Maintenance` + } else if (commit.type === `ci`) { + commit.type = `Continuous Integration` + } else { + return + } + + if (commit.scope === `*`) { + commit.scope = `` + } + + if (typeof commit.hash === `string`) { + commit.shortHash = commit.hash.substring(0, 7) + } + + if (typeof commit.subject === `string`) { + let url = context.repository + ? `${context.host}/${context.owner}/${context.repository}` + : context.repoUrl + if (url) { + url = `${url}/issues/` + // Issue URLs. + commit.subject = commit.subject.replace(/#([0-9]+)/g, (_, issue) => { + issues.push(issue) + return `[#${issue}](${url}${issue})` + }) + } + if (context.host) { + // User URLs. + commit.subject = commit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => { + if (username.includes('/')) { + return `@${username}` + } + + return `[@${username}](${context.host}/${username})` + }) + } + } + + // remove references that already appear in the subject + commit.references = commit.references.filter(reference => { + if (issues.indexOf(reference.issue) === -1) { + return true + } + + return false + }) + + return commit + }, + }, + }, +}; From 9504adc302850e320a51f18057b3602a981016e8 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Mon, 30 Jan 2023 11:52:02 +0100 Subject: [PATCH 02/24] test(pillar): add testing pillars --- test/salt/pillar/default.sls | 52 ++++++++++++++++++++++++++++++++++++ test/salt/pillar/top.sls | 7 +++++ 2 files changed, 59 insertions(+) create mode 100644 test/salt/pillar/default.sls create mode 100644 test/salt/pillar/top.sls diff --git a/test/salt/pillar/default.sls b/test/salt/pillar/default.sls new file mode 100644 index 0000000..a56c4fd --- /dev/null +++ b/test/salt/pillar/default.sls @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +moosefs: + master: + enabled: true + service: + enabled: true + + config: + # Enfore chunkserver authentication + auth_code: yYyzqzZw5PvZ74pQAd8M1Uqa7PWGznlycVGTEzHDGG + + metalogger: + enabled: true + service: + enabled: true + + config: + master_host: {{ salt["grains.get"]("id") }} + + chunkserver: + enabled: true + service: + enabled: true + + config: + # Enfore chunkserver authentication + auth_code: yYyzqzZw5PvZ74pQAd8M1Uqa7PWGznlycVGTEzHDGG + + hdds: + /srv/moosefs-storage: {} + + master_host: {{ salt["grains.get"]("id") }} + + cgiserv: + enabled: true + service: + enabled: false + + cli: + enabled: true + + client: + enabled: true + config: + mounts: + "/mnt": + device: "127.0.0.1:/" + user: man + group: nogroup +... diff --git a/test/salt/pillar/top.sls b/test/salt/pillar/top.sls new file mode 100644 index 0000000..3311974 --- /dev/null +++ b/test/salt/pillar/top.sls @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +base: + '*': + - default +... From cdf3c3e88ebc0369ccd539928ed1cf45bba0cd89 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Mon, 30 Jan 2023 11:52:30 +0100 Subject: [PATCH 03/24] test(inspec): verify `libs/map.jinja` Force hostname that will be used in generated configuration files. --- kitchen.yml | 2 + test/integration/default/README.md | 50 +++++ test/integration/default/controls/_mapdata.rb | 47 ++++ .../default/files/_mapdata/debian-11.yaml | 200 ++++++++++++++++++ .../default/files/_mapdata/ubuntu-22.yaml | 200 ++++++++++++++++++ test/integration/default/inspec.yml | 15 ++ test/integration/share/README.md | 22 ++ test/integration/share/inspec.yml | 25 +++ test/integration/share/libraries/system.rb | 138 ++++++++++++ 9 files changed, 699 insertions(+) create mode 100644 test/integration/default/README.md create mode 100644 test/integration/default/controls/_mapdata.rb create mode 100644 test/integration/default/files/_mapdata/debian-11.yaml create mode 100644 test/integration/default/files/_mapdata/ubuntu-22.yaml create mode 100644 test/integration/default/inspec.yml create mode 100644 test/integration/share/README.md create mode 100644 test/integration/share/inspec.yml create mode 100644 test/integration/share/libraries/system.rb diff --git a/kitchen.yml b/kitchen.yml index 9c2a94a..495c6b9 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -270,6 +270,8 @@ verifier: suites: - name: default + driver: + hostname: moosefs.example.net provisioner: state_top: base: diff --git a/test/integration/default/README.md b/test/integration/default/README.md new file mode 100644 index 0000000..37cf963 --- /dev/null +++ b/test/integration/default/README.md @@ -0,0 +1,50 @@ +# InSpec Profile: `default` + +This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +## Verify a profile + +InSpec ships with built-in features to verify a profile structure. + +```bash +$ inspec check default +Summary +------- +Location: default +Profile: profile +Controls: 4 +Timestamp: 2019-06-24T23:09:01+00:00 +Valid: true + +Errors +------ + +Warnings +-------- +``` + +## Execute a profile + +To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. + +```bash +$ inspec exec default +.. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +8 examples, 0 failures +``` + +## Execute a specific control from a profile + +To run one control from the profile use `inspec exec /path/to/profile --controls name`. + +```bash +$ inspec exec default --controls package +. + +Finished in 0.0025 seconds (files took 0.12449 seconds to load) +1 examples, 0 failures +``` + +See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). diff --git a/test/integration/default/controls/_mapdata.rb b/test/integration/default/controls/_mapdata.rb new file mode 100644 index 0000000..113100a --- /dev/null +++ b/test/integration/default/controls/_mapdata.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +require 'yaml' + +control 'moosefs._mapdata' do + title '`map.jinja` should match the reference file' + + ### Method + # The steps below for each file appear convoluted but they are both required + # and similar in nature: + # 1. The earliest method was to simply compare the files textually but this often + # led to false positives due to inconsistencies (e.g. spacing, ordering) + # 2. The next method was to load the files back into YAML structures and then + # compare but InSpec provided block diffs this way, unusable by end users + # 3. The final step was to dump the YAML structures back into a string to use + # for the comparison; this both worked and provided human-friendly diffs + + ### Comparison file for the specific platform + ### Static, adjusted as part of code contributions, as map data is changed + # Strip the `platform[:finger]` version number down to the "OS major release" + platform_finger = system.platform[:finger].split('.').first.to_s + # Use that to set the path to the file (relative to the InSpec suite directory) + mapdata_file_path = "_mapdata/#{platform_finger}.yaml" + # Load the mapdata from profile, into a YAML structure + # https://docs.chef.io/inspec/profiles/#profile-files + mapdata_file_yaml = YAML.load(inspec.profile.file(mapdata_file_path)) + # Dump the YAML back into a string for comparison + mapdata_file_dump = YAML.dump(mapdata_file_yaml) + + ### Output file produced by running the `_mapdata` state + ### Dynamic, generated during Kitchen's `converge` phase + # Derive the location of the dumped mapdata (differs for Windows) + output_dir = platform[:family] == 'windows' ? '/temp' : '/tmp' + # Use that to set the path to the file (absolute path, i.e. within the container) + output_file_path = "#{output_dir}/salt_mapdata_dump.yaml" + # Load the output into a YAML structure using InSpec's `yaml` resource + # https://github.com/inspec/inspec/blob/49b7d10/lib/inspec/resources/yaml.rb#L29 + output_file_yaml = yaml(output_file_path).params + # Dump the YAML back into a string for comparison + output_file_dump = YAML.dump(output_file_yaml) + + describe 'File content' do + it 'should match profile map data exactly' do + expect(output_file_dump).to eq(mapdata_file_dump) + end + end +end diff --git a/test/integration/default/files/_mapdata/debian-11.yaml b/test/integration/default/files/_mapdata/debian-11.yaml new file mode 100644 index 0000000..b1c96be --- /dev/null +++ b/test/integration/default/files/_mapdata/debian-11.yaml @@ -0,0 +1,200 @@ +# yamllint disable rule:indentation rule:line-length +# Debian-11 +--- +values: + cgi: + enabled: false + pkg: + name: moosefs-cgi + cgiserv: + default: + bind_host: localhost + bind_port: '9425' + daemon_opts: null + mfscgiserv_group: nogroup + mfscgiserv_user: nobody + root_path: /usr/share/moosefs-cgi + enabled: true + files: + moosefs-cgiserv: /etc/default/moosefs-cgiserv + pkg: + name: moosefs-cgiserv + service: + enabled: false + name: moosefs-cgiserv + chunkserver: + auth_code: yYyzqzZw5PvZ74pQAd8M1Uqa7PWGznlycVGTEzHDGG + default: + allow_starting_with_invalid_disks: '0' + auth_code: mfspassword + bind_host: '*' + chunks_per_register_packet: '10000' + csserv_listen_host: '*' + csserv_listen_port: '9422' + data_path: /var/lib/mfs + disable_oom_killer: '1' + file_umask: '027' + hdd_conf_filename: /etc/mfs/mfshdd.cfg + hdd_error_tolerance_count: '2' + hdd_error_tolerance_period: '600' + hdd_fadvise_min_time: '86400' + hdd_fsync_before_close: '0' + hdd_high_speed_rebalance_limit: '0' + hdd_keep_duplicates_hours: '168' + hdd_leave_space_default: 256MiB + hdd_min_test_interval: '86400' + hdd_rebalance_utilization: '20' + hdd_rr_chunk_count: '10000' + hdd_sparsify_on_write: '1' + hdd_test_speed: '1.0' + labels: '' + limit_glibc_malloc_arenas: '4' + lock_memory: '0' + master_host: mfsmaster + master_port: '9420' + master_reconnection_delay: '5' + master_timeout: '0' + nice_level: '-19' + syslog_ident: mfschunkserver + workers_max: '250' + workers_max_idle: '40' + working_group: mfs + working_user: mfs + enabled: true + files: + mfschunkserver: /etc/mfs/mfschunkserver.cfg + mfshdd: /etc/mfs/mfshdd.cfg + hdds: + /srv/moosefs-storage: {} + master_host: moosefs.example.net + pkg: + name: moosefs-chunkserver + service: + enabled: true + name: moosefs-chunkserver + cli: + enabled: true + pkg: + name: moosefs-cli + client: + enabled: true + mounts: + /mnt: + device: 127.0.0.1:/ + group: nogroup + user: man + pkg: + name: moosefs-client + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@moosefs:lookup + - C@moosefs + - Y:G@id + master: + auth_code: yYyzqzZw5PvZ74pQAd8M1Uqa7PWGznlycVGTEzHDGG + default: + acceptable_percentage_difference: '1.0' + atime_mode: '0' + auth_code: mfspassword + back_logs: '50' + back_meta_keep_previous: '1' + changelog_preserve_seconds: '1800' + changelog_save_mode: '0' + chunks_hard_del_limit: '25' + chunks_loop_max_cps: '100000' + chunks_loop_min_time: '300' + chunks_read_rep_limit: 10,5,2,5 + chunks_soft_del_limit: '10' + chunks_unique_mode: '0' + chunks_write_rep_limit: 2,1,1,4 + creations_respect_topology: '0' + cs_days_to_remove_unused: '7' + cs_heavy_load_grace_period: '900' + cs_heavy_load_ratio_threshold: '3.0' + cs_heavy_load_threshold: '150' + cs_maintenance_mode_timeout: '0' + cs_temp_maintenance_mode_timeout: '1800' + data_path: /var/lib/mfs + disable_oom_killer: '1' + exports_filename: /etc/mfs/mfsexports.cfg + file_umask: '027' + inode_reuse_delay: '86400' + limit_glibc_malloc_arenas: '4' + lock_memory: '0' + matocl_listen_host: '*' + matocl_listen_port: '9421' + matocs_listen_host: '*' + matocs_listen_port: '9420' + matocs_timeout: '10' + matoml_listen_host: '*' + matoml_listen_port: '9419' + max_allowed_hard_links: '32767' + metadata_save_freq: '1' + missing_log_capacity: '100000' + nice_level: '-19' + priority_queues_length: '1000000' + quota_default_grace_period: '604800' + remap_bits: '24' + remap_destination_ip_class: 10.0.0.0 + remap_source_ip_class: 192.168.1.0 + replications_delay_init: '60' + replications_respect_topology: '0' + reserve_space: '0' + session_sustain_time: '86400' + syslog_ident: mfsmaster + topology_filename: /etc/mfs/mfstopology.cfg + working_group: mfs + working_user: mfs + enabled: true + exports: + /: + allow: 127.0.0.1 + comment: Access of the Mfs root + options: rw,maproot=0 + files: + metadata: /var/lib/mfs/metadata.mfs + mfsexports: /etc/mfs/mfsexports.cfg + mfsmaster: /etc/mfs/mfsmaster.cfg + mfstopology: /etc/mfs/mfstopology.cfg + moosefs-master-default: /etc/default/moosefs-master + pkg: + name: moosefs-master + service: + enabled: true + name: moosefs-master + metalogger: + default: + back_logs: '50' + back_meta_keep_previous: '3' + bind_host: '*' + data_path: /var/lib/mfs + disable_oom_killer: '1' + file_umask: '027' + limit_glibc_malloc_arenas: '4' + lock_memory: '0' + master_host: mfsmaster + master_port: '9419' + master_reconnection_delay: '5' + master_timeout: '10' + meta_download_freq: '24' + nice_level: '-19' + syslog_ident: mfsmetalogger + working_group: mfs + working_user: mfs + enabled: true + files: + mfsmetalogger: /etc/mfs/mfsmetalogger.cfg + master_host: moosefs.example.net + pkg: + name: moosefs-metalogger + service: + enabled: true + name: moosefs-metalogger + netdump: + enabled: false + pkg: + name: moosefs-netdump diff --git a/test/integration/default/files/_mapdata/ubuntu-22.yaml b/test/integration/default/files/_mapdata/ubuntu-22.yaml new file mode 100644 index 0000000..11311e9 --- /dev/null +++ b/test/integration/default/files/_mapdata/ubuntu-22.yaml @@ -0,0 +1,200 @@ +# yamllint disable rule:indentation rule:line-length +# Ubuntu-22 +--- +values: + cgi: + enabled: false + pkg: + name: moosefs-cgi + cgiserv: + default: + bind_host: localhost + bind_port: '9425' + daemon_opts: null + mfscgiserv_group: nogroup + mfscgiserv_user: nobody + root_path: /usr/share/moosefs-cgi + enabled: true + files: + moosefs-cgiserv: /etc/default/moosefs-cgiserv + pkg: + name: moosefs-cgiserv + service: + enabled: false + name: moosefs-cgiserv + chunkserver: + auth_code: yYyzqzZw5PvZ74pQAd8M1Uqa7PWGznlycVGTEzHDGG + default: + allow_starting_with_invalid_disks: '0' + auth_code: mfspassword + bind_host: '*' + chunks_per_register_packet: '10000' + csserv_listen_host: '*' + csserv_listen_port: '9422' + data_path: /var/lib/mfs + disable_oom_killer: '1' + file_umask: '027' + hdd_conf_filename: /etc/mfs/mfshdd.cfg + hdd_error_tolerance_count: '2' + hdd_error_tolerance_period: '600' + hdd_fadvise_min_time: '86400' + hdd_fsync_before_close: '0' + hdd_high_speed_rebalance_limit: '0' + hdd_keep_duplicates_hours: '168' + hdd_leave_space_default: 256MiB + hdd_min_test_interval: '86400' + hdd_rebalance_utilization: '20' + hdd_rr_chunk_count: '10000' + hdd_sparsify_on_write: '1' + hdd_test_speed: '1.0' + labels: '' + limit_glibc_malloc_arenas: '4' + lock_memory: '0' + master_host: mfsmaster + master_port: '9420' + master_reconnection_delay: '5' + master_timeout: '0' + nice_level: '-19' + syslog_ident: mfschunkserver + workers_max: '250' + workers_max_idle: '40' + working_group: mfs + working_user: mfs + enabled: true + files: + mfschunkserver: /etc/mfs/mfschunkserver.cfg + mfshdd: /etc/mfs/mfshdd.cfg + hdds: + /srv/moosefs-storage: {} + master_host: moosefs.example.net + pkg: + name: moosefs-chunkserver + service: + enabled: true + name: moosefs-chunkserver + cli: + enabled: true + pkg: + name: moosefs-cli + client: + enabled: true + mounts: + /mnt: + device: 127.0.0.1:/ + group: nogroup + user: man + pkg: + name: moosefs-client + map_jinja: + sources: + - Y:G@osarch + - Y:G@os_family + - Y:G@os + - Y:G@osfinger + - C@moosefs:lookup + - C@moosefs + - Y:G@id + master: + auth_code: yYyzqzZw5PvZ74pQAd8M1Uqa7PWGznlycVGTEzHDGG + default: + acceptable_percentage_difference: '1.0' + atime_mode: '0' + auth_code: mfspassword + back_logs: '50' + back_meta_keep_previous: '1' + changelog_preserve_seconds: '1800' + changelog_save_mode: '0' + chunks_hard_del_limit: '25' + chunks_loop_max_cps: '100000' + chunks_loop_min_time: '300' + chunks_read_rep_limit: 10,5,2,5 + chunks_soft_del_limit: '10' + chunks_unique_mode: '0' + chunks_write_rep_limit: 2,1,1,4 + creations_respect_topology: '0' + cs_days_to_remove_unused: '7' + cs_heavy_load_grace_period: '900' + cs_heavy_load_ratio_threshold: '3.0' + cs_heavy_load_threshold: '150' + cs_maintenance_mode_timeout: '0' + cs_temp_maintenance_mode_timeout: '1800' + data_path: /var/lib/mfs + disable_oom_killer: '1' + exports_filename: /etc/mfs/mfsexports.cfg + file_umask: '027' + inode_reuse_delay: '86400' + limit_glibc_malloc_arenas: '4' + lock_memory: '0' + matocl_listen_host: '*' + matocl_listen_port: '9421' + matocs_listen_host: '*' + matocs_listen_port: '9420' + matocs_timeout: '10' + matoml_listen_host: '*' + matoml_listen_port: '9419' + max_allowed_hard_links: '32767' + metadata_save_freq: '1' + missing_log_capacity: '100000' + nice_level: '-19' + priority_queues_length: '1000000' + quota_default_grace_period: '604800' + remap_bits: '24' + remap_destination_ip_class: 10.0.0.0 + remap_source_ip_class: 192.168.1.0 + replications_delay_init: '60' + replications_respect_topology: '0' + reserve_space: '0' + session_sustain_time: '86400' + syslog_ident: mfsmaster + topology_filename: /etc/mfs/mfstopology.cfg + working_group: mfs + working_user: mfs + enabled: true + exports: + /: + allow: 127.0.0.1 + comment: Access of the Mfs root + options: rw,maproot=0 + files: + metadata: /var/lib/mfs/metadata.mfs + mfsexports: /etc/mfs/mfsexports.cfg + mfsmaster: /etc/mfs/mfsmaster.cfg + mfstopology: /etc/mfs/mfstopology.cfg + moosefs-master-default: /etc/default/moosefs-master + pkg: + name: moosefs-master + service: + enabled: true + name: moosefs-master + metalogger: + default: + back_logs: '50' + back_meta_keep_previous: '3' + bind_host: '*' + data_path: /var/lib/mfs + disable_oom_killer: '1' + file_umask: '027' + limit_glibc_malloc_arenas: '4' + lock_memory: '0' + master_host: mfsmaster + master_port: '9419' + master_reconnection_delay: '5' + master_timeout: '10' + meta_download_freq: '24' + nice_level: '-19' + syslog_ident: mfsmetalogger + working_group: mfs + working_user: mfs + enabled: true + files: + mfsmetalogger: /etc/mfs/mfsmetalogger.cfg + master_host: moosefs.example.net + pkg: + name: moosefs-metalogger + service: + enabled: true + name: moosefs-metalogger + netdump: + enabled: false + pkg: + name: moosefs-netdump diff --git a/test/integration/default/inspec.yml b/test/integration/default/inspec.yml new file mode 100644 index 0000000..efc3fd7 --- /dev/null +++ b/test/integration/default/inspec.yml @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: default +title: MooseFS formula +maintainer: SaltStack Formulas +license: Apache-2.0 +# yamllint disable-line rule:line-length +summary: Verify that the MooseFS formula is setup and configured correctly +depends: + - name: share + path: test/integration/share +supports: + - platform-name: debian + - platform-name: ubuntu diff --git a/test/integration/share/README.md b/test/integration/share/README.md new file mode 100644 index 0000000..5c5785b --- /dev/null +++ b/test/integration/share/README.md @@ -0,0 +1,22 @@ +# InSpec Profile: `share` + +This shows the implementation of the `share` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). + +Its goal is to share the libraries between all profiles. + +## Libraries + +### `system` + +The `system` library provides easy access to system dependent information: + +- `system.platform`: based on `inspec.platform`, modify to values that are more consistent from a SaltStack perspective + - `system.platform[:family]` provide a family name for Arch and Gentoo + - `system.platform[:name]` append `linux` to both `amazon` and `oracle`; ensure Windows platforms are resolved as simply `windows` + - `system.platform[:release]` tweak Arch, Amazon Linux, Gentoo, openSUSE and Windows: + - `Arch` is always `base-latest` + - `Amazon Linux` release `2018` is resolved as `1` + - `Gentoo` release is trimmed to its major version number and then the init system is appended (i.e. `sysv` or `sysd`) + - `openSUSE` is resolved as `tumbleweed` if the `platform[:release]` is in date format + - `Windows` uses the widely-used release number (e.g. `8.1` or `2019-server`) in place of the actual system release version + - `system.platform[:finger]` is the concatenation of the name and the major release number (except for Ubuntu, which gives `ubuntu-20.04` for example) diff --git a/test/integration/share/inspec.yml b/test/integration/share/inspec.yml new file mode 100644 index 0000000..28a97b9 --- /dev/null +++ b/test/integration/share/inspec.yml @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +name: share +title: InSpec shared resources +maintainer: SaltStack Formulas +license: Apache-2.0 +summary: shared resources +supports: + - platform-name: debian + - platform-name: ubuntu + - platform-name: centos + - platform-name: fedora + - platform-name: opensuse + - platform-name: suse + - platform-name: freebsd + - platform-name: openbsd + - platform-name: amazon + - platform-name: oracle + - platform-name: arch + - platform-name: gentoo + - platform-name: almalinux + - platform-name: rocky + - platform-name: mac_os_x + - platform: windows diff --git a/test/integration/share/libraries/system.rb b/test/integration/share/libraries/system.rb new file mode 100644 index 0000000..64405bb --- /dev/null +++ b/test/integration/share/libraries/system.rb @@ -0,0 +1,138 @@ +# frozen_string_literal: true + +# system.rb -- InSpec resources for system values +# Author: Daniel Dehennin +# Copyright (C) 2020 Daniel Dehennin + +# rubocop:disable Metrics/ClassLength +class SystemResource < Inspec.resource(1) + name 'system' + + attr_reader :platform + + def initialize + super + @platform = build_platform + end + + private + + def build_platform + { + family: build_platform_family, + name: build_platform_name, + release: build_platform_release, + finger: build_platform_finger, + codename: build_platform_codename + } + end + + def build_platform_family + case inspec.platform[:name] + when 'arch', 'gentoo' + inspec.platform[:name] + else + inspec.platform[:family] + end + end + + def build_platform_name + case inspec.platform[:name] + when 'amazon', 'oracle', 'rocky' + "#{inspec.platform[:name]}linux" + when /^windows_/ + inspec.platform[:family] + else + inspec.platform[:name] + end + end + + # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity + def build_platform_release + case inspec.platform[:name] + when 'amazon' + # `2018` relase is named `1` in `kitchen.yml` + inspec.platform[:release].gsub(/2018.*/, '1') + when 'arch' + 'base-latest' + when 'gentoo' + "#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}" + when 'mac_os_x' + inspec.command('sw_vers -productVersion').stdout.to_s + when 'opensuse' + # rubocop:disable Style/NumericLiterals,Layout/LineLength + inspec.platform[:release].to_i > 20210101 ? 'tumbleweed' : inspec.platform[:release] + # rubocop:enable Style/NumericLiterals,Layout/LineLength + when 'windows_8.1_pro' + '8.1' + when 'windows_server_2022_datacenter' + '2022-server' + when 'windows_server_2019_datacenter' + '2019-server' + when 'windows_server_2016_datacenter' + '2016-server' + else + inspec.platform[:release] + end + end + # rubocop:enable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity + + def derive_gentoo_init_system + inspec.command('systemctl').exist? ? 'sysd' : 'sysv' + end + + def build_platform_finger + "#{build_platform_name}-#{build_finger_release}" + end + + def build_finger_release + case inspec.platform[:name] + when 'ubuntu' + build_platform_release.split('.').slice(0, 2).join('.') + else + build_platform_release.split('.')[0] + end + end + + # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity + def build_platform_codename + case build_platform_finger + when 'ubuntu-22.04' + 'jammy' + when 'ubuntu-20.04' + 'focal' + when 'ubuntu-18.04' + 'bionic' + when 'debian-11' + 'bullseye' + when 'debian-10' + 'buster' + when 'debian-9' + 'stretch' + when 'almalinux-8' + "AlmaLinux #{build_platform_release} (Arctic Sphynx)" + when 'amazonlinux-2' + 'Amazon Linux 2' + when 'arch-base-latest' + 'Arch Linux' + when 'centos-7' + 'CentOS Linux 7 (Core)' + when 'centos-8' + 'CentOS Stream 8' + when 'opensuse-tumbleweed' + 'openSUSE Tumbleweed' + when 'opensuse-15' + "openSUSE Leap #{build_platform_release}" + when 'oraclelinux-8', 'oraclelinux-7' + "Oracle Linux Server #{build_platform_release}" + when 'gentoo-2-sysd', 'gentoo-2-sysv' + 'Gentoo/Linux' + when 'rockylinux-8' + "Rocky Linux #{build_platform_release} (Green Obsidian)" + else + '' + end + end + # rubocop:enable Metrics/MethodLength,Metrics/CyclomaticComplexity +end +# rubocop:enable Metrics/ClassLength From 9078cbd0af263a522650a04d874535fd8568640a Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Mon, 30 Jan 2023 11:52:56 +0100 Subject: [PATCH 04/24] feat(map): update to v5 `map.jinja` The v5 `map.jinja` is a generic and configurable system to load configuration values, exposed as the `mapdata` variable, from different places: - YAML files and templates from the fileserver for non-secret data - pillars or SDB are preferred for secret data - grains or `config.get` The `map.jinja` optional sources are configured with compound targeting like syntax `[[: