adding policy to the tracked image to help with polling

pull/318/head
Karolis Rusenas 2018-11-30 22:47:54 +00:00
parent aa932d748b
commit 23f262f9b2
2 changed files with 14 additions and 12 deletions

View File

@ -22,12 +22,15 @@ type TrackedImage struct {
Meta map[string]string // metadata supplied by providers
// a list of pre-release tags, ie: 1.0.0-dev, 1.5.0-prod get translated into
// dev, prod
// SemverPreReleaseTags []string
SemverPreReleaseTags map[string]string
// combined semver tags
Tags []string
Tags []string
Policy Policy
}
type Policy interface {
ShouldUpdate(current, new string) (bool, error)
}
func (i TrackedImage) String() string {
return fmt.Sprintf("namespace:%s,image:%s:%s,provider:%s,trigger:%s,sched:%s,secrets:%s,semver:%v,tags:%v", i.Namespace, i.Image.Repository(), i.Image.Tag(), i.Provider, i.Trigger, i.PollSchedule, i.Secrets, i.SemverPreReleaseTags, i.Tags)
return fmt.Sprintf("namespace:%s,image:%s:%s,provider:%s,trigger:%s,sched:%s,secrets:%s", i.Namespace, i.Image.Repository(), i.Image.Tag(), i.Provider, i.Trigger, i.PollSchedule, i.Secrets)
}

View File

@ -88,13 +88,12 @@ func GetTrackedImage(i string) *types.TrackedImage {
panic(err)
}
return &types.TrackedImage{
Image: ref,
PollSchedule: "",
Trigger: types.TriggerTypeDefault,
Provider: "",
Namespace: "",
Meta: make(map[string]string),
SemverPreReleaseTags: make(map[string]string),
Tags: []string{ref.Tag()},
Image: ref,
PollSchedule: "",
Trigger: types.TriggerTypeDefault,
Provider: "",
Namespace: "",
Meta: make(map[string]string),
Tags: []string{ref.Tag()},
}
}