Skip to content

Update Release.save() eol_date logic to handle pre-releases #2016

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

Closed
sarahboyce opened this issue Apr 3, 2025 · 0 comments · Fixed by #2018
Closed

Update Release.save() eol_date logic to handle pre-releases #2016

sarahboyce opened this issue Apr 3, 2025 · 0 comments · Fixed by #2018

Comments

@sarahboyce
Copy link
Contributor

Currently Release.save() has the following:

        # Each micro release EOLs the previous one in the same series.
        if self.status == "f" and self.micro > 0 and self.is_active:
            (
                type(self)
                .objects.filter(
                    major=self.major, minor=self.minor, micro=self.micro - 1, status="f"
                )
                .update(eol_date=self.date)
            )

This sets the previous final release as eol.

We should add handling for the following:

  • The final feature release will make the previous release candidate eol
  • Any further iterations of the release candidate sets the previous iteration as eol
  • The release candidate sets the beta as eol and the beta sets the alpha as eol

Some untested messy logic below for an idea:

        # Each micro release EOLs the previous one in the same series.
        if self.status == "f" and self.micro > 0 and self.is_active:
            (
                type(self)
                .objects.filter(
                    major=self.major, minor=self.minor, micro=self.micro - 1, status="f"
                )
                .update(eol_date=self.date)
            )
        elif self.status == "f" and self.micro == 0 and self.is_active:
            (
                type(self)
                .objects.filter(
                    major=self.major,
                    minor=self.minor,
                    micro=self.micro,
                    status="rc",
                    eol_date__isnull=True,
                )
                .update(eol_date=self.date)
            )
        elif self.iteration > 1 and self.is_active:
            (
                type(self)
                .objects.filter(
                    major=self.major,
                    minor=self.minor,
                    micro=self.micro,
                    status=self.status,
                    iteration=self.iteration - 1,
                )
                .update(eol_date=self.date)
            )
        elif self.status in ["b", "rc"]  and self.is_active:
            previous_status = {"b": "a", "rc": "b"}
            (
                type(self)
                .objects.filter(
                    major=self.major,
                    minor=self.minor,
                    micro=self.micro,
                    status=previous_status[self.status],
                    eol_date__isnull=True,
                )
                .update(eol_date=self.date)
            )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant