class RepoMirrorConfig(BaseModel):
    """
    Represents a repository to be mirrored and any additional configuration required to perform the
    mirroring.
    """

    repository = ForeignKeyField(Repository, index=True, unique=True, backref="mirror")
    creation_date = DateTimeField(default=datetime.utcnow)
    is_enabled = BooleanField(default=True)

    # Mirror Configuration
    mirror_type = ClientEnumField(RepoMirrorType, default=RepoMirrorType.PULL)
    internal_robot = QuayUserField(
        allows_robots=True, null=True, backref="mirrorpullrobot", robot_null_delete=True
    )
    external_reference = CharField()
    external_registry = CharField()
    external_namespace = CharField()
    external_repository = CharField()
    external_registry_username = EncryptedCharField(max_length=2048, null=True)
    external_registry_password = EncryptedCharField(max_length=2048, null=True)
    external_registry_config = JSONField(default={})

    # Worker Queuing
    sync_interval = IntegerField()  # seconds between syncs
    sync_start_date = DateTimeField(null=True)  # next start time
    sync_expiration_date = DateTimeField(null=True)  # max duration
    sync_retries_remaining = IntegerField(default=3)
    sync_status = ClientEnumField(RepoMirrorStatus, default=RepoMirrorStatus.NEVER_RUN)
    sync_transaction_id = CharField(default=uuid_generator, max_length=36)

    # Tag-Matching Rules
    root_rule = ForeignKeyField(RepoMirrorRule)
Esempio n. 2
0
class RobotAccountToken(BaseModel):
    robot_account = QuayUserField(index=True, allows_robots=True, unique=True)
    token = EncryptedCharField(default_token_length=64)
    fully_migrated = BooleanField(default=False)