-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from lsst-sqre/u/jsickcodes/tracked-ref-v2
Add git_ref tracking mode
- Loading branch information
Showing
13 changed files
with
123 additions
and
31 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
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,36 @@ | ||
"""Implements the ``git_refs`` tracking mode.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Optional | ||
|
||
from keeper.editiontracking.base import TrackingModeBase | ||
|
||
if TYPE_CHECKING: | ||
from keeper.models import Build, Edition | ||
|
||
__all__ = ["GitRefsTrackingMode"] | ||
|
||
|
||
class GitRefsTrackingMode(TrackingModeBase): | ||
"""Tracking mode where an edition tracks an array of Git refs. | ||
This is the default mode if Edition.mode is None. | ||
""" | ||
|
||
@property | ||
def name(self) -> str: | ||
return "git_refs" | ||
|
||
def should_update( | ||
self, edition: Optional[Edition], candidate_build: Optional[Build] | ||
) -> bool: | ||
if edition is None or candidate_build is None: | ||
return False | ||
|
||
if (candidate_build.product == edition.product) and ( | ||
candidate_build.git_refs == edition.tracked_refs | ||
): | ||
return True | ||
else: | ||
return False |
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
25 changes: 25 additions & 0 deletions
25
migrations/versions/f8eeb27a49e7_add_edition_tracked_ref_column.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,25 @@ | ||
"""Add Edition tracked_ref column | ||
Revision ID: f8eeb27a49e7 | ||
Revises: febbe2d7e47b | ||
Create Date: 2022-03-19 18:02:05.929442 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "f8eeb27a49e7" | ||
down_revision = "febbe2d7e47b" | ||
|
||
|
||
def upgrade(): | ||
with op.batch_alter_table("editions", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column("tracked_ref", sa.Unicode(length=255), nullable=True) | ||
) | ||
|
||
|
||
def downgrade(): | ||
with op.batch_alter_table("editions", schema=None) as batch_op: | ||
batch_op.drop_column("tracked_ref") |
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