Skip to content

Commit

Permalink
fix(deploy): listLocalDeployments failing while running=true (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
kon14 authored Jul 19, 2022
1 parent 165e35c commit 28d17d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $ npm install -g @conduitplatform/cli
$ conduit COMMAND
running command...
$ conduit (--version|-v)
@conduitplatform/cli/0.0.5 linux-x64 node-v16.15.0
@conduitplatform/cli/0.0.6 linux-x64 node-v16.15.0
$ conduit --help [COMMAND]
USAGE
$ conduit COMMAND
Expand Down
10 changes: 7 additions & 3 deletions src/deploy/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ export async function listLocalDeployments(command: Command, running = false) {
const deployments = fs.readdirSync(deploymentBasePath).filter(file => {
return fs.statSync(path.join(deploymentBasePath, file)).isFile();
});
let onlineDeployments: string[];
if (running) {
onlineDeployments = [];
for (const deployment of deployments) {
if (!(await Docker.getInstance().containerIsUp(`conduit-${deployment}`))) {
deployments.splice(deployments.indexOf(deployment));
if (await Docker.getInstance().containerIsUp(`conduit-${deployment}`)) {
onlineDeployments.push(deployment);
}
}
} else {
onlineDeployments = deployments;
}
return deployments;
return onlineDeployments;
}

export function getDeploymentPaths(command: Command, tag: string) {
Expand Down

0 comments on commit 28d17d1

Please sign in to comment.