From ab48dcdf0a8943941e7cf2044fef099d6bc1b29b Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Wed, 16 Dec 2020 06:29:46 +0000 Subject: [PATCH] ci(gitlab-ci): use GitLab CI as Travis CI replacement * Automated using https://github.com/myii/ssf-formula/pull/275 --- .gitlab-ci.yml | 212 ++++++++++++++++++++++++++++ .travis.yml | 15 +- .yamllint | 1 + CODEOWNERS | 5 +- docker/libtofs.jinja | 156 ++++++++++---------- docs/CONTRIBUTING.rst | 186 ------------------------ docs/TOFS_pattern.rst | 6 +- pre-commit_semantic-release.sh | 2 +- release.config.js | 1 + test/integration/clean/README.md | 12 +- test/integration/clean/inspec.yml | 2 +- test/integration/package/README.md | 12 +- test/integration/package/inspec.yml | 2 +- 13 files changed, 333 insertions(+), 279 deletions(-) create mode 100644 .gitlab-ci.yml delete mode 100644 docs/CONTRIBUTING.rst diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..7a04febb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,212 @@ +# -*- 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/docker-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_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 ${CI_PROJECT_URL}.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' + +############################################################################### +# 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` +# archive-debian-10-master-py3: {extends: '.test_instance'} +# package-debian-10-master-py3: {extends: '.test_instance'} +# clean-debian-10-master-py3: {extends: '.test_instance'} +# archive-ubuntu-1804-master-py3: {extends: '.test_instance'} +# package-ubuntu-1804-master-py3: {extends: '.test_instance'} +# clean-ubuntu-1804-master-py3: {extends: '.test_instance'} +# archive-centos-8-master-py3: {extends: '.test_instance'} +# package-centos-8-master-py3: {extends: '.test_instance'} +# clean-centos-8-master-py3: {extends: '.test_instance'} +# archive-fedora-31-master-py3: {extends: '.test_instance'} +# package-fedora-31-master-py3: {extends: '.test_instance'} +# clean-fedora-31-master-py3: {extends: '.test_instance'} +# archive-opensuse-leap-151-master-py3: {extends: '.test_instance'} +# package-opensuse-leap-151-master-py3: {extends: '.test_instance'} +# clean-opensuse-leap-151-master-py3: {extends: '.test_instance'} +# archive-amazonlinux-2-master-py3: {extends: '.test_instance'} +# package-amazonlinux-2-master-py3: {extends: '.test_instance'} +# clean-amazonlinux-2-master-py3: {extends: '.test_instance'} +# archive-debian-10-2019-2-py3: {extends: '.test_instance'} +# package-debian-10-2019-2-py3: {extends: '.test_instance'} +# clean-debian-10-2019-2-py3: {extends: '.test_instance'} +# archive-debian-9-2019-2-py3: {extends: '.test_instance'} +# package-debian-9-2019-2-py3: {extends: '.test_instance'} +# clean-debian-9-2019-2-py3: {extends: '.test_instance'} +# archive-ubuntu-1804-2019-2-py3: {extends: '.test_instance'} +# package-ubuntu-1804-2019-2-py3: {extends: '.test_instance'} +# clean-ubuntu-1804-2019-2-py3: {extends: '.test_instance'} +# archive-centos-8-2019-2-py3: {extends: '.test_instance'} +# package-centos-8-2019-2-py3: {extends: '.test_instance'} +# clean-centos-8-2019-2-py3: {extends: '.test_instance'} +# archive-fedora-31-2019-2-py3: {extends: '.test_instance'} +# package-fedora-31-2019-2-py3: {extends: '.test_instance'} +# clean-fedora-31-2019-2-py3: {extends: '.test_instance'} +# archive-opensuse-leap-151-2019-2-py3: {extends: '.test_instance'} +# package-opensuse-leap-151-2019-2-py3: {extends: '.test_instance'} +# clean-opensuse-leap-151-2019-2-py3: {extends: '.test_instance'} +# archive-centos-7-2019-2-py2: {extends: '.test_instance'} +# package-centos-7-2019-2-py2: {extends: '.test_instance'} +# clean-centos-7-2019-2-py2: {extends: '.test_instance'} +# archive-amazonlinux-2-2019-2-py3: {extends: '.test_instance'} +# package-amazonlinux-2-2019-2-py3: {extends: '.test_instance'} +# clean-amazonlinux-2-2019-2-py3: {extends: '.test_instance'} +# archive-arch-base-latest-2019-2-py2: {extends: '.test_instance'} +# package-arch-base-latest-2019-2-py2: {extends: '.test_instance'} +# clean-arch-base-latest-2019-2-py2: {extends: '.test_instance'} +# archive-fedora-30-2018-3-py3: {extends: '.test_instance'} +# package-fedora-30-2018-3-py3: {extends: '.test_instance'} +# clean-fedora-30-2018-3-py3: {extends: '.test_instance'} +# archive-debian-9-2018-3-py2: {extends: '.test_instance'} +# package-debian-9-2018-3-py2: {extends: '.test_instance'} +# clean-debian-9-2018-3-py2: {extends: '.test_instance'} +# archive-ubuntu-1604-2018-3-py2: {extends: '.test_instance'} +# package-ubuntu-1604-2018-3-py2: {extends: '.test_instance'} +# clean-ubuntu-1604-2018-3-py2: {extends: '.test_instance'} +# archive-centos-7-2018-3-py2: {extends: '.test_instance'} +# package-centos-7-2018-3-py2: {extends: '.test_instance'} +# clean-centos-7-2018-3-py2: {extends: '.test_instance'} +# archive-opensuse-leap-151-2018-3-py2: {extends: '.test_instance'} +# package-opensuse-leap-151-2018-3-py2: {extends: '.test_instance'} +# clean-opensuse-leap-151-2018-3-py2: {extends: '.test_instance'} +# archive-amazonlinux-1-2018-3-py2: {extends: '.test_instance'} +# package-amazonlinux-1-2018-3-py2: {extends: '.test_instance'} +# clean-amazonlinux-1-2018-3-py2: {extends: '.test_instance'} +# archive-arch-base-latest-2018-3-py2: {extends: '.test_instance'} +# package-arch-base-latest-2018-3-py2: {extends: '.test_instance'} +# clean-arch-base-latest-2018-3-py2: {extends: '.test_instance'} +# archive-debian-8-2017-7-py2: {extends: '.test_instance'} +# package-debian-8-2017-7-py2: {extends: '.test_instance'} +# clean-debian-8-2017-7-py2: {extends: '.test_instance'} +# archive-ubuntu-1604-2017-7-py2: {extends: '.test_instance'} +# package-ubuntu-1604-2017-7-py2: {extends: '.test_instance'} +# clean-ubuntu-1604-2017-7-py2: {extends: '.test_instance'} +# archive-centos-6-2017-7-py2: {extends: '.test_instance'} +# package-centos-6-2017-7-py2: {extends: '.test_instance'} +# clean-centos-6-2017-7-py2: {extends: '.test_instance'} +# archive-fedora-30-2017-7-py2: {extends: '.test_instance'} +# package-fedora-30-2017-7-py2: {extends: '.test_instance'} +# clean-fedora-30-2017-7-py2: {extends: '.test_instance'} +# archive-opensuse-leap-151-2017-7-py2: {extends: '.test_instance'} +# package-opensuse-leap-151-2017-7-py2: {extends: '.test_instance'} +# clean-opensuse-leap-151-2017-7-py2: {extends: '.test_instance'} +# archive-amazonlinux-1-2017-7-py2: {extends: '.test_instance'} +# package-amazonlinux-1-2017-7-py2: {extends: '.test_instance'} +# clean-amazonlinux-1-2017-7-py2: {extends: '.test_instance'} +# archive-arch-base-latest-2017-7-py2: {extends: '.test_instance'} +# package-arch-base-latest-2017-7-py2: {extends: '.test_instance'} +# clean-arch-base-latest-2017-7-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/.travis.yml b/.travis.yml index c73727c4..2fd48fba 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' @@ -32,8 +41,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) diff --git a/.yamllint b/.yamllint index 358570e0..9be508fe 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/CODEOWNERS b/CODEOWNERS index d8686b0e..ef5bffab 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -19,12 +19,13 @@ /docs/AUTHORS.rst @saltstack-formulas/ssf /docs/CHANGELOG.rst @saltstack-formulas/ssf /docs/TOFS_pattern.rst @saltstack-formulas/ssf -/docker/libsaltcli.jinja @saltstack-formulas/ssf -/docker/libtofs.jinja @saltstack-formulas/ssf +/*/libsaltcli.jinja @saltstack-formulas/ssf +/*/libtofs.jinja @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 diff --git a/docker/libtofs.jinja b/docker/libtofs.jinja index da656a5e..f39fd42b 100644 --- a/docker/libtofs.jinja +++ b/docker/libtofs.jinja @@ -1,40 +1,37 @@ -{%- macro files_switch(source_files, - lookup=None, - default_files_switch=['id', 'os_family'], - indent_width=6, - v1_path_prefix='') %} - {#- +{%- macro files_switch( + source_files, + lookup=None, + default_files_switch=["id", "os_family"], + indent_width=6, + use_subpath=False + ) %} +{#- Returns a valid value for the "source" parameter of a "file.managed" state function. This makes easier the usage of the Template Override and Files Switch (TOFS) pattern. - Params: * source_files: ordered list of files to look for - * lookup: key under ':tofs:source_files' to override + * lookup: key under ":tofs:source_files" to prepend to the list of source files * default_files_switch: if there's no config (e.g. pillar) - ':tofs:files_switch' this is the ordered list of grains to + ":tofs:files_switch" this is the ordered list of grains to use as selector switch of the directories under "/files" - * indent_witdh: indentation of the result value to conform to YAML - * v1_path_prefix: (deprecated) only used for injecting a path prefix into - the source, to support older TOFS configs - + * indent_width: indentation of the result value to conform to YAML + * use_subpath: defaults to `False` but if set, lookup the source file + recursively from the current state directory up to `tplroot` Example (based on a `tplroot` of `xxx`): - If we have a state: - Deploy configuration: file.managed: - name: /etc/yyy/zzz.conf - - source: {{ files_switch(['/etc/yyy/zzz.conf', '/etc/yyy/zzz.conf.jinja'], - lookup='Deploy configuration' - ) }} + - source: {{ files_switch( + ["/etc/yyy/zzz.conf", "/etc/yyy/zzz.conf.jinja"], + lookup="Deploy configuration", + ) }} - template: jinja - In a minion with id=theminion and os_family=RedHat, it's going to be rendered as: - Deploy configuration: file.managed: - name: /etc/yyy/zzz.conf @@ -46,56 +43,73 @@ - salt://xxx/files/default/etc/yyy/zzz.conf - salt://xxx/files/default/etc/yyy/zzz.conf.jinja - template: jinja - #} - {#- Get the `tplroot` from `tpldir` #} - {%- set tplroot = tpldir.split('/')[0] %} - {%- set path_prefix = salt['config.get'](tplroot ~ ':tofs:path_prefix', tplroot) %} - {%- set files_dir = salt['config.get'](tplroot ~ ':tofs:dirs:files', 'files') %} - {%- set files_switch_list = salt['config.get']( - tplroot ~ ':tofs:files_switch', - default_files_switch - ) %} - {#- Lookup source_files (v2), files (v1), or fallback to source_files parameter #} - {%- set src_files = salt['config.get']( - tplroot ~ ':tofs:source_files:' ~ lookup, - salt['config.get']( - tplroot ~ ':tofs:files:' ~ lookup, - source_files - ) - ) %} - {#- Only add to [''] when supporting older TOFS implementations #} - {%- set path_prefix_exts = [''] %} - {%- if v1_path_prefix != '' %} - {%- do path_prefix_exts.append(v1_path_prefix) %} - {%- endif %} - {%- for path_prefix_ext in path_prefix_exts %} - {%- set path_prefix_inc_ext = path_prefix ~ path_prefix_ext %} - {#- For older TOFS implementation, use `files_switch` from the config #} - {#- Use the default, new method otherwise #} - {%- set fsl = salt['config.get']( - tplroot ~ path_prefix_ext|replace('/', ':') ~ ':files_switch', - files_switch_list - ) %} - {#- Append an empty value to evaluate as `default` in the loop below #} - {%- if '' not in fsl %} - {%- do fsl.append('') %} - {%- endif %} - {%- for fs in fsl %} - {%- for src_file in src_files %} - {%- if fs %} - {%- set fs_dir = salt['config.get'](fs, fs) %} - {%- else %} - {%- set fs_dir = salt['config.get'](tplroot ~ ':tofs:dirs:default', 'default') %} - {%- endif %} - {%- set url = [ - '- salt:/', - path_prefix_inc_ext.strip('/'), - files_dir.strip('/'), - fs_dir.strip('/'), - src_file.strip('/'), - ] | select | join('/') %} +#} +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split("/")[0] %} +{%- set path_prefix = salt["config.get"](tplroot ~ ":tofs:path_prefix", tplroot) %} +{%- set files_dir = salt["config.get"](tplroot ~ ":tofs:dirs:files", "files") %} +{%- set files_switch_list = salt["config.get"]( + tplroot ~ ":tofs:files_switch", default_files_switch + ) %} +{#- Lookup source_files (v2), files (v1), or fallback to an empty list #} +{%- set src_files = salt["config.get"]( + tplroot ~ ":tofs:source_files:" ~ lookup, + salt["config.get"](tplroot ~ ":tofs:files:" ~ lookup, []), + ) %} +{#- Append the default source_files #} +{%- set src_files = src_files + source_files %} +{#- Only add to [""] when supporting older TOFS implementations #} +{%- set path_prefix_exts = [""] %} +{%- if use_subpath and tplroot != tpldir %} +{#- Walk directory tree to find {{ files_dir }} #} +{%- set subpath_parts = tpldir.lstrip(tplroot).lstrip("/").split("/") %} +{%- for path in subpath_parts %} +{%- set subpath = subpath_parts[0 : loop.index] | join("/") %} +{%- do path_prefix_exts.append("/" ~ subpath) %} +{%- endfor %} +{%- endif %} +{%- for path_prefix_ext in path_prefix_exts | reverse %} +{%- set path_prefix_inc_ext = path_prefix ~ path_prefix_ext %} +{#- For older TOFS implementation, use `files_switch` from the config #} +{#- Use the default, new method otherwise #} +{%- set fsl = salt["config.get"]( + tplroot ~ path_prefix_ext | replace("/", ":") ~ ":files_switch", + files_switch_list, + ) %} +{#- Append an empty value to evaluate as `default` in the loop below #} +{%- if "" not in fsl %} +{%- set fsl = fsl + [""] %} +{%- endif %} +{%- for fs in fsl %} +{%- for src_file in src_files %} +{%- if fs %} +{%- set fs_dirs = salt["config.get"](fs, fs) %} +{%- else %} +{%- set fs_dirs = salt["config.get"]( + tplroot ~ ":tofs:dirs:default", "default" + ) %} +{%- endif %} +{#- Force the `config.get` lookup result as a list where necessary #} +{#- since we need to also handle grains that are lists #} +{%- if fs_dirs is string %} +{%- set fs_dirs = [fs_dirs] %} +{%- endif %} +{%- for fs_dir in fs_dirs %} +{#- strip empty elements by using a select #} +{%- set url = ( + [ + "- salt:/", + path_prefix_inc_ext.strip("/"), + files_dir.strip("/"), + fs_dir.strip("/"), + src_file.strip("/"), + ] + | select + | join("/") + ) %} {{ url | indent(indent_width, true) }} - {%- endfor %} - {%- endfor %} - {%- endfor %} +{%- endfor %} +{%- endfor %} +{%- endfor %} +{%- endfor %} {%- endmacro %} diff --git a/docs/CONTRIBUTING.rst b/docs/CONTRIBUTING.rst deleted file mode 100644 index 1179c5a0..00000000 --- a/docs/CONTRIBUTING.rst +++ /dev/null @@ -1,186 +0,0 @@ -.. _contributing: - -How to contribute -================= - -This document will eventually outline all aspects of guidance to make your contributing experience a fruitful and enjoyable one. -What it already contains is information about *commit message formatting* and how that directly affects the numerous automated processes that are used for this repo. -It also covers how to contribute to this *formula's documentation*. - -.. contents:: **Table of Contents** - -Overview --------- - -Submitting a pull request is more than just code! -To achieve a quality product, the *tests* and *documentation* need to be updated as well. -An excellent pull request will include these in the changes, wherever relevant. - -Commit message formatting -------------------------- - -Since every type of change requires making Git commits, -we will start by covering the importance of ensuring that all of your commit -messages are in the correct format. - -Automation of multiple processes -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This formula uses `semantic-release `_ for automating numerous processes such as bumping the version number appropriately, creating new tags/releases and updating the changelog. -The entire process relies on the structure of commit messages to determine the version bump, which is then used for the rest of the automation. - -Full details are available in the upstream docs regarding the `Angular Commit Message Conventions `_. -The key factor is that the first line of the commit message must follow this format: - -.. code-block:: - - type(scope): subject - - -* E.g. ``docs(contributing): add commit message formatting instructions``. - -Besides the version bump, the changelog and release notes are formatted accordingly. -So based on the example above: - -.. - - .. raw:: html - -

Documentation

- - * **contributing:** add commit message formatting instructions - - -* The ``type`` translates into a ``Documentation`` sub-heading. -* The ``(scope):`` will be shown in bold text without the brackets. -* The ``subject`` follows the ``scope`` as standard text. - -Linting commit messages in Travis CI -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This formula uses `commitlint `_ for checking commit messages during CI testing. -This ensures that they are in accordance with the ``semantic-release`` settings. - -For more details about the default settings, refer back to the ``commitlint`` `reference rules `_. - -Relationship between commit type and version bump -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This formula applies some customisations to the defaults, as outlined in the table below, -based upon the `type `_ of the commit: - -.. list-table:: - :name: commit-type-vs-version-bump - :header-rows: 1 - :stub-columns: 0 - :widths: 1,2,3,1,1 - - * - Type - - Heading - - Description - - Bump (default) - - Bump (custom) - * - ``build`` - - Build System - - Changes related to the build system - - – - - - * - ``chore`` - - – - - Changes to the build process or auxiliary tools and libraries such as - documentation generation - - – - - - * - ``ci`` - - Continuous Integration - - Changes to the continuous integration configuration - - – - - - * - ``docs`` - - Documentation - - Documentation only changes - - – - - 0.0.1 - * - ``feat`` - - Features - - A new feature - - 0.1.0 - - - * - ``fix`` - - Bug Fixes - - A bug fix - - 0.0.1 - - - * - ``perf`` - - Performance Improvements - - A code change that improves performance - - 0.0.1 - - - * - ``refactor`` - - Code Refactoring - - A code change that neither fixes a bug nor adds a feature - - – - - 0.0.1 - * - ``revert`` - - Reverts - - A commit used to revert a previous commit - - – - - 0.0.1 - * - ``style`` - - Styles - - Changes that do not affect the meaning of the code (white-space, - formatting, missing semi-colons, etc.) - - – - - 0.0.1 - * - ``test`` - - Tests - - Adding missing or correcting existing tests - - – - - 0.0.1 - -Use ``BREAKING CHANGE`` to trigger a ``major`` version change -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Adding ``BREAKING CHANGE`` to the footer of the extended description of the commit message will **always** trigger a ``major`` version change, no matter which type has been used. -This will be appended to the changelog and release notes as well. -To preserve good formatting of these notes, the following format is prescribed: - -* ``BREAKING CHANGE: .`` - -An example of that: - -.. code-block:: git - - ... - - BREAKING CHANGE: With the removal of all of the `.sls` files under - `template package`, this formula no longer supports the installation of - packages. - - -Semantic release formulas -------------------------- - -These formulas are already compatible with semantic-release: - -* `bind-formula `_ -* `cert-formula `_ -* `chrony-formula `_ -* `collectd-formula `_ -* `fail2ban-formula `_ -* `keepalived-formula `_ -* `nginx-formula `_ -* `postgres-formula `_ -* `prometheus-formula `_ -* `rkhunter-formula `_ -* `salt-formula `_ -* `syslog-ng-formula `_ -* `systemd-formula `_ -* `ufw-formula `_ -* `vault-formula `_ - - -Documentation -------------- - -`Documentation contributing guidelines `_ 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/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..eb316518 100644 --- a/release.config.js +++ b/release.config.js @@ -1,5 +1,6 @@ module.exports = { branch: 'master', + repositoryUrl: 'https://github.com/saltstack-formulas/docker-formula', plugins: [ ['@semantic-release/commit-analyzer', { preset: 'angular', diff --git a/test/integration/clean/README.md b/test/integration/clean/README.md index ea26edea..bf2a3cc8 100644 --- a/test/integration/clean/README.md +++ b/test/integration/clean/README.md @@ -1,16 +1,16 @@ -# InSpec Profile: `archive` +# InSpec Profile: `clean` -This shows the implementation of the `archive` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). +This shows the implementation of the `clean` 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 archive +$ inspec check clean Summary ------- -Location: archive +Location: clean Profile: profile Controls: 4 Timestamp: 2019-06-24T23:09:01+00:00 @@ -28,7 +28,7 @@ Warnings To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. ```bash -$ inspec exec archive +$ inspec exec clean .. Finished in 0.0025 seconds (files took 0.12449 seconds to load) @@ -40,7 +40,7 @@ Finished in 0.0025 seconds (files took 0.12449 seconds to load) To run one control from the profile use `inspec exec /path/to/profile --controls name`. ```bash -$ inspec exec archive --controls package +$ inspec exec clean --controls package . Finished in 0.0025 seconds (files took 0.12449 seconds to load) diff --git a/test/integration/clean/inspec.yml b/test/integration/clean/inspec.yml index 5fc4decd..682f49e3 100644 --- a/test/integration/clean/inspec.yml +++ b/test/integration/clean/inspec.yml @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- -name: archive +name: clean title: docker formula maintainer: SaltStack Formulas license: Apache-2.0 diff --git a/test/integration/package/README.md b/test/integration/package/README.md index ea26edea..8a5a5baf 100644 --- a/test/integration/package/README.md +++ b/test/integration/package/README.md @@ -1,16 +1,16 @@ -# InSpec Profile: `archive` +# InSpec Profile: `package` -This shows the implementation of the `archive` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). +This shows the implementation of the `package` 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 archive +$ inspec check package Summary ------- -Location: archive +Location: package Profile: profile Controls: 4 Timestamp: 2019-06-24T23:09:01+00:00 @@ -28,7 +28,7 @@ Warnings To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. ```bash -$ inspec exec archive +$ inspec exec package .. Finished in 0.0025 seconds (files took 0.12449 seconds to load) @@ -40,7 +40,7 @@ Finished in 0.0025 seconds (files took 0.12449 seconds to load) To run one control from the profile use `inspec exec /path/to/profile --controls name`. ```bash -$ inspec exec archive --controls package +$ inspec exec package --controls package . Finished in 0.0025 seconds (files took 0.12449 seconds to load) diff --git a/test/integration/package/inspec.yml b/test/integration/package/inspec.yml index 5fc4decd..e34ba3ce 100644 --- a/test/integration/package/inspec.yml +++ b/test/integration/package/inspec.yml @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # vim: ft=yaml --- -name: archive +name: package title: docker formula maintainer: SaltStack Formulas license: Apache-2.0