-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend: automatically EOL lifeless rolling chroots
Implements: https://github.com/fedora-copr/debate/blob/main/2024-04-23-rawhide-chroots-eol.md Fixes: #2933
- Loading branch information
Showing
12 changed files
with
152 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
frontend/coprs_frontend/alembic/versions/d23f84f87130_eol_rolling_builds.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
record last copr_chroot build, allow marking Rawhide as rolling | ||
Create Date: 2024-05-13 08:56:31.557843 | ||
""" | ||
|
||
import time | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.sql import text | ||
|
||
revision = 'd23f84f87130' | ||
down_revision = '41763f7a5185' | ||
|
||
def upgrade(): | ||
op.add_column('mock_chroot', sa.Column('rolling', sa.Boolean(), nullable=True)) | ||
op.add_column('copr_chroot', sa.Column('last_build_timestamp', sa.Integer(), nullable=True)) | ||
conn = op.get_bind() | ||
conn.execute( | ||
text("update copr_chroot set last_build_timestamp = :start_stamp;"), | ||
{"start_stamp": int(time.time())}, | ||
) | ||
op.create_index('copr_chroot_rolling_last_build_idx', 'copr_chroot', | ||
['mock_chroot_id', 'last_build_timestamp', 'delete_after'], | ||
unique=False) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index('copr_chroot_rolling_last_build_idx', table_name='copr_chroot') | ||
op.drop_column('copr_chroot', 'last_build_timestamp') | ||
op.drop_column('mock_chroot', 'rolling') |
14 changes: 14 additions & 0 deletions
14
frontend/coprs_frontend/commands/eol_lifeless_rolling_chroots.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
copr-frontend eol-lifeless-rolling-chroots command | ||
""" | ||
|
||
import click | ||
from coprs.logic.outdated_chroots_logic import OutdatedChrootsLogic | ||
|
||
@click.command() | ||
def eol_lifeless_rolling_chroots(): | ||
""" | ||
Go through all rolling CoprChroots and check whether they shouldn't be | ||
scheduled for future removal. | ||
""" | ||
OutdatedChrootsLogic.trigger_rolling_eol_policy() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters