Fix pipeline deployment with postgres
All checks were successful
Build, test and publish / verify (push) Successful in 6m15s
All checks were successful
Build, test and publish / verify (push) Successful in 6m15s
This commit is contained in:
@@ -22,6 +22,30 @@ class ReleaseShellTests {
|
||||
CiTests.equal(false, calls.contains("prune"));
|
||||
}
|
||||
});
|
||||
ReleaseTests.test("actual NAS script rejects a missing database password before pulling images", () -> {
|
||||
try (var f = new Fixture()) {
|
||||
Path config = f.directory.resolve("production.env");
|
||||
Files.writeString(
|
||||
config, Files.readString(config).replace("DATABASE_PASSWORD=fixture-only-password\n", ""));
|
||||
f.call("lock", null, "one").checked();
|
||||
Commands.Result result = f.call("preflight", null, "one");
|
||||
CiTests.equal(1, result.code());
|
||||
CiTests.equal(true, result.output().contains("Missing DATABASE_PASSWORD"));
|
||||
CiTests.equal(false, Files.exists(f.directory.resolve("live.env")));
|
||||
}
|
||||
});
|
||||
ReleaseTests.test("actual NAS script passes database configuration through sudo", () -> {
|
||||
try (var f = new Fixture()) {
|
||||
f.executable("sudo", "#!/bin/sh\n[ \"$1\" != -n ] || shift\nunset DATABASE_PASSWORD\nexec \"$@\"\n");
|
||||
Path config = f.directory.resolve("production.env");
|
||||
Files.writeString(config, Files.readString(config).replace("DOCKER_SUDO=0", "DOCKER_SUDO=1"));
|
||||
f.prepare();
|
||||
CiTests.equal(
|
||||
false,
|
||||
Files.readString(f.directory.resolve("releases/one/release.env"))
|
||||
.contains("PASSWORD"));
|
||||
}
|
||||
});
|
||||
ReleaseTests.test("actual NAS script rejects wrong image revision before replacement", () -> {
|
||||
try (var f = new Fixture()) {
|
||||
f.env.put("WRONG_REVISION", "1");
|
||||
@@ -102,7 +126,11 @@ class ReleaseShellTests {
|
||||
Files.writeString(directory.resolve("docker-auth/config.json"), "{}");
|
||||
Files.writeString(
|
||||
directory.resolve("production.env"),
|
||||
"BIND_IP=127.0.0.1\nFRONTEND_PORT=8088\nDOCKER_SUDO=0\nDOCKER_BIN="
|
||||
"DATABASE_PASSWORD=fixture-only-password\n"
|
||||
+ "BIND_IP=127.0.0.1\n"
|
||||
+ "FRONTEND_PORT=8088\n"
|
||||
+ "DOCKER_SUDO=0\n"
|
||||
+ "DOCKER_BIN="
|
||||
+ directory.resolve("bin/docker") + "\nDOCKER_CONFIG=" + directory.resolve("docker-auth")
|
||||
+ "\n");
|
||||
}
|
||||
@@ -171,8 +199,15 @@ class ReleaseShellTests {
|
||||
[ "$1" != version ] || exit 0
|
||||
shift 4
|
||||
[ "$1" = --env-file ] || exit 1
|
||||
production=$2
|
||||
shift 2
|
||||
[ "$1" = --env-file ] || exit 1
|
||||
file=$2
|
||||
shift 4
|
||||
# Compose must read the secret from disk, even after sudo clears the environment.
|
||||
test -f "$production"
|
||||
. "$production"
|
||||
[ "$DATABASE_PASSWORD" = fixture-only-password ] || exit 15
|
||||
case "$1" in
|
||||
config) test -f "$file";;
|
||||
up) cp "$file" "$FIXTURE/live.env";;
|
||||
|
||||
Reference in New Issue
Block a user