mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 13:23:09 +01:00
More explicit massage if manifest not found (#94)
This commit is contained in:
33
docs/faq.md
33
docs/faq.md
@@ -18,21 +18,23 @@ $ docker-compose exec diun --test-notif
|
||||
|
||||
If you have the error `failed to decode configuration from file: field docker uses unsupported type: invalid` that's because your `docker`, `swarm` or `kubernetes` provider is not initialized in your configuration:
|
||||
|
||||
```yaml
|
||||
providers:
|
||||
docker:
|
||||
```
|
||||
!!! failure
|
||||
```yaml
|
||||
providers:
|
||||
docker:
|
||||
```
|
||||
|
||||
should be:
|
||||
|
||||
```yaml
|
||||
providers:
|
||||
docker: {}
|
||||
```
|
||||
!!! success
|
||||
```yaml
|
||||
providers:
|
||||
docker: {}
|
||||
```
|
||||
|
||||
## No image found in manifest list for architecture, variant, OS
|
||||
|
||||
If you encounter this kind of error, you are probably using the [file provider](providers/file.md) containing an image with an erroneous or empty platform. If the platform is not filled in, it will be deduced automatically from the information of your operating system on which Diun is running.
|
||||
If you encounter this kind of warning, you are probably using the [file provider](providers/file.md) containing an image with an erroneous or empty platform. If the platform is not filled in, it will be deduced automatically from the information of your operating system on which Diun is running.
|
||||
|
||||
In the example below, Diun is running (`diun_x.x.x_windows_i386.zip`) on Windows 10 and tries to analyze the `crazymax/cloudflared` image with the detected platform (`windows/386)`:
|
||||
|
||||
@@ -43,12 +45,10 @@ In the example below, Diun is running (`diun_x.x.x_windows_i386.zip`) on Windows
|
||||
|
||||
But this platform is not supported by this image as you can see [on DockerHub](https://hub.docker.com/layers/crazymax/cloudflared/2020.2.1/images/sha256-137eea4e84ec4c6cb5ceb2017b9788dcd7b04f135d756e1f37e3e6673c0dd9d2?context=explore):
|
||||
|
||||
```
|
||||
Fri, 27 Mar 2020 01:20:03 UTC ERR Cannot run job error="Error choosing image instance: no image found in manifest list for architecture 386, variant , OS windows" provider=file
|
||||
Fri, 27 Mar 2020 01:20:03 UTC ERR Cannot list tags from registry error="Error choosing image instance: no image found in manifest list for architecture 386, variant , OS windows" image=crazymax/cloudflared:2020.2.1 provider=file
|
||||
```
|
||||
!!! warning
|
||||
`Fri, 27 Mar 2020 01:20:03 UTC WRN Cannot get remote manifest error="Cannot create image closer: Error choosing image instance: no image found in manifest list for architecture 386, variant \"\", OS windows" image=docker.io/image=crazymax/cloudflared:2020.2.1 provider=file`
|
||||
|
||||
You have to force the platform for this image if you are not on a supported platform. For example:
|
||||
You have to force the platform for this image if you are not on a supported platform:
|
||||
|
||||
```yaml
|
||||
- name: crazymax/cloudflared:2020.2.1
|
||||
@@ -58,6 +58,5 @@ You have to force the platform for this image if you are not on a supported plat
|
||||
arch: amd64
|
||||
```
|
||||
|
||||
```
|
||||
Fri, 27 Mar 2020 01:24:33 UTC INF New image found image=docker.io/crazymax/cloudflared:2020.2.1 provider=file
|
||||
```
|
||||
!!! success
|
||||
`Fri, 27 Mar 2020 01:24:33 UTC INF New image found image=docker.io/crazymax/cloudflared:2020.2.1 provider=file`
|
||||
|
||||
@@ -105,11 +105,7 @@ func (di *Diun) Run() {
|
||||
di.wg = new(sync.WaitGroup)
|
||||
di.pool, _ = ants.NewPoolWithFunc(di.cfg.Watch.Workers, func(i interface{}) {
|
||||
job := i.(model.Job)
|
||||
if err := di.runJob(job); err != nil {
|
||||
log.Error().Err(err).
|
||||
Str("provider", job.Provider).
|
||||
Msg("Cannot run job")
|
||||
}
|
||||
di.runJob(job)
|
||||
di.wg.Done()
|
||||
}, ants.WithLogger(new(logging.AntsLogger)))
|
||||
defer di.pool.Release()
|
||||
|
||||
@@ -137,7 +137,7 @@ func (di *Diun) createJob(job model.Job) {
|
||||
}
|
||||
}
|
||||
|
||||
func (di *Diun) runJob(job model.Job) error {
|
||||
func (di *Diun) runJob(job model.Job) {
|
||||
sublog := log.With().
|
||||
Str("provider", job.Provider).
|
||||
Str("image", job.RegImage.String()).
|
||||
@@ -145,20 +145,22 @@ func (di *Diun) runJob(job model.Job) error {
|
||||
|
||||
if !utl.IsIncluded(job.RegImage.Tag, job.Image.IncludeTags) {
|
||||
sublog.Warn().Msg("Tag not included")
|
||||
return nil
|
||||
return
|
||||
} else if utl.IsExcluded(job.RegImage.Tag, job.Image.ExcludeTags) {
|
||||
sublog.Warn().Msg("Tag excluded")
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
liveManifest, err := job.Registry.Manifest(job.RegImage)
|
||||
if err != nil {
|
||||
return err
|
||||
sublog.Warn().Err(err).Msg("Cannot get remote manifest")
|
||||
return
|
||||
}
|
||||
|
||||
dbManifest, err := di.db.GetManifest(job.RegImage)
|
||||
if err != nil {
|
||||
return err
|
||||
sublog.Error().Err(err).Msg("Cannot get manifest from db")
|
||||
return
|
||||
}
|
||||
|
||||
status := model.ImageStatusUnchange
|
||||
@@ -170,17 +172,18 @@ func (di *Diun) runJob(job model.Job) error {
|
||||
sublog.Info().Msg("Image update found")
|
||||
} else {
|
||||
sublog.Debug().Msg("No changes")
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
if err := di.db.PutManifest(job.RegImage, liveManifest); err != nil {
|
||||
return err
|
||||
sublog.Error().Err(err).Msg("Cannot write manifest to db")
|
||||
return
|
||||
}
|
||||
sublog.Debug().Msg("Manifest saved to database")
|
||||
|
||||
if job.FirstCheck && !*di.cfg.Watch.FirstCheckNotif {
|
||||
sublog.Debug().Msg("Skipping notification (first check)")
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
di.notif.Send(model.NotifEntry{
|
||||
@@ -189,6 +192,4 @@ func (di *Diun) runJob(job model.Job) error {
|
||||
Image: job.RegImage,
|
||||
Manifest: liveManifest,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/containers/image/v5/manifest"
|
||||
"github.com/opencontainers/go-digest"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Manifest is the Docker image manifest information
|
||||
@@ -28,23 +29,23 @@ func (c *Client) Manifest(image Image) (Manifest, error) {
|
||||
|
||||
imgCloser, err := c.newImage(ctx, image.String())
|
||||
if err != nil {
|
||||
return Manifest{}, err
|
||||
return Manifest{}, errors.Wrap(err, "Cannot create image closer")
|
||||
}
|
||||
defer imgCloser.Close()
|
||||
|
||||
rawManifest, _, err := imgCloser.Manifest(ctx)
|
||||
if err != nil {
|
||||
return Manifest{}, err
|
||||
return Manifest{}, errors.Wrap(err, "Cannot get raw manifest")
|
||||
}
|
||||
|
||||
imgInspect, err := imgCloser.Inspect(ctx)
|
||||
if err != nil {
|
||||
return Manifest{}, err
|
||||
return Manifest{}, errors.Wrap(err, "Cannot inspect")
|
||||
}
|
||||
|
||||
imgDigest, err := manifest.Digest(rawManifest)
|
||||
if err != nil {
|
||||
return Manifest{}, err
|
||||
return Manifest{}, errors.Wrap(err, "Cannot get digest")
|
||||
}
|
||||
|
||||
imgTag := imgInspect.Tag
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/containers/image/v5/docker"
|
||||
"github.com/containers/image/v5/types"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Client represents an active docker registry object
|
||||
@@ -71,7 +72,7 @@ func (c *Client) newImage(ctx context.Context, imageStr string) (types.ImageClos
|
||||
|
||||
ref, err := docker.ParseReference(imageStr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid image name %s: %v", imageStr, err)
|
||||
return nil, errors.Wrap(err, "Invalid image name")
|
||||
}
|
||||
|
||||
img, err := ref.NewImage(ctx, c.sysCtx)
|
||||
|
||||
Reference in New Issue
Block a user