Skip to content

Commit

Permalink
Merge pull request #177 from kaleido-io/double-pull
Browse files Browse the repository at this point in the history
Avoid double pulling images that are in service list - breaking `"local: true`
  • Loading branch information
nguyer authored Apr 18, 2022
2 parents 921e46d + d9178a7 commit 6d7064c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/blockchain/ethereum/geth/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func CreateGenesis(addresses []string, blockPeriod int) *Genesis {
Nonce: "0x0",
Timestamp: "0x60edb1c7",
ExtraData: extraData,
GasLimit: "0x47b760",
GasLimit: "0xffffffff",
Difficulty: "0x1",
MixHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
Coinbase: "0x0000000000000000000000000000000000000000",
Expand Down
18 changes: 11 additions & 7 deletions internal/stacks/stack_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,16 +531,16 @@ func (s *StackManager) StartStack(verbose bool, options *types.StartOptions) err

func (s *StackManager) PullStack(verbose bool, options *types.PullOptions) error {
var images []string
manifestImages := make(map[string]bool)

// Collect FireFly docker image names
for _, entry := range s.Stack.VersionManifest.Entries() {
fullImage := entry.GetDockerImageString()
s.Log.Info(fmt.Sprintf("Manifest entry image='%s' local=%t", fullImage, entry.Local))
manifestImages[fullImage] = true
if entry.Local {
continue
}
fullImage := fmt.Sprintf("%s@sha256:%s", entry.Image, entry.SHA)
if entry.SHA == "" {
fullImage = fmt.Sprintf("%s:%s", entry.Image, entry.Tag)
}
images = append(images, fullImage)
}

Expand All @@ -559,19 +559,23 @@ func (s *StackManager) PullStack(verbose bool, options *types.PullOptions) error

// Iterate over all images used by the blockchain provider
for _, service := range s.blockchainProvider.GetDockerServiceDefinitions() {
images = append(images, service.Service.Image)
if !manifestImages[service.Service.Image] {
images = append(images, service.Service.Image)
}
}

// Iterate over all images used by the tokens provider
for iTok, tp := range s.tokenProviders {
for _, service := range tp.GetDockerServiceDefinitions(iTok) {
images = append(images, service.Service.Image)
if !manifestImages[service.Service.Image] {
images = append(images, service.Service.Image)
}
}
}

// Use docker to pull every image - retry on failure
for _, image := range images {
s.Log.Info(fmt.Sprintf("pulling '%s", image))
s.Log.Info(fmt.Sprintf("pulling '%s'", image))
if err := docker.RunDockerCommandRetry(s.Stack.InitDir, verbose, verbose, options.Retries, "pull", image); err != nil {
return err
}
Expand Down

0 comments on commit 6d7064c

Please sign in to comment.