mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 23:51:27 +01:00
commit
32a2c41c3b
@ -14,7 +14,7 @@ const (
|
||||
idParam = ":id"
|
||||
)
|
||||
|
||||
// ChartLabelAPI handles the requests of marking/removing lables to/from charts.
|
||||
// ChartLabelAPI handles the requests of marking/removing labels to/from charts.
|
||||
type ChartLabelAPI struct {
|
||||
LabelResourceAPI
|
||||
project *models.Project
|
||||
|
@ -269,7 +269,7 @@ func (cra *ChartRepositoryAPI) DeleteChartVersion() {
|
||||
chartName := cra.GetStringFromPath(nameParam)
|
||||
version := cra.GetStringFromPath(versionParam)
|
||||
|
||||
// Try to remove labels from deleting chart if exitsing
|
||||
// Try to remove labels from deleting chart if existing
|
||||
if err := cra.removeLabelsFromChart(chartName, version); err != nil {
|
||||
cra.SendInternalServerError(err)
|
||||
return
|
||||
@ -408,7 +408,7 @@ func (cra *ChartRepositoryAPI) DeleteChart() {
|
||||
}
|
||||
|
||||
func (cra *ChartRepositoryAPI) removeLabelsFromChart(chartName, version string) error {
|
||||
// Try to remove labels from deleting chart if exitsing
|
||||
// Try to remove labels from deleting chart if existing
|
||||
resourceID := chartFullName(cra.namespace, chartName, version)
|
||||
labels, err := cra.labelManager.GetLabelsOfResource(common.ResourceTypeChart, resourceID)
|
||||
if err == nil && len(labels) > 0 {
|
||||
@ -432,7 +432,7 @@ func (cra *ChartRepositoryAPI) requireNamespace(namespace string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
existsing, err := cra.ProjectMgr.Exists(namespace)
|
||||
existing, err := cra.ProjectMgr.Exists(namespace)
|
||||
if err != nil {
|
||||
// Check failed with error
|
||||
cra.SendInternalServerError(fmt.Errorf("failed to check existence of namespace %s with error: %s", namespace, err.Error()))
|
||||
@ -440,7 +440,7 @@ func (cra *ChartRepositoryAPI) requireNamespace(namespace string) bool {
|
||||
}
|
||||
|
||||
// Not existing
|
||||
if !existsing {
|
||||
if !existing {
|
||||
cra.SendBadRequestError(fmt.Errorf("namespace %s is not existing", namespace))
|
||||
return false
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func (l *LabelAPI) Prepare() {
|
||||
if method == http.MethodPut || method == http.MethodDelete {
|
||||
id, err := l.GetInt64FromPath(":id")
|
||||
if err != nil || id <= 0 {
|
||||
l.SendBadRequestError(errors.New("invalid lable ID"))
|
||||
l.SendBadRequestError(errors.New("invalid label ID"))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ type QuotaMigrator interface {
|
||||
// Usage computes the quota usage of all the projects
|
||||
Usage([]ProjectInfo) ([]ProjectUsage, error)
|
||||
|
||||
// Persist record the data to DB, artifact, artifact_blob and blob tabel.
|
||||
// Persist record the data to DB, artifact, artifact_blob and blob table.
|
||||
Persist([]ProjectInfo) error
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ func (ra *RepositoryAPI) Delete() {
|
||||
}
|
||||
log.Debugf("Tag: %s, digest: %s", t, digest)
|
||||
if _, ok := signedTags[digest]; ok {
|
||||
log.Errorf("Found signed tag, repostory: %s, tag: %s, deletion will be canceled", repoName, t)
|
||||
log.Errorf("Found signed tag, repository: %s, tag: %s, deletion will be canceled", repoName, t)
|
||||
ra.SendPreconditionFailedError(fmt.Errorf("tag %s is signed", t))
|
||||
return
|
||||
}
|
||||
@ -882,7 +882,7 @@ func getManifest(client *registry.Repository,
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GetTopRepos returns the most populor repositories
|
||||
// GetTopRepos returns the most popular repositories
|
||||
func (ra *RepositoryAPI) GetTopRepos() {
|
||||
count, err := ra.GetInt("count", 10)
|
||||
if err != nil || count <= 0 {
|
||||
|
@ -235,7 +235,7 @@ func getClairVulnStatus() *models.ClairVulnerabilityStatus {
|
||||
m := make(map[string]int64)
|
||||
for _, e := range l {
|
||||
ns := strings.Split(e.Namespace, ":")
|
||||
// only returns the latest time of one distro, i.e. unbuntu:14.04 and ubuntu:15.4 shares one timestamp
|
||||
// only returns the latest time of one distro, i.e. ubuntu:14.04 and ubuntu:15.4 shares one timestamp
|
||||
el := e.LastUpdate.UTC().Unix()
|
||||
if ts, ok := m[ns[0]]; !ok || ts < el {
|
||||
m[ns[0]] = el
|
||||
|
@ -8,7 +8,7 @@ type NotificationHandler interface {
|
||||
Handle(value interface{}) error
|
||||
|
||||
// IsStateful returns whether the handler is stateful or not.
|
||||
// If handler is stateful, it will not be triggerred in parallel.
|
||||
// If handler is stateful, it will not be triggered in parallel.
|
||||
// Otherwise, the handler will be triggered concurrently if more
|
||||
// than one same handler are matched the topics.
|
||||
IsStateful() bool
|
||||
|
@ -26,7 +26,7 @@ type ProjectMetadataManager interface {
|
||||
Add(projectID int64, meta map[string]string) error
|
||||
// Delete metadatas whose keys are specified in parameter meta, if it
|
||||
// is absent, delete all
|
||||
Delete(projecdtID int64, meta ...string) error
|
||||
Delete(projectID int64, meta ...string) error
|
||||
// Update metadatas
|
||||
Update(projectID int64, meta map[string]string) error
|
||||
// Get metadatas whose keys are specified in parameter meta, if it is
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"github.com/goharbor/harbor/src/core/promgr/pmsdriver"
|
||||
)
|
||||
|
||||
// ProjectManager is the project mamager which abstracts the operations related
|
||||
// ProjectManager is the project manager which abstracts the operations related
|
||||
// to projects
|
||||
type ProjectManager interface {
|
||||
Get(projectIDOrName interface{}) (*models.Project, error)
|
||||
|
@ -35,7 +35,7 @@ var statusMap = map[string]string{
|
||||
job.JobServiceStatusScheduled: models.JobScheduled,
|
||||
}
|
||||
|
||||
// Handler handles reqeust on /service/notifications/jobs/adminjob/*, which listens to the webhook of jobservice.
|
||||
// Handler handles request on /service/notifications/jobs/adminjob/*, which listens to the webhook of jobservice.
|
||||
type Handler struct {
|
||||
api.BaseController
|
||||
id int64
|
||||
|
@ -42,7 +42,7 @@ var statusMap = map[string]string{
|
||||
job.JobServiceStatusSuccess: models.JobFinished,
|
||||
}
|
||||
|
||||
// Handler handles reqeust on /service/notifications/jobs/*, which listens to the webhook of jobservice.
|
||||
// Handler handles request on /service/notifications/jobs/*, which listens to the webhook of jobservice.
|
||||
type Handler struct {
|
||||
api.BaseController
|
||||
id int64
|
||||
|
@ -29,7 +29,7 @@ type Handler struct {
|
||||
|
||||
// Get handles GET request, it checks the http header for user credentials
|
||||
// and parse service and scope based on docker registry v2 standard,
|
||||
// checkes the permission against local DB and generates jwt token.
|
||||
// checks the permission against local DB and generates jwt token.
|
||||
func (h *Handler) Get() {
|
||||
request := h.Ctx.Request
|
||||
log.Debugf("URL for token request: %s", request.URL.String())
|
||||
|
@ -59,7 +59,7 @@ func newRepositoryClient(endpoint, username, repository string) (*registry.Repos
|
||||
return registry.NewRepository(repository, endpoint, client)
|
||||
}
|
||||
|
||||
// WaitForManifestReady implements exponential sleeep to wait until manifest is ready in registry.
|
||||
// WaitForManifestReady implements exponential sleep to wait until manifest is ready in registry.
|
||||
// This is a workaround for https://github.com/docker/distribution/issues/2625
|
||||
func WaitForManifestReady(repository string, tag string, maxRetry int) bool {
|
||||
// The initial wait interval, hard-coded to 80ms, interval will be 80ms,200ms,500ms,1.25s,3.124999936s
|
||||
|
Loading…
Reference in New Issue
Block a user