imageupdate

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: BSD-3-Clause Imports: 47 Imported by: 0

Documentation

Overview

Package imageupdate owns image update checks, persistence, and HTTP routes.

Index

Constants

View Source
const (
	UpdateTypeDigest    = "digest"
	UpdateTypeTag       = "tag"
	UpdateTypeLocal     = "local"
	UpdateTypeNotPulled = "not_pulled"
)

Variables

This section is empty.

Functions

func RegisterImageUpdates

func RegisterImageUpdates(api huma.API, imageUpdateSvc *ImageUpdateService, getUpdateInfoByImageRefs func(context.Context, []string) (map[string]*imagetypes.UpdateInfo, error), appCtx handlerutil.ActivityAppContext)

RegisterImageUpdates registers image update endpoints.

Types

type CheckAllImagesInput

type CheckAllImagesInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	Body          imageupdate.CheckAllImagesRequest
}

type CheckAllImagesOutput

type CheckAllImagesOutput struct {
	Body base.ApiResponse[imageupdate.BatchResponse]
}

type CheckImageUpdateByIDInput

type CheckImageUpdateByIDInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	ImageID       string `path:"imageId" doc:"Image ID"`
}

type CheckImageUpdateByIDOutput

type CheckImageUpdateByIDOutput struct {
	Body base.ApiResponse[imageupdate.Response]
}

type CheckImageUpdateInput

type CheckImageUpdateInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	ImageRef      string `query:"imageRef" doc:"Image reference"`
}

type CheckImageUpdateOutput

type CheckImageUpdateOutput struct {
	Body base.ApiResponse[imageupdate.Response]
}

type CheckMultipleImagesInput

type CheckMultipleImagesInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	Body          imageupdate.BatchImageUpdateRequest
}

type CheckMultipleImagesOutput

type CheckMultipleImagesOutput struct {
	Body base.ApiResponse[imageupdate.BatchResponse]
}

type Dependencies

type Dependencies struct {
	GetUpdateInfoByImageRefs func(context.Context, []string) (map[string]*imagetypes.UpdateInfo, error)
}

type GetUpdateInfoByRefsInput

type GetUpdateInfoByRefsInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
	ImageRefs     string `query:"imageRefs" doc:"Comma-separated image references"`
}

type GetUpdateInfoByRefsOutput

type GetUpdateInfoByRefsOutput struct {
	Body base.ApiResponse[map[string]*imagetypes.UpdateInfo]
}

type GetUpdateSummaryInput

type GetUpdateSummaryInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
}

type GetUpdateSummaryOutput

type GetUpdateSummaryOutput struct {
	Body base.ApiResponse[imageupdate.Summary]
}

type ImageParts

type ImageParts struct {
	Registry   string
	Repository string
	Tag        string
}

type ImageUpdate added in v2.8.1

type ImageUpdate struct {
	HasUpdate      bool   `json:"hasUpdate"`
	UpdateType     string `json:"updateType"`
	CurrentVersion string `json:"currentVersion"`
	LatestVersion  string `json:"latestVersion,omitempty"`
	CheckTime      string `json:"checkTime"`
}

type ImageUpdateHandler

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

func (*ImageUpdateHandler) CheckAllImages

func (*ImageUpdateHandler) CheckImageUpdate

func (*ImageUpdateHandler) CheckImageUpdateByID

func (*ImageUpdateHandler) CheckMultipleImages

func (*ImageUpdateHandler) GetUpdateInfoByRefs

func (*ImageUpdateHandler) GetUpdateSummary

type ImageUpdateRecord added in v2.8.1

type ImageUpdateRecord struct {
	database.BaseModel

	CheckTime        time.Time `json:"checkTime" gorm:"column:check_time"`
	LatestVersion    *string   `json:"latestVersion,omitempty" gorm:"column:latest_version"`
	CurrentDigest    *string   `json:"currentDigest,omitempty" gorm:"column:current_digest"`
	LatestDigest     *string   `json:"latestDigest,omitempty" gorm:"column:latest_digest"`
	LastError        *string   `json:"lastError,omitempty" gorm:"column:last_error"`
	AuthMethod       *string   `json:"authMethod,omitempty" gorm:"column:auth_method"`
	AuthUsername     *string   `json:"authUsername,omitempty" gorm:"column:auth_username"`
	AuthRegistry     *string   `json:"authRegistry,omitempty" gorm:"column:auth_registry"`
	ID               string    `json:"id" gorm:"primaryKey;type:text"`
	Repository       string    `json:"repository"`
	Tag              string    `json:"tag"`
	UpdateType       string    `json:"updateType" gorm:"column:update_type"`
	CurrentVersion   string    `json:"currentVersion" gorm:"column:current_version"`
	ResponseTimeMs   int       `json:"responseTimeMs" gorm:"column:response_time_ms"`
	HasUpdate        bool      `json:"hasUpdate" gorm:"column:has_update"`
	UsedCredential   bool      `json:"usedCredential,omitempty" gorm:"column:used_credential"`
	NotificationSent bool      `json:"notificationSent" gorm:"column:notification_sent;default:false"`
}

func (*ImageUpdateRecord) IsDigestUpdate added in v2.8.1

func (i *ImageUpdateRecord) IsDigestUpdate() bool

func (*ImageUpdateRecord) IsTagUpdate added in v2.8.1

func (i *ImageUpdateRecord) IsTagUpdate() bool

func (*ImageUpdateRecord) NeedsUpdate added in v2.8.1

func (i *ImageUpdateRecord) NeedsUpdate() bool

func (*ImageUpdateRecord) TableName added in v2.8.1

func (i *ImageUpdateRecord) TableName() string

type ImageUpdateService

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

func NewImageUpdateService

func NewImageUpdateService(db *database.DB, settingsService *settings.SettingsService, registryService *registry.ContainerRegistryService, dockerService *docker.DockerClientService, eventService *event.EventService, notificationService *notification.NotificationService, activityService *activity.ActivityService) *ImageUpdateService

func (*ImageUpdateService) CheckAllImages

func (s *ImageUpdateService) CheckAllImages(ctx context.Context, limit int, externalCreds []containerregistry.Credential) (map[string]*imageupdate.Response, error)

func (*ImageUpdateService) CheckImageUpdate

func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef string) (*imageupdate.Response, error)

func (*ImageUpdateService) CheckImageUpdateByID

func (s *ImageUpdateService) CheckImageUpdateByID(ctx context.Context, imageID string) (*imageupdate.Response, error)

func (*ImageUpdateService) CheckMultipleImages

func (s *ImageUpdateService) CheckMultipleImages(ctx context.Context, imageRefs []string, externalCreds []containerregistry.Credential) (results map[string]*imageupdate.Response, err error)

func (*ImageUpdateService) CleanupOrphanedRecords

func (s *ImageUpdateService) CleanupOrphanedRecords(ctx context.Context) error

func (*ImageUpdateService) GetUnnotifiedUpdates

func (s *ImageUpdateService) GetUnnotifiedUpdates(ctx context.Context) (map[string]*ImageUpdateRecord, error)

GetUnnotifiedUpdates returns a map of image IDs that have updates but haven't been notified yet

func (*ImageUpdateService) GetUpdateSummary

func (s *ImageUpdateService) GetUpdateSummary(ctx context.Context) (*imageupdate.Summary, error)

func (*ImageUpdateService) MarkImageRefUpToDateAfterPull

func (s *ImageUpdateService) MarkImageRefUpToDateAfterPull(ctx context.Context, imageRef string) error

func (*ImageUpdateService) MarkUpdatesAsNotified

func (s *ImageUpdateService) MarkUpdatesAsNotified(ctx context.Context, imageIDs []string) error

MarkUpdatesAsNotified marks the given image IDs as having been notified

func (*ImageUpdateService) SendBatchUpdateNotifications

func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context)

func (*ImageUpdateService) StoredUpdateByImageID

func (s *ImageUpdateService) StoredUpdateByImageID(ctx context.Context, imageID string) (*ImageUpdateRecord, bool, error)

type Module

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

func New

func New(service *ImageUpdateService, deps Dependencies) *Module

func (*Module) RegisterRoutes

func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext)

func (*Module) Service

func (m *Module) Service() *ImageUpdateService

Jump to

Keyboard shortcuts

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