Execute scoped deploy action reliably
vadimenovikau/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (push) Successful in 23s

This commit is contained in:
2026-08-18 15:38:07 +02:00
parent 1cb56cd720
commit c9e5f82e28
2 changed files with 49 additions and 5 deletions
@@ -4,6 +4,7 @@ import test from "node:test";
import {
deployExactImage,
mergeEnvironment,
resolveDeploymentBranch,
selectDeployment,
toSavePayload,
validateTarget,
@@ -33,6 +34,28 @@ test("selects only the deployment matching the triggering branch", () => {
assert.equal(selectDeployment(config, "other"), null);
});
test("resolves push and pull request deployment branches without accepting empty context values", () => {
assert.equal(
resolveDeploymentBranch({
eventName: "push",
environment: { GITHUB_REF_NAME: "", GITEA_REF_NAME: "main" },
}),
"main",
);
assert.equal(
resolveDeploymentBranch({
eventName: "pull_request",
environment: { GITHUB_BASE_REF: "", GITEA_BASE_REF: "" },
eventPayload: { pull_request: { base: { ref: "main" } } },
}),
"main",
);
assert.throws(
() => resolveDeploymentBranch({ eventName: "pull_request", environment: {}, eventPayload: {} }),
/Pull request base branch/,
);
});
test("validates OCI paths and repository-local build paths", () => {
assert.equal(validateTarget({ name: "Web", image: "Owner/Web", appId: "app-1" }).image, "owner/web");
assert.throws(() => validateTarget({ name: "Web", image: "owner/web", appId: "app-1", context: "../secret" }), /inside/);