Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add autopush and stable_days to an update.
This commit adds an autopush boolean and stable_days integer to an update. When this boolean is true the approve_testing cronjob will push the update to stable if it has meet the testing requirements (stable_days). stable_days cannot be smaller than the release mandatory_days_in_testing. Signed-off-by: Clement Verna <cverna@tutanota.com>
- Loading branch information
Showing
12 changed files
with
363 additions
and
49 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
67 changes: 67 additions & 0 deletions
67
...server/migrations/versions/b1fd856efcf6_add_autopush_boolean_and_stable_days_to_update.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,67 @@ | ||
# Copyright (c) 2019 | ||
# | ||
# This file is part of Bodhi. | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
""" | ||
Add autopush boolean and stable_days to Update. | ||
Revision ID: b1fd856efcf6 | ||
Revises: 58b7919b942c | ||
Create Date: 2019-03-22 09:51:53.941289 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'b1fd856efcf6' | ||
down_revision = '58b7919b942c' | ||
|
||
|
||
def upgrade(): | ||
"""Add the autopush boolean and stable_days integer to the updates table.""" | ||
# autopush | ||
op.add_column('updates', sa.Column('autopush', sa.Boolean())) | ||
op.execute('UPDATE updates SET autopush=FALSE') | ||
op.alter_column('updates', 'autopush', existing_type=sa.Boolean(), nullable=False) | ||
|
||
# stable_days | ||
op.add_column('updates', sa.Column('stable_days', sa.Integer())) | ||
# set stable_days to 0 for old updates | ||
op.execute( | ||
"UPDATE updates SET stable_days=0 " | ||
"WHERE updates.status IN ('stable', 'obsolete', 'unpushed')" | ||
) | ||
# set stable_days to 7 for non critpath FEDORA updates | ||
op.execute( | ||
"UPDATE updates SET stable_days=7 " | ||
"WHERE updates.status NOT IN ('stable', 'obsolete', 'unpushed')" | ||
"AND updates.critpath = FALSE AND updates.release_id NOT IN (8, 9, 10)" # EPEL releases | ||
) | ||
# set stable_days to 14 for critpath FEDORA updates or EPEL updates. | ||
op.execute( | ||
"UPDATE updates SET stable_days=14 " | ||
"WHERE updates.status NOT IN ('stable', 'obsolete', 'unpushed')" | ||
"AND updates.critpath = TRUE OR updates.release_id IN (8, 9, 10)" # EPEL releases | ||
) | ||
|
||
op.alter_column('updates', 'stable_days', existing_type=sa.Integer(), nullable=False) | ||
|
||
|
||
def downgrade(): | ||
"""Drop the autopush boolean and the stable_days integer from the updates table.""" | ||
op.drop_column('updates', 'autopush') | ||
op.drop_column('updates', 'stable_days') |
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
Oops, something went wrong.