HasDifferentDigest returns true if the image specified by `remoteRef` has a different digest than the local one. This check can be useful to check for updates on remote registries.
(ctx context.Context, remoteRef types.ImageReference, options *HasDifferentDigestOptions)
| 780 | // different digest than the local one. This check can be useful to check for |
| 781 | // updates on remote registries. |
| 782 | func (i *Image) HasDifferentDigest(ctx context.Context, remoteRef types.ImageReference, options *HasDifferentDigestOptions) (bool, error) { |
| 783 | // We need to account for the arch that the image uses. It seems |
| 784 | // common on ARM to tweak this option to pull the correct image. See |
| 785 | // github.com/containers/podman/issues/6613. |
| 786 | inspectInfo, err := i.inspectInfo(ctx) |
| 787 | if err != nil { |
| 788 | return false, err |
| 789 | } |
| 790 | |
| 791 | sys := i.runtime.systemContextCopy() |
| 792 | sys.ArchitectureChoice = inspectInfo.Architecture |
| 793 | // OS and variant may not be set, so let's check to avoid accidental |
| 794 | // overrides of the runtime settings. |
| 795 | if inspectInfo.Os != "" { |
| 796 | sys.OSChoice = inspectInfo.Os |
| 797 | } |
| 798 | if inspectInfo.Variant != "" { |
| 799 | sys.VariantChoice = inspectInfo.Variant |
| 800 | } |
| 801 | |
| 802 | if options != nil && options.AuthFilePath != "" { |
| 803 | sys.AuthFilePath = options.AuthFilePath |
| 804 | } |
| 805 | |
| 806 | return i.hasDifferentDigestWithSystemContext(ctx, remoteRef, sys) |
| 807 | } |
| 808 | |
| 809 | func (i *Image) hasDifferentDigestWithSystemContext(ctx context.Context, remoteRef types.ImageReference, sys *types.SystemContext) (bool, error) { |
| 810 | remoteImg, err := remoteRef.NewImage(ctx, sys) |