From 30c16bbb7e7f4522ce40e92874bc83f7e26c7deb Mon Sep 17 00:00:00 2001 From: Reda Noureddine Date: Mon, 7 Aug 2023 09:39:18 +0200 Subject: [PATCH 1/3] fix: check if directory is empty --- deploy/lib/buildAndPushContainers.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/lib/buildAndPushContainers.js b/deploy/lib/buildAndPushContainers.js index aaae9125..aa11fd3f 100644 --- a/deploy/lib/buildAndPushContainers.js +++ b/deploy/lib/buildAndPushContainers.js @@ -68,13 +68,16 @@ module.exports = { const containerNames = Object.keys(this.containers); const promises = containerNames.map((containerName) => { const container = this.containers[containerName]; + if (container['directory'] == undefined) { + return + } const tarStream = tar.pack(`./${container.directory}`); const imageName = `${this.namespace.registry_endpoint}/${container.name}:latest`; this.serverless.cli.log( `Building and pushing container ${container.name} to: ${imageName} ...` ); - + return new Promise(async (resolve, reject) => { const buildStream = await docker.buildImage(tarStream, { t: imageName, From 0b53370593c8ff04c566053de5e9c4581057818b Mon Sep 17 00:00:00 2001 From: Reda Noureddine Date: Mon, 7 Aug 2023 09:58:41 +0200 Subject: [PATCH 2/3] chore: run prettier --- deploy/lib/buildAndPushContainers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy/lib/buildAndPushContainers.js b/deploy/lib/buildAndPushContainers.js index aa11fd3f..01299fc7 100644 --- a/deploy/lib/buildAndPushContainers.js +++ b/deploy/lib/buildAndPushContainers.js @@ -68,8 +68,8 @@ module.exports = { const containerNames = Object.keys(this.containers); const promises = containerNames.map((containerName) => { const container = this.containers[containerName]; - if (container['directory'] == undefined) { - return + if (container["directory"] == undefined) { + return; } const tarStream = tar.pack(`./${container.directory}`); const imageName = `${this.namespace.registry_endpoint}/${container.name}:latest`; @@ -77,7 +77,7 @@ module.exports = { this.serverless.cli.log( `Building and pushing container ${container.name} to: ${imageName} ...` ); - + return new Promise(async (resolve, reject) => { const buildStream = await docker.buildImage(tarStream, { t: imageName, From 7ed4f98c06144c5e52889335546007bb74288a16 Mon Sep 17 00:00:00 2001 From: Reda Noureddine <58738453+redanrd@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:45:31 +0200 Subject: [PATCH 3/3] Update deploy/lib/buildAndPushContainers.js chore: use triple equal operator Co-authored-by: Thomas TACQUET --- deploy/lib/buildAndPushContainers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/lib/buildAndPushContainers.js b/deploy/lib/buildAndPushContainers.js index 01299fc7..f408bfac 100644 --- a/deploy/lib/buildAndPushContainers.js +++ b/deploy/lib/buildAndPushContainers.js @@ -68,7 +68,7 @@ module.exports = { const containerNames = Object.keys(this.containers); const promises = containerNames.map((containerName) => { const container = this.containers[containerName]; - if (container["directory"] == undefined) { + if (container["directory"] === undefined) { return; } const tarStream = tar.pack(`./${container.directory}`);