@dragonmastery/tamer 0.31.4 → 0.31.5
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.
- package/dist/tamer.mjs +34 -18
- package/dist/tamer.mjs.map +1 -1
- package/package.json +1 -1
package/dist/tamer.mjs
CHANGED
|
@@ -8041,13 +8041,7 @@ function secretsDrift(entries) {
|
|
|
8041
8041
|
detail: "removed from vault"
|
|
8042
8042
|
});
|
|
8043
8043
|
break;
|
|
8044
|
-
case "undeclared_on_worker":
|
|
8045
|
-
drift.unrecordedInState.push({
|
|
8046
|
-
logicalName: e.name,
|
|
8047
|
-
derivedName,
|
|
8048
|
-
detail: "undeclared on worker"
|
|
8049
|
-
});
|
|
8050
|
-
break;
|
|
8044
|
+
case "undeclared_on_worker": break;
|
|
8051
8045
|
}
|
|
8052
8046
|
}
|
|
8053
8047
|
return drift;
|
|
@@ -8102,8 +8096,20 @@ const STATUS_LABEL = {
|
|
|
8102
8096
|
never_deployed: "never deployed",
|
|
8103
8097
|
rotated_not_deployed: "rotated, not deployed",
|
|
8104
8098
|
removed_from_vault: "removed from vault",
|
|
8105
|
-
undeclared_on_worker: "
|
|
8099
|
+
undeclared_on_worker: "not in secrets.required"
|
|
8106
8100
|
};
|
|
8101
|
+
function isDeclaredIssue(status) {
|
|
8102
|
+
return status !== "in_sync" && status !== "undeclared_on_worker";
|
|
8103
|
+
}
|
|
8104
|
+
function sortEntries(entries) {
|
|
8105
|
+
return [...entries].sort((a, b) => secretDerivedName(a.worker, a.name).localeCompare(secretDerivedName(b.worker, b.name)));
|
|
8106
|
+
}
|
|
8107
|
+
function printEntry(entry) {
|
|
8108
|
+
const label = STATUS_LABEL[entry.status];
|
|
8109
|
+
const id = secretDerivedName(entry.worker, entry.name);
|
|
8110
|
+
const workerFlag = entry.onWorker ? "on worker" : "not on worker";
|
|
8111
|
+
console.log(` ${id} ${label} (${workerFlag})`);
|
|
8112
|
+
}
|
|
8107
8113
|
async function runSecretsVerify(options) {
|
|
8108
8114
|
const ctx = await createSecretsContext({
|
|
8109
8115
|
env: options.env,
|
|
@@ -8123,21 +8129,31 @@ async function runSecretsVerify(options) {
|
|
|
8123
8129
|
vault: vaultReaderFromVault(ctx.vault),
|
|
8124
8130
|
state: ctx.state
|
|
8125
8131
|
});
|
|
8132
|
+
const declared = sortEntries(entries.filter((e) => e.status !== "undeclared_on_worker"));
|
|
8133
|
+
const onWorkerOnly = sortEntries(entries.filter((e) => e.status === "undeclared_on_worker"));
|
|
8126
8134
|
console.log(`\nSecrets verify — env ${ctx.env}\n`);
|
|
8127
|
-
if (
|
|
8135
|
+
if (declared.length === 0 && onWorkerOnly.length === 0) {
|
|
8128
8136
|
console.log(" (no declared secrets)\n");
|
|
8129
8137
|
return 0;
|
|
8130
8138
|
}
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
const
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8139
|
+
if (declared.length > 0) {
|
|
8140
|
+
console.log(" Declared in config (secrets.required):\n");
|
|
8141
|
+
for (const entry of declared) printEntry(entry);
|
|
8142
|
+
console.log("");
|
|
8143
|
+
}
|
|
8144
|
+
if (onWorkerOnly.length > 0) {
|
|
8145
|
+
console.log(" On worker, not in secrets.required (outside Tamer management — add to config or remove from worker):\n");
|
|
8146
|
+
for (const entry of onWorkerOnly) printEntry(entry);
|
|
8147
|
+
console.log("");
|
|
8148
|
+
}
|
|
8149
|
+
const declaredIssues = declared.filter((e) => isDeclaredIssue(e.status)).length;
|
|
8150
|
+
if (declaredIssues === 0) {
|
|
8151
|
+
const suffix = onWorkerOnly.length > 0 ? ` (${onWorkerOnly.length} on worker but not in config — informational only)` : "";
|
|
8152
|
+
console.log(`All declared secrets in sync.${suffix}\n`);
|
|
8153
|
+
return 0;
|
|
8138
8154
|
}
|
|
8139
|
-
console.log(
|
|
8140
|
-
return
|
|
8155
|
+
console.log(`${declaredIssues} declared secret(s) need attention.\n`);
|
|
8156
|
+
return 1;
|
|
8141
8157
|
}
|
|
8142
8158
|
|
|
8143
8159
|
//#endregion
|