feat(ci): support explicit runtime secret mapping #3
@@ -6,6 +6,7 @@ import {
|
|||||||
deployExactImage,
|
deployExactImage,
|
||||||
expandTokens,
|
expandTokens,
|
||||||
mergeEnvironment,
|
mergeEnvironment,
|
||||||
|
resolveSecretEnvironment,
|
||||||
orderApplications,
|
orderApplications,
|
||||||
resolveDeploymentBranch,
|
resolveDeploymentBranch,
|
||||||
resolvePullRequestHeadBranch,
|
resolvePullRequestHeadBranch,
|
||||||
@@ -170,6 +171,24 @@ test("preserves response-only fields and existing environment secrets safely", (
|
|||||||
assert.equal(mergeEnvironment(app().envVars, { ENVIRONMENT: "new" }), "SECRET=preserved\nENVIRONMENT=new");
|
assert.equal(mergeEnvironment(app().envVars, { ENVIRONMENT: "new" }), "SECRET=preserved\nENVIRONMENT=new");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("maps only explicitly declared Actions secrets into runtime environment", () => {
|
||||||
|
assert.deepEqual(
|
||||||
|
resolveSecretEnvironment(
|
||||||
|
{ MINIO_ENDPOINT: "MINIO_ENDPOINT", MINIO_REGION: "MINIO_REGION" },
|
||||||
|
{ MINIO_ENDPOINT: "https://minio.example.test", MINIO_REGION: "us-east-1" },
|
||||||
|
),
|
||||||
|
{ MINIO_ENDPOINT: "https://minio.example.test", MINIO_REGION: "us-east-1" },
|
||||||
|
);
|
||||||
|
assert.throws(
|
||||||
|
() => resolveSecretEnvironment({ MINIO_ENDPOINT: "MINIO_ENDPOINT" }, {}),
|
||||||
|
/Missing Actions secret MINIO_ENDPOINT/,
|
||||||
|
);
|
||||||
|
assert.throws(
|
||||||
|
() => resolveSecretEnvironment({ "INVALID-KEY": "MINIO_ENDPOINT" }, { MINIO_ENDPOINT: "value" }),
|
||||||
|
/Invalid secret environment key/,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("postflight waits for the exact expected identity", async () => {
|
test("postflight waits for the exact expected identity", async () => {
|
||||||
let attempt = 0;
|
let attempt = 0;
|
||||||
const result = await verifyEndpoint(
|
const result = await verifyEndpoint(
|
||||||
|
|||||||
Reference in New Issue
Block a user