feat(infra): integrate release pipeline natively into setup.ts with rolling restart and new install guides
This commit is contained in:
parent
26739f4b63
commit
434ac32336
@ -15,7 +15,7 @@
|
|||||||
"dump:compose": "deno run -A infra/setup.ts dump_compose",
|
"dump:compose": "deno run -A infra/setup.ts dump_compose",
|
||||||
"dump:env": "deno run -A infra/setup.ts dump_env",
|
"dump:env": "deno run -A infra/setup.ts dump_env",
|
||||||
"build": "deno run -A infra/setup.ts build",
|
"build": "deno run -A infra/setup.ts build",
|
||||||
"release": "./infra/release.sh"
|
"release": "deno run -A infra/setup.ts release"
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|||||||
172
infra/setup.ts
172
infra/setup.ts
@ -793,6 +793,178 @@ if (import.meta.main) {
|
|||||||
"\nTip: To dump raw environment variables, run: deno run -A infra/setup.ts dump_env\n",
|
"\nTip: To dump raw environment variables, run: deno run -A infra/setup.ts dump_env\n",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
})
|
||||||
|
.command(
|
||||||
|
"release",
|
||||||
|
"Run complete build & release pipeline with copy-paste deployment instructions",
|
||||||
|
)
|
||||||
|
.action(async () => {
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.blue(
|
||||||
|
"\n================================================================",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.green(
|
||||||
|
" Auth-Yes Infrastructure Build & Release Pipeline",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.blue(
|
||||||
|
"================================================================\n",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 1. Quality Gates
|
||||||
|
console.log(colors.cyan("[1/4] Running Quality Gates & Test Suite..."));
|
||||||
|
const testCmd = new Deno.Command("deno", {
|
||||||
|
args: ["task", "test"],
|
||||||
|
stdout: "inherit",
|
||||||
|
stderr: "inherit",
|
||||||
|
});
|
||||||
|
const testRes = await testCmd.output();
|
||||||
|
if (testRes.code !== 0) {
|
||||||
|
console.error(
|
||||||
|
colors.red("\n✗ Quality gates failed. Aborting release."),
|
||||||
|
);
|
||||||
|
Deno.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Compile Protobufs
|
||||||
|
console.log(
|
||||||
|
colors.cyan("\n[2/4] Downloading & Compiling Protobufs..."),
|
||||||
|
);
|
||||||
|
await downloadWorkloadProto();
|
||||||
|
await executeProtobufCompilation();
|
||||||
|
|
||||||
|
// 3. Build & Push Images
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"\n[3/4] Building and Pushing Custom Container Images...",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
const loadedEnv = await readEnv();
|
||||||
|
const currentConfig: AuthSetupConfig = {
|
||||||
|
...DEFAULT_AUTH_CONFIG,
|
||||||
|
...loadedEnv,
|
||||||
|
};
|
||||||
|
const commands = generateBuildCommands(currentConfig.reg);
|
||||||
|
await executeBuildImage(commands);
|
||||||
|
console.log(
|
||||||
|
colors.green(
|
||||||
|
"\n✓ Successfully built and pushed all stack images to " +
|
||||||
|
currentConfig.reg + "!",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// 4. Output Copy-Paste Guides
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"\n[4/4] Release Complete. Deployment & Configuration Guides:\n",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.yellow(
|
||||||
|
"┌──────────────────────────────────────────────────────────────┐",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.yellow(
|
||||||
|
"│ A. FOR NEW SYSTEM INSTALLATIONS │",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.yellow(
|
||||||
|
"└──────────────────────────────────────────────────────────────┘",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.gray("# 1. Inspect environment variables and secrets:"),
|
||||||
|
);
|
||||||
|
console.log(colors.cyan("deno task dump:env"));
|
||||||
|
console.log(
|
||||||
|
colors.gray("\n# 2. Inspect generated Docker Compose files:"),
|
||||||
|
);
|
||||||
|
console.log(colors.cyan("deno task dump:compose"));
|
||||||
|
console.log(
|
||||||
|
colors.gray("\n# 3. Create persistent storage paths on host:"),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
`mkdir -p ${currentConfig.spireDataPath} ${currentConfig.dbDataPath}`,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(colors.gray("\n# 4. Deploy fresh stacks:"));
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"podman-compose --project-name spire --env-file infra/.env -f infra/compose.spire.yml up -d",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"podman-compose --project-name auth-yes --env-file infra/.env -f infra/compose.yml up -d",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.yellow(
|
||||||
|
"\n┌──────────────────────────────────────────────────────────────┐",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.yellow(
|
||||||
|
"│ B. FOR EXISTING SYSTEM UPDATES (ROLLING RESTART) │",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.bold(
|
||||||
|
colors.yellow(
|
||||||
|
"└──────────────────────────────────────────────────────────────┘",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.gray(
|
||||||
|
"# Pull newly pushed custom images and restart containers:",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"podman-compose --project-name spire --env-file infra/.env -f infra/compose.spire.yml pull",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"podman-compose --project-name spire --env-file infra/.env -f infra/compose.spire.yml up -d\n",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"podman-compose --project-name auth-yes --env-file infra/.env -f infra/compose.yml pull",
|
||||||
|
),
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
colors.cyan(
|
||||||
|
"podman-compose --project-name auth-yes --env-file infra/.env -f infra/compose.yml up -d\n",
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
await cmd.parse(Deno.args);
|
await cmd.parse(Deno.args);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user