deployment_repo

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeploymentRepository

type DeploymentRepository struct {
	// contains filtered or unexported fields
}

DeploymentRepository handles GitHub-related database operations

func NewDeploymentRepository

func NewDeploymentRepository(db *ent.Client) *DeploymentRepository

NewDeploymentRepository creates a new repository

func (*DeploymentRepository) AssignKubernetesJobName

func (self *DeploymentRepository) AssignKubernetesJobName(ctx context.Context, deploymentID uuid.UUID, jobName string) (*ent.Deployment, error)

Assigns the kubernetes "Job" name to the build job

func (*DeploymentRepository) AttachDeploymentMetadata

func (self *DeploymentRepository) AttachDeploymentMetadata(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, imageName string, resourceDefinition *v1.Service) (*ent.Deployment, error)

func (*DeploymentRepository) Create

func (self *DeploymentRepository) Create(ctx context.Context,
	tx repository.TxInterface,
	serviceID uuid.UUID,
	CommitSHA,
	CommitMessage string,
	committer *schema.GitCommitter,
	source schema.DeploymentSource,
	initialStatus schema.DeploymentStatus) (*ent.Deployment, error)

func (*DeploymentRepository) CreateCopy

func (self *DeploymentRepository) CreateCopy(ctx context.Context, tx repository.TxInterface, deployment *ent.Deployment) (*ent.Deployment, error)

Create a copy with all metadata, except for failed_at, completed_at, and status

func (*DeploymentRepository) ExistsInEnvironment

func (self *DeploymentRepository) ExistsInEnvironment(ctx context.Context, deploymentID uuid.UUID, environmentID uuid.UUID) (bool, error)

func (*DeploymentRepository) ExistsInProject

func (self *DeploymentRepository) ExistsInProject(ctx context.Context, deploymentID uuid.UUID, projectID uuid.UUID) (bool, error)

func (*DeploymentRepository) ExistsInTeam

func (self *DeploymentRepository) ExistsInTeam(ctx context.Context, deploymentID uuid.UUID, teamID uuid.UUID) (bool, error)

func (*DeploymentRepository) GetByID

func (self *DeploymentRepository) GetByID(ctx context.Context, deploymentID uuid.UUID) (*ent.Deployment, error)

func (*DeploymentRepository) GetByServiceIDPaginated

func (self *DeploymentRepository) GetByServiceIDPaginated(ctx context.Context, serviceID uuid.UUID, perPage int, cursor *time.Time, statusFilter []schema.DeploymentStatus) (jobs []*ent.Deployment, nextCursor *time.Time, err error)

func (*DeploymentRepository) GetJobsByStatus

func (self *DeploymentRepository) GetJobsByStatus(ctx context.Context, status schema.DeploymentStatus) ([]*ent.Deployment, error)

func (*DeploymentRepository) GetLastSuccessfulDeployment

func (self *DeploymentRepository) GetLastSuccessfulDeployment(ctx context.Context, serviceID uuid.UUID) (*ent.Deployment, error)

func (*DeploymentRepository) MarkAsCancelled

func (self *DeploymentRepository) MarkAsCancelled(ctx context.Context, jobIDs []uuid.UUID) error

Mark cancelled by IDs

func (*DeploymentRepository) MarkCancelledExcept

func (self *DeploymentRepository) MarkCancelledExcept(ctx context.Context, serviceID uuid.UUID, deploymentID uuid.UUID) error

Cancels all jobs that are not in a finished state

func (*DeploymentRepository) MarkFailed

func (self *DeploymentRepository) MarkFailed(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, message string, failedAt time.Time) (*ent.Deployment, error)

func (*DeploymentRepository) MarkQueued

func (self *DeploymentRepository) MarkQueued(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, queuedAt time.Time) (*ent.Deployment, error)

func (*DeploymentRepository) MarkStarted

func (self *DeploymentRepository) MarkStarted(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, startedAt time.Time) (*ent.Deployment, error)

func (*DeploymentRepository) MarkSucceeded

func (self *DeploymentRepository) MarkSucceeded(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, completedAt time.Time) (*ent.Deployment, error)

func (*DeploymentRepository) SetKubernetesJobStatus

func (self *DeploymentRepository) SetKubernetesJobStatus(ctx context.Context, deploymentID uuid.UUID, status string) (*ent.Deployment, error)

type DeploymentRepositoryInterface

type DeploymentRepositoryInterface interface {
	Create(ctx context.Context, tx repository.TxInterface, serviceID uuid.UUID, CommitSHA, CommitMessage string, committer *schema.GitCommitter, source schema.DeploymentSource, initialStatus schema.DeploymentStatus) (*ent.Deployment, error)
	MarkQueued(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, queuedAt time.Time) (*ent.Deployment, error)
	MarkStarted(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, startedAt time.Time) (*ent.Deployment, error)
	MarkFailed(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, message string, failedAt time.Time) (*ent.Deployment, error)
	MarkSucceeded(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, completedAt time.Time) (*ent.Deployment, error)
	// Cancels all jobs that are not in a finished state
	MarkCancelledExcept(ctx context.Context, serviceID uuid.UUID, deploymentID uuid.UUID) error
	// Mark cancelled by IDs
	MarkAsCancelled(ctx context.Context, jobIDs []uuid.UUID) error
	// Assigns the kubernetes "Job" name to the build job
	AssignKubernetesJobName(ctx context.Context, deploymentID uuid.UUID, jobName string) (*ent.Deployment, error)
	SetKubernetesJobStatus(ctx context.Context, deploymentID uuid.UUID, status string) (*ent.Deployment, error)
	AttachDeploymentMetadata(ctx context.Context, tx repository.TxInterface, deploymentID uuid.UUID, imageName string, resourceDefinition *v1.Service) (*ent.Deployment, error)
	// Create a copy with all metadata, except for failed_at, completed_at, and status
	CreateCopy(ctx context.Context, tx repository.TxInterface, deployment *ent.Deployment) (*ent.Deployment, error)
	GetByID(ctx context.Context, deploymentID uuid.UUID) (*ent.Deployment, error)
	ExistsInEnvironment(ctx context.Context, deploymentID uuid.UUID, environmentID uuid.UUID) (bool, error)
	ExistsInProject(ctx context.Context, deploymentID uuid.UUID, projectID uuid.UUID) (bool, error)
	ExistsInTeam(ctx context.Context, deploymentID uuid.UUID, teamID uuid.UUID) (bool, error)
	GetLastSuccessfulDeployment(ctx context.Context, serviceID uuid.UUID) (*ent.Deployment, error)
	GetJobsByStatus(ctx context.Context, status schema.DeploymentStatus) ([]*ent.Deployment, error)
	GetByServiceIDPaginated(ctx context.Context, serviceID uuid.UUID, perPage int, cursor *time.Time, statusFilter []schema.DeploymentStatus) (jobs []*ent.Deployment, nextCursor *time.Time, err error)
}

DeploymentRepositoryInterface ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL