feat: Implement .env persistence during Git rebuilds
- Added functionality to persist `.env` files to a private sidecar directory before Git checkout replacement. - Enhanced recovery of `.env` files from the sidecar after cloning, with fallback to templates if necessary. - Introduced validation for `envFilePath` to ensure it is an absolute path and integrated it into Docker run commands. - Updated deployment routes and rollback services to support the new environment file handling. - Added regression tests to verify the persistence and recovery of environment variables across rebuilds.
This commit is contained in:
1 parent
797f5ce01a
commit
fea9940774
5 files changed
+246
-2
No files matched your search
@@ -20,6 +20,31 @@ describe("deployment strategy", () => {
|
||||
assert.match(command, /'--memory' '512m'/);
|
||||
});
|
||||
|
||||
it("applies a managed env file without embedding its contents in the command", () => {
|
||||
const command = buildDockerRunCommand({
|
||||
name: "app",
|
||||
image: "example/app:stable",
|
||||
restartPolicy: "unless-stopped",
|
||||
envFilePath: "/opt/doktainer/deployments/app.doktainer/root.env",
|
||||
});
|
||||
|
||||
assert.match(
|
||||
command,
|
||||
/'--env-file' '\/opt\/doktainer\/deployments\/app\.doktainer\/root\.env'/,
|
||||
);
|
||||
assert.doesNotMatch(command, /SECRET_VALUE/);
|
||||
assert.throws(
|
||||
() =>
|
||||
buildDockerRunCommand({
|
||||
name: "app",
|
||||
image: "example/app:stable",
|
||||
restartPolicy: "unless-stopped",
|
||||
envFilePath: "relative/.env",
|
||||
}),
|
||||
/absolute path/,
|
||||
);
|
||||
});
|
||||
|
||||
it("uses atomic rename when no published ports are configured", () => {
|
||||
assert.equal(resolveDeploymentStrategy(""), "ATOMIC_RENAME");
|
||||
assert.equal(resolveDeploymentStrategy(" "), "ATOMIC_RENAME");
|
||||
|
||||
Reference in new issue
Block a user