Skip to content

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

Closed
@sarahboyce

Description

@sarahboyce

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)
            )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions