@treeseed/sdk 0.12.19 → 0.12.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -65,6 +65,7 @@ export interface TreeseedHostedServiceCheckOptions {
|
|
|
65
65
|
appId?: string;
|
|
66
66
|
serviceKeys?: string[];
|
|
67
67
|
now?: Date;
|
|
68
|
+
env?: NodeJS.ProcessEnv | Record<string, string | undefined>;
|
|
68
69
|
valuesOverlay?: Record<string, string | undefined>;
|
|
69
70
|
observedRailwayServices?: Record<string, TreeseedObservedRailwayServiceState | undefined>;
|
|
70
71
|
httpChecks?: Record<string, {
|
|
@@ -145,7 +145,8 @@ function httpStatus(url, options) {
|
|
|
145
145
|
function collectTreeseedHostedServiceChecks(options) {
|
|
146
146
|
const target = options.target ?? "prod";
|
|
147
147
|
const tenantRoot = options.tenantRoot;
|
|
148
|
-
const
|
|
148
|
+
const configEnv = { ...process.env, ...options.env ?? {} };
|
|
149
|
+
const deployConfig = loadTreeseedPlatformConfig({ tenantRoot, environment: target, env: configEnv }).deployConfig;
|
|
149
150
|
const registry = collectTreeseedEnvironmentContext(tenantRoot);
|
|
150
151
|
let machineValues = {};
|
|
151
152
|
try {
|
|
@@ -153,7 +154,7 @@ function collectTreeseedHostedServiceChecks(options) {
|
|
|
153
154
|
} catch {
|
|
154
155
|
machineValues = {};
|
|
155
156
|
}
|
|
156
|
-
const values = { ...machineValues, ...options.valuesOverlay ?? {} };
|
|
157
|
+
const values = { ...machineValues, ...configEnv, ...options.valuesOverlay ?? {} };
|
|
157
158
|
const checks = [];
|
|
158
159
|
const selectedServiceKeys = new Set((options.serviceKeys ?? []).map((key) => key.trim()).filter(Boolean));
|
|
159
160
|
const selectedAppId = options.appId?.trim() || null;
|
|
@@ -211,7 +212,7 @@ function collectTreeseedHostedServiceChecks(options) {
|
|
|
211
212
|
}));
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
|
-
const configuredServices = configuredRailwayServices(tenantRoot, target).filter((service) => !selectedAppId || service.application?.id === selectedAppId).filter((service) => selectedServiceKeys.size === 0 || selectedServiceKeys.has(service.key));
|
|
215
|
+
const configuredServices = configuredRailwayServices(tenantRoot, target, configEnv).filter((service) => !selectedAppId || service.application?.id === selectedAppId).filter((service) => selectedServiceKeys.size === 0 || selectedServiceKeys.has(service.key));
|
|
215
216
|
for (const service of configuredServices) {
|
|
216
217
|
const serviceType = serviceTypeFor(service.key);
|
|
217
218
|
const observed = observedFor(options, service.serviceName);
|
|
@@ -218,7 +218,7 @@ async function collectRailwayObservations(options) {
|
|
|
218
218
|
try {
|
|
219
219
|
const workspace = await resolveRailwayWorkspaceContext({ env: options.env, fetchImpl: options.fetchImpl });
|
|
220
220
|
const projects = await listRailwayProjects({ workspaceId: workspace.id, env: options.env, fetchImpl: options.fetchImpl });
|
|
221
|
-
const configuredServices = configuredRailwayServices(options.tenantRoot, options.target).filter((entry) => !options.appId || entry.application?.id === options.appId).filter((entry) => serviceIsSelected(selectedServiceKeys, entry.key));
|
|
221
|
+
const configuredServices = configuredRailwayServices(options.tenantRoot, options.target, options.env).filter((entry) => !options.appId || entry.application?.id === options.appId).filter((entry) => serviceIsSelected(selectedServiceKeys, entry.key));
|
|
222
222
|
if (selectedServiceKeys.size === 0 || selectedServiceKeys.has("api") || selectedServiceKeys.has("operationsRunner")) {
|
|
223
223
|
for (const descriptor of treeseedDatabaseDescriptors(options.tenantRoot, options)) {
|
|
224
224
|
await verifyRailwayPostgresTopology({ descriptor, configuredServices, projects, options, issues });
|
|
@@ -347,7 +347,7 @@ async function collectRailwayObservations(options) {
|
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
349
|
if (selectedServiceKeys.size === 0) {
|
|
350
|
-
const deployConfig = loadTreeseedPlatformConfig({ tenantRoot: options.tenantRoot, environment: options.target, env:
|
|
350
|
+
const deployConfig = loadTreeseedPlatformConfig({ tenantRoot: options.tenantRoot, environment: options.target, env: options.env }).deployConfig;
|
|
351
351
|
const appConfigs = [
|
|
352
352
|
...!options.appId || options.appId === "web" ? [deployConfig] : [],
|
|
353
353
|
...discoverTreeseedApplications(options.tenantRoot).filter((application) => application.id === "api" && (!options.appId || options.appId === "api")).map((application) => application.config)
|
|
@@ -418,7 +418,7 @@ async function collectRailwayObservations(options) {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
async function collectHttpObservations(options) {
|
|
421
|
-
const deployConfig = loadTreeseedPlatformConfig({ tenantRoot: options.tenantRoot, environment: options.target, env:
|
|
421
|
+
const deployConfig = loadTreeseedPlatformConfig({ tenantRoot: options.tenantRoot, environment: options.target, env: options.env }).deployConfig;
|
|
422
422
|
const urls = /* @__PURE__ */ new Set();
|
|
423
423
|
const fallbacks = /* @__PURE__ */ new Map();
|
|
424
424
|
const selectedServiceKeys = selectedServiceKeySet(options);
|
|
@@ -440,7 +440,7 @@ async function collectHttpObservations(options) {
|
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
for (const service of configuredRailwayServices(options.tenantRoot, options.target).filter((entry) => !options.appId || entry.application?.id === options.appId).filter((entry) => serviceIsSelected(selectedServiceKeys, entry.key))) {
|
|
443
|
+
for (const service of configuredRailwayServices(options.tenantRoot, options.target, options.env).filter((entry) => !options.appId || entry.application?.id === options.appId).filter((entry) => serviceIsSelected(selectedServiceKeys, entry.key))) {
|
|
444
444
|
const serviceConfig = deployConfig.services?.[service.key];
|
|
445
445
|
const domain = service.publicBaseUrl ?? serviceConfig?.environments?.[options.target]?.baseUrl ?? serviceConfig?.environments?.[options.target]?.domain ?? (service.key === "api" ? deployConfig.surfaces?.api?.environments?.[options.target]?.domain : null);
|
|
446
446
|
const baseUrl = urlForDomain(domain);
|
|
@@ -500,6 +500,7 @@ async function collectTreeseedLiveHostedServiceChecks(options) {
|
|
|
500
500
|
target: effectiveOptions.target,
|
|
501
501
|
appId: effectiveOptions.appId,
|
|
502
502
|
serviceKeys: effectiveOptions.serviceKeys,
|
|
503
|
+
env: effectiveOptions.env,
|
|
503
504
|
observedRailwayServices: railway.observed,
|
|
504
505
|
httpChecks
|
|
505
506
|
});
|
|
@@ -534,7 +534,7 @@ function selectorFromWorkflowHostingGraph(graph) {
|
|
|
534
534
|
}))]
|
|
535
535
|
};
|
|
536
536
|
}
|
|
537
|
-
async function reconcileSaveHostedEnvironment(root, environment, helpers, workflowRunId, operation = "save", envOverlay = {}) {
|
|
537
|
+
async function reconcileSaveHostedEnvironment(root, environment, helpers, workflowRunId, operation = "save", envOverlay = {}, options = {}) {
|
|
538
538
|
const target = createPersistentDeployTarget(environment);
|
|
539
539
|
const env = {
|
|
540
540
|
...helpers.context.env,
|
|
@@ -585,6 +585,7 @@ ${status.blockers.join("\n")}`, {
|
|
|
585
585
|
const live = await collectTreeseedLiveHostedServiceChecks({
|
|
586
586
|
tenantRoot: root,
|
|
587
587
|
target: environment,
|
|
588
|
+
appId: options.liveAppId,
|
|
588
589
|
strict: true,
|
|
589
590
|
requireLiveRailway: true,
|
|
590
591
|
requireLiveHttp: true,
|
|
@@ -5611,7 +5612,7 @@ ${rendered}`);
|
|
|
5611
5612
|
packageReleases.push(packageRelease);
|
|
5612
5613
|
}
|
|
5613
5614
|
const publishedArtifacts = await executeJournalStep(root, workflowRun.runId, "verify-published-artifacts", () => verifyPublishedReleaseArtifacts(selectedVersions));
|
|
5614
|
-
const productionHosting = await executeJournalStep(root, workflowRun.runId, "production-hosting", () => reconcileSaveHostedEnvironment(root, "prod", helpers, workflowRun.runId, "release", productionReleaseImageRefEnv(selectedVersions)));
|
|
5615
|
+
const productionHosting = await executeJournalStep(root, workflowRun.runId, "production-hosting", () => reconcileSaveHostedEnvironment(root, "prod", helpers, workflowRun.runId, "release", productionReleaseImageRefEnv(selectedVersions), { liveAppId: "api" }));
|
|
5615
5616
|
const productionApiGuarantees = await executeJournalStep(root, workflowRun.runId, "production-api-guarantees", () => runReleaseApiGuarantees(root, "prod", helpers, "release", normalizeSceneArtifactsMode(effectiveInput.sceneArtifacts)));
|
|
5616
5617
|
const rootRelease = await executeJournalStep(root, workflowRun.runId, "release-root", () => {
|
|
5617
5618
|
const rootInstall = runReleaseNpmInstall(root, { workspaceRoot: root });
|