Protect active E2E resources from scheduled cleanup (#2595)

* Protect active E2E test resources from cleanup

* Validate E2E cleanup duration

* Test E2E resource naming
This commit is contained in:
Vsevolod Kukol
2026-09-30 18:51:14 +02:00
committed by GitHub
parent a70971d9c2
commit 0842b1f131
6 changed files with 164 additions and 32 deletions
+16
View File
@@ -0,0 +1,16 @@
const crypto = require("crypto");
function generateUniqueName(baseName, options, environment = process.env) {
const length = options?.length ?? 1;
const timestamp = options?.timestampped === undefined ? true : options.timestampped;
const prefixed = options?.prefixed === undefined ? true : options.prefixed;
const runId = environment.GITHUB_RUN_ID;
const runAttempt = environment.GITHUB_RUN_ATTEMPT ?? "1";
const runPrefix = runId ? `${runId}_${runAttempt}_` : "";
const prefix = prefixed ? `t_${runPrefix}` : "";
const suffix = timestamp ? `_${Date.now()}` : "";
return `${prefix}${baseName}${crypto.randomBytes(length).toString("hex")}${suffix}`;
}
module.exports = { generateUniqueName };