Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
lib: stop downloading images if the caller already has this manifest
Browse files Browse the repository at this point in the history
This commit allows a user of the library to provide a list of manifest
hashes, presumably generated from annotations left on images by prior
invocations of docker2aci, for images it already has. If docker2aci
fetches a manifest and the hash for it matches one of the elements in
the user provided list, docker2aci will stop working, and return with no
error and no produced ACIs.
  • Loading branch information
Derek Gonyeo committed Jan 23, 2017
1 parent 5c558b0 commit 6676468
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/docker2aci.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ import (
// CommonConfig represents the shared configuration options for converting
// Docker images.
type CommonConfig struct {
Squash bool // squash the layers in one file
OutputDir string // where to put the resulting ACI
TmpDir string // directory to use for temporary files
Compression common.Compression // which compression to use for the resulting file(s)
Squash bool // squash the layers in one file
OutputDir string // where to put the resulting ACI
TmpDir string // directory to use for temporary files
Compression common.Compression // which compression to use for the resulting file(s)
CurrentManifestHashes []string // any manifest hashes the caller already has

Info log.Logger
Debug log.Logger
Expand Down Expand Up @@ -145,6 +146,11 @@ func (c *converter) convert() ([]string, error) {
if err != nil {
return nil, err
}
for _, h := range c.config.CurrentManifestHashes {
if manhash == h {
return nil, nil
}
}

layersOutputDir := c.config.OutputDir
if c.config.Squash {
Expand Down

0 comments on commit 6676468

Please sign in to comment.