feat(build): support optional BuildKit secrets
Platform CI tests / QuickStack deploy action tests (pull_request) Successful in 40s
Nuvisphere/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (pull_request) Successful in 27s
Platform CI tests / QuickStack deploy action tests (push) Successful in 28s
Nuvisphere/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (push) Successful in 29s
Platform CI tests / QuickStack deploy action tests (pull_request) Successful in 40s
Nuvisphere/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (pull_request) Successful in 27s
Platform CI tests / QuickStack deploy action tests (push) Successful in 28s
Nuvisphere/Platform-CI: Immutable QuickStack OCI deployment / Build once and deploy exact digest (push) Successful in 29s
This commit was merged in pull request #4.
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
deployExactImage,
|
||||
expandTokens,
|
||||
mergeEnvironment,
|
||||
resolveBuildSecretArguments,
|
||||
resolveSecretEnvironment,
|
||||
orderApplications,
|
||||
resolveDeploymentBranch,
|
||||
@@ -151,6 +152,34 @@ test("version 2 validates promotion contracts and token expansion", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("passes declared Actions secrets to Docker only through BuildKit secret mounts", () => {
|
||||
const secretValue = "must-not-appear-in-docker-arguments";
|
||||
const artifact = validateArtifact({
|
||||
name: "web",
|
||||
image: "owner/web",
|
||||
buildSecrets: {
|
||||
"next-server-actions-encryption-key": "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
|
||||
},
|
||||
});
|
||||
const args = resolveBuildSecretArguments(artifact.buildSecrets, {
|
||||
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: secretValue,
|
||||
});
|
||||
|
||||
assert.deepEqual(args, [
|
||||
"--secret",
|
||||
"id=next-server-actions-encryption-key,env=NEXT_SERVER_ACTIONS_ENCRYPTION_KEY",
|
||||
]);
|
||||
assert.doesNotMatch(JSON.stringify(args), new RegExp(secretValue));
|
||||
assert.throws(
|
||||
() => resolveBuildSecretArguments(artifact.buildSecrets, {}),
|
||||
/Missing Actions secret NEXT_SERVER_ACTIONS_ENCRYPTION_KEY/,
|
||||
);
|
||||
assert.throws(
|
||||
() => validateArtifact({ name: "web", image: "owner/web", buildSecrets: { "../invalid": "SECRET" } }),
|
||||
/Invalid BuildKit secret ID/,
|
||||
);
|
||||
});
|
||||
|
||||
test("application dependencies reject missing nodes and cycles", () => {
|
||||
assert.throws(
|
||||
() => orderApplications([{ name: "web", dependsOn: ["missing"] }]),
|
||||
|
||||
Reference in New Issue
Block a user