Skip to content

Commit 01ef1eb

Browse files
committed
fix(compas): only print info on changes to the started docker containers
1 parent e493d16 commit 01ef1eb

File tree

1 file changed

+14
-1
lines changed
  • packages/compas/src/main/development/integrations

1 file changed

+14
-1
lines changed

packages/compas/src/main/development/integrations/docker.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export class DockerIntegration extends BaseIntegration {
4646
if (!(await this.checkEnv())) {
4747
return;
4848
}
49+
50+
let didExecuteAHostAction = false;
51+
4952
const { containersOnHost, runningContainersOnHost } =
5053
await this.containersOnHost();
5154

@@ -54,6 +57,8 @@ export class DockerIntegration extends BaseIntegration {
5457
);
5558

5659
if (containersToStop.length > 0) {
60+
didExecuteAHostAction = true;
61+
5762
this.state.logInformation(
5863
"Stopping containers that are not required for the current project.",
5964
);
@@ -68,6 +73,8 @@ export class DockerIntegration extends BaseIntegration {
6873
}
6974

7075
if (imagesToPull.length > 0) {
76+
didExecuteAHostAction = true;
77+
7178
this.state.logInformation(
7279
"Downloading images and creating containers in the background...",
7380
);
@@ -76,6 +83,8 @@ export class DockerIntegration extends BaseIntegration {
7683

7784
for (const key of Object.keys(containerObject)) {
7885
if (!containersOnHost.includes(key)) {
86+
didExecuteAHostAction = true;
87+
7988
const info = containerObject[key];
8089
await exec(
8190
`docker create ${info.createArguments ?? ""} --name ${key} ${
@@ -90,10 +99,14 @@ export class DockerIntegration extends BaseIntegration {
9099
);
91100

92101
if (containersToStart.length > 0) {
102+
didExecuteAHostAction = true;
103+
93104
await exec(`docker start ${Object.keys(containerObject).join(" ")}`);
94105
}
95106

96-
this.state.logInformation("Required docker containers are running!");
107+
if (didExecuteAHostAction) {
108+
this.state.logInformation("Required docker containers are running!");
109+
}
97110
}
98111

99112
async containersOnHost() {

0 commit comments

Comments
 (0)