diff --git a/.gitchangelog.rc b/.gitchangelog.rc index c7e3912..d6234d7 100644 --- a/.gitchangelog.rc +++ b/.gitchangelog.rc @@ -1,6 +1,4 @@ # -*- coding: utf-8; mode: python -*- -import yaml - ## ## Format ## @@ -53,6 +51,7 @@ import yaml ## message will be displayed in the changelog without reformatting. +## ## ``ignore_regexps`` is a line of regexps ## ## Any commit having its full commit message matching any regexp listed here @@ -130,8 +129,18 @@ section_regexps = [ ## whatever given ``msg`` if the current text is empty. ## ## Additionally, you can `pipe` the provided filters, for instance: +#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ") +#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') +#body_process = noop body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip + +## ``subject_process`` is a callable +## +## This callable will be given the original subject and result will +## be used in the changelog. +## +## Available constructs are those listed in ``body_process`` doc. subject_process = (strip | ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') | SetIfEmpty("No commit message.") | ucfirst | final_dot) @@ -144,39 +153,139 @@ subject_process = (strip | tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$' +## ``unreleased_version_label`` is a string or a callable that outputs a string +## +## This label will be used as the changelog Title of the last set of changes +## between last valid tag and HEAD if any. +import yaml + with open('vars/main.yml') as stream: unreleased_version_label = yaml.safe_load(stream)['cassandra_role_version'] +## ``output_engine`` is a callable +## +## This will change the output format of the generated changelog file +## +## Available choices are: +## +## - rest_py +## +## Legacy pure python engine, outputs ReSTructured text. +## This is the default. +## +## - mustache() +## +## Template name could be any of the available templates in +## ``templates/mustache/*.tpl``. +## Requires python package ``pystache``. +## Examples: +## - mustache("markdown") +## - mustache("restructuredtext") +## +## - makotemplate() +## +## Template name could be any of the available templates in +## ``templates/mako/*.tpl``. +## Requires python package ``mako``. +## Examples: +## - makotemplate("restructuredtext") +## +#output_engine = rest_py +#output_engine = mustache("restructuredtext") output_engine = mustache("markdown") +#output_engine = makotemplate("restructuredtext") + + +## ``include_merge`` is a boolean +## +## This option tells git-log whether to include merge commits in the log. +## The default is to include them. include_merge = False -log_encoding = 'utf-8' -OUTPUT_FILE = "CHANGELOG.md" -INSERT_POINT_REGEX = r'''(?isxu) -^ -( - \s*\#\s+Changelog\s*(\n|\r\n|\r) ## ``Changelog`` line -) - -( ## Match all between changelog and release rev - ( - (?! - (?<=(\n|\r)) ## look back for newline - \#\#\s+%(rev)s ## revision - \s+ - \([0-9]+-[0-9]{2}-[0-9]{2}\)(\n|\r\n|\r) ## date - ) - . - )* -) - -(?P\#\#\s+(?P%(rev)s)) -''' % {'rev': r"[0-9]+\.[0-9]+(\.[0-9]+)?"} - -revs = [ - Caret(FileFirstRegexMatch(OUTPUT_FILE, INSERT_POINT_REGEX)), - 'HEAD' -] -publish = FileInsertAtFirstRegexMatch( - OUTPUT_FILE, INSERT_POINT_REGEX, - idx=lambda m: m.start(1) -) + + +## ``log_encoding`` is a string identifier +## +## This option tells gitchangelog what encoding is outputed by ``git log``. +## The default is to be clever about it: it checks ``git config`` for +## ``i18n.logOutputEncoding``, and if not found will default to git's own +## default: ``utf-8``. +#log_encoding = 'utf-8' + + +## ``publish`` is a callable +## +## Sets what ``gitchangelog`` should do with the output generated by +## the output engine. ``publish`` is a callable taking one argument +## that is an interator on lines from the output engine. +## +## Some helper callable are provided: +## +## Available choices are: +## +## - stdout +## +## Outputs directly to standard output +## (This is the default) +## +## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start(), flags) +## +## Creates a callable that will parse given file for the given +## regex pattern and will insert the output in the file. +## ``idx`` is a callable that receive the matching object and +## must return a integer index point where to insert the +## the output in the file. Default is to return the position of +## the start of the matched string. +## +## - FileRegexSubst(file, pattern, replace, flags) +## +## Apply a replace inplace in the given file. Your regex pattern must +## take care of everything and might be more complex. Check the README +## for a complete copy-pastable example. +## +# publish = FileInsertIntoFirstRegexMatch( +# "CHANGELOG.rst", +# r'/(?P[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/', +# idx=lambda m: m.start(1) +# ) +#publish = stdout + + +## ``revs`` is a list of callable or a list of string +## +## callable will be called to resolve as strings and allow dynamical +## computation of these. The result will be used as revisions for +## gitchangelog (as if directly stated on the command line). This allows +## to filter exaclty which commits will be read by gitchangelog. +## +## To get a full documentation on the format of these strings, please +## refer to the ``git rev-list`` arguments. There are many examples. +## +## Using callables is especially useful, for instance, if you +## are using gitchangelog to generate incrementally your changelog. +## +## Some helpers are provided, you can use them:: +## +## - FileFirstRegexMatch(file, pattern): will return a callable that will +## return the first string match for the given pattern in the given file. +## If you use named sub-patterns in your regex pattern, it'll output only +## the string matching the regex pattern named "rev". +## +## - Caret(rev): will return the rev prefixed by a "^", which is a +## way to remove the given revision and all its ancestor. +## +## Please note that if you provide a rev-list on the command line, it'll +## replace this value (which will then be ignored). +## +## If empty, then ``gitchangelog`` will act as it had to generate a full +## changelog. +## +## The default is to use all commits to make the changelog. +#revs = ["^1.0.3", ] +#revs = [ +# Caret( +# FileFirstRegexMatch( +# "CHANGELOG.rst", +# r"(?P[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")), +# "HEAD" +#] +revs = [] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ddf3b4..53c90f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,10 +17,11 @@ jobs: strategy: matrix: include: - - image-version: centos7 - command: /usr/sbin/init - distro: centos - tag: 7 + # Disable Tests for CentOS 7 due to https://github.com/locp/ansible-role-cassandra/issues/155 + # - image-version: centos7 + # command: /usr/sbin/init + # distro: centos + # tag: 7 - image-version: centos8 command: /usr/sbin/init distro: centos diff --git a/CHANGELOG.md b/CHANGELOG.md index 2341df1..71b4d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,22 @@ -## 1.18.0 +# Changelog + + +## 1.18.1 + +### Changes + +* Migrate to testinfra-bdd 2.0.0. [Ben Dalling] + +### Fix + +* Change apache package repository URLs to new location (CASSANDRA-17748) [Hauke Hans] + +* Disable testing against CentOS 7. [Ben Dalling] + +* Correct Lint errors in metadata file. [Ben Dalling] + + +## 1.18.0 (2022-07-17) ### New diff --git a/meta/main.yml b/meta/main.yml index 3b75c5e..04304c9 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -11,8 +11,6 @@ galaxy_info: namespace: locp - github_branch: main - license: GPLv3 min_ansible_version: 2.12.6 @@ -30,8 +28,8 @@ galaxy_info: platforms: - name: EL versions: - - 7 - - 8 + - '7' + - '8' - name: Ubuntu versions: - bionic @@ -45,15 +43,13 @@ galaxy_info: - stretch - name: Fedora versions: - - 27 - - 28 - - 29 - - 30 # https://github.com/ansible/galaxy/issues/1926 - - 31 # https://github.com/ansible/galaxy/issues/2105 - - 32 # https://github.com/ansible/galaxy/issues/2356 - - 33 # https://github.com/ansible/galaxy/issues/2533 - - 34 - - 35 - - 36 - - dependencies: [] + - '27' + - '28' + - '29' + - '30' # https://github.com/ansible/galaxy/issues/1926 + - '31' # https://github.com/ansible/galaxy/issues/2105 + - '32' # https://github.com/ansible/galaxy/issues/2356 + - '33' # https://github.com/ansible/galaxy/issues/2533 + - '34' + - '35' + - '36' diff --git a/molecule/default/tests/test_supported_platform.py b/molecule/default/tests/test_supported_platform.py index efb7523..120bebe 100644 --- a/molecule/default/tests/test_supported_platform.py +++ b/molecule/default/tests/test_supported_platform.py @@ -55,7 +55,7 @@ def test_platform_is_supported(self): supported_versions = platform['versions'] if platform_name == 'EL' or platform_name == 'Fedora': - version = int(host.system_info.release.split('.')[0]) + version = host.system_info.release.split('.')[0] else: version = host.system_info.codename diff --git a/molecule/latest/tests/step_defs/test_cassandra.py b/molecule/latest/tests/step_defs/test_cassandra.py index f99187a..67dd8c1 100644 --- a/molecule/latest/tests/step_defs/test_cassandra.py +++ b/molecule/latest/tests/step_defs/test_cassandra.py @@ -1,32 +1,11 @@ """Test Cassandra feature tests.""" -from pytest_bdd import scenario +import testinfra_bdd +from pytest_bdd import scenarios -# Ensure that the PyTest fixtures provided in testinfra-bdd are available to -# your test suite. -pytest_plugins = ['testinfra_bdd'] - - -@scenario('../features/cassandra.feature', 'Check that a File Contains an Expected String') -def test_check_that_a_file_contains_an_expected_string(): - """Check that a File Contains an Expected String.""" - - -@scenario('../features/cassandra.feature', 'Check that a file exists and matches an expected type') -def test_check_that_a_file_exists_and_matches_an_expected_type(): - """Check that a file exists and matches an expected type.""" +scenarios('../features/cassandra.feature') -@scenario('../features/cassandra.feature', 'Check the Cassandra Service and Package') -def test_check_the_cassandra_service_and_package(): - """Check the Cassandra Service and Package.""" - - -@scenario('../features/cassandra.feature', 'Custom Directories') -def test_custom_directories(): - """Custom Directories.""" - - -@scenario('../features/cassandra.feature', 'Run the nodetool command') -def test_run_the_nodetool_command(): - """Run the nodetool command.""" +# Ensure that the PyTest fixtures provided in testinfra-bdd are available to +# your test suite. +pytest_plugins = testinfra_bdd.PYTEST_MODULES diff --git a/molecule/latest/tests/test_supported_platform.py b/molecule/latest/tests/test_supported_platform.py index efb7523..120bebe 100644 --- a/molecule/latest/tests/test_supported_platform.py +++ b/molecule/latest/tests/test_supported_platform.py @@ -55,7 +55,7 @@ def test_platform_is_supported(self): supported_versions = platform['versions'] if platform_name == 'EL' or platform_name == 'Fedora': - version = int(host.system_info.release.split('.')[0]) + version = host.system_info.release.split('.')[0] else: version = host.system_info.codename diff --git a/requirements.txt b/requirements.txt index 6a6a0f1..4c3383f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ ansible==5.8.0 -ansible-compat==2.1.0 +ansible-compat==2.2.0 ansible-core==2.12.6 -ansible-lint==6.2.1 +ansible-lint==6.4.0 arrow==1.2.2 attrs==21.4.0 bcrypt==3.2.2 @@ -14,12 +14,14 @@ chardet==4.0.0 charset-normalizer==2.0.12 click==8.1.3 click-help-colors==0.9.1 +colorama==0.4.4 commonmark==0.9.1 cookiecutter==2.1.1 cryptography==37.0.2 docker==5.0.3 enrich==1.2.7 flake8==4.0.1 +future==0.18.2 gitchangelog==3.0.4 glob2==0.7 idna==3.3 @@ -27,8 +29,9 @@ importlib-resources==5.7.1 iniconfig==1.1.1 Jinja2==3.1.2 jinja2-time==0.2.0 -jsonschema==4.5.1 +jsonschema==4.9.1 Mako==1.2.0 +mando==0.6.4 MarkupSafe==2.1.1 mccabe==0.6.1 molecule==3.6.1 @@ -39,6 +42,7 @@ paramiko==2.11.0 parse==1.19.0 parse-type==0.6.0 pathspec==0.9.0 +pkgutil_resolve_name==1.3.10 pluggy==1.0.0 poyo==0.5.0 py==1.11.0 @@ -51,11 +55,12 @@ pyparsing==3.0.9 pyrsistent==0.18.1 pystache==0.6.0 pytest==7.1.2 -pytest-bdd==5.0.0 +pytest-bdd==6.0.1 pytest-testinfra==6.7.0 python-dateutil==2.8.2 python-slugify==6.1.2 PyYAML==6.0 +radon==5.1.0 requests==2.27.1 resolvelib==0.5.4 rich==12.4.4 @@ -64,8 +69,9 @@ ruamel.yaml.clib==0.2.6 six==1.16.0 subprocess-tee==0.3.5 tenacity==8.0.1 -testinfra-bdd==1.0.5 +testinfra-bdd==2.0.0 text-unidecode==1.3 +toml==0.10.2 tomli==2.0.1 typing_extensions==4.2.0 urllib3==1.26.9 diff --git a/tasks/install/Debian.yml b/tasks/install/Debian.yml index 9e466d5..8a94122 100644 --- a/tasks/install/Debian.yml +++ b/tasks/install/Debian.yml @@ -13,7 +13,7 @@ - name: Configure the Apache Cassandra Apt Repository ansible.builtin.apt_repository: filename: /etc/apt/sources.list.d/cassandra.sources - repo: "deb http://www.apache.org/dist/cassandra/debian {{ cassandra_repo_apache_release }} main" + repo: "deb https://debian.cassandra.apache.org {{ cassandra_repo_apache_release }} main" state: present when: - cassandra_configure_apache_repo|bool diff --git a/tasks/install/RedHat.yml b/tasks/install/RedHat.yml index a2b8431..9d87e56 100644 --- a/tasks/install/RedHat.yml +++ b/tasks/install/RedHat.yml @@ -3,7 +3,7 @@ - name: Configure the Apache Cassandra YUM Repository ansible.builtin.yum_repository: name: cassandra - baseurl: "https://www.apache.org/dist/cassandra/redhat/{{ cassandra_repo_apache_release }}/" + baseurl: "https://redhat.cassandra.apache.org/{{ cassandra_repo_apache_release }}/" gpgcheck: true description: Apache Cassandra repo_gpgcheck: true diff --git a/vars/main.yml b/vars/main.yml index e2eaf8b..e24d661 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,3 @@ --- # The version of the Cassandra role. -cassandra_role_version: 1.18.0 +cassandra_role_version: 1.18.1