using scheme
parent
9507ef5637
commit
53bc2285b2
|
@ -145,8 +145,10 @@ func (w *RepositoryWatcher) Watch(imageName, schedule, registryUsername, registr
|
|||
|
||||
func (w *RepositoryWatcher) addJob(ref *image.Reference, registryUsername, registryPassword, schedule string) error {
|
||||
// getting initial digest
|
||||
reg := ref.Scheme() + "://" + ref.Registry()
|
||||
|
||||
digest, err := w.registryClient.Digest(registry.Opts{
|
||||
Registry: ref.Registry(),
|
||||
Registry: reg,
|
||||
Name: ref.ShortName(),
|
||||
Tag: ref.Tag(),
|
||||
})
|
||||
|
@ -175,6 +177,7 @@ func (w *RepositoryWatcher) addJob(ref *image.Reference, registryUsername, regis
|
|||
log.WithFields(log.Fields{
|
||||
"job_name": key,
|
||||
"image": ref.Remote(),
|
||||
"digest": digest,
|
||||
"schedule": schedule,
|
||||
}).Info("trigger.poll.RepositoryWatcher: new job added")
|
||||
return w.cron.AddJob(key, schedule, job)
|
||||
|
@ -200,8 +203,9 @@ func NewWatchTagJob(providers provider.Providers, registryClient registry.Client
|
|||
|
||||
// Run - main function to check schedule
|
||||
func (j *WatchTagJob) Run() {
|
||||
reg := j.details.imageRef.Scheme() + "://" + j.details.imageRef.Registry()
|
||||
currentDigest, err := j.registryClient.Digest(registry.Opts{
|
||||
Registry: j.details.imageRef.Registry(),
|
||||
Registry: reg,
|
||||
Name: j.details.imageRef.ShortName(),
|
||||
Tag: j.details.imageRef.Tag(),
|
||||
})
|
||||
|
@ -214,6 +218,12 @@ func (j *WatchTagJob) Run() {
|
|||
return
|
||||
}
|
||||
|
||||
log.WithFields(log.Fields{
|
||||
"current_digest": j.details.digest,
|
||||
"new_digest": currentDigest,
|
||||
"image_name": j.details.imageRef.Remote(),
|
||||
}).Info("trigger.poll.WatchTagJob: checking digest")
|
||||
|
||||
// checking whether image digest has changed
|
||||
if j.details.digest != currentDigest {
|
||||
// updating digest
|
||||
|
@ -227,6 +237,7 @@ func (j *WatchTagJob) Run() {
|
|||
},
|
||||
TriggerName: types.TriggerTypePoll.String(),
|
||||
}
|
||||
log.Info("trigger.poll.WatchTagJob: digest change detected, submiting event to providers")
|
||||
|
||||
j.providers.Submit(event)
|
||||
|
||||
|
|
|
@ -13,13 +13,13 @@ const (
|
|||
// DefaultTag defines the default tag used when performing images related actions and no tag or digest is specified
|
||||
DefaultTag = "latest"
|
||||
// DefaultHostname is the default built-in hostname
|
||||
DefaultHostname = "docker.io"
|
||||
DefaultHostname = "index.docker.io"
|
||||
|
||||
// DefaultScheme is default scheme for registries
|
||||
DefaultScheme = "https"
|
||||
|
||||
// LegacyDefaultHostname is automatically converted to DefaultHostname
|
||||
LegacyDefaultHostname = "index.docker.io"
|
||||
// // LegacyDefaultHostname is automatically converted to DefaultHostname
|
||||
// LegacyDefaultHostname = "index.docker.io"
|
||||
// DefaultRepoPrefix is the prefix used for default repositories in default host
|
||||
DefaultRepoPrefix = "library/"
|
||||
)
|
||||
|
@ -180,9 +180,9 @@ func splitHostname(name string) (hostname, remoteName string) {
|
|||
} else {
|
||||
hostname, remoteName = name[:i], name[i+1:]
|
||||
}
|
||||
if hostname == LegacyDefaultHostname {
|
||||
hostname = DefaultHostname
|
||||
}
|
||||
// if hostname == LegacyDefaultHostname {
|
||||
// hostname = DefaultHostname
|
||||
// }
|
||||
if hostname == DefaultHostname && !strings.ContainsRune(remoteName, '/') {
|
||||
remoteName = DefaultRepoPrefix + remoteName
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue