@treeseed/sdk 0.12.28 → 0.12.30
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.
|
@@ -1679,25 +1679,27 @@ mutation TreeseedRailwayVariableCollectionUpsert($input: VariableCollectionUpser
|
|
|
1679
1679
|
await upsertOne(key, value);
|
|
1680
1680
|
}
|
|
1681
1681
|
}
|
|
1682
|
+
const expectedKeys = Object.keys(variables);
|
|
1683
|
+
const mismatchedKeys = (observed2) => expectedKeys.filter((key) => observed2[key] !== variables[key]);
|
|
1682
1684
|
const observed = await listRailwayVariables({ projectId, environmentId, serviceId, env, fetchImpl }).catch(() => ({}));
|
|
1683
|
-
const
|
|
1684
|
-
for (const key of
|
|
1685
|
+
const missingOrMismatched = mismatchedKeys(observed);
|
|
1686
|
+
for (const key of missingOrMismatched) {
|
|
1685
1687
|
await upsertOne(key, variables[key]);
|
|
1686
1688
|
}
|
|
1687
|
-
let retried =
|
|
1688
|
-
let
|
|
1689
|
-
for (let attempt = 0;
|
|
1689
|
+
let retried = missingOrMismatched.length > 0 ? await listRailwayVariables({ projectId, environmentId, serviceId, env, fetchImpl }).catch(() => ({})) : observed;
|
|
1690
|
+
let stillMismatched = mismatchedKeys(retried);
|
|
1691
|
+
for (let attempt = 0; stillMismatched.length > 0 && attempt < 12; attempt += 1) {
|
|
1690
1692
|
await new Promise((resolve) => setTimeout(resolve, 2500));
|
|
1691
1693
|
retried = await listRailwayVariables({ projectId, environmentId, serviceId, env, fetchImpl }).catch(() => ({}));
|
|
1692
|
-
|
|
1693
|
-
if (
|
|
1694
|
-
for (const key of
|
|
1694
|
+
stillMismatched = mismatchedKeys(retried);
|
|
1695
|
+
if (stillMismatched.length > 0 && attempt === 5) {
|
|
1696
|
+
for (const key of stillMismatched) {
|
|
1695
1697
|
await upsertOne(key, variables[key]);
|
|
1696
1698
|
}
|
|
1697
1699
|
}
|
|
1698
1700
|
}
|
|
1699
|
-
if (
|
|
1700
|
-
throw new Error(`Railway variable upsert did not persist: ${
|
|
1701
|
+
if (stillMismatched.length > 0) {
|
|
1702
|
+
throw new Error(`Railway variable upsert did not persist expected values: ${stillMismatched.join(", ")}.`);
|
|
1701
1703
|
}
|
|
1702
1704
|
}
|
|
1703
1705
|
async function listRailwayVolumes({
|
|
@@ -5030,8 +5030,9 @@ async function verifyRailwayUnit(input) {
|
|
|
5030
5030
|
serviceId: entry.service.id,
|
|
5031
5031
|
env: topology.env
|
|
5032
5032
|
}).catch(() => entry.currentVariables);
|
|
5033
|
-
const
|
|
5034
|
-
|
|
5033
|
+
const expectedVariablesMatch = Object.entries(sync.variables).every(([key, value]) => currentVariables[key] === value);
|
|
5034
|
+
const expectedSecretsExist = Object.keys(sync.secrets).every((key) => Object.hasOwn(currentVariables, key));
|
|
5035
|
+
if (expectedVariablesMatch && expectedSecretsExist) {
|
|
5035
5036
|
break;
|
|
5036
5037
|
}
|
|
5037
5038
|
sleepMs(1e3);
|
package/dist/reconcile/engine.js
CHANGED
|
@@ -343,7 +343,7 @@ async function reconcileTreeseedTarget({
|
|
|
343
343
|
observed: plan.observed,
|
|
344
344
|
diff: plan.diff,
|
|
345
345
|
action: plan.diff.action,
|
|
346
|
-
warnings: [...plan.observed.warnings, "
|
|
346
|
+
warnings: [...plan.observed.warnings, "plan mode: apply skipped"],
|
|
347
347
|
resourceLocators: plan.observed.locators,
|
|
348
348
|
state: plan.observed.live,
|
|
349
349
|
verification: null
|