Repository navigation
7.31.3 keeps making new releases #490
Copy link
Copy link
Closed
Labels
bugSomething isn't working properlySomething isn't working properly
Description
The problem
We noticed today that our CICD generated 10+ new releases
After looking into it we've discovered that the problem is the newest version of SR itself. The current version of SR (7.31.3) keeps making new releases even if we don't push any new commits. Just running it on the clean master branch causes it to make a new release.
❯ pip list | grep python-semantic-release
python-semantic-release 7.31.3
❯ semantic-release publish --noop
Current version: 14.0.0, Current release version: 14.0.0
warning: No operation mode. Should have bumped from 14.0.0 to 15.0.0
The previous version (7.31.2) works as expected
❯ pip list | grep python-semantic-release
python-semantic-release 7.31.2
❯ semantic-release publish --noop
Current version: 14.0.0, Current release version: 14.0.0
No release will be made.
A clear and concise description of what the bug is.
Expected behavior
If I run semantic release without changing any of the code in master then I won't get a release. But the actual behavior is we do get a release. This is not the case for previous versions of SR.
Additional context
Here's the command with debug verbosity
❯ semantic-release publish --verbosity=DEBUG --noop
debug: get_current_version_by_config_file()
debug: Parsing current version: path=PosixPath('src/myproject/__init__.py') pattern='__version__ *[:=] *["\\\'](\\d+\\.\\d+\\.\\d+(-dev\\.\\d+)?)["\\\']' num_matches=1
debug: Parsing current version: path=PosixPath('pyproject.toml') pattern='version *[:=] *["\\\'](\\d+\\.\\d+\\.\\d+(-dev\\.\\d+)?)["\\\']' num_matches=1
debug: Regex matched version: 14.0.0
debug: get_current_version_by_config_file -> 14.0.0
debug: get_current_release_version_by_commits()
debug: Checking commit 797c773f6be96b0224cdba6e05b1dad20b142ab7
debug: Version matches regex 14.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: get_current_release_version_by_commits -> 14.0.0
Current version: 14.0.0, Current release version: 14.0.0
debug: evaluate_version_bump('14.0.0', None)
debug: Reference v14.0.0 does not exist, considering entire history
debug: parse_commit_message('14.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 14.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('13.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 13.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('12.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 12.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('11.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 11.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('10.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 10.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('9.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 9.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('8.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 8.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('7.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 7.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('6.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 6.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('5.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 5.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('4.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 4.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('3.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 3.0.0
debug:
debug: Automatically generated by python-semantic-release
debug: parse_commit_message('2.0.0
debug:
debug: Automatically generated by python-semantic-release')
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: 2.0.0
# -----------------------------
# skipping the next 140 commits
# -----------------------------
debug: Ignoring UnknownCommitMessageStyleError: Unable to parse the given commit message: root commit
debug: Commits found since last release: 140
debug: evaluate_version_bump -> major
debug: get_new_version('14.0.0', '14.0.0', 'major', False, True)
debug: get_new_version -> 15.0.0
debug: get_repository_owner_and_name()
debug: get_repository_owner_and_name -> ('mycompany/myorg', 'myproject')
debug: Running publish on branch master
debug: checkout(master)
debug: checkout -> Your branch is up to date with 'origin/master'.
warning: No operation mode. Should have bumped from 14.0.0 to 15.0.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't working properlySomething isn't working properly

Activity
bernardcooke53 commentedon Aug 23, 2022
@zjgoodman can you post your configuration please? Are the commits in your screenshot the full messages that you're releasing with, or is there more to them that isn't shown (like a message body)?
I suspect https://github.com/relekang/python-semantic-release/blob/aad17b0bdaac088b7538d3d3e04622c15ab31e60/semantic_release/vcs_helpers.py#L40 is not producing the same message as your configuration does when PSR commits on a release, so it "thinks" it hasn't found a commit releasing this version. Combined with going back over the history, probably finding your last major release (v2?), taking that as max level bump and bumping major version.
Are you running this in a CI on a cron trigger?
zjgoodman commentedon Aug 23, 2022
Hi thanks for looking into this!
The commits do have a body but it's just the default SR body, as shown below.
Below is the config for SR that I have in my
pyproject.tomlfile.No this CI pipeline is triggered by commits. If you commit to the master branch it kicks off a pipeline. So what you're seeing with all these commits is that semantic release is running and determining that a new release should be made, then commits the release, which triggers a new pipeline, which runs semantic release and then the cycle repeats. On previous versions of semantic release, it determines that there's no need to make a new release and so it doesn't commit, so another pipeline doesn't get triggered.
fix: account for trailing newlines in commit messages
bernardcooke53 commentedon Aug 23, 2022
@zjgoodman - not sure if the tag worked properly - the issue was that trailing newlines in git commit history were breaking a stricter comparison introduced in #488. I've been able to fix this in a test repo - have replicated with your config etc
zjgoodman commentedon Aug 24, 2022
@bernardcooke53 I can confirm that the fix in 7.31.4 worked and the problem is resolved. Thanks for taking care of this
7.31.3
Not working (as reported in this bug)
7.31.4
Working as expected
Fixes changelog release commit search logic
fix: changelog release commit search logic (#530)
fix: changelog release commit search logic (python-semantic-release#530)
fix: account for trailing newlines in commit messages (python-semanti…