feat(docker): add guided install and saved one-command updates
This commit is contained in:
1 parent
8dc187483c
commit
27447ce029
11 files changed
+395
-7
No files matched your search
@@ -30,6 +30,14 @@ function simulate(scenario: string) {
|
||||
try {
|
||||
mkdirSync(join(dir, "scripts"));
|
||||
mkdirSync(join(dir, "logs"));
|
||||
copyFileSync(
|
||||
resolve(root, "scripts/docker-config.sh"),
|
||||
join(dir, "scripts/docker-config.sh"),
|
||||
);
|
||||
copyFileSync(
|
||||
resolve(root, "docker-image.txt"),
|
||||
join(dir, "docker-image.txt"),
|
||||
);
|
||||
writeFileSync(
|
||||
join(dir, "logs/docker-release-history.log"),
|
||||
`${"b".repeat(40)}\n${"c".repeat(40)}\n`,
|
||||
@@ -39,6 +47,11 @@ function simulate(scenario: string) {
|
||||
join(dir, "scripts/docker-update.sh"),
|
||||
);
|
||||
writeFileSync(join(dir, ".env"), "HOTEL_NAME=Test\n");
|
||||
if (scenario.startsWith("saved-"))
|
||||
writeFileSync(
|
||||
join(dir, ".docker-install"),
|
||||
`MODE=${scenario === "saved-source" ? "source" : "prebuilt"}\nPUBLIC_URL=https://saved.test\n`,
|
||||
);
|
||||
const result = spawnSync(bash, [join(dir, "scripts/docker-update.sh")], {
|
||||
cwd: dir,
|
||||
encoding: "utf8",
|
||||
@@ -49,10 +62,14 @@ function simulate(scenario: string) {
|
||||
TEST_DIR: dir.replaceAll("\\", "/"),
|
||||
TEST_SHA: sha,
|
||||
SCENARIO: scenario,
|
||||
CMS_PUBLIC_URL: "https://example.test",
|
||||
CMS_IMAGE_REPOSITORY: scenario.startsWith("registry")
|
||||
? "registry.test/team/cms"
|
||||
: "",
|
||||
CMS_PUBLIC_URL: scenario.startsWith("saved-")
|
||||
? undefined
|
||||
: "https://example.test",
|
||||
CMS_IMAGE_REPOSITORY: scenario.startsWith("saved-")
|
||||
? undefined
|
||||
: scenario.startsWith("registry")
|
||||
? "registry.test/team/cms"
|
||||
: "",
|
||||
},
|
||||
});
|
||||
if (result.error) throw result.error;
|
||||
@@ -169,3 +186,19 @@ describe("HTTP release verification", () => {
|
||||
expect(result.status, result.stderr).toBe(expected);
|
||||
});
|
||||
});
|
||||
|
||||
it("updates using the saved profile and repository-provided image without arguments", () => {
|
||||
const r = simulate("saved-prebuilt");
|
||||
expect(r.status, r.output).toBe(0);
|
||||
expect(r.calls).toContain(
|
||||
`docker pull gitlab.epicnabbo.nl/simo/epicnext-cms:${sha}`,
|
||||
);
|
||||
expect(r.calls).toContain("https://saved.test/api/health");
|
||||
expect(r.calls).not.toContain("docker compose build");
|
||||
});
|
||||
it("keeps source builds available for a saved source installation", () => {
|
||||
const r = simulate("saved-source");
|
||||
expect(r.status, r.output).toBe(0);
|
||||
expect(r.calls).toContain("docker compose build");
|
||||
expect(r.calls).not.toContain("docker pull");
|
||||
});
|
||||
Reference in new issue
Block a user