Documentation ¶
Overview ¶
Package utils contains methods to support security, cache, and webhook functions.
Package utils contains methods to support security, cache, and webhook functions.
Index ¶
- func GetJobServiceClient() job.Client
- func NewRepositoryClientForUI(username, repository string) (*registry.Repository, error)
- func Retag(srcImage, destImage *models.Image) error
- func ScanAllImages() error
- func ScheduleScanAllImages(cron string) error
- func TriggerImageScan(repository string, tag string) error
- func WaitForManifestReady(repository string, tag string, maxRetry int) bool
- func WrapError(err error) error
- func WrapErrorMessage(msg string) string
- type JobLogRespHandler
- type ResponseHandler
- type StatusRespHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJobServiceClient ¶
GetJobServiceClient returns the job service client instance.
func NewRepositoryClientForUI ¶
func NewRepositoryClientForUI(username, repository string) (*registry.Repository, error)
NewRepositoryClientForUI creates a repository client that can only be used to access the internal registry 用来访问内部的 registry
func ScanAllImages ¶
func ScanAllImages() error
ScanAllImages scans all images of Harbor by submiting a scan all job to jobservice, and the job handler will call API on the "core" service 镜像扫描的任务首先提交给 jobservice 组件进行处理,然后 jobservice handler 将会调用 core 中对应的 API 执行具体的操作。
func ScheduleScanAllImages ¶
ScheduleScanAllImages will schedule a scan all job based on the cron string, add append a record in admin job table. 根据 cron 对扫描计划进行调度
func TriggerImageScan ¶
TriggerImageScan triggers an image scan job on jobservice.
func WaitForManifestReady ¶
WaitForManifestReady implements exponential sleeep to wait until manifest is ready in registry. This is a workaround for https://github.com/docker/distribution/issues/2625
func WrapError ¶
WrapError wraps the error to the well formated error `{ "error": "The error message" }`
func WrapErrorMessage ¶
WrapErrorMessage wraps the error msg to the well formated error message `{ "error": "The error message" }`
Types ¶
type JobLogRespHandler ¶
type JobLogRespHandler struct {
// contains filtered or unexported fields
}
JobLogRespHandler handles the response from jobservice to show the log of a job
type ResponseHandler ¶
ResponseHandler provides utility to handle http response.
func NewJobLogRespHandler ¶
func NewJobLogRespHandler(apiHandler *api.BaseAPI) ResponseHandler
NewJobLogRespHandler ...
func NewStatusRespHandler ¶
func NewStatusRespHandler(sc int) ResponseHandler
NewStatusRespHandler ...
type StatusRespHandler ¶
type StatusRespHandler struct {
// contains filtered or unexported fields
}
StatusRespHandler handles the response to check if the status is expected, if not returns an error.