diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..8417ee8a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,171 @@ +# -*- 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/openssh-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_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` +############################################################################### +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/openssh-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: + 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}"' + +############################################################################### +# `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` +default-debian-10-master-py3: {extends: '.test_instance'} +default-ubuntu-2004-master-py3: {extends: '.test_instance'} +# default-ubuntu-1804-master-py3: {extends: '.test_instance'} +default-centos-8-master-py3: {extends: '.test_instance'} +default-fedora-32-master-py3: {extends: '.test_instance'} +# default-fedora-31-master-py3: {extends: '.test_instance'} +default-opensuse-leap-152-master-py3: {extends: '.test_instance'} +default-amazonlinux-2-master-py3: {extends: '.test_instance'} +# default-debian-10-3000-3-py3: {extends: '.test_instance'} +# default-debian-9-3000-3-py3: {extends: '.test_instance'} +# default-ubuntu-1804-3000-3-py3: {extends: '.test_instance'} +# default-centos-8-3000-3-py3: {extends: '.test_instance'} +# default-centos-7-3000-3-py3: {extends: '.test_instance'} +# default-fedora-31-3000-3-py3: {extends: '.test_instance'} +# default-opensuse-leap-152-3000-3-py3: {extends: '.test_instance'} +# default-amazonlinux-2-3000-3-py3: {extends: '.test_instance'} +# default-ubuntu-1804-3000-3-py2: {extends: '.test_instance'} +# default-ubuntu-1604-3000-3-py2: {extends: '.test_instance'} +# default-arch-base-latest-3000-3-py2: {extends: '.test_instance'} +# default-debian-10-2019-2-py3: {extends: '.test_instance'} +# default-debian-9-2019-2-py3: {extends: '.test_instance'} +# default-ubuntu-1804-2019-2-py3: {extends: '.test_instance'} +# default-ubuntu-1604-2019-2-py3: {extends: '.test_instance'} +# default-centos-8-2019-2-py3: {extends: '.test_instance'} +# default-centos-7-2019-2-py3: {extends: '.test_instance'} +# default-fedora-31-2019-2-py3: {extends: '.test_instance'} +# default-opensuse-leap-152-2019-2-py3: {extends: '.test_instance'} +# default-amazonlinux-2-2019-2-py3: {extends: '.test_instance'} +# default-centos-6-2019-2-py2: {extends: '.test_instance'} +# default-amazonlinux-1-2019-2-py2: {extends: '.test_instance'} +default-arch-base-latest-2019-2-py2: {extends: '.test_instance'} + +############################################################################### +# `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 00000000..0efdb51a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +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/adithyabsk/mirrors-rubocop + rev: v0.91.0 + hooks: + - id: rubocop + name: Check Ruby files with rubocop + args: [--debug] + always_run: true + pass_filenames: false + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 2.1.3 + hooks: + - id: shellcheck + name: Check shell scripts with shellcheck + files: ^.*\.(sh|bash|ksh)$ + types: [] + args: [] + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.23.0 + 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.3.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' + args: [--report=warning] diff --git a/.rstcheck.cfg b/.rstcheck.cfg new file mode 100644 index 00000000..05856dc7 --- /dev/null +++ b/.rstcheck.cfg @@ -0,0 +1,3 @@ +[rstcheck] +report=error +ignore_language=rst diff --git a/.travis.yml b/.travis.yml index 08c33989..63f6bac3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,15 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- +################################################################################ +# NOTE: This file is UNMAINTAINED; it is provided for references purposes only. +# No guarantees are tendered that this structure will work after 2020. +################################################################################ +# * https://en.wikipedia.org/wiki/Travis_CI: +# - "... free open-source plans were removed in [sic] the end of 2020" +# - https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing +# - https://ropensci.org/technotes/2020/11/19/moving-away-travis/ +################################################################################ ## Machine config os: 'linux' arch: 'amd64' @@ -22,8 +31,10 @@ script: ## Stages and jobs matrix stages: - test - - name: 'release' - if: 'branch = master AND type != pull_request' + # # As part of the switch away from Travis CI, ensure that the `release` stage + # # is not run inadvertently + # - name: 'release' + # if: 'branch = master AND type != pull_request' jobs: include: ## Define the test stage that runs the linters (and testing matrix, if applicable) @@ -55,6 +66,20 @@ jobs: @commitlint/travis-cli - commitlint-travis + # Run `pre-commit` linters in a single job + - language: 'python' + env: 'Lint_pre-commit' + name: 'Lint: pre-commit' + before_install: 'skip' + cache: + directories: + - $HOME/.cache/pre-commit + script: + # Install and run `pre-commit` + - pip install pre-commit==2.7.1 + - pre-commit run --all-files --color always --verbose + - pre-commit run --color always --hook-stage manual --verbose commitlint-travis + ## Define the rest of the matrix based on Kitchen testing # Make sure the instances listed below match up with # the `platforms` defined in `kitchen.yml` diff --git a/.yamllint b/.yamllint index 740beca0..73bcbe2b 100644 --- a/.yamllint +++ b/.yamllint @@ -9,6 +9,7 @@ extends: default # 2. Any SLS files under directory `test/`, which are actually state files # 3. Any YAML files under directory `.kitchen/`, introduced during local testing ignore: | + .cache/ node_modules/ test/**/states/**/*.sls .kitchen/ diff --git a/AUTHORS.md b/AUTHORS.md index b02782aa..e42273ba 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -4,7 +4,7 @@ This list is sorted by the number of commits per contributor in _descending_ ord Avatar|Contributor|Contributions :-:|---|:-: -@myii|[@myii](https://github.com/myii)|76 +@myii|[@myii](https://github.com/myii)|86 @alxwr|[@alxwr](https://github.com/alxwr)|38 @gravyboat|[@gravyboat](https://github.com/gravyboat)|28 @aboe76|[@aboe76](https://github.com/aboe76)|25 @@ -33,6 +33,7 @@ Avatar|Contributor|Contributions @rhertzog|[@rhertzog](https://github.com/rhertzog)|3 @brot|[@brot](https://github.com/brot)|2 @carlosperello|[@carlosperello](https://github.com/carlosperello)|2 +@dafyddj|[@dafyddj](https://github.com/dafyddj)|2 @fpletz|[@fpletz](https://github.com/fpletz)|2 @ingben|[@ingben](https://github.com/ingben)|2 @OrangeDog|[@OrangeDog](https://github.com/OrangeDog)|2 @@ -77,4 +78,4 @@ Avatar|Contributor|Contributions --- -Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2020-09-27. +Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2020-12-22. diff --git a/CHANGELOG.md b/CHANGELOG.md index 749f2178..3bf7526c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## [2.0.5](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.4...v2.0.5) (2020-12-22) + + +### Continuous Integration + +* **commitlint:** ensure `upstream/master` uses main repo URL [skip ci] ([7af3bf2](https://github.com/saltstack-formulas/openssh-formula/commit/7af3bf255df5d636750edb8b3a95c63b032712b4)) +* **gitlab-ci:** add `rubocop` linter (with `allow_failure`) [skip ci] ([37b9f3a](https://github.com/saltstack-formulas/openssh-formula/commit/37b9f3ac09a895b6aad5e796f062c6f3871e697c)) +* **gitlab-ci:** use GitLab CI as Travis CI replacement ([bccd5fd](https://github.com/saltstack-formulas/openssh-formula/commit/bccd5fd3d88ba22d1b9b91018e7eb2a24620138f)) +* **pre-commit:** add to formula [skip ci] ([4e13609](https://github.com/saltstack-formulas/openssh-formula/commit/4e13609b992d5d2e3e2a540e736016fe1f22c7e2)) +* **pre-commit:** enable/disable `rstcheck` as relevant [skip ci] ([094bef5](https://github.com/saltstack-formulas/openssh-formula/commit/094bef540614043947434a00b0a0e8bfe4665f93)) +* **pre-commit:** finalise `rstcheck` configuration [skip ci] ([75e843a](https://github.com/saltstack-formulas/openssh-formula/commit/75e843a7bdabcc64f29bcea7e7ae6ce204bd5397)) + + +### Tests + +* **map:** standardise `map.jinja` verification ([2bab68f](https://github.com/saltstack-formulas/openssh-formula/commit/2bab68f5ff5485c9b43712bd2dd17f447ed787f4)) + ## [2.0.4](https://github.com/saltstack-formulas/openssh-formula/compare/v2.0.3...v2.0.4) (2020-09-27) diff --git a/CODEOWNERS b/CODEOWNERS index 6ee138f0..91d61559 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -14,16 +14,23 @@ # 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 -/openssh/libsaltcli.jinja @saltstack-formulas/ssf -/openssh/libtofs.jinja @saltstack-formulas/ssf +/*/_mapdata/ @saltstack-formulas/ssf +/*/libsaltcli.jinja @saltstack-formulas/ssf +/*/libtofs.jinja @saltstack-formulas/ssf +/test/integration/**/_mapdata_spec.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 /.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 diff --git a/FORMULA b/FORMULA index 1fb53778..c71f764f 100644 --- a/FORMULA +++ b/FORMULA @@ -1,7 +1,7 @@ name: openssh os: Debian, Ubuntu, Raspbian, RedHat, Fedora, CentOS, Suse, openSUSE, Gentoo, Funtoo, Arch, Manjaro, Alpine, FreeBSD, OpenBSD, Solaris, SmartOS, Windows, MacOS os_family: Debian, RedHat, Suse, Gentoo, Arch, Alpine, FreeBSD, OpenBSD, Solaris, Windows, MacOS -version: 2.0.4 +version: 2.0.5 release: 1 minimum_version: 2017.7 summary: openssh formula diff --git a/Gemfile b/Gemfile index 414db6dd..900e5cf4 100644 --- a/Gemfile +++ b/Gemfile @@ -2,9 +2,14 @@ source 'https://rubygems.org' -gem 'kitchen-docker', '>= 2.9' -gem 'kitchen-inspec', '>= 1.1' -gem 'kitchen-salt', '>= 0.6.0' +# Use the latest version of `inspec` prior to `4.23.4`, which introduces a +# regression where the diff isn't displayed when comparing using `eq`. +gem 'inspec', '~> 4.22.22' +# Install the `kitchen-docker` gem from GitHub because the latest version +# currently available (`2.10.0`) doesn't include a recent fix for Gentoo. +gem 'kitchen-docker', github: 'test-kitchen/kitchen-docker', ref: '41e80fe' +gem 'kitchen-inspec', '>= 2.2.1' +gem 'kitchen-salt', '>= 0.6.3' group :vagrant do gem 'kitchen-vagrant' diff --git a/Gemfile.lock b/Gemfile.lock index de60746c..75baeadb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,15 @@ +GIT + remote: https://github.com/test-kitchen/kitchen-docker.git + revision: 41e80fed3a7cc86323e19c16a5a340cebf7e5848 + ref: 41e80fe + specs: + kitchen-docker (2.10.0) + test-kitchen (>= 1.0.0) + GEM remote: https://rubygems.org/ specs: - activesupport (5.2.4.3) + activesupport (5.2.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -9,186 +17,189 @@ GEM addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) aws-eventstream (1.1.0) - aws-partitions (1.338.0) - aws-sdk-apigateway (1.48.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-partitions (1.386.0) + aws-sdk-apigateway (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-apigatewayv2 (1.23.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-apigatewayv2 (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-athena (1.30.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-athena (1.33.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) aws-sdk-autoscaling (1.22.0) aws-sdk-core (~> 3, >= 3.52.1) aws-sigv4 (~> 1.1) - aws-sdk-budgets (1.32.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-budgets (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudformation (1.41.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudformation (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudfront (1.33.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudfront (1.46.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudhsm (1.24.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudhsm (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudhsmv2 (1.26.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudhsmv2 (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudtrail (1.26.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudtrail (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudwatch (1.41.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudwatch (1.45.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-cloudwatchlogs (1.34.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-cloudwatchlogs (1.38.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-codecommit (1.37.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-codecommit (1.40.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-codedeploy (1.34.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-codedeploy (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-codepipeline (1.34.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-codepipeline (1.37.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-configservice (1.48.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-configservice (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-core (3.103.0) + aws-sdk-core (3.109.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-costandusagereportservice (1.24.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-costandusagereportservice (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) + aws-sigv4 (~> 1.1) + aws-sdk-dynamodb (1.55.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-dynamodb (1.51.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ec2 (1.202.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ec2 (1.174.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ecr (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ecr (1.34.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ecs (1.70.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ecs (1.67.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-efs (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-efs (1.32.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-eks (1.45.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-eks (1.39.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticache (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticache (1.40.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticbeanstalk (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticbeanstalk (1.34.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticloadbalancing (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticloadbalancing (1.25.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticloadbalancingv2 (1.53.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticloadbalancingv2 (1.47.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-elasticsearchservice (1.43.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-elasticsearchservice (1.39.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-firehose (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-firehose (1.31.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-guardduty (1.42.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-iam (1.43.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-iam (1.46.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-kafka (1.23.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-kafka (1.29.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-kinesis (1.26.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-kinesis (1.30.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-kms (1.36.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-kms (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-lambda (1.46.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-lambda (1.51.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) aws-sdk-organizations (1.17.0) aws-sdk-core (~> 3, >= 3.39.0) aws-sigv4 (~> 1.0) - aws-sdk-rds (1.92.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-rds (1.104.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-redshift (1.46.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-redshift (1.50.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-route53 (1.40.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-route53 (1.44.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-route53domains (1.25.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-route53domains (1.28.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-route53resolver (1.17.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-route53resolver (1.21.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.73.0) - aws-sdk-core (~> 3, >= 3.102.1) + aws-sdk-s3 (1.83.1) + aws-sdk-core (~> 3, >= 3.109.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sdk-securityhub (1.29.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-securityhub (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ses (1.33.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ses (1.36.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-sms (1.23.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-sms (1.27.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-sns (1.27.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-sns (1.34.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-sqs (1.30.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-sqs (1.34.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-ssm (1.84.0) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-ssm (1.95.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.1) + aws-sigv4 (1.2.2) aws-eventstream (~> 1, >= 1.0.2) azure_graph_rbac (0.17.2) ms_rest_azure (~> 0.12.0) azure_mgmt_key_vault (0.17.6) ms_rest_azure (~> 0.12.0) - azure_mgmt_resources (0.17.9) + azure_mgmt_resources (0.18.0) ms_rest_azure (~> 0.12.0) azure_mgmt_security (0.18.2) ms_rest_azure (~> 0.12.0) - azure_mgmt_storage (0.21.2) + azure_mgmt_storage (0.22.0) ms_rest_azure (~> 0.12.0) bcrypt_pbkdf (1.0.1) builder (3.2.4) - chef-config (16.2.73) + chef-config (16.6.14) addressable - chef-utils (= 16.2.73) + chef-utils (= 16.6.14) fuzzyurl mixlib-config (>= 2.2.12, < 4.0) mixlib-shellout (>= 2.0, < 4.0) tomlrb (~> 1.2) - chef-telemetry (1.0.8) + chef-telemetry (1.0.14) chef-config concurrent-ruby (~> 1.0) ffi-yajl (~> 2.2) - chef-utils (16.2.73) + chef-utils (16.6.14) coderay (1.1.3) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.7) declarative (0.0.20) declarative-option (0.1.0) diff-lcs (1.4.4) - docker-api (1.34.2) + docker-api (2.0.0) excon (>= 0.47.0) multi_json domain_name (0.5.20190701) @@ -196,21 +207,20 @@ GEM ecma-re-validator (0.2.1) regexp_parser (~> 1.2) ed25519 (1.2.4) - equatable (0.6.1) erubi (1.9.0) - excon (0.75.0) + excon (0.78.0) faraday (0.17.3) multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) http-cookie (~> 1.0.0) faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) ffi (1.13.1) - ffi-yajl (2.3.3) + ffi-yajl (2.3.4) libyajl2 (~> 1.2) fuzzyurl (0.9.0) - google-api-client (0.34.1) + google-api-client (0.44.0) addressable (~> 2.5, >= 2.5.1) googleauth (~> 0.9) httpclient (>= 2.8.1, < 3.0) @@ -218,40 +228,38 @@ GEM representable (~> 3.0) retriable (>= 2.0, < 4.0) signet (~> 0.12) - googleauth (0.10.0) - faraday (~> 0.12) + googleauth (0.13.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.12) + signet (~> 0.14) gssapi (1.3.0) ffi (>= 1.0.1) gyoku (1.3.1) builder (>= 2.1.2) hana (1.3.6) hashie (3.6.0) - htmlentities (4.3.4) http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.8.3) + i18n (1.8.5) concurrent-ruby (~> 1.0) inifile (3.0.0) - inspec (4.21.3) + inspec (4.22.22) faraday_middleware (~> 0.12.2) - inspec-core (= 4.21.3) + inspec-core (= 4.22.22) train (~> 3.0) train-aws (~> 0.1) train-habitat (~> 0.1) train-winrm (~> 0.2) - inspec-core (4.21.3) + inspec-core (4.22.22) addressable (~> 2.4) chef-telemetry (~> 1.0) faraday (>= 0.9.0) hashie (~> 3.4) - htmlentities (~> 4.3) - json_schemer (~> 0.2.1) + json_schemer (>= 0.2.1, < 0.2.12) license-acceptance (>= 0.2.13, < 2.0) method_source (>= 0.8, < 2.0) mixlib-log (~> 3.0) @@ -264,7 +272,6 @@ GEM rubyzip (~> 1.2, >= 1.2.2) semverse (~> 3.0) sslshake (~> 1.2) - term-ansicolor (~> 1.7) thor (>= 0.20, < 2.0) tomlrb (~> 1.2.0) train-core (~> 3.0) @@ -277,17 +284,15 @@ GEM hana (~> 1.3) regexp_parser (~> 1.5) uri_template (~> 0.7) - jwt (2.2.1) - kitchen-docker (2.10.0) - test-kitchen (>= 1.0.0) - kitchen-inspec (2.0.0) + jwt (2.2.2) + kitchen-inspec (2.2.1) hashie (~> 3.4) inspec (>= 2.2.64, < 5.0) - test-kitchen (>= 1.6, < 3) + test-kitchen (>= 2.7, < 3) kitchen-salt (0.6.3) hashie (>= 3.5) test-kitchen (>= 1.4) - kitchen-vagrant (1.6.1) + kitchen-vagrant (1.7.0) test-kitchen (>= 1.4, < 3) libyajl2 (1.2.0) license-acceptance (1.0.19) @@ -302,15 +307,16 @@ GEM memoist (0.16.2) method_source (1.0.0) mini_mime (1.0.2) - minitest (5.14.1) - mixlib-config (3.0.6) + minitest (5.14.2) + mixlib-config (3.0.9) tomlrb - mixlib-install (3.12.1) + mixlib-install (3.12.3) mixlib-shellout mixlib-versioning thor - mixlib-log (3.0.8) - mixlib-shellout (3.0.9) + mixlib-log (3.0.9) + mixlib-shellout (3.1.6) + chef-utils mixlib-versioning (1.2.12) ms_rest (0.7.6) concurrent-ruby (~> 1.0) @@ -321,26 +327,24 @@ GEM faraday (>= 0.9, < 2.0.0) faraday-cookie_jar (~> 0.0.6) ms_rest (~> 0.7.6) - multi_json (1.14.1) + multi_json (1.15.0) multipart-post (2.1.1) - necromancer (0.5.1) 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) - os (1.1.0) + os (1.1.1) parallel (1.19.2) parslet (1.8.2) - pastel (0.7.4) - equatable (~> 0.6) + pastel (0.8.0) tty-color (~> 0.5) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.5) - regexp_parser (1.7.1) + public_suffix (4.0.6) + regexp_parser (1.8.2) representable (3.0.4) declarative (< 0.1.0) declarative-option (< 0.2.0) @@ -350,9 +354,9 @@ GEM rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) - rspec-core (3.9.2) + rspec-core (3.9.3) rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rspec-expectations (3.9.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-its (1.3.0) @@ -361,7 +365,7 @@ GEM rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-support (3.9.3) + rspec-support (3.9.4) rubyntlm (0.6.2) rubyzip (1.3.0) semverse (3.0.0) @@ -371,18 +375,15 @@ GEM jwt (>= 1.5, < 3.0) multi_json (~> 1.10) sslshake (1.3.1) - strings (0.1.8) - strings-ansi (~> 0.1) + strings (0.2.0) + strings-ansi (~> 0.2) unicode-display_width (~> 1.5) unicode_utils (~> 1.4) strings-ansi (0.2.0) - sync (0.5.0) - term-ansicolor (1.7.1) - tins (~> 1.0) - test-kitchen (2.5.2) + test-kitchen (2.7.2) bcrypt_pbkdf (~> 1.0) ed25519 (~> 1.2) - license-acceptance (~> 1.0, >= 1.0.11) + license-acceptance (>= 1.0.11, < 3.0) mixlib-install (~> 3.6) mixlib-shellout (>= 1.2, < 4.0) net-scp (>= 1.1, < 4.0) @@ -395,23 +396,21 @@ GEM thor (1.0.1) thread_safe (0.3.6) timeliness (0.3.10) - tins (1.25.0) - sync tomlrb (1.2.9) - train (3.3.6) + train (3.3.27) activesupport (>= 5.2.4.3, < 6.0.0) 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) - google-api-client (>= 0.23.9, < 0.35.0) - googleauth (>= 0.6.6, < 0.11.0) + docker-api (>= 1.26, < 3.0) + google-api-client (>= 0.23.9, < 0.44.1) + googleauth (>= 0.6.6, < 0.13.1) inifile (~> 3.0) - train-core (= 3.3.6) + train-core (= 3.3.27) train-winrm (~> 0.2) - train-aws (0.1.17) + train-aws (0.1.18) aws-sdk-apigateway (~> 1.0) aws-sdk-apigatewayv2 (~> 1.0) aws-sdk-athena (~> 1.0) @@ -442,6 +441,7 @@ GEM aws-sdk-elasticloadbalancingv2 (~> 1.0) aws-sdk-elasticsearchservice (~> 1.0) aws-sdk-firehose (~> 1.0) + aws-sdk-guardduty (~> 1.31) aws-sdk-iam (~> 1.13) aws-sdk-kafka (~> 1.0) aws-sdk-kinesis (~> 1.0) @@ -460,7 +460,7 @@ GEM aws-sdk-sns (~> 1.9) aws-sdk-sqs (~> 1.10) aws-sdk-ssm (~> 1.0) - train-core (3.3.6) + train-core (3.3.27) addressable (~> 2.5) ffi (!= 1.13.0) json (>= 1.8, < 3.0) @@ -468,30 +468,28 @@ GEM net-scp (>= 1.2, < 4.0) net-ssh (>= 2.9, < 7.0) train-habitat (0.2.13) - train-winrm (0.2.6) + train-winrm (0.2.11) winrm (~> 2.0) + winrm-elevated (~> 1.2.2) winrm-fs (~> 1.0) - tty-box (0.5.0) - pastel (~> 0.7.2) - strings (~> 0.1.6) + tty-box (0.6.0) + pastel (~> 0.8) + strings (~> 0.2.0) tty-cursor (~> 0.7) - tty-color (0.5.1) + tty-color (0.5.2) tty-cursor (0.7.1) - tty-prompt (0.21.0) - necromancer (~> 0.5.0) - pastel (~> 0.7.0) - tty-reader (~> 0.7.0) - tty-reader (0.7.0) + tty-prompt (0.22.0) + pastel (~> 0.8) + tty-reader (~> 0.8) + tty-reader (0.8.0) tty-cursor (~> 0.7) - tty-screen (~> 0.7) - wisper (~> 2.0.0) - tty-screen (0.8.0) - tty-table (0.11.0) - equatable (~> 0.6) - necromancer (~> 0.5) - pastel (~> 0.7.2) - strings (~> 0.1.5) - tty-screen (~> 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 (1.2.7) thread_safe (~> 0.1) uber (0.1.0) @@ -501,7 +499,7 @@ GEM unicode-display_width (1.7.0) unicode_utils (1.4.0) uri_template (0.7.0) - winrm (2.3.4) + winrm (2.3.5) builder (>= 2.1.2) erubi (~> 1.8) gssapi (~> 1.2) @@ -510,7 +508,7 @@ GEM logging (>= 1.6.1, < 3.0) nori (~> 2.0) rubyntlm (~> 0.6.0, >= 0.6.1) - winrm-elevated (1.2.1) + winrm-elevated (1.2.2) erubi (~> 1.8) winrm (~> 2.0) winrm-fs (~> 1.0) @@ -525,9 +523,10 @@ PLATFORMS ruby DEPENDENCIES - kitchen-docker (>= 2.9) - kitchen-inspec (>= 1.1) - kitchen-salt (>= 0.6.0) + inspec (~> 4.22.22) + kitchen-docker! + kitchen-inspec (>= 2.2.1) + kitchen-salt (>= 0.6.3) kitchen-vagrant BUNDLED WITH diff --git a/bin/install-hooks b/bin/install-hooks new file mode 100755 index 00000000..840bb6c5 --- /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/commitlint.config.js b/commitlint.config.js index 2f9d1aa0..4eb37f40 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,3 +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/docs/AUTHORS.rst b/docs/AUTHORS.rst index 96b3ebe0..04fa9fab 100644 --- a/docs/AUTHORS.rst +++ b/docs/AUTHORS.rst @@ -15,7 +15,7 @@ This list is sorted by the number of commits per contributor in *descending* ord - Contributions * - :raw-html-m2r:`@myii` - `@myii `_ - - 76 + - 86 * - :raw-html-m2r:`@alxwr` - `@alxwr `_ - 38 @@ -100,6 +100,9 @@ This list is sorted by the number of commits per contributor in *descending* ord * - :raw-html-m2r:`@carlosperello` - `@carlosperello `_ - 2 + * - :raw-html-m2r:`@dafyddj` + - `@dafyddj `_ + - 2 * - :raw-html-m2r:`@fpletz` - `@fpletz `_ - 2 @@ -227,4 +230,4 @@ This list is sorted by the number of commits per contributor in *descending* ord ---- -Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2020-09-27. +Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2020-12-22. diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 89674c13..12481c63 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,26 @@ Changelog ========= +`2.0.5 `_ (2020-12-22) +--------------------------------------------------------------------------------------------------------- + +Continuous Integration +^^^^^^^^^^^^^^^^^^^^^^ + + +* **commitlint:** ensure ``upstream/master`` uses main repo URL [skip ci] (\ `7af3bf2 `_\ ) +* **gitlab-ci:** add ``rubocop`` linter (with ``allow_failure``\ ) [skip ci] (\ `37b9f3a `_\ ) +* **gitlab-ci:** use GitLab CI as Travis CI replacement (\ `bccd5fd `_\ ) +* **pre-commit:** add to formula [skip ci] (\ `4e13609 `_\ ) +* **pre-commit:** enable/disable ``rstcheck`` as relevant [skip ci] (\ `094bef5 `_\ ) +* **pre-commit:** finalise ``rstcheck`` configuration [skip ci] (\ `75e843a `_\ ) + +Tests +^^^^^ + + +* **map:** standardise ``map.jinja`` verification (\ `2bab68f `_\ ) + `2.0.4 `_ (2020-09-27) --------------------------------------------------------------------------------------------------------- diff --git a/docs/TOFS_pattern.rst b/docs/TOFS_pattern.rst index 4fea5dda..dd2c17e5 100644 --- a/docs/TOFS_pattern.rst +++ b/docs/TOFS_pattern.rst @@ -64,7 +64,7 @@ Example: NTP before applying TOFS Let's work with the NTP example. A basic formula that follows the `design guidelines `_ has the following files and directories tree: -.. code-block:: +.. code-block:: console /srv/saltstack/salt-formulas/ntp-saltstack-formula/ ntp/ @@ -226,7 +226,7 @@ We can make different templates coexist for different minions, classified by any If we decide that we want ``os_family`` as switch, then we could provide the formula template variants for both the ``RedHat`` and ``Debian`` families. -.. code-block:: +.. code-block:: console /srv/saltstack/salt-formulas/ntp-saltstack-formula/ntp/files/ default/ @@ -449,7 +449,7 @@ Using sub-directories for ``components`` If your formula is composed of several components, you may prefer to provides files under sub-directories, like in the `systemd-formula `_. -.. code-block:: +.. code-block:: console /srv/saltstack/systemd-formula/ systemd/ diff --git a/openssh/_mapdata/init.sls b/openssh/_mapdata/init.sls index 5e4fcf18..81f3ad5d 100644 --- a/openssh/_mapdata/init.sls +++ b/openssh/_mapdata/init.sls @@ -5,9 +5,10 @@ {%- set tplroot = tpldir.split('/')[0] %} {%- from tplroot ~ "/map.jinja" import mapdata with context %} -{%- set output_file = '/tmp/salt_mapdata_dump.yaml' %} +{%- do salt['log.debug']('### MAP.JINJA DUMP ###\n' ~ mapdata | yaml(False)) %} -{%- do salt['log.debug']( 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: diff --git a/pre-commit_semantic-release.sh b/pre-commit_semantic-release.sh index ba805352..458b7b64 100755 --- a/pre-commit_semantic-release.sh +++ b/pre-commit_semantic-release.sh @@ -11,7 +11,7 @@ sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA ############################################################################### # Install `m2r` -sudo -H pip install m2r +pip3 install m2r # Copy and then convert the `.md` docs cp ./*.md docs/ diff --git a/release.config.js b/release.config.js index 6af7aa8f..c1ed11b9 100644 --- a/release.config.js +++ b/release.config.js @@ -1,5 +1,6 @@ module.exports = { branch: 'master', + repositoryUrl: 'https://github.com/saltstack-formulas/openssh-formula', plugins: [ ['@semantic-release/commit-analyzer', { preset: 'angular', diff --git a/test/integration/default/controls/_mapdata_spec.rb b/test/integration/default/controls/_mapdata_spec.rb index 79c3ca88..2cced0a4 100644 --- a/test/integration/default/controls/_mapdata_spec.rb +++ b/test/integration/default/controls/_mapdata_spec.rb @@ -1,13 +1,23 @@ # frozen_string_literal: true -mapdata_file = "_mapdata/#{system.platform[:finger].split('.').first}.yaml" -mapdata_dump = inspec.profile.file(mapdata_file) +require 'yaml' control '`map.jinja` YAML dump' do - title 'should contain the lines' + title 'should match the comparison file' - describe file('/tmp/salt_mapdata_dump.yaml') do - it { should exist } - its('content') { should eq mapdata_dump } + # Strip the `platform[:finger]` version number down to the "OS major release" + mapdata_file = "_mapdata/#{system.platform[:finger].split('.').first}.yaml" + + # Load the mapdata from profile https://docs.chef.io/inspec/profiles/#profile-files + mapdata_dump = YAML.safe_load(inspec.profile.file(mapdata_file)) + + # Derive the location of the dumped mapdata + output_dir = platform[:family] == 'windows' ? '/temp' : '/tmp' + output_file = "#{output_dir}/salt_mapdata_dump.yaml" + + describe 'File content' do + it 'should match profile map data exactly' do + expect(yaml(output_file).params).to eq(mapdata_dump) + end end end diff --git a/test/integration/share/README.md b/test/integration/share/README.md index 7de80b24..5bc510cd 100644 --- a/test/integration/share/README.md +++ b/test/integration/share/README.md @@ -11,9 +11,11 @@ Its goal is to share the libraries between all profiles. 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 - - `system.platform[:name]` modify `amazon` to `amazonlinux` - - `system.platform[:release]` tweak Arch and Amazon Linux: + - `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 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`) + - `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 index 96a5ab66..697417a1 100644 --- a/test/integration/share/inspec.yml +++ b/test/integration/share/inspec.yml @@ -15,4 +15,7 @@ supports: - platform-name: suse - platform-name: freebsd - platform-name: amazon + - platform-name: oracle - platform-name: arch + - platform-name: gentoo + - platform: windows diff --git a/test/integration/share/libraries/system.rb b/test/integration/share/libraries/system.rb index ebd32b31..ef234996 100644 --- a/test/integration/share/libraries/system.rb +++ b/test/integration/share/libraries/system.rb @@ -10,6 +10,7 @@ class SystemResource < Inspec.resource(1) attr_reader :platform def initialize + super @platform = build_platform end @@ -26,8 +27,8 @@ def build_platform def build_platform_family case inspec.platform[:name] - when 'arch' - 'arch' + when 'arch', 'gentoo' + inspec.platform[:name] else inspec.platform[:family] end @@ -35,13 +36,16 @@ def build_platform_family def build_platform_name case inspec.platform[:name] - when 'amazon' - 'amazonlinux' + when 'amazon', 'oracle' + "#{inspec.platform[:name]}linux" + when 'windows_8.1_pro', 'windows_server_2019_datacenter' + 'windows' else inspec.platform[:name] end end + # rubocop:disable Metrics/MethodLength def build_platform_release case inspec.platform[:name] when 'amazon' @@ -49,10 +53,26 @@ def build_platform_release inspec.platform[:release].gsub(/2018.*/, '1') when 'arch' 'base-latest' + when 'gentoo' + "#{inspec.platform[:release].split('.')[0]}-#{derive_gentoo_init_system}" + when 'windows_8.1_pro' + '8.1' + when 'windows_server_2019_datacenter' + '2019-server' else inspec.platform[:release] end end + # rubocop:enable Metrics/MethodLength + + def derive_gentoo_init_system + case inspec.command('systemctl').exist? + when true + 'sysd' + else + 'sysv' + end + end def build_platform_finger "#{build_platform_name}-#{build_finger_release}"