Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid double pulling images that are in service list - breaking "local: true #177

Merged
merged 2 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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