Resolve fixed-name Traefik in E2E smoke
This commit is contained in:
@@ -124,22 +124,29 @@ async function readComposeServiceHost(rootDir, composeProject, serviceName) {
|
|||||||
allowFailure: true,
|
allowFailure: true,
|
||||||
});
|
});
|
||||||
const containerId = String(ps.stdout || "").trim().split(/\s+/).find(Boolean);
|
const containerId = String(ps.stdout || "").trim().split(/\s+/).find(Boolean);
|
||||||
if (!containerId) {
|
const containerRefs = [
|
||||||
return null;
|
...(containerId ? [containerId] : []),
|
||||||
|
serviceName,
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const containerRef of [...new Set(containerRefs)]) {
|
||||||
|
const inspection = await runCommand("docker", [
|
||||||
|
"inspect",
|
||||||
|
"-f",
|
||||||
|
"{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}",
|
||||||
|
containerRef,
|
||||||
|
], {
|
||||||
|
cwd: rootDir,
|
||||||
|
allowFailure: true,
|
||||||
|
});
|
||||||
|
const host = String(inspection.stdout || "").trim().split(/\s+/).find((value) => /^\d{1,3}(?:\.\d{1,3}){3}$/.test(value));
|
||||||
|
|
||||||
|
if (host) {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const inspection = await runCommand("docker", [
|
return null;
|
||||||
"inspect",
|
|
||||||
"-f",
|
|
||||||
"{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}",
|
|
||||||
containerId,
|
|
||||||
], {
|
|
||||||
cwd: rootDir,
|
|
||||||
allowFailure: true,
|
|
||||||
});
|
|
||||||
const host = String(inspection.stdout || "").trim().split(/\s+/).find((value) => /^\d{1,3}(?:\.\d{1,3}){3}$/.test(value));
|
|
||||||
|
|
||||||
return host || null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function candidateApiBaseUrls(baseUrl, rootDir, composeProject) {
|
async function candidateApiBaseUrls(baseUrl, rootDir, composeProject) {
|
||||||
|
|||||||
Reference in New Issue
Block a user