@centreon/js-config 25.6.5 â 25.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/tasks.ts +29 -0
- package/package.json +1 -1
package/cypress/e2e/tasks.ts
CHANGED
|
@@ -54,6 +54,35 @@ export default (on: Cypress.PluginEvents): void => {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
on("task", {
|
|
57
|
+
checkDockerImage: async (params: StartContainerProps) => {
|
|
58
|
+
const { image, name } = params;
|
|
59
|
+
console.log(`đ [checkDockerImage] Checking if image exists: ${image}`);
|
|
60
|
+
|
|
61
|
+
if (!image) {
|
|
62
|
+
console.error("â [checkDockerImage] No image name provided");
|
|
63
|
+
return { exists: false, error: "Image name is undefined" };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
execSync(`docker image inspect ${image}`, { stdio: "ignore" });
|
|
68
|
+
console.log(`â
[checkDockerImage] Image already exists locally: ${image}`);
|
|
69
|
+
return { exists: true, image };
|
|
70
|
+
} catch {
|
|
71
|
+
console.log(`âšī¸ [checkDockerImage] Image not found locally, trying to pull...`);
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
execSync(`docker pull ${image}`, { stdio: "pipe" });
|
|
75
|
+
console.log(`â
[checkDockerImage] Image successfully pulled: ${image}`);
|
|
76
|
+
return { exists: true, image };
|
|
77
|
+
} catch (err: unknown) {
|
|
78
|
+
const errorMessage =
|
|
79
|
+
err instanceof Error ? err.message : JSON.stringify(err);
|
|
80
|
+
console.warn(`â ī¸ [checkDockerImage] Image not found or pull failed: ${errorMessage}`);
|
|
81
|
+
|
|
82
|
+
return { exists: false, error: errorMessage, image };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
57
86
|
copyFromContainer: async ({ destination, serviceName, source }) => {
|
|
58
87
|
try {
|
|
59
88
|
const container = getContainer(serviceName);
|
package/package.json
CHANGED