Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a parse_semver filter #73935

Open
wants to merge 21 commits into
base: devel
Choose a base branch
from

Conversation

JensHeinrich
Copy link
Contributor

SUMMARY

This filter uses the SemanticVersion class from utils.version

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

filters

ADDITIONAL INFORMATION

@ansibot ansibot added affects_2.11 core_review In order to be merged, this PR must follow the core review workflow. feature This issue/PR relates to a feature request. has_issue needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Mar 17, 2021
@ansibot
Copy link
Contributor

ansibot commented Mar 17, 2021

The test ansible-test sanity --test pep8 [explain] failed with 9 errors:

lib/ansible/plugins/filter/core.py:345:1: E302: expected 2 blank lines, found 1
lib/ansible/plugins/filter/core.py:347:22: E231: missing whitespace after ','
lib/ansible/plugins/filter/core.py:347:30: E231: missing whitespace after ','
lib/ansible/plugins/filter/core.py:348:9: E123: closing bracket does not match indentation of opening bracket's line
lib/ansible/plugins/filter/core.py:351:11: E225: missing whitespace around operator
lib/ansible/plugins/filter/core.py:353:11: E271: multiple spaces after keyword
lib/ansible/plugins/filter/core.py:353:14: E201: whitespace after '{'
lib/ansible/plugins/filter/core.py:353:58: E202: whitespace before '}'
lib/ansible/plugins/filter/core.py:355:1: E302: expected 2 blank lines, found 1

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:353:47: SyntaxError: return  { k: semver.__getattribute__(k) for k in keys }

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:345:0: dangerous-default-value: Dangerous default value [] as argument

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Mar 17, 2021
@bmillemathias
Copy link
Contributor

Hi @JensHeinrich

Thanks for your patch, to complete it we need also a changelog file and some tests to validate the code does not break over time, look to https://docs.ansible.com/ansible/latest/community/development_process.html#making-your-pr-merge-worthy to get an idea how to do this.

@JensHeinrich
Copy link
Contributor Author

@bmillemathias on it

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 18, 2021
@ansibot
Copy link
Contributor

ansibot commented Mar 18, 2021

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

changelogs/fragments/73935-add-semver-filter.yaml:3:1: empty-lines: too many blank lines (1 > 0)

The test ansible-test sanity --test pep8 [explain] failed with 9 errors:

lib/ansible/plugins/filter/core.py:345:1: E302: expected 2 blank lines, found 1
lib/ansible/plugins/filter/core.py:347:22: E231: missing whitespace after ','
lib/ansible/plugins/filter/core.py:347:30: E231: missing whitespace after ','
lib/ansible/plugins/filter/core.py:348:9: E123: closing bracket does not match indentation of opening bracket's line
lib/ansible/plugins/filter/core.py:351:11: E225: missing whitespace around operator
lib/ansible/plugins/filter/core.py:353:11: E271: multiple spaces after keyword
lib/ansible/plugins/filter/core.py:353:14: E201: whitespace after '{'
lib/ansible/plugins/filter/core.py:353:58: E202: whitespace before '}'
lib/ansible/plugins/filter/core.py:355:1: E302: expected 2 blank lines, found 1

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:353:47: SyntaxError: return  { k: semver.__getattribute__(k) for k in keys }

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:345:0: dangerous-default-value: Dangerous default value [] as argument

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Mar 18, 2021
@bmillemathias
Copy link
Contributor

@bmillemathias on it

Hi, the unit / integration test is missing (test the semver filter works but also testing failure behavior)
also could you look to the errors reported by the CI tests.

Best

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 18, 2021
@ansibot
Copy link
Contributor

ansibot commented Mar 18, 2021

The test ansible-test sanity --test pylint [explain] failed with 1 error:

test/units/plugins/filter/test_core.py:325:0: dangerous-default-value: Dangerous default value [] as argument

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:349:0: dangerous-default-value: Dangerous default value SEMVER_VALID_KEYS (builtins.list) as argument

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

changelogs/fragments/73935-add-semver-filter.yaml:3:1: empty-lines: too many blank lines (1 > 0)

The test ansible-test sanity --test pep8 [explain] failed with 79 errors:

lib/ansible/plugins/filter/core.py:345:1: E305: expected 2 blank lines after class or function definition, found 1
lib/ansible/plugins/filter/core.py:349:1: E302: expected 2 blank lines, found 1
lib/ansible/plugins/filter/core.py:352:9: E123: closing bracket does not match indentation of opening bracket's line
lib/ansible/plugins/filter/core.py:357:15: E225: missing whitespace around operator
lib/ansible/plugins/filter/core.py:357:25: E226: missing whitespace around arithmetic operator
lib/ansible/plugins/filter/core.py:366:13: E201: whitespace after '{'
lib/ansible/plugins/filter/core.py:366:57: E202: whitespace before '}'
lib/ansible/plugins/filter/core.py:368:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:11:48: E231: missing whitespace after ','
test/units/plugins/filter/test_core.py:11:61: E231: missing whitespace after ','
test/units/plugins/filter/test_core.py:78:24: E225: missing whitespace around operator
test/units/plugins/filter/test_core.py:79:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:80:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:85:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:86:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:91:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:92:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:97:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:98:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:103:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:104:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:109:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:110:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:115:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:116:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:121:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:122:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:127:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:128:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:133:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:134:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:139:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:140:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:145:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:146:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:151:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:152:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:157:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:158:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:163:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:164:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:169:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:170:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:175:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:176:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:181:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:182:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:187:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:188:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:193:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:194:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:199:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:200:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:205:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:206:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:211:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:212:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:217:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:218:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:223:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:224:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:229:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:230:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:235:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:236:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:241:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:242:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:247:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:248:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:253:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:254:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:259:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:260:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:265:9: E126: continuation line over-indented for hanging indent
test/units/plugins/filter/test_core.py:267:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:318:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:324:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:325:56: E231: missing whitespace after ','
test/units/plugins/filter/test_core.py:327:29: E231: missing whitespace after ','

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:366:46: SyntaxError: return { k: semver.__getattribute__(k) for k in keys }

click here for bot help

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. core_review In order to be merged, this PR must follow the core review workflow. and removed core_review In order to be merged, this PR must follow the core review workflow. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 18, 2021
@ansibot
Copy link
Contributor

ansibot commented Mar 18, 2021

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

changelogs/fragments/73935-add-semver-filter.yaml:3:1: empty-lines: too many blank lines (1 > 0)

The test ansible-test sanity --test pep8 [explain] failed with 86 errors:

lib/ansible/plugins/filter/core.py:345:1: E305: expected 2 blank lines after class or function definition, found 1
lib/ansible/plugins/filter/core.py:349:1: E302: expected 2 blank lines, found 1
lib/ansible/plugins/filter/core.py:352:9: E123: closing bracket does not match indentation of opening bracket's line
lib/ansible/plugins/filter/core.py:361:5: E303: too many blank lines (2)
lib/ansible/plugins/filter/core.py:361:15: E225: missing whitespace around operator
lib/ansible/plugins/filter/core.py:361:25: E226: missing whitespace around arithmetic operator
lib/ansible/plugins/filter/core.py:370:13: E201: whitespace after '{'
lib/ansible/plugins/filter/core.py:370:57: E202: whitespace before '}'
lib/ansible/plugins/filter/core.py:372:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:11:48: E231: missing whitespace after ','
test/units/plugins/filter/test_core.py:11:61: E231: missing whitespace after ','
test/units/plugins/filter/test_core.py:78:24: E225: missing whitespace around operator
test/units/plugins/filter/test_core.py:79:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:80:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:85:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:86:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:91:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:92:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:97:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:98:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:103:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:104:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:109:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:110:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:115:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:116:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:121:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:122:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:127:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:128:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:133:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:134:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:139:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:140:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:145:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:146:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:151:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:152:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:157:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:158:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:163:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:164:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:169:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:170:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:175:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:176:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:181:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:182:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:187:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:188:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:193:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:194:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:199:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:200:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:205:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:206:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:211:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:212:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:217:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:218:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:223:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:224:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:229:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:230:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:235:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:236:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:241:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:242:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:247:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:248:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:253:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:254:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:259:6: E201: whitespace after '('
test/units/plugins/filter/test_core.py:260:10: E201: whitespace after '{'
test/units/plugins/filter/test_core.py:265:9: E126: continuation line over-indented for hanging indent
test/units/plugins/filter/test_core.py:267:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:317:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:323:1: E305: expected 2 blank lines after class or function definition, found 1
test/units/plugins/filter/test_core.py:323:29: E225: missing whitespace around operator
test/units/plugins/filter/test_core.py:328:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:334:1: E305: expected 2 blank lines after class or function definition, found 1
test/units/plugins/filter/test_core.py:334:20: E225: missing whitespace around operator
test/units/plugins/filter/test_core.py:340:1: E302: expected 2 blank lines, found 1
test/units/plugins/filter/test_core.py:345:9: E123: closing bracket does not match indentation of opening bracket's line
test/units/plugins/filter/test_core.py:347:56: E231: missing whitespace after ','
test/units/plugins/filter/test_core.py:349:29: E231: missing whitespace after ','

The test ansible-test sanity --test compile --python 2.6 [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:370:46: SyntaxError: return { k: semver.__getattribute__(k) for k in keys }

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/plugins/filter/core.py:349:0: dangerous-default-value: Dangerous default value SEMVER_VALID_KEYS (builtins.list) as argument

click here for bot help

@ansibot ansibot removed the needs_info This issue requires further information. Please answer any outstanding questions. label Jun 21, 2023
@JensHeinrich
Copy link
Contributor Author

  • as mentioned by matt, no need to do the filtering
    done
  • docs should now live in it's own yaml file document adjacent docs (sidecar) #79056
    done
  • version_added should be the 'core' version, 2.15 at this point
    done

@ansibot ansibot added new_plugin This PR includes a new plugin. and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jun 21, 2023
@JensHeinrich JensHeinrich requested a review from bcoca June 21, 2023 06:31
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jun 29, 2023
@ansibot ansibot added stale_review Updates were made after the last review and the last review is more than 7 days old. and removed has_issue labels Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.11 docs This issue/PR relates to or includes documentation. feature This issue/PR relates to a feature request. new_plugin This PR includes a new plugin. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants