@kungfu-tech/buildchain 4.1.0-alpha.0 → 4.1.0-alpha.2
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/AGENTS.md +30 -41
- package/CONTRIBUTING.md +6 -7
- package/architecture/action-taxonomy.json +5 -21
- package/architecture/agent-change-map.md +74 -56
- package/architecture/build-orchestration.json +8 -1
- package/architecture/ci-lane-change-budget.json +179 -69
- package/architecture/floating-consumer-policy.json +7 -17
- package/architecture/internal-capabilities.json +58 -72
- package/architecture/maintainability-debt.json +138 -52
- package/architecture/maintainability-policy.json +6 -15
- package/architecture/promotion-job-topology.json +39 -20
- package/architecture/release-topology.json +26 -37
- package/architecture/runtime-entry.json +26 -0
- package/architecture/runtime-resume-lineage.json +23 -0
- package/architecture/stage-capsule-qualification.json +2 -2
- package/architecture/universal-workflow-bootstrap.json +10 -25
- package/architecture/universal-workflow-capability-policy.json +61 -0
- package/architecture/universal-workflow-fault-campaign.json +18 -24
- package/architecture/workflow-taxonomy.json +0 -11
- package/contracts/fixtures/{v4-runtime-ref-resume-authority-v1 → runtime-resume-lineage-v2}/scenario.json +2 -3
- package/contracts/fixtures/v4-floating-consumer-policy-v1/cases.json +2 -2
- package/contracts/fixtures/v4-tail-reseal-v1/valid.json +1 -1
- package/contracts/promotion-invocation-v1.schema.json +0 -44
- package/contracts/promotion-request-v1.schema.json +0 -39
- package/contracts/runtime-resume-lineage-v2.schema.json +182 -0
- package/dist/site/buildchain-contract.json +472 -361
- package/dist/site/buildchain-site.json +99 -99
- package/dist/site/capability-registry.json +3 -3
- package/dist/site/cli-registry.json +4 -4
- package/dist/site/controller-registry.json +94 -78
- package/dist/site/kfd-claims.json +224 -343
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +15 -15
- package/dist/site/node-api-registry.json +239 -354
- package/dist/site/page-registry.json +80 -80
- package/dist/site/public-surface-audit.json +203 -254
- package/dist/site/publication-authority-registry.json +1 -24
- package/dist/site/publication-registry.json +4 -4
- package/dist/site/release-provenance.json +1 -1
- package/dist/site/site-manifest.json +19 -19
- package/dist/site/workflow-registry.json +197 -357
- package/docs/MAP.md +3 -3
- package/docs/auditable-demo.md +4 -4
- package/docs/cli-reference.md +2 -2
- package/docs/code-organization.md +5 -4
- package/docs/controller-evidence.md +2 -2
- package/docs/dev-alpha-candidate-patrol.md +5 -5
- package/docs/dev-delivery-warrant.md +14 -24
- package/docs/engineering-housekeeper.md +3 -3
- package/docs/github-artifact-attestation.md +9 -12
- package/docs/github-governance-authority.md +4 -4
- package/docs/node-api-reference.md +153 -167
- package/docs/publication-artifacts.md +3 -4
- package/docs/publication-authority.md +2 -2
- package/docs/release-candidate.md +21 -27
- package/docs/release-governance.md +10 -10
- package/docs/release-promotion-request.md +11 -18
- package/docs/release-propagation.md +5 -6
- package/docs/release-tail-provider-plane.md +2 -3
- package/docs/reusable-build-surface.md +13 -7
- package/docs/runtime-entry.md +122 -0
- package/docs/runtime-train-validation.md +30 -41
- package/docs/v4-publication-rehearsal.md +5 -5
- package/docs/v4-stage-capsule.md +9 -10
- package/docs/web-surface-deployments.md +16 -20
- package/docs/workflow-catalog.md +0 -1
- package/package.json +6 -6
- package/packages/core/adoption/commands/init-repo.mjs +2 -2
- package/packages/core/adoption/cross-platform-adopter-qualification.js +2 -13
- package/packages/core/adoption/qualification/actions.js +3 -5
- package/packages/core/adoption/qualification/admission.js +2 -3
- package/packages/core/build/artifact/attestation.js +0 -1
- package/packages/core/build/artifact/contracts.js +1 -4
- package/packages/core/build/artifact/store.js +6 -5
- package/packages/core/build/artifact-signing.js +4 -10
- package/packages/core/build/binary/actions.js +15 -9
- package/packages/core/build/binary-publication-dispatch.js +2 -6
- package/packages/core/build/demo/action-context.js +2 -11
- package/packages/core/build/demo/binary-action.js +8 -10
- package/packages/core/build/gate/controller.js +0 -2
- package/packages/core/build/github-attestation/action.js +2 -7
- package/packages/core/build/github-attestation/admission.js +0 -8
- package/packages/core/build/github-attestation/transaction.js +1 -2
- package/packages/core/build/lifecycle/stage-action.js +2 -0
- package/packages/core/build/lifecycle/stage.js +6 -3
- package/packages/core/build/macos-credential-island/dmg-assembly.js +0 -2
- package/packages/core/build/macos-credential-island/lib.js +2 -6
- package/packages/core/build/plan/action-context.js +0 -7
- package/packages/core/build/plan/action.js +7 -11
- package/packages/core/build/plan/admission.js +6 -73
- package/packages/core/build/plan/configuration.js +1 -1
- package/packages/core/build/plan/environment.js +1 -1
- package/packages/core/build/plan/identity.js +1 -5
- package/packages/core/build/plan/resolve.js +7 -1
- package/packages/core/build/recovery/checkpoint.js +158 -0
- package/packages/core/build/recovery/transaction.js +51 -0
- package/packages/core/build/signing/authority-actions.js +2 -11
- package/packages/core/build/signing/control.js +0 -5
- package/packages/core/build/signing/controller-transaction.js +0 -1
- package/packages/core/build/signing/delegation.js +2 -4
- package/packages/core/build/signing/dispatch.js +10 -56
- package/packages/core/build/signing/intake.js +0 -4
- package/packages/core/build/signing/prepare.js +1 -1
- package/packages/core/build/signing/request.js +3 -8
- package/packages/core/build/source/checkout-action.js +6 -10
- package/packages/core/build/source/controller.js +1 -4
- package/packages/core/build/source/lifecycle.js +3 -13
- package/packages/core/build/stage-capsule/actions.js +3 -13
- package/packages/core/build/stage-capsule/campaign/resume.js +10 -5
- package/packages/core/build/stage-capsule/rehearsal/verify.js +3 -4
- package/packages/core/build/stage-capsule-resume-planner.js +0 -1
- package/packages/core/build/summary/aggregation.js +5 -5
- package/packages/core/build/summary/finalization.js +1 -1
- package/packages/core/build/verification/actions.js +3 -12
- package/packages/core/build/verification/runner.js +22 -20
- package/packages/core/consumer/floating-consumer-evidence.js +3 -21
- package/packages/core/consumer/floating-consumer-policy.js +2 -93
- package/packages/core/consumer/floating-consumer-release-passport.js +1 -34
- package/packages/core/consumer/policy-admission.js +1 -3
- package/packages/core/contracts/buildchain-contract.js +12 -146
- package/packages/core/contracts/workflow-yaml-contract.js +11 -1
- package/packages/core/dev-delivery/candidate/admission.js +3 -4
- package/packages/core/dev-delivery/candidate/coordinates.js +0 -8
- package/packages/core/dev-delivery/commands/dev-delivery-request.sh +5 -13
- package/packages/core/dev-delivery/commands/dev-delivery-source-proof-reuse.mjs +0 -3
- package/packages/core/dev-delivery/dev-delivery-contract-surface.js +4 -52
- package/packages/core/dev-delivery/dev-delivery-execution-transfer.js +2 -15
- package/packages/core/dev-delivery/native/action-context.js +4 -32
- package/packages/core/dev-delivery/native/provider-boundary.js +0 -2
- package/packages/core/dev-delivery/native/transactions.js +1 -2
- package/packages/core/dev-delivery/queue/reconciliation-action.js +6 -10
- package/packages/core/dev-delivery/source-proof/predicates.js +0 -6
- package/packages/core/dev-delivery/source-proof/reuse.js +0 -2
- package/packages/core/dev-delivery/source-proof/seal.js +0 -2
- package/packages/core/governance/alpha-candidate/action.js +1 -10
- package/packages/core/governance/audit/actions.js +1 -3
- package/packages/core/governance/audit/collection.js +1 -3
- package/packages/core/governance/audit/identity.js +3 -31
- package/packages/core/governance/audit/transactions.js +2 -4
- package/packages/core/governance/buildchain-publication-authority.js +0 -1
- package/packages/core/governance/commands/audit-github-governance.mjs +3 -2
- package/packages/core/governance/github-governance-authority.js +0 -5
- package/packages/core/governance/receipt-admission.js +0 -15
- package/packages/core/index.js +1 -1
- package/packages/core/observability/controller/identity.js +4 -5
- package/packages/core/observability/controller-evidence.js +5 -10
- package/packages/core/paper/commands/paper.mjs +6 -6
- package/packages/core/paper/operations/plans.js +2 -2
- package/packages/core/paper/operations/provisioning-validation.js +1 -1
- package/packages/core/paper/operations/scaffold-workflows.js +29 -12
- package/packages/core/paper/operations/scaffold.js +97 -69
- package/packages/core/paper/paper-agent-entry.js +0 -11
- package/packages/core/paper/paper-runtime-channels.js +21 -66
- package/packages/core/paper/paper-scaffold-content.js +1 -1
- package/packages/core/paper/paper.js +9 -5
- package/packages/core/paper/publication/candidate.js +0 -9
- package/packages/core/paper/publication-controller.js +2 -4
- package/packages/core/providers/github/artifact-attestation.js +1 -1
- package/packages/core/publication/authority/actions.js +9 -8
- package/packages/core/publication/authority/admission.js +0 -11
- package/packages/core/publication/authority/assembly.js +2 -7
- package/packages/core/publication/authority/control-plane.js +2 -2
- package/packages/core/publication/authority/governance.js +2 -9
- package/packages/core/publication/authority/request.js +7 -2
- package/packages/core/publication/authority/verification.js +3 -18
- package/packages/core/publication/binary/action.js +5 -7
- package/packages/core/publication/candidate/qualification-action.js +1 -6
- package/packages/core/publication/candidate/stage-capsules.js +1 -1
- package/packages/core/publication/npm/preview-action.js +9 -15
- package/packages/core/publication/oci/preview-actions.js +1 -10
- package/packages/core/publication/publication-artifact-candidate.js +2 -2
- package/packages/core/publication/publication-authority.js +2 -2
- package/packages/core/publication/publication-rehearsal-projection.js +3 -3
- package/packages/core/publication/settlement/actions.js +2 -11
- package/packages/core/release/binary/coordinates-action.js +0 -13
- package/packages/core/release/binary/coordinates.js +2 -19
- package/packages/core/release/commands/promotion-channel-router.mjs +12 -56
- package/packages/core/release/commands/resume-from-candidate-run.mjs +2 -3
- package/packages/core/release/dev-alpha-active-release-train.js +0 -5
- package/packages/core/release/line/action.js +2 -13
- package/packages/core/release/next-development/actions.js +2 -5
- package/packages/core/release/passport/consumer-validation.js +1 -28
- package/packages/core/release/promote-candidate/development-source.js +7 -8
- package/packages/core/release/promotion/actions.js +7 -38
- package/packages/core/release/promotion/admission.js +3 -50
- package/packages/core/release/promotion/candidate.js +2 -4
- package/packages/core/release/promotion/channel.js +13 -101
- package/packages/core/release/promotion/qualification-action.js +2 -13
- package/packages/core/release/promotion/routing.js +16 -81
- package/packages/core/release/promotion/selection.js +1 -9
- package/packages/core/release/promotion-request.js +1 -40
- package/packages/core/release/qualification/actions.js +0 -8
- package/packages/core/release/qualification/public-build.js +1 -1
- package/packages/core/release/recovery/candidate.js +15 -21
- package/packages/core/release/recovery/capsules.js +2 -10
- package/packages/core/release/recovery/lineage.js +305 -0
- package/packages/core/release/recovery/provenance.js +1 -2
- package/packages/core/release/recovery/publication.js +4 -14
- package/packages/core/release/recovery/readback.js +19 -32
- package/packages/core/release/recovery/runtime.js +4 -95
- package/packages/core/release/release-candidate-recovery.js +4 -9
- package/packages/core/release/release-candidate.js +2 -5
- package/packages/core/release/reseal/actions.js +3 -22
- package/packages/core/release/reseal/admission.js +0 -2
- package/packages/core/release/reseal/finalize-platform.js +0 -2
- package/packages/core/release/tail-reseal-github.js +1 -2
- package/packages/core/release/tail-reseal-receipt.js +0 -1
- package/packages/core/release/tail-reseal.js +2 -20
- package/packages/core/release/version-state.js +16 -13
- package/packages/core/runtime/buildchain-domain.wasm +0 -0
- package/packages/core/runtime/checkout-identity.js +0 -13
- package/packages/core/runtime/domain-wasm-artifact.js +2 -2
- package/packages/core/runtime/entry/actions.js +121 -0
- package/packages/core/runtime/entry/activation.js +86 -0
- package/packages/core/runtime/entry/github.js +55 -0
- package/packages/core/runtime/entry/recovery.js +37 -0
- package/packages/core/runtime/entry/selection.js +110 -0
- package/packages/core/web/controller.js +1 -1
- package/packages/core/web/publication-admission-action.js +1 -8
- package/packages/core/web/web-surface-publication-candidate.js +2 -5
- package/packages/core/workflow/admission/actions.js +6 -26
- package/packages/core/workflow/admission/recovery.js +3 -43
- package/packages/core/workflow/admission/transactions.js +8 -24
- package/packages/core/workflow/commands/buildchain-cli-help.mjs +1 -1
- package/packages/core/workflow/commands/universal-workflow-engine.mjs +2 -7
- package/packages/core/workflow/dogfood/actions.js +0 -17
- package/packages/core/workflow/engine/action.js +0 -5
- package/packages/core/workflow/engine/conformance.js +1 -1
- package/packages/core/workflow/engine/execution.js +2 -6
- package/packages/core/workflow/engine/identity.js +1 -6
- package/packages/core/workflow/engine/release-environment.js +11 -35
- package/packages/core/workflow/engine/release-promotion.js +2 -2
- package/packages/core/workflow/settlement/actions.js +0 -12
- package/packages/core/workflow/universal-self-dogfood.js +2 -16
- package/packages/core/workflow/universal-workflow-bootstrap.js +16 -241
- package/packages/core/workflow/workflow-taxonomy.mjs +2 -2
- package/scripts/check-dev-delivery-actions.mjs +17 -8
- package/scripts/check-floating-consumer-policy-contract.mjs +6 -6
- package/scripts/check-inventory.mjs +1 -10
- package/scripts/check-public-dogfood-contract.mjs +34 -21
- package/scripts/check-release-topology.mjs +2 -6
- package/scripts/check-runtime-entry.mjs +133 -0
- package/scripts/check-universal-workflow-bootstrap.mjs +45 -281
- package/scripts/check-workflows.sh +0 -7
- package/scripts/generate-bootstrap-admission.mjs +1 -1
- package/scripts/generate-channel-promotion-workflow.mjs +4 -4
- package/scripts/inventory/binary.mjs +4 -4
- package/scripts/inventory/promotion.mjs +5 -3
- package/scripts/runtime-source-boundaries.mjs +70 -0
- package/scripts/site-capability-metadata.mjs +2 -2
- package/scripts/workflow-action-graph.mjs +5 -18
- package/scripts/workflow-self-reference.mjs +20 -0
- package/templates/native-dev-delivery.yml +4 -4
- package/templates/universal-buildchain-bootstrap.yml +12 -2
- package/architecture/runtime-ref-resume-authority.json +0 -64
- package/architecture/universal-workflow-train-admission.json +0 -76
- package/contracts/v4-runtime-ref-resume-authority-v1.schema.json +0 -235
- package/docs/v4-runtime-ref-resume-authority.md +0 -69
- package/packages/core/consumer/channel-selection.js +0 -211
- package/packages/core/consumer/commands/buildchain-channel-router.mjs +0 -81
- package/packages/core/consumer/invocation-selector.js +0 -4
- package/packages/core/consumer/runtime-ref-resume-authority.js +0 -621
- package/packages/core/consumer/workflow-definition-authority.js +0 -64
- package/packages/core/contracts/runtime-contract-action.js +0 -48
- package/packages/core/release/commands/promotion-identity-resolver.mjs +0 -77
- package/packages/core/release/commands/verify-promotion-router-binding.sh +0 -36
- package/packages/core/release/promotion/identities.js +0 -56
- package/packages/core/release/runtime-override-authorization.js +0 -242
- package/packages/core/runtime/commands/runtime-ref-core.mjs +0 -171
- package/packages/core/runtime/provider-closure.js +0 -60
- package/packages/core/runtime/runtime-selection-action.js +0 -34
- package/packages/core/runtime/runtime-selection.js +0 -136
- package/packages/core/runtime/workflow-runtime.js +0 -11
- package/packages/core/workflow/admission/review.js +0 -188
- package/packages/core/workflow/commands/universal-workflow-backflow.mjs +0 -26
- package/packages/core/workflow/installation.js +0 -33
- package/packages/core/workflow/settlement/backflow.js +0 -187
- package/scripts/generate-bootstrap-recovery.mjs +0 -94
- package/templates/bootstrap-recovery/actions/build/source/admit/action.yml +0 -17
- package/templates/bootstrap-recovery/actions/build/source/admit/dist/index.js +0 -63
- package/templates/bootstrap-recovery/actions/runtime/dependencies/install/action.yml +0 -18
- package/templates/bootstrap-recovery/actions/runtime/dependencies/install/dist/index.js +0 -63
- package/templates/bootstrap-recovery/actions/runtime/environment/prepare/action.yml +0 -21
- package/templates/bootstrap-recovery/actions/workflow/admission/inspect/action.yml +0 -27
- package/templates/bootstrap-recovery/actions/workflow/admission/inspect/dist/index.js +0 -64
- package/templates/bootstrap-recovery/actions/workflow/admission/review/action.yml +0 -15
- package/templates/bootstrap-recovery/actions/workflow/admission/review/dist/index.js +0 -65
- package/templates/bootstrap-recovery/actions/workflow/recovery/admit/action.yml +0 -47
- package/templates/bootstrap-recovery/actions/workflow/recovery/execute/action.yml +0 -48
- package/templates/bootstrap-recovery/actions/workflow/recovery/settle/action.yml +0 -54
- package/templates/bootstrap-recovery/actions/workflow/settlement/seal/action.yml +0 -17
- package/templates/bootstrap-recovery/actions/workflow/settlement/seal/dist/index.js +0 -65
- package/templates/bootstrap-recovery/manifest.json +0 -68
- package/templates/bootstrap-recovery/package.json +0 -9
- package/templates/universal-buildchain-bootstrap-recovery.yml +0 -115
|
@@ -14,44 +14,12 @@ function repository(value, label) {
|
|
|
14
14
|
return normalized;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
const DEFAULT_ARTIFACT_SIGNING_AUTHORITY_REF =
|
|
18
|
-
"authority/v4/v4.1/artifact-signing";
|
|
19
17
|
const AUTHORITY_WORKFLOW = "public-release-signing-authority.yml";
|
|
20
18
|
|
|
21
|
-
export function resolveAuthorityDispatchRef(value) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (ref !== DEFAULT_ARTIFACT_SIGNING_AUTHORITY_REF)
|
|
26
|
-
throw new Error(
|
|
27
|
-
"Artifact signing requires the current protected authority",
|
|
28
|
-
);
|
|
29
|
-
return ref;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function resolveArtifactSigningAuthorityRuntime({
|
|
33
|
-
authorityRepository,
|
|
34
|
-
authorityRef,
|
|
35
|
-
token,
|
|
36
|
-
requestImpl = githubRequest,
|
|
37
|
-
}) {
|
|
38
|
-
const authorityRepo = repository(authorityRepository, "authority repository");
|
|
39
|
-
const ref = resolveAuthorityDispatchRef(authorityRef);
|
|
40
|
-
const encodedRef = ref.split("/").map(encodeURIComponent).join("/");
|
|
41
|
-
const response = await requestImpl(
|
|
42
|
-
`/repos/${authorityRepo}/git/ref/heads/${encodedRef}`,
|
|
43
|
-
{ token: required(token, "Buildchain authority dispatch token") },
|
|
44
|
-
);
|
|
45
|
-
if (response?.object?.type !== "commit") {
|
|
46
|
-
throw new Error(
|
|
47
|
-
"Buildchain signing authority ref does not resolve to a commit",
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
const sha = String(response.object.sha || "");
|
|
51
|
-
if (!/^[0-9a-f]{40}$/u.test(sha)) {
|
|
52
|
-
throw new Error("Buildchain signing authority runtime SHA must be exact");
|
|
53
|
-
}
|
|
54
|
-
return { ref, sha };
|
|
19
|
+
export function resolveAuthorityDispatchRef(value = "v4") {
|
|
20
|
+
if (!["v4", "v4-alpha"].includes(value))
|
|
21
|
+
throw new Error("Signing entry must use a public floating channel");
|
|
22
|
+
return value;
|
|
55
23
|
}
|
|
56
24
|
|
|
57
25
|
function authorityError(message, outputs = {}) {
|
|
@@ -62,7 +30,7 @@ function authorityError(message, outputs = {}) {
|
|
|
62
30
|
|
|
63
31
|
export function validateArtifactSigningAuthorityRun(
|
|
64
32
|
run,
|
|
65
|
-
{ authorityRepository,
|
|
33
|
+
{ authorityRepository, expectedTitle },
|
|
66
34
|
) {
|
|
67
35
|
if (!run || typeof run !== "object") {
|
|
68
36
|
throw new Error("Buildchain signing authority run is missing");
|
|
@@ -73,9 +41,6 @@ export function validateArtifactSigningAuthorityRun(
|
|
|
73
41
|
if (String(run.event || "") !== "workflow_dispatch") {
|
|
74
42
|
throw new Error("Buildchain signing authority event mismatch");
|
|
75
43
|
}
|
|
76
|
-
if (String(run.head_sha || "") !== authorityRuntimeSha) {
|
|
77
|
-
throw new Error("Buildchain signing authority runtime SHA mismatch");
|
|
78
|
-
}
|
|
79
44
|
if (
|
|
80
45
|
run.repository?.full_name &&
|
|
81
46
|
String(run.repository.full_name) !== authorityRepository
|
|
@@ -92,7 +57,6 @@ export function validateArtifactSigningAuthorityRun(
|
|
|
92
57
|
async function pollArtifactSigningAuthorityRun({
|
|
93
58
|
authorityRepository,
|
|
94
59
|
token,
|
|
95
|
-
authorityRuntimeSha,
|
|
96
60
|
expectedTitle,
|
|
97
61
|
startedAtMs,
|
|
98
62
|
deadline,
|
|
@@ -122,8 +86,7 @@ async function pollArtifactSigningAuthorityRun({
|
|
|
122
86
|
try {
|
|
123
87
|
run = validateArtifactSigningAuthorityRun(matches[0], {
|
|
124
88
|
authorityRepository,
|
|
125
|
-
|
|
126
|
-
expectedTitle,
|
|
89
|
+
expectedTitle,
|
|
127
90
|
});
|
|
128
91
|
} catch (error) {
|
|
129
92
|
throw authorityError(error.message, {
|
|
@@ -194,7 +157,7 @@ function successfulAuthorityResult({
|
|
|
194
157
|
export async function dispatchArtifactSigningAuthority({
|
|
195
158
|
token,
|
|
196
159
|
authorityRepository = "kungfu-systems/buildchain",
|
|
197
|
-
authorityRef,
|
|
160
|
+
authorityRef = "v4",
|
|
198
161
|
sourceRepository,
|
|
199
162
|
sourceRunId,
|
|
200
163
|
sourceRunAttempt = "1",
|
|
@@ -213,8 +176,6 @@ export async function dispatchArtifactSigningAuthority({
|
|
|
213
176
|
const sourceRepo = repository(sourceRepository, "source repository");
|
|
214
177
|
const ref = resolveAuthorityDispatchRef(authorityRef);
|
|
215
178
|
const runtime = required(runtimeSha, "Buildchain runtime SHA");
|
|
216
|
-
if (!/^[0-9a-f]{40}$/u.test(runtime))
|
|
217
|
-
throw new Error("Buildchain runtime SHA must be exact");
|
|
218
179
|
const runId = required(sourceRunId, "source run ID");
|
|
219
180
|
const runAttempt = required(sourceRunAttempt, "source run attempt");
|
|
220
181
|
if (!/^[1-9][0-9]*$/u.test(runAttempt)) {
|
|
@@ -243,20 +204,14 @@ export async function dispatchArtifactSigningAuthority({
|
|
|
243
204
|
"controller-started-at": controllerStartedAt,
|
|
244
205
|
};
|
|
245
206
|
try {
|
|
246
|
-
|
|
247
|
-
authorityRepository: authorityRepo,
|
|
248
|
-
authorityRef: ref,
|
|
249
|
-
token: authToken,
|
|
250
|
-
requestImpl,
|
|
251
|
-
});
|
|
252
|
-
baseOutputs["authority-runtime-sha"] = authorityRuntime.sha;
|
|
207
|
+
baseOutputs["authority-runtime-sha"] = runtime;
|
|
253
208
|
await requestImpl(
|
|
254
209
|
`/repos/${authorityRepo}/actions/workflows/${AUTHORITY_WORKFLOW}/dispatches`,
|
|
255
210
|
{
|
|
256
211
|
token: authToken,
|
|
257
212
|
method: "POST",
|
|
258
213
|
body: {
|
|
259
|
-
ref
|
|
214
|
+
ref,
|
|
260
215
|
inputs: {
|
|
261
216
|
"source-repository": sourceRepo,
|
|
262
217
|
"source-run-id": runId,
|
|
@@ -265,7 +220,7 @@ export async function dispatchArtifactSigningAuthority({
|
|
|
265
220
|
"expected-request-root": requestRootDigest,
|
|
266
221
|
"result-artifact-name": resultName,
|
|
267
222
|
"correlation-id": correlation,
|
|
268
|
-
"
|
|
223
|
+
"runtime-ref": runtime,
|
|
269
224
|
},
|
|
270
225
|
},
|
|
271
226
|
},
|
|
@@ -274,7 +229,6 @@ export async function dispatchArtifactSigningAuthority({
|
|
|
274
229
|
const run = await pollArtifactSigningAuthorityRun({
|
|
275
230
|
authorityRepository: authorityRepo,
|
|
276
231
|
token: authToken,
|
|
277
|
-
authorityRuntimeSha: authorityRuntime.sha,
|
|
278
232
|
expectedTitle,
|
|
279
233
|
startedAtMs: controllerStartedAtMs,
|
|
280
234
|
deadline: controllerStartedAtMs + timeout * 1000,
|
|
@@ -15,7 +15,6 @@ import { artifactSigningRequestRoot } from "../signing/request.js";
|
|
|
15
15
|
export function inspectArtifactSigningRequests({
|
|
16
16
|
inputRoot,
|
|
17
17
|
expectedRepository,
|
|
18
|
-
expectedRuntimeSha,
|
|
19
18
|
expectedRequestRoot,
|
|
20
19
|
} = {}) {
|
|
21
20
|
const root = path.resolve(required(inputRoot, "signing request root"));
|
|
@@ -53,9 +52,6 @@ export function inspectArtifactSigningRequests({
|
|
|
53
52
|
) {
|
|
54
53
|
throw new Error("signing request source repository mismatch");
|
|
55
54
|
}
|
|
56
|
-
if (expectedRuntimeSha && request.runtime.sha !== expectedRuntimeSha) {
|
|
57
|
-
throw new Error("signing request runtime SHA mismatch");
|
|
58
|
-
}
|
|
59
55
|
const key = `${request.source.sha}:${request.artifact.id}:${request.artifact.platform}`;
|
|
60
56
|
if (seen.has(key))
|
|
61
57
|
throw new Error(`duplicate artifact signing request: ${key}`);
|
|
@@ -27,7 +27,7 @@ export async function sealSigning(plan, platform, sourceRoot) {
|
|
|
27
27
|
sourceSha: plan.source.sha,
|
|
28
28
|
sourceTreeSha: plan.source.tree_sha,
|
|
29
29
|
runtimeRepository: plan.identity.repository,
|
|
30
|
-
runtimeRef: plan.identity.ref,
|
|
30
|
+
runtimeRef: plan.runtime?.ref || plan.identity.ref,
|
|
31
31
|
runtimeSha: plan.identity.sha,
|
|
32
32
|
platformId: platform.id,
|
|
33
33
|
platformName: platform.name,
|
|
@@ -139,7 +139,6 @@ export function artifactSigningCorrelation({
|
|
|
139
139
|
return [
|
|
140
140
|
required(sourceRunId, "source run ID"),
|
|
141
141
|
positiveInteger(sourceRunAttempt, "source run attempt"),
|
|
142
|
-
exactSha(runtimeSha, "runtime SHA").slice(0, 12),
|
|
143
142
|
required(platformId, "platform ID").replace(/[^A-Za-z0-9._-]+/gu, "-"),
|
|
144
143
|
sha256Root(requestRoot, "request root").slice("sha256:".length, 19),
|
|
145
144
|
].join("-");
|
|
@@ -171,7 +170,7 @@ export function validateArtifactSigningControlRequest(value) {
|
|
|
171
170
|
runtime: {
|
|
172
171
|
repository: repository(value.runtime?.repository, "runtime.repository"),
|
|
173
172
|
ref: required(value.runtime?.ref, "runtime.ref"),
|
|
174
|
-
sha:
|
|
173
|
+
sha: value.runtime?.sha,
|
|
175
174
|
},
|
|
176
175
|
platform: {
|
|
177
176
|
id: required(value.platform?.id, "platform.id"),
|
|
@@ -356,8 +355,6 @@ export function assertArtifactSigningControlRequestContext(
|
|
|
356
355
|
[sourceRunAttempt, String(value.source.runAttempt), "source run attempt"],
|
|
357
356
|
[sourceSha, value.source.sha, "source SHA"],
|
|
358
357
|
[sourceTreeSha, value.source.treeSha, "source tree SHA"],
|
|
359
|
-
[runtimeRepository, value.runtime.repository, "runtime repository"],
|
|
360
|
-
[runtimeSha, value.runtime.sha, "runtime SHA"],
|
|
361
358
|
[platformId, value.platform.id, "platform ID"],
|
|
362
359
|
];
|
|
363
360
|
for (const [expected, actual, label] of expectations) {
|
|
@@ -378,7 +375,6 @@ export function artifactSigningControlRequestOutputs(request) {
|
|
|
378
375
|
"result-artifact": value.authority.resultArtifact,
|
|
379
376
|
"correlation-id": value.authority.correlationId,
|
|
380
377
|
"authority-repository": value.authority.repository,
|
|
381
|
-
"authority-ref": value.runtime.ref,
|
|
382
378
|
"runtime-sha": value.runtime.sha,
|
|
383
379
|
};
|
|
384
380
|
}
|
|
@@ -417,7 +413,7 @@ export function validateArtifactSigningControllerReceipt(value) {
|
|
|
417
413
|
},
|
|
418
414
|
runtime: {
|
|
419
415
|
repository: repository(value.runtime?.repository, "runtime.repository"),
|
|
420
|
-
sha:
|
|
416
|
+
sha: value.runtime?.sha,
|
|
421
417
|
},
|
|
422
418
|
platform: {
|
|
423
419
|
id: required(value.platform?.id, "platform.id"),
|
|
@@ -436,7 +432,7 @@ export function validateArtifactSigningControllerReceipt(value) {
|
|
|
436
432
|
"authority.repository",
|
|
437
433
|
),
|
|
438
434
|
runtimeSha: value.authority?.runtimeSha
|
|
439
|
-
?
|
|
435
|
+
? value.authority.runtimeSha
|
|
440
436
|
: "",
|
|
441
437
|
runId: optional(value.authority?.runId, "authority.runId"),
|
|
442
438
|
runUrl: optional(value.authority?.runUrl, "authority.runUrl"),
|
|
@@ -501,7 +497,6 @@ export function validateArtifactSigningControllerReceipt(value) {
|
|
|
501
497
|
required(receipt.authority.runId, "authority.runId");
|
|
502
498
|
required(receipt.authority.runUrl, "authority.runUrl");
|
|
503
499
|
required(receipt.authority.resultArtifact, "authority.resultArtifact");
|
|
504
|
-
exactSha(receipt.authority.runtimeSha, "authority.runtimeSha");
|
|
505
500
|
}
|
|
506
501
|
if (
|
|
507
502
|
receipt.request.count === 0 &&
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
export function
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { verifyCheckoutIdentity } from "../../runtime/checkout-identity.js";
|
|
3
|
+
export function verifySourceCheckoutAction(core, env) {
|
|
4
|
+
verifyCheckoutIdentity({
|
|
5
|
+
directory: path.resolve(
|
|
6
6
|
env.GITHUB_WORKSPACE,
|
|
7
7
|
core.getInput("source-directory"),
|
|
8
8
|
),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
env.GITHUB_WORKSPACE,
|
|
12
|
-
core.getInput("runtime-directory"),
|
|
13
|
-
),
|
|
14
|
-
runtimeSha: core.getInput("runtime-sha", { required: true }),
|
|
9
|
+
sha: core.getInput("source-sha", { required: true }),
|
|
10
|
+
label: "Consumer source",
|
|
15
11
|
});
|
|
16
12
|
}
|
|
@@ -64,10 +64,7 @@ export function sourceQualificationStages({
|
|
|
64
64
|
return [
|
|
65
65
|
{
|
|
66
66
|
id: "resolve-runtime",
|
|
67
|
-
status:
|
|
68
|
-
observations.runtime?.outcome,
|
|
69
|
-
observations["core-runtime"]?.outcome,
|
|
70
|
-
]),
|
|
67
|
+
status: "success",
|
|
71
68
|
},
|
|
72
69
|
{ id: "checkout-source", status: sourceOutcome },
|
|
73
70
|
{
|
|
@@ -5,14 +5,13 @@ import {
|
|
|
5
5
|
loadBuildchainConfig,
|
|
6
6
|
validateBuildchainConfig,
|
|
7
7
|
} from "../../consumer/buildchain-config.js";
|
|
8
|
-
import {
|
|
9
|
-
import { resolvePaperBuildchainSha } from "../../paper/paper-agent-entry.js";
|
|
8
|
+
import { collectPaperSourcePolicy } from "../../paper/paper.js";
|
|
10
9
|
import { runLifecycle } from "../lifecycle/transaction.js";
|
|
11
10
|
import { consumerCommandSession } from "../../runtime/consumer-shell.js";
|
|
12
11
|
|
|
13
12
|
export function admitSourcePaper(
|
|
14
13
|
{ cwd, runtimeRoot, runtimeRef },
|
|
15
|
-
inspect =
|
|
14
|
+
inspect = collectPaperSourcePolicy,
|
|
16
15
|
) {
|
|
17
16
|
const config = loadBuildchainConfig(cwd)?.config;
|
|
18
17
|
const applicable =
|
|
@@ -21,16 +20,7 @@ export function admitSourcePaper(
|
|
|
21
20
|
(config?.project?.type === "publication-artifact" &&
|
|
22
21
|
(!config.publication || config.publication.kind === "paper"));
|
|
23
22
|
if (!applicable) return { applicable: false };
|
|
24
|
-
|
|
25
|
-
throw new Error("Paper policy requires the selected runtime coordinate");
|
|
26
|
-
const result = inspect({
|
|
27
|
-
cwd,
|
|
28
|
-
buildchainRoot: runtimeRoot,
|
|
29
|
-
buildchainRef: runtimeRef,
|
|
30
|
-
buildchainSha: resolvePaperBuildchainSha(runtimeRoot),
|
|
31
|
-
offline: true,
|
|
32
|
-
agentEntryMode: "ci",
|
|
33
|
-
});
|
|
23
|
+
const result = inspect({ cwd });
|
|
34
24
|
console.log(JSON.stringify(result));
|
|
35
25
|
if (!result.ok)
|
|
36
26
|
throw new Error("Paper agent-entry and acceptance policy did not qualify");
|
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { command } from "../../runtime/action-process.mjs";
|
|
3
3
|
import { installationRoot } from "../../runtime/installation-root.js";
|
|
4
|
-
import { exactWorkflowRuntime } from "../../runtime/workflow-runtime.js";
|
|
5
4
|
import { qualifyStageCapsuleConsumer } from "./canary.js";
|
|
6
5
|
import { aggregateStageCapsuleCampaign } from "./campaign/aggregate.js";
|
|
7
|
-
function runtime(
|
|
6
|
+
function runtime(env) {
|
|
8
7
|
const runtimeRoot = installationRoot(import.meta.url);
|
|
9
|
-
const runtimeSha =
|
|
10
|
-
core.getInput("workflow-sha", { required: true }),
|
|
11
|
-
);
|
|
12
|
-
if (
|
|
13
|
-
command("git", ["-C", runtimeRoot, "rev-parse", "HEAD"], {
|
|
14
|
-
stdio: "pipe",
|
|
15
|
-
}).trim() !== runtimeSha
|
|
16
|
-
)
|
|
17
|
-
throw new Error("Stage Capsule runtime differs from called workflow");
|
|
8
|
+
const runtimeSha = env.BUILDCHAIN_RUNTIME_SHA;
|
|
18
9
|
return { runtimeRoot, runtimeSha };
|
|
19
10
|
}
|
|
20
11
|
export async function qualifyStageCapsuleConsumerAction(core, env) {
|
|
21
|
-
const binding = runtime(
|
|
12
|
+
const binding = runtime(env);
|
|
22
13
|
const workspace = path.resolve(env.GITHUB_WORKSPACE);
|
|
23
14
|
if (
|
|
24
15
|
command("git", ["-C", workspace, "rev-parse", "HEAD"], {
|
|
@@ -38,7 +29,6 @@ export async function qualifyStageCapsuleConsumerAction(core, env) {
|
|
|
38
29
|
});
|
|
39
30
|
}
|
|
40
31
|
export function aggregateStageCapsuleConsumerAction(core, env) {
|
|
41
|
-
runtime(core);
|
|
42
32
|
return aggregateStageCapsuleCampaign({
|
|
43
33
|
directory: path.join(
|
|
44
34
|
env.GITHUB_WORKSPACE,
|
|
@@ -60,13 +60,19 @@ function resumeRequest(state, store) {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
function checkpointResult(entry) {
|
|
64
|
+
const { runtimeRoot: _runtimeProvenance, ...identity } =
|
|
65
|
+
entry.capsule.identity;
|
|
66
|
+
return domainCanonicalBytes({
|
|
67
|
+
identity,
|
|
68
|
+
manifestRoot: entry.manifest.manifestRoot,
|
|
69
|
+
}).toString("utf8");
|
|
70
|
+
}
|
|
71
|
+
|
|
63
72
|
function emitMissing(context, state, store, stageId) {
|
|
64
73
|
const emitted = emitStageCapsuleCampaignCheckpoint(context, stageId, store);
|
|
65
74
|
const expected = state.reference.find(({ stage }) => stage === stageId);
|
|
66
|
-
if (
|
|
67
|
-
emitted.capsule.capsuleRoot !== expected.capsule.capsuleRoot ||
|
|
68
|
-
emitted.manifest.manifestRoot !== expected.manifest.manifestRoot
|
|
69
|
-
)
|
|
75
|
+
if (checkpointResult(emitted) !== checkpointResult(expected))
|
|
70
76
|
throw new Error(`resumed ${stageId} differs from the fresh build`);
|
|
71
77
|
return {
|
|
72
78
|
stage: stageId,
|
|
@@ -81,7 +87,6 @@ export function resumeStageCapsuleCampaign(context) {
|
|
|
81
87
|
for (const [name, code] of [
|
|
82
88
|
["consumer", "stage-capsule-campaign-consumer-drift"],
|
|
83
89
|
["platform", "stage-capsule-campaign-platform-drift"],
|
|
84
|
-
["runtimeRef", "stage-capsule-campaign-runtime-ref-drift"],
|
|
85
90
|
["consumerSourceRevision", "stage-capsule-campaign-source-revision-drift"],
|
|
86
91
|
])
|
|
87
92
|
if (state[name] !== context[name])
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { command } from "../../../runtime/action-process.mjs";
|
|
3
|
-
import { installationRoot } from "../../../runtime/installation-root.js";
|
|
4
3
|
import { rehearseStageCheckpoint } from "./run.js";
|
|
5
4
|
import { rehearseStageResume } from "./resume.js";
|
|
6
5
|
import { rehearseTailResealMacos } from "./macos-tail.js";
|
|
@@ -38,9 +37,9 @@ export function verifyStageCapsuleCheckpoints({
|
|
|
38
37
|
return { checkpoint, resume, tail };
|
|
39
38
|
}
|
|
40
39
|
export function verifyStageCapsuleCheckpointsAction(core, env) {
|
|
41
|
-
const
|
|
40
|
+
const sourceRoot = path.resolve(env.GITHUB_WORKSPACE);
|
|
42
41
|
if (
|
|
43
|
-
command("git", ["-C",
|
|
42
|
+
command("git", ["-C", sourceRoot, "rev-parse", "HEAD"], {
|
|
44
43
|
stdio: "pipe",
|
|
45
44
|
}).trim() !== env.GITHUB_SHA
|
|
46
45
|
)
|
|
@@ -48,7 +47,7 @@ export function verifyStageCapsuleCheckpointsAction(core, env) {
|
|
|
48
47
|
"Checkpoint verification must execute exact candidate source",
|
|
49
48
|
);
|
|
50
49
|
return verifyStageCapsuleCheckpoints({
|
|
51
|
-
runtimeRoot,
|
|
50
|
+
runtimeRoot: sourceRoot,
|
|
52
51
|
workspace: path.resolve(env.GITHUB_WORKSPACE),
|
|
53
52
|
platform: core.getInput("platform", { required: true }),
|
|
54
53
|
environment: env,
|
|
@@ -237,7 +237,6 @@ function changedDecision(node, candidate, availabilityRoot) {
|
|
|
237
237
|
"toolchain-changed",
|
|
238
238
|
false,
|
|
239
239
|
],
|
|
240
|
-
["runtimeRoot", "runtime-root", "rebuild", "runtime-changed", true],
|
|
241
240
|
["policyRoot", "policy-root", "rebuild", "policy-changed", true],
|
|
242
241
|
["declaredInputs", "declared-inputs", "rebuild", "input-changed", false],
|
|
243
242
|
[
|
|
@@ -76,12 +76,12 @@ export async function aggregate(context, plan, jobs, executions) {
|
|
|
76
76
|
},
|
|
77
77
|
runtime: {
|
|
78
78
|
workflowShellRef: plan.identity.ref,
|
|
79
|
-
requestedRef: plan.identity.ref,
|
|
80
|
-
ref: plan.identity.ref,
|
|
79
|
+
requestedRef: plan.runtime?.ref || plan.identity.ref,
|
|
80
|
+
ref: plan.runtime?.ref || plan.identity.ref,
|
|
81
81
|
sha: plan.identity.sha,
|
|
82
|
-
class: plan.identity.channel,
|
|
83
|
-
override:
|
|
84
|
-
trustDecision: "
|
|
82
|
+
class: plan.runtime?.class || plan.identity.channel,
|
|
83
|
+
override: plan.runtime?.origin === "runtime-parameter",
|
|
84
|
+
trustDecision: "entry-selection",
|
|
85
85
|
rollbackRef: plan.identity.ref,
|
|
86
86
|
},
|
|
87
87
|
});
|
|
@@ -49,7 +49,7 @@ async function finalizeBuild(context, jobs) {
|
|
|
49
49
|
sourceTreeHash: plan.source.tree_sha,
|
|
50
50
|
buildSummary: aggregated.summary,
|
|
51
51
|
buildchain: {
|
|
52
|
-
ref: plan.identity.ref,
|
|
52
|
+
ref: plan.runtime?.ref || plan.identity.ref,
|
|
53
53
|
sha: plan.identity.sha,
|
|
54
54
|
workflowShellRef: plan.identity.ref,
|
|
55
55
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { installationRoot } from "../../runtime/installation-root.js";
|
|
3
2
|
import { command } from "../../runtime/action-process.mjs";
|
|
4
3
|
import { qualifyRepositorySource, verificationProvider } from "./source.js";
|
|
5
4
|
|
|
@@ -8,13 +7,9 @@ export async function qualifyRepositorySourceAction(core, env) {
|
|
|
8
7
|
runtimeRoot = path.join(workspace, ".buildchain/runtime");
|
|
9
8
|
const sha = (cwd) =>
|
|
10
9
|
command("git", ["rev-parse", "HEAD"], { cwd, stdio: "pipe" }).trim();
|
|
11
|
-
if (
|
|
12
|
-
sha(workspace) !== env.GITHUB_SHA ||
|
|
13
|
-
sha(runtimeRoot) !== env.GITHUB_SHA ||
|
|
14
|
-
path.resolve(installationRoot(import.meta.url)) !== path.resolve(workspace)
|
|
15
|
-
)
|
|
10
|
+
if (sha(workspace) !== env.GITHUB_SHA)
|
|
16
11
|
throw new Error(
|
|
17
|
-
"Repository verification requires
|
|
12
|
+
"Repository verification requires the invoked source checkout",
|
|
18
13
|
);
|
|
19
14
|
return qualifyRepositorySource(
|
|
20
15
|
{
|
|
@@ -37,11 +32,7 @@ export async function qualifyRepositorySourceAction(core, env) {
|
|
|
37
32
|
);
|
|
38
33
|
}
|
|
39
34
|
export function qualifyBuildBackboneAction(_core, env) {
|
|
40
|
-
const root =
|
|
41
|
-
if (path.resolve(root) !== path.resolve(env.GITHUB_WORKSPACE))
|
|
42
|
-
throw new Error(
|
|
43
|
-
"Build backbone tests must execute from the admitted source checkout",
|
|
44
|
-
);
|
|
35
|
+
const root = path.resolve(env.GITHUB_WORKSPACE);
|
|
45
36
|
command(
|
|
46
37
|
"node",
|
|
47
38
|
[
|
|
@@ -2,7 +2,6 @@ import { verifyRepository } from "./repository.js";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { command } from "../../runtime/action-process.mjs";
|
|
5
|
-
import { installationRoot } from "../../runtime/installation-root.js";
|
|
6
5
|
import { collectGitHubReleasePassport } from "../../release/passport/collection.js";
|
|
7
6
|
import { verifyReleasePassport } from "../../release/release-passport.js";
|
|
8
7
|
|
|
@@ -44,26 +43,29 @@ export async function qualifyRunnerCompatibility(
|
|
|
44
43
|
throw new Error("Runner compatibility passport verification failed");
|
|
45
44
|
return report;
|
|
46
45
|
}
|
|
47
|
-
export async function qualifyRunnerCompatibilityAction(
|
|
46
|
+
export async function qualifyRunnerCompatibilityAction(
|
|
47
|
+
core,
|
|
48
|
+
env,
|
|
49
|
+
dependencies,
|
|
50
|
+
) {
|
|
48
51
|
const workspace = env.GITHUB_WORKSPACE;
|
|
49
|
-
if (
|
|
50
|
-
path.resolve(installationRoot(import.meta.url)) !== path.resolve(workspace)
|
|
51
|
-
)
|
|
52
|
-
throw new Error("Runner compatibility requires source-owned code");
|
|
53
52
|
core.info(`Runner ${env.RUNNER_NAME}: ${env.RUNNER_OS}/${env.RUNNER_ARCH}`);
|
|
54
|
-
return qualifyRunnerCompatibility(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
return qualifyRunnerCompatibility(
|
|
54
|
+
{
|
|
55
|
+
workspace,
|
|
56
|
+
repository: env.GITHUB_REPOSITORY,
|
|
57
|
+
sourceSha: env.GITHUB_SHA,
|
|
58
|
+
env,
|
|
59
|
+
workflow: {
|
|
60
|
+
name: env.GITHUB_WORKFLOW || "",
|
|
61
|
+
runId: env.GITHUB_RUN_ID || "",
|
|
62
|
+
runAttempt: env.GITHUB_RUN_ATTEMPT || "",
|
|
63
|
+
url: `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}`,
|
|
64
|
+
runnerOs: env.RUNNER_OS || process.platform,
|
|
65
|
+
runnerArch: env.RUNNER_ARCH || process.arch,
|
|
66
|
+
runnerImage: env.ImageOS || "",
|
|
67
|
+
},
|
|
67
68
|
},
|
|
68
|
-
|
|
69
|
+
dependencies,
|
|
70
|
+
);
|
|
69
71
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import crypto from "node:crypto";
|
|
2
|
-
import { SOURCE_OWNED_PROMOTION } from "./invocation-selector.js";
|
|
3
2
|
|
|
4
3
|
export const FLOATING_CONSUMER_POLICY =
|
|
5
4
|
"kungfu-buildchain-v4-floating-consumer-policy/v1";
|
|
@@ -61,13 +60,6 @@ function verifyIdentity(value, expected, check, label) {
|
|
|
61
60
|
"invoked-workflow-mismatch",
|
|
62
61
|
`${label} workflow mismatch`,
|
|
63
62
|
);
|
|
64
|
-
if (expected.resolvedRuntimeSha)
|
|
65
|
-
check(
|
|
66
|
-
value?.invocation?.resolvedRuntimeSha ===
|
|
67
|
-
expected.resolvedRuntimeSha.toLowerCase(),
|
|
68
|
-
"runtime-sha-mismatch",
|
|
69
|
-
`${label} runtime SHA mismatch`,
|
|
70
|
-
);
|
|
71
63
|
}
|
|
72
64
|
|
|
73
65
|
function verifyAuthorityFields(value, expected, check, label) {
|
|
@@ -111,28 +103,18 @@ function verifyAuthorityFields(value, expected, check, label) {
|
|
|
111
103
|
|
|
112
104
|
function verifyFloatingSelector(value, check, label) {
|
|
113
105
|
const invocation = value?.invocation;
|
|
114
|
-
const local =
|
|
115
|
-
value?.caller?.repository === SOURCE_OWNED_PROMOTION.repository &&
|
|
116
|
-
invocation?.workflow === SOURCE_OWNED_PROMOTION.workflow &&
|
|
117
|
-
invocation?.visibleSelector === `./${SOURCE_OWNED_PROMOTION.workflow}` &&
|
|
118
|
-
invocation?.selectorClass === "repository-local" &&
|
|
119
|
-
invocation?.definition?.repository === value.caller.repository &&
|
|
120
|
-
/^[0-9a-f]{40}$/.test(invocation?.definition?.commitSha || "") &&
|
|
121
|
-
invocation.definition.commitSha === invocation.resolvedWorkflowSha &&
|
|
122
|
-
SHA256_ROOT.test(invocation?.definition?.filesRoot || "") &&
|
|
123
|
-
["stable", "alpha"].includes(invocation?.channel);
|
|
124
106
|
const floating =
|
|
125
107
|
invocation?.selectorClass === "floating" &&
|
|
126
108
|
{ v4: "stable", "v4-alpha": "alpha" }[invocation?.visibleSelector] ===
|
|
127
109
|
invocation?.channel &&
|
|
128
110
|
invocation?.definition === undefined;
|
|
129
111
|
check(
|
|
130
|
-
floating
|
|
112
|
+
floating,
|
|
131
113
|
"selector-class-invalid",
|
|
132
|
-
`${label} must bind a floating channel
|
|
114
|
+
`${label} must bind a floating channel`,
|
|
133
115
|
);
|
|
134
116
|
check(
|
|
135
|
-
["v4", "v4-alpha"].includes(invocation?.visibleSelector)
|
|
117
|
+
["v4", "v4-alpha"].includes(invocation?.visibleSelector),
|
|
136
118
|
"selector-invalid",
|
|
137
119
|
`${label} selector is outside the current invocation contract`,
|
|
138
120
|
);
|