From 2c8ae8bc85c42b738926c783f1160bf1b4e63972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Uhl=C3=AD=C5=99?= Date: Mon, 7 Nov 2022 06:05:59 -0800 Subject: [PATCH] chore: update target bee (#215) --- package.json | 2 +- src/utils/docker.ts | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index bbe6333..1c461fa 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,6 @@ "engines": { "node": ">=12.0.0", "npm": ">=6.0.0", - "bee": "1.6.1" + "bee": "1.9.0" } } diff --git a/src/utils/docker.ts b/src/utils/docker.ts index a4327ce..171a1f0 100644 --- a/src/utils/docker.ts +++ b/src/utils/docker.ts @@ -104,6 +104,7 @@ export class Docker { public async startBlockchainNode(blockchainVersion: string, options: RunOptions): Promise { if (options.fresh) await this.removeContainer(this.blockchainName) + await this.pullImageIfNotFound(this.blockchainImage(blockchainVersion)) const container = await this.findOrCreateContainer(this.blockchainName, { Image: this.blockchainImage(blockchainVersion), @@ -132,8 +133,9 @@ export class Docker { public async startQueenNode(beeVersion: string, options: RunOptions): Promise { if (options.fresh) await this.removeContainer(this.queenName) - const contractAddresses = await this.getContractAddresses(this.queenImage(beeVersion)) + await this.pullImageIfNotFound(this.queenImage(beeVersion)) + const contractAddresses = await this.getContractAddresses(this.queenImage(beeVersion)) const container = await this.findOrCreateContainer(this.queenName, { Image: this.queenImage(beeVersion), name: this.queenName, @@ -176,8 +178,9 @@ export class Docker { options: RunOptions, ): Promise { if (options.fresh) await this.removeContainer(this.workerName(workerNumber)) - const contractAddresses = await this.getContractAddresses(this.workerImage(beeVersion, workerNumber)) + await this.pullImageIfNotFound(this.workerImage(beeVersion, workerNumber)) + const contractAddresses = await this.getContractAddresses(this.workerImage(beeVersion, workerNumber)) const container = await this.findOrCreateContainer(this.workerName(workerNumber), { Image: this.workerImage(beeVersion, workerNumber), name: this.workerName(workerNumber), @@ -414,8 +417,9 @@ export class Docker { private async pullImageIfNotFound(name: string): Promise { try { - await this.docker.getImage(name) + await this.docker.getImage(name).inspect() } catch (e) { + this.console.info(`Image ${name} not found locally, pulling it.`) const pullStream = await this.docker.pull(name) await new Promise(res => this.docker.modem.followProgress(pullStream, res)) @@ -423,7 +427,6 @@ export class Docker { } private async getContractAddresses(imageName: string): Promise> { - await this.pullImageIfNotFound(imageName) const imageMetadata = await this.docker.getImage(imageName).inspect() const contractAddresses: Record = {}