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

Unclear how to release a patch of an old version #861

Open
silverjam opened this issue Mar 15, 2024 · 5 comments
Open

Unclear how to release a patch of an old version #861

silverjam opened this issue Mar 15, 2024 · 5 comments
Labels
bug Something isn't working properly confirmed Prevent from becoming stale

Comments

@silverjam
Copy link

silverjam commented Mar 15, 2024

I wasn't able to find a forum for general questions, so if there's a better place to ask general support questions... please let me know.

That said, I am trying to understand how we would configure python-semantic-release to enable us to release a patch version or hotfix of an old version. In our code base we have versions like 0.2.11 and 0.15.12 -- if we currently have 0.2.11 pushed to a production environment and need to release a patch (or hotfix) version (for example 0.2.12 or 0.2.12-hotfix.1 if attempting a "prerelease") when using python-semantic-version it seems to want the next release to be 0.15.13.

In this scenario we've created a branch from an old version of our main branch where the last tagged version is 0.2.11 -- so the "next" release we'd expect is 0.2.12 or 0.2.12-hotfix.1.

Is there a pattern or path where we could implement our expected behavior? Thanks!

@codejedi365
Copy link
Contributor

This is definitely supposed to be a supported ability via release branches but I do believe there likely is a bug with tag resolution that I haven't been able to solve yet.

@codejedi365
Copy link
Contributor

codejedi365 commented Mar 16, 2024

I wasn't able to find a forum for general questions, so if there's a better place to ask general support questions

This is the correct location for general support questions as of now.

In this scenario we've created a branch from an old version of our main branch where the last tagged version is 0.2.11 -- so the "next" release we'd expect is 0.2.12 or 0.2.12-hotfix.1.

Is there a pattern or path where we could implement our expected behavior? Thanks!

I have simulated your scenario as much as I understood and PSR will provide 0.2.12 if the configuration has prerelease = False. If prerelease is set to true, it does jump to 0.15.12 as the base version to increment from. I think latter section is a bug but I will have to apply further testing.

The configuration concept I used is documented under the Mulitbranch releases section of the documentation. In your case, you are creating a second non-prerelease channel for the special release branch that will diverge from the original history.

# pyproject.toml

[tool.semantic_release.branches.main]
match = '(master|main)'
prerelease = false

[tool.semantic_release.branches."0.2.x"]
match = "0.2.x"
prerelease = false

This image below was the truncated git history that I generated to test your scenario.

Screen Shot 2024-03-16 at 11 21 25 AM

When I execute the following command with the 0.2.x branch checked out, I get 0.2.12 as the next version to release.

semantic-release version --print
# 0.2.12

If this does not work in your scenario, please provide some detail on your merging/branching strategy or a log of your git history in graph format (git log --graph --decorate --oneline --all --topo-order) to help me create a more accurate representation.

@silverjam
Copy link
Author

I wasn't able to find a forum for general questions, so if there's a better place to ask general support questions

This is the correct location for general support questions as of now.

In this scenario we've created a branch from an old version of our main branch where the last tagged version is 0.2.11 -- so the "next" release we'd expect is 0.2.12 or 0.2.12-hotfix.1.
Is there a pattern or path where we could implement our expected behavior? Thanks!

I have simulated your scenario as much as I understood and PSR will provide 0.2.12 if the configuration has prerelease = False. If prerelease is set to true, it does jump to 0.15.12 as the base version to increment from. I think latter section is a bug but I will have to apply further testing.

Ok, I didn't try without prerelease so this is likely the issue.

The configuration concept I used is documented under the Mulitbranch releases section of

Thanks, this looks similar to https://semantic-release.gitbook.io/semantic-release/recipes/release-workflow/maintenance-releases

@codejedi365
Copy link
Contributor

codejedi365 commented Mar 17, 2024

Thanks, this looks similar to https://semantic-release.gitbook.io/semantic-release/recipes/release-workflow/maintenance-releases

This is not the correct documentation. The link above is for the JavaScript variant of semantic-release which is similar but not this project's docs.

Correct Link: Multibranch Releases

codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Mar 18, 2024
refactor duplicate logging messages and flow to process out odd cases
in a fail fast methodology. This removes the reliance on any last full
release that is not within the history of the current branch.

Resolves: python-semantic-release#861
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Mar 19, 2024
refactor duplicate logging messages and flow to process out odd cases
in a fail fast methodology. This removes the reliance on any last full
release that is not within the history of the current branch.

Resolves: python-semantic-release#861
@silverjam
Copy link
Author

Thanks, this looks similar to https://semantic-release.gitbook.io/semantic-release/recipes/release-workflow/maintenance-releases

This is not the correct documentation. The link above is for the JavaScript variant of semantic-release which is similar but not this project's docs.

Correct Link: Multibranch Releases

Yes I realize that, apologies, I was referencing that doc as an example of what I was trying to accomplish-- the multibranch release doc is similar, but the nodejs version matched our exact use case more closely.

codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Mar 21, 2024
refactor duplicate logging messages and flow to process out odd cases
in a fail fast methodology. This removes the reliance on any last full
release that is not within the history of the current branch.

Resolves: python-semantic-release#861
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Mar 22, 2024
refactor duplicate logging messages and flow to process out odd cases
in a fail fast methodology. This removes the reliance on any last full
release that is not within the history of the current branch.

Resolves: python-semantic-release#861
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 14, 2024
refactor duplicate logging messages and flow to process out odd cases
in a fail fast methodology. This removes the reliance on any last full
release that is not within the history of the current branch.

Resolves: python-semantic-release#861
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue Apr 20, 2024
refactor duplicate logging messages and flow to process out odd cases
in a fail fast methodology. This removes the reliance on any last full
release that is not within the history of the current branch.

Resolves: python-semantic-release#861
@codejedi365 codejedi365 added bug Something isn't working properly confirmed Prevent from becoming stale labels May 6, 2024
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 18, 2024
refactor duplicate logging messages and flow to process out odd cases
in a fail fast methodology. This removes the reliance on any last full
release that is not within the history of the current branch.

Resolves: python-semantic-release#861
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly confirmed Prevent from becoming stale
Projects
None yet
Development

No branches or pull requests

2 participants