@intentius/chant-lexicon-pulumi 0.124.97 → 0.124.99
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/dist/adopt.d.ts +0 -1
- package/dist/capability-plugin.d.ts +0 -1
- package/dist/change-set.d.ts +0 -1
- package/dist/changed-units.d.ts +0 -1
- package/dist/check-step.d.ts +0 -1
- package/dist/ci-setup.d.ts +0 -1
- package/dist/codegen/docs-cli.d.ts +0 -1
- package/dist/codegen/docs.d.ts +0 -1
- package/dist/codegen/package.d.ts +0 -1
- package/dist/composites/pulumi-adopt-op.d.ts +0 -1
- package/dist/composites/pulumi-watch-op.d.ts +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/describe-resources.d.ts +0 -1
- package/dist/drift-read.d.ts +0 -1
- package/dist/drift-record.d.ts +0 -1
- package/dist/engine-events.d.ts +0 -1
- package/dist/engine-graph.d.ts +0 -1
- package/dist/exit-codes.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/init-templates.d.ts +0 -1
- package/dist/integrity.json +2 -2
- package/dist/lint/audit-catalog.d.ts +0 -1
- package/dist/lint/post-synth/index.d.ts +0 -1
- package/dist/lint/post-synth/member-read-helpers.d.ts +0 -1
- package/dist/lint/post-synth/pul001.d.ts +0 -1
- package/dist/lint/post-synth/pul002.d.ts +0 -1
- package/dist/lint/post-synth/pul003.d.ts +0 -1
- package/dist/lint/post-synth/pul004.d.ts +0 -1
- package/dist/lint/post-synth/pul005.d.ts +0 -1
- package/dist/lint/post-synth/pul006.d.ts +0 -1
- package/dist/lint/post-synth/pul007.d.ts +0 -1
- package/dist/lint/post-synth/pul008.d.ts +0 -1
- package/dist/lint/post-synth/pul009.d.ts +0 -1
- package/dist/lint/post-synth/pul010.d.ts +0 -1
- package/dist/lint/post-synth/pul011.d.ts +0 -1
- package/dist/lint/post-synth/pul012.d.ts +0 -1
- package/dist/lint/post-synth/pul013.d.ts +0 -1
- package/dist/lint/post-synth/pul014.d.ts +0 -1
- package/dist/lint/post-synth/pul015.d.ts +0 -1
- package/dist/lint/rules/index.d.ts +0 -1
- package/dist/lint/rules/member-dir-absolute.d.ts +0 -1
- package/dist/lock-rows.d.ts +0 -1
- package/dist/lsp/completions.d.ts +0 -1
- package/dist/lsp/documents.d.ts +0 -1
- package/dist/lsp/hover.d.ts +0 -1
- package/dist/lsp/keys.d.ts +0 -1
- package/dist/lsp/object-path.d.ts +0 -1
- package/dist/lsp/yaml-cursor.d.ts +0 -1
- package/dist/manifest.json +1 -1
- package/dist/member-engine.d.ts +0 -1
- package/dist/member-outputs.d.ts +0 -1
- package/dist/op/activities/index.d.ts +0 -1
- package/dist/op/activities/pulumi-adopt.d.ts +0 -1
- package/dist/op/activities/pulumi.d.ts +0 -1
- package/dist/op/activity-contracts.d.ts +0 -1
- package/dist/op/builders.d.ts +0 -1
- package/dist/package-cli.d.ts +0 -1
- package/dist/plan-shape.d.ts +0 -1
- package/dist/planned-output-changes.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plunge-timings.d.ts +0 -1
- package/dist/preview-tips.d.ts +0 -1
- package/dist/pulumi-up.d.ts +0 -1
- package/dist/release-copy.d.ts +0 -1
- package/dist/review-stack.d.ts +0 -1
- package/dist/run.d.ts +0 -1
- package/dist/serializer.d.ts +0 -1
- package/dist/stack-export-snapshot.d.ts +0 -1
- package/dist/stack-ops.d.ts +0 -1
- package/dist/stack-outputs.d.ts +0 -1
- package/dist/stack-references.d.ts +0 -1
- package/dist/trace-facts.d.ts +0 -1
- package/dist/values.d.ts +0 -1
- package/dist/workspace-member.d.ts +0 -1
- package/package.json +3 -4
- package/dist/adopt.d.ts.map +0 -1
- package/dist/capability-plugin.d.ts.map +0 -1
- package/dist/change-set.d.ts.map +0 -1
- package/dist/changed-units.d.ts.map +0 -1
- package/dist/check-step.d.ts.map +0 -1
- package/dist/ci-setup.d.ts.map +0 -1
- package/dist/codegen/docs-cli.d.ts.map +0 -1
- package/dist/codegen/docs.d.ts.map +0 -1
- package/dist/codegen/package.d.ts.map +0 -1
- package/dist/composites/pulumi-adopt-op.d.ts.map +0 -1
- package/dist/composites/pulumi-watch-op.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/describe-resources.d.ts.map +0 -1
- package/dist/drift-read.d.ts.map +0 -1
- package/dist/drift-record.d.ts.map +0 -1
- package/dist/engine-events.d.ts.map +0 -1
- package/dist/engine-graph.d.ts.map +0 -1
- package/dist/exit-codes.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/init-templates.d.ts.map +0 -1
- package/dist/lint/audit-catalog.d.ts.map +0 -1
- package/dist/lint/post-synth/index.d.ts.map +0 -1
- package/dist/lint/post-synth/member-read-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/pul001.d.ts.map +0 -1
- package/dist/lint/post-synth/pul002.d.ts.map +0 -1
- package/dist/lint/post-synth/pul003.d.ts.map +0 -1
- package/dist/lint/post-synth/pul004.d.ts.map +0 -1
- package/dist/lint/post-synth/pul005.d.ts.map +0 -1
- package/dist/lint/post-synth/pul006.d.ts.map +0 -1
- package/dist/lint/post-synth/pul007.d.ts.map +0 -1
- package/dist/lint/post-synth/pul008.d.ts.map +0 -1
- package/dist/lint/post-synth/pul009.d.ts.map +0 -1
- package/dist/lint/post-synth/pul010.d.ts.map +0 -1
- package/dist/lint/post-synth/pul011.d.ts.map +0 -1
- package/dist/lint/post-synth/pul012.d.ts.map +0 -1
- package/dist/lint/post-synth/pul013.d.ts.map +0 -1
- package/dist/lint/post-synth/pul014.d.ts.map +0 -1
- package/dist/lint/post-synth/pul015.d.ts.map +0 -1
- package/dist/lint/rules/index.d.ts.map +0 -1
- package/dist/lint/rules/member-dir-absolute.d.ts.map +0 -1
- package/dist/lock-rows.d.ts.map +0 -1
- package/dist/lsp/completions.d.ts.map +0 -1
- package/dist/lsp/documents.d.ts.map +0 -1
- package/dist/lsp/hover.d.ts.map +0 -1
- package/dist/lsp/keys.d.ts.map +0 -1
- package/dist/lsp/object-path.d.ts.map +0 -1
- package/dist/lsp/yaml-cursor.d.ts.map +0 -1
- package/dist/member-engine.d.ts.map +0 -1
- package/dist/member-outputs.d.ts.map +0 -1
- package/dist/op/activities/index.d.ts.map +0 -1
- package/dist/op/activities/pulumi-adopt.d.ts.map +0 -1
- package/dist/op/activities/pulumi.d.ts.map +0 -1
- package/dist/op/activity-contracts.d.ts.map +0 -1
- package/dist/op/builders.d.ts.map +0 -1
- package/dist/package-cli.d.ts.map +0 -1
- package/dist/plan-shape.d.ts.map +0 -1
- package/dist/planned-output-changes.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plunge-timings.d.ts.map +0 -1
- package/dist/preview-tips.d.ts.map +0 -1
- package/dist/pulumi-up.d.ts.map +0 -1
- package/dist/release-copy.d.ts.map +0 -1
- package/dist/review-stack.d.ts.map +0 -1
- package/dist/run.d.ts.map +0 -1
- package/dist/serializer.d.ts.map +0 -1
- package/dist/stack-export-snapshot.d.ts.map +0 -1
- package/dist/stack-ops.d.ts.map +0 -1
- package/dist/stack-outputs.d.ts.map +0 -1
- package/dist/stack-references.d.ts.map +0 -1
- package/dist/trace-facts.d.ts.map +0 -1
- package/dist/values.d.ts.map +0 -1
- package/dist/workspace-member.d.ts.map +0 -1
- package/src/adopt.ts +0 -202
- package/src/capability-plugin.ts +0 -34
- package/src/change-set.test.ts +0 -245
- package/src/change-set.ts +0 -508
- package/src/changed-units.test.ts +0 -87
- package/src/changed-units.ts +0 -96
- package/src/check-step.test.ts +0 -191
- package/src/check-step.ts +0 -316
- package/src/ci-setup.test.ts +0 -234
- package/src/ci-setup.ts +0 -224
- package/src/codegen/docs-cli.ts +0 -4
- package/src/codegen/docs.ts +0 -58
- package/src/codegen/package.ts +0 -63
- package/src/composites/pulumi-adopt-op.test.ts +0 -258
- package/src/composites/pulumi-adopt-op.ts +0 -193
- package/src/composites/pulumi-watch-op.test.ts +0 -42
- package/src/composites/pulumi-watch-op.ts +0 -85
- package/src/config.ts +0 -43
- package/src/describe-resources.test.ts +0 -112
- package/src/describe-resources.ts +0 -118
- package/src/drift-read.test.ts +0 -178
- package/src/drift-read.ts +0 -94
- package/src/drift-record.test.ts +0 -197
- package/src/drift-record.ts +0 -326
- package/src/engine-events.test.ts +0 -160
- package/src/engine-events.ts +0 -395
- package/src/engine-graph.test.ts +0 -141
- package/src/engine-graph.ts +0 -149
- package/src/exit-codes.test.ts +0 -21
- package/src/exit-codes.ts +0 -71
- package/src/index.ts +0 -139
- package/src/init-templates.ts +0 -85
- package/src/lint/audit-catalog.test.ts +0 -33
- package/src/lint/audit-catalog.ts +0 -174
- package/src/lint/post-synth/index.ts +0 -35
- package/src/lint/post-synth/member-read-helpers.ts +0 -122
- package/src/lint/post-synth/post-synth.test.ts +0 -245
- package/src/lint/post-synth/pul001.ts +0 -38
- package/src/lint/post-synth/pul002.ts +0 -38
- package/src/lint/post-synth/pul003.ts +0 -43
- package/src/lint/post-synth/pul004.ts +0 -32
- package/src/lint/post-synth/pul005.ts +0 -31
- package/src/lint/post-synth/pul006.ts +0 -31
- package/src/lint/post-synth/pul007.ts +0 -35
- package/src/lint/post-synth/pul008.ts +0 -35
- package/src/lint/post-synth/pul009.ts +0 -32
- package/src/lint/post-synth/pul010.ts +0 -42
- package/src/lint/post-synth/pul011.ts +0 -38
- package/src/lint/post-synth/pul012.ts +0 -35
- package/src/lint/post-synth/pul013.ts +0 -35
- package/src/lint/post-synth/pul014.ts +0 -32
- package/src/lint/post-synth/pul015.ts +0 -39
- package/src/lint/rules/index.ts +0 -7
- package/src/lint/rules/member-dir-absolute.test.ts +0 -37
- package/src/lint/rules/member-dir-absolute.ts +0 -83
- package/src/lock-rows.test.ts +0 -60
- package/src/lock-rows.ts +0 -56
- package/src/lsp/completions.test.ts +0 -69
- package/src/lsp/completions.ts +0 -119
- package/src/lsp/documents.ts +0 -48
- package/src/lsp/hover.test.ts +0 -56
- package/src/lsp/hover.ts +0 -83
- package/src/lsp/keys.ts +0 -169
- package/src/lsp/object-path.ts +0 -71
- package/src/lsp/yaml-cursor.ts +0 -85
- package/src/member-engine.test.ts +0 -112
- package/src/member-engine.ts +0 -97
- package/src/member-outputs.test.ts +0 -339
- package/src/member-outputs.ts +0 -157
- package/src/op/activities/index.ts +0 -36
- package/src/op/activities/pulumi-adopt.ts +0 -345
- package/src/op/activities/pulumi.ts +0 -136
- package/src/op/activity-contracts.ts +0 -129
- package/src/op/builders.ts +0 -67
- package/src/package-cli.ts +0 -14
- package/src/plan-shape.test.ts +0 -91
- package/src/plan-shape.ts +0 -105
- package/src/planned-output-changes.test.ts +0 -85
- package/src/planned-output-changes.ts +0 -141
- package/src/plugin.test.ts +0 -96
- package/src/plugin.ts +0 -272
- package/src/plunge-timings.test.ts +0 -241
- package/src/plunge-timings.ts +0 -115
- package/src/plunge-up-failed.test.ts +0 -54
- package/src/pr-note.test.ts +0 -87
- package/src/preview-generated.test.ts +0 -124
- package/src/preview-tips.test.ts +0 -134
- package/src/preview-tips.ts +0 -128
- package/src/pulumi-up.test.ts +0 -581
- package/src/pulumi-up.ts +0 -1102
- package/src/pulumi-urn-node.test.ts +0 -94
- package/src/release-copy.test.ts +0 -162
- package/src/release-copy.ts +0 -223
- package/src/review-stack.test.ts +0 -254
- package/src/review-stack.ts +0 -266
- package/src/run-plan-flags.test.ts +0 -53
- package/src/run.test.ts +0 -540
- package/src/run.ts +0 -1129
- package/src/serializer.test.ts +0 -9
- package/src/serializer.ts +0 -15
- package/src/skills/chant-pulumi-plunge.md +0 -51
- package/src/skills/chant-pulumi-stack-export.md +0 -54
- package/src/skills/chant-pulumi.md +0 -83
- package/src/stack-export-snapshot.test.ts +0 -192
- package/src/stack-export-snapshot.ts +0 -312
- package/src/stack-ops.fake-binary.test.ts +0 -323
- package/src/stack-ops.test.ts +0 -511
- package/src/stack-ops.ts +0 -1082
- package/src/stack-outputs.ts +0 -66
- package/src/stack-references.test.ts +0 -96
- package/src/stack-references.ts +0 -110
- package/src/testdata/plunge-drift/README.md +0 -10
- package/src/testdata/plunge-drift/assets-drifted.ndjson +0 -3
- package/src/testdata/plunge-drift/component-unsupported.ndjson +0 -3
- package/src/testdata/plunge-drift/role-in-sync.ndjson +0 -3
- package/src/testdata/plunge-drift/settled-empty.ndjson +0 -2
- package/src/testdata/plunge-graph/Pulumi.yaml +0 -4
- package/src/testdata/plunge-graph/README.md +0 -12
- package/src/testdata/plunge-graph/engine-graph.json +0 -158
- package/src/testdata/plunge-graph/stack-export.json +0 -49
- package/src/testdata/plunge-member/Pulumi.yaml +0 -4
- package/src/testdata/plunge-member/README.md +0 -3
- package/src/testdata/plunge-member/stack-export.json +0 -480
- package/src/testdata/plunge-outputs/Pulumi.yaml +0 -9
- package/src/testdata/plunge-outputs/README.md +0 -7
- package/src/testdata/plunge-outputs/stack-export.json +0 -2003
- package/src/testdata/plunge-outputs/stack-output.json +0 -19
- package/src/testdata/pulumi-member/Pulumi.yaml +0 -2
- package/src/testdata/pulumi-member/README.md +0 -50
- package/src/testdata/pulumi-member/recording/Pulumi.dev.yaml +0 -19
- package/src/testdata/pulumi-member/recording/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-member/recording/index.js +0 -47
- package/src/testdata/pulumi-member/recording/package-lock.json +0 -2707
- package/src/testdata/pulumi-member/recording/package.json +0 -9
- package/src/testdata/pulumi-member/stack-export.json +0 -746
- package/src/testdata/pulumi-outputs/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-outputs/README.md +0 -9
- package/src/testdata/pulumi-outputs/preview-replaced.json +0 -2894
- package/src/testdata/pulumi-outputs/preview-settled.json +0 -2894
- package/src/testdata/pulumi-outputs/stack-export.json +0 -1919
- package/src/testdata/pulumi-outputs/stack-output.json +0 -19
- package/src/testdata/pulumi-preview/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-preview/README.md +0 -9
- package/src/testdata/pulumi-preview/preview-create.json +0 -992
- package/src/testdata/pulumi-preview/preview.json +0 -2894
- package/src/testdata/pulumi-preview/stack-export.json +0 -1919
- package/src/testdata/pulumi-refresh/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-refresh/README.md +0 -14
- package/src/testdata/pulumi-refresh/all.json +0 -3742
- package/src/testdata/pulumi-refresh/bucket-edited.json +0 -468
- package/src/testdata/pulumi-refresh/policy-deleted.json +0 -95
- package/src/testdata/pulumi-refresh/queue-edited.json +0 -250
- package/src/testdata/pulumi-refresh/role-same.json +0 -242
- package/src/testdata/pulumi-refresh/secret-edited.json +0 -247
- package/src/testdata/pulumi-refresh/stack-export.json +0 -1907
- package/src/testdata/pulumi-stream/README.md +0 -16
- package/src/testdata/pulumi-stream/preview-stream.ndjson +0 -42
- package/src/testdata/pulumi-stream/up-failed-plunge.ndjson +0 -5
- package/src/testdata/pulumi-unexported/Pulumi.yaml +0 -2
- package/src/testdata/pulumi-urn-node/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-urn-node/README.md +0 -9
- package/src/testdata/pulumi-urn-node/preview.json +0 -2894
- package/src/testdata/pulumi-urn-node/stack-export.json +0 -1919
- package/src/trace-facts.test.ts +0 -38
- package/src/trace-facts.ts +0 -83
- package/src/values.ts +0 -147
- package/src/workspace-kinds.test.ts +0 -47
- package/src/workspace-member.test.ts +0 -127
- package/src/workspace-member.ts +0 -304
package/src/ci-setup.test.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* #4592: the Pulumi and plunge install lines take a version, check the
|
|
3
|
-
* release checksums file against a recorded sum per architecture, install
|
|
4
|
-
* under a versioned path and skip an engine already present. String checks
|
|
5
|
-
* only; nothing is downloaded.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { execFileSync, spawnSync } from "node:child_process";
|
|
9
|
-
import { createHash } from "node:crypto";
|
|
10
|
-
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
|
-
import { tmpdir } from "node:os";
|
|
12
|
-
import { join } from "node:path";
|
|
13
|
-
import { describe, expect, test } from "vitest";
|
|
14
|
-
import { CI_SETUP_UNLINKED_FLOOR } from "@intentius/chant/lexicon";
|
|
15
|
-
import { CI_TOOL_DOCKER_ARCH, CI_TOOL_JOB_ARCH, CI_TOOL_SHA256, ciToolFetchScript } from "@intentius/chant/ci-image";
|
|
16
|
-
import {
|
|
17
|
-
ciEngineDir,
|
|
18
|
-
ciFetchScript,
|
|
19
|
-
ciRelease,
|
|
20
|
-
CI_DOCKER_ARCH,
|
|
21
|
-
CI_ENGINE_ROOT,
|
|
22
|
-
CI_JOB_ARCH,
|
|
23
|
-
PULUMI_CI_SETUP_FLOOR,
|
|
24
|
-
PINNED_SHA256,
|
|
25
|
-
PLUNGE_CI_VERSION,
|
|
26
|
-
plungeInstallLine,
|
|
27
|
-
PULUMI_CI_VERSION,
|
|
28
|
-
pulumiInstallLine,
|
|
29
|
-
recordedSums,
|
|
30
|
-
} from "./ci-setup";
|
|
31
|
-
|
|
32
|
-
describe("ciRelease", () => {
|
|
33
|
-
test("Pulumi's and plunge's archives and checksums files", () => {
|
|
34
|
-
const p = ciRelease("pulumi", "3.272.0");
|
|
35
|
-
expect(p.base).toBe("https://github.com/pulumi/pulumi/releases/download/v3.272.0");
|
|
36
|
-
expect(p.archive("arm64")).toBe("pulumi-v3.272.0-linux-arm64.tar.gz");
|
|
37
|
-
expect(p.checksums).toBe("pulumi-3.272.0-checksums.txt");
|
|
38
|
-
const g = ciRelease("plunge", "0.1.0");
|
|
39
|
-
expect(g.base).toBe("https://github.com/INTENTIUS/plunge/releases/download/plunge-v0.1.0");
|
|
40
|
-
expect(g.archive("x64")).toBe("plunge-v0.1.0-linux-x64.tar.gz");
|
|
41
|
-
expect(g.checksums).toBe("plunge-v0.1.0-checksums.txt");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("refuses a version a shell would read as more", () => {
|
|
45
|
-
expect(() => ciRelease("pulumi", "3.272.0; curl evil")).toThrow(/not a release version/);
|
|
46
|
-
expect(() => pulumiInstallLine("latest")).toThrow();
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe("recordedSums", () => {
|
|
51
|
-
test("the default releases are recorded for both architectures", () => {
|
|
52
|
-
expect(Object.keys(recordedSums("pulumi", PULUMI_CI_VERSION))).toEqual(["x64", "arm64"]);
|
|
53
|
-
expect(Object.keys(recordedSums("plunge", PLUNGE_CI_VERSION))).toEqual(["x64", "arm64"]);
|
|
54
|
-
expect(recordedSums("pulumi", PULUMI_CI_VERSION).x64).toBe(PINNED_SHA256["pulumi-v3.272.0-linux-x64.tar.gz"]);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test("an unrecorded release has none, and the caller's sums replace the table", () => {
|
|
58
|
-
expect(recordedSums("pulumi", "3.300.0")).toEqual({});
|
|
59
|
-
expect(recordedSums("pulumi", "3.300.0", { x64: "a".repeat(64) })).toEqual({ x64: "a".repeat(64) });
|
|
60
|
-
expect(() => recordedSums("pulumi", "3.300.0", { x64: "nope" })).toThrow(/64 lower-case hex/);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
describe("pulumiInstallLine", () => {
|
|
65
|
-
const line = pulumiInstallLine();
|
|
66
|
-
|
|
67
|
-
test("installs the default version under a versioned path and links it", () => {
|
|
68
|
-
expect(line).toContain(`${CI_ENGINE_ROOT}/pulumi-${PULUMI_CI_VERSION}`);
|
|
69
|
-
expect(line).toContain(`ln -sf "${CI_ENGINE_ROOT}/pulumi-${PULUMI_CI_VERSION}/pulumi" /usr/local/bin/pulumi`);
|
|
70
|
-
expect(line).not.toContain("get.pulumi.com");
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test("checks the checksums file, then the recorded sum per architecture, then the archive", () => {
|
|
74
|
-
expect(line).toContain(`/pulumi-${PULUMI_CI_VERSION}-checksums.txt"`);
|
|
75
|
-
expect(line).toContain(`(amd64) want=${PINNED_SHA256["pulumi-v3.272.0-linux-x64.tar.gz"]} ;;`);
|
|
76
|
-
expect(line).toContain(`(arm64) want=${PINNED_SHA256["pulumi-v3.272.0-linux-arm64.tar.gz"]} ;;`);
|
|
77
|
-
expect(line).toContain("sha256sum -c -");
|
|
78
|
-
expect(line.indexOf("want=")).toBeLessThan(line.indexOf("sha256sum -c"));
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test("skips when the pulumi on PATH is that version, or the versioned directory holds it", () => {
|
|
82
|
-
expect(line.startsWith(`{ command -v pulumi >/dev/null 2>&1 && [ "$(pulumi version 2>/dev/null)" = "v${PULUMI_CI_VERSION}" ]; } || `)).toBe(true);
|
|
83
|
-
expect(line).toContain(`[ -x "${CI_ENGINE_ROOT}/pulumi-${PULUMI_CI_VERSION}/pulumi" ] || (set -e;`);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test("another version, unrecorded, checks only the checksums file", () => {
|
|
87
|
-
const other = pulumiInstallLine("3.300.0");
|
|
88
|
-
expect(other).toContain("/opt/chant/pulumi-3.300.0");
|
|
89
|
-
expect(other).toContain('case "$a" in (*) want= ;; esac');
|
|
90
|
-
expect(other).not.toContain("(amd64) want=");
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test("a product's root and sums", () => {
|
|
94
|
-
const own = pulumiInstallLine("3.272.0", { root: "/opt/plywood", sha256: { x64: "b".repeat(64) } });
|
|
95
|
-
expect(own).toContain('"/opt/plywood/pulumi-3.272.0/pulumi"');
|
|
96
|
-
expect(own).toContain(`(amd64) want=${"b".repeat(64)} ;;`);
|
|
97
|
-
expect(own).not.toContain("(arm64) want=");
|
|
98
|
-
expect(() => pulumiInstallLine("3.272.0", { root: "relative/dir" })).toThrow(/absolute/);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
describe("plungeInstallLine", () => {
|
|
103
|
-
test("installs plunge's release under a versioned path, checked, skipping on the directory alone", () => {
|
|
104
|
-
const line = plungeInstallLine();
|
|
105
|
-
expect(line.startsWith(`{ [ -x "${CI_ENGINE_ROOT}/plunge-${PLUNGE_CI_VERSION}/plunge" ] || (set -e;`)).toBe(true);
|
|
106
|
-
expect(line).toContain(`plunge-v${PLUNGE_CI_VERSION}-checksums.txt`);
|
|
107
|
-
expect(line).toContain(`(amd64) want=${PINNED_SHA256["plunge-v0.1.0-linux-x64.tar.gz"]} ;;`);
|
|
108
|
-
expect(line).toContain("--strip-components=1");
|
|
109
|
-
expect(line).toContain(`ln -sf "${ciEngineDir("plunge", PLUNGE_CI_VERSION)}/plunge" /usr/local/bin/plunge`);
|
|
110
|
-
expect(line).not.toContain("plunge version");
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
describe("pulumi-up's pinned binary (#4592)", () => {
|
|
115
|
-
test("engineVersion runs the binary at the install lines' versioned path", async () => {
|
|
116
|
-
const { pulumiUpEngineBin } = await import("./pulumi-up");
|
|
117
|
-
expect(pulumiUpEngineBin({ engineVersion: "3.272.0" }, "pulumi")).toBe("/opt/chant/pulumi-3.272.0/pulumi");
|
|
118
|
-
expect(pulumiUpEngineBin({ engineVersion: "0.1.0", engineRoot: "/opt/plywood" }, "plunge")).toBe("/opt/plywood/plunge-0.1.0/plunge");
|
|
119
|
-
expect(pulumiInstallLine("3.272.0")).toContain(`"${pulumiUpEngineBin({ engineVersion: "3.272.0" }, "pulumi")}"`);
|
|
120
|
-
expect(plungeInstallLine("0.1.0", { root: "/opt/plywood" })).toContain(`"${pulumiUpEngineBin({ engineVersion: "0.1.0", engineRoot: "/opt/plywood" }, "plunge")}"`);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
test("absent, PATH; a bad version or a root alone is refused", async () => {
|
|
124
|
-
const { pulumiUpEngineBin } = await import("./pulumi-up");
|
|
125
|
-
expect(pulumiUpEngineBin({}, "pulumi")).toBeUndefined();
|
|
126
|
-
expect(() => pulumiUpEngineBin({ engineVersion: "3.272.0; id" }, "pulumi")).toThrow(/pulumi-up/);
|
|
127
|
-
expect(() => pulumiUpEngineBin({ engineRoot: "/opt/plywood" }, "pulumi")).toThrow(/engineVersion/);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test("engineRunnerAt refuses a relative binary", async () => {
|
|
131
|
-
const { engineRunnerAt } = await import("./run");
|
|
132
|
-
expect(() => engineRunnerAt("pulumi")).toThrow(/absolute/);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// #4814: a second release beside the linked one, and the fetch script for image builds.
|
|
137
|
-
describe("an unlinked install line (#4814)", () => {
|
|
138
|
-
test("installs under the versioned path and never touches PATH", () => {
|
|
139
|
-
for (const line of [pulumiInstallLine("3.250.0", { root: "/opt/plywood", link: false }), plungeInstallLine("0.2.0", { root: "/opt/plywood", link: false })]) {
|
|
140
|
-
expect(line).not.toContain("/usr/local/bin");
|
|
141
|
-
expect(line).not.toContain("ln -s");
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test("skips on the versioned directory alone, not on the pulumi that PATH finds", () => {
|
|
146
|
-
const line = pulumiInstallLine("3.250.0", { root: "/opt/plywood", link: false });
|
|
147
|
-
expect(line.startsWith('[ -x "/opt/plywood/pulumi-3.250.0/pulumi" ] || (set -e; ')).toBe(true);
|
|
148
|
-
expect(line).not.toContain("command -v pulumi");
|
|
149
|
-
expect(line).not.toContain("pulumi version");
|
|
150
|
-
expect(line.endsWith(")")).toBe(true);
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test("is the fetch script under the job's architecture, so plywood's unlinkedInstallLine is this call", () => {
|
|
154
|
-
const sums = { x64: "c".repeat(64), arm64: "d".repeat(64) };
|
|
155
|
-
expect(plungeInstallLine("0.2.0", { root: "/opt/plywood", sha256: sums, link: false })).toBe(
|
|
156
|
-
`[ -x "/opt/plywood/plunge-0.2.0/plunge" ] || (set -e; ${ciFetchScript("plunge", "0.2.0", { dir: "/opt/plywood/plunge-0.2.0", sha256: sums })})`,
|
|
157
|
-
);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
test("a linked line is the one it was", () => {
|
|
161
|
-
expect(pulumiInstallLine()).toBe(pulumiInstallLine(PULUMI_CI_VERSION, { link: true }));
|
|
162
|
-
expect(pulumiInstallLine().startsWith("{ command -v pulumi")).toBe(true);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
describe("ciFetchScript (#4814)", () => {
|
|
167
|
-
test("takes the target directory, an arch expression and a checksums URL word", () => {
|
|
168
|
-
const s = ciFetchScript("pulumi", "3.272.0", { dir: "/out/opt/plywood/pulumi-3.272.0", arch: CI_DOCKER_ARCH, checksumsUrl: '"$CHECKSUMS_URL"' });
|
|
169
|
-
// #4908: ci-image's script, which reads the Docker build's architecture as amd64 or arm64.
|
|
170
|
-
expect(s.startsWith(`a=${CI_TOOL_DOCKER_ARCH} && `)).toBe(true);
|
|
171
|
-
expect(CI_DOCKER_ARCH).toBe(`"$(case "$TARGETARCH" in (arm64) echo arm64 ;; (*) echo x64 ;; esac)"`);
|
|
172
|
-
expect(s).toContain('curl -fsSLo "$t/sums" "$CHECKSUMS_URL"');
|
|
173
|
-
expect(s).toContain('tar -xzf "$t/$f" -C "/out/opt/plywood/pulumi-3.272.0" --strip-components=1');
|
|
174
|
-
expect(s).toContain(`(amd64) want=${PINNED_SHA256["pulumi-v3.272.0-linux-x64.tar.gz"]} ;;`);
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test("defaults to the job's architecture and the release's own checksums file", () => {
|
|
178
|
-
const s = ciFetchScript("plunge", "0.1.0", { dir: "/opt/chant/plunge-0.1.0" });
|
|
179
|
-
expect(s.startsWith(`a=${CI_TOOL_JOB_ARCH} && `)).toBe(true);
|
|
180
|
-
expect(CI_JOB_ARCH).toBe(`"$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')"`);
|
|
181
|
-
expect(s).toContain('curl -fsSLo "$t/sums" "https://github.com/INTENTIUS/plunge/releases/download/plunge-v0.1.0/plunge-v0.1.0-checksums.txt"');
|
|
182
|
-
expect(() => ciFetchScript("plunge", "0.1.0", { dir: "relative" })).toThrow(/absolute/);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
test.skipIf(!["sha256sum", "tar", "sh"].every((b) => spawnSync("sh", ["-c", `command -v ${b}`]).status === 0))(
|
|
186
|
-
"run: installs a release whose sum matches, and refuses a tampered checksums file",
|
|
187
|
-
() => {
|
|
188
|
-
const work = mkdtempSync(join(tmpdir(), "chant-ci-fetch-"));
|
|
189
|
-
const served = join(work, "served");
|
|
190
|
-
mkdirSync(join(served, "src", "pulumi"), { recursive: true });
|
|
191
|
-
writeFileSync(join(served, "src", "pulumi", "pulumi"), "#!/bin/sh\necho v3.272.0\n");
|
|
192
|
-
chmodSync(join(served, "src", "pulumi", "pulumi"), 0o755);
|
|
193
|
-
const archive = "pulumi-v3.272.0-linux-x64.tar.gz";
|
|
194
|
-
execFileSync("tar", ["-czf", join(served, archive), "-C", join(served, "src"), "pulumi"]);
|
|
195
|
-
const sum = createHash("sha256").update(readFileSync(join(served, archive))).digest("hex");
|
|
196
|
-
writeFileSync(join(served, "pulumi-3.272.0-checksums.txt"), `${sum} ${archive}\n`);
|
|
197
|
-
writeFileSync(join(served, "tampered.txt"), `${"0".repeat(64)} ${archive}\n`);
|
|
198
|
-
// curl -fsSLo <out> <url>: serve the file the URL names from the served directory.
|
|
199
|
-
const bin = join(work, "bin");
|
|
200
|
-
mkdirSync(bin);
|
|
201
|
-
writeFileSync(join(bin, "curl"), `#!/bin/sh\ncp "${served}/$(basename "$3")" "$2"\n`);
|
|
202
|
-
chmodSync(join(bin, "curl"), 0o755);
|
|
203
|
-
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}` };
|
|
204
|
-
const run = (script: string) => spawnSync("sh", ["-c", `set -e; ${script}`], { env, encoding: "utf8" });
|
|
205
|
-
|
|
206
|
-
const dir = join(work, "opt", "pulumi-3.272.0");
|
|
207
|
-
const ok = run(ciFetchScript("pulumi", "3.272.0", { dir, arch: '"x64"', sha256: { x64: sum } }));
|
|
208
|
-
expect(ok.stderr).toBe("");
|
|
209
|
-
expect(ok.status).toBe(0);
|
|
210
|
-
expect(existsSync(join(dir, "pulumi"))).toBe(true);
|
|
211
|
-
|
|
212
|
-
const tampered = run(ciFetchScript("pulumi", "3.272.0", { dir: join(work, "t"), arch: '"x64"', checksumsUrl: '"https://example.test/tampered.txt"', sha256: { x64: sum } }));
|
|
213
|
-
expect(tampered.status).not.toBe(0);
|
|
214
|
-
expect(tampered.stderr).toContain(`lists ${"0".repeat(64)} for ${archive}; chant records ${sum}`);
|
|
215
|
-
},
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
test("is ci-image's fetch script, and the pins are ci-image's (#4908)", () => {
|
|
219
|
-
const sums = { x64: "e".repeat(64), arm64: "f".repeat(64) };
|
|
220
|
-
expect(ciFetchScript("pulumi", "3.272.0", { dir: "/out/p", arch: CI_DOCKER_ARCH, sha256: sums, checksumsUrl: '"$U"' })).toBe(
|
|
221
|
-
ciToolFetchScript("pulumi", "3.272.0", { dir: "/out/p", arch: CI_TOOL_DOCKER_ARCH, sha256: { amd64: sums.x64, arm64: sums.arm64 }, checksumsUrl: '"$U"' }),
|
|
222
|
-
);
|
|
223
|
-
expect(ciFetchScript("plunge", "0.2.0", { dir: "/out/g" })).toBe(ciToolFetchScript("plunge", "0.2.0", { dir: "/out/g" }));
|
|
224
|
-
expect(PINNED_SHA256["pulumi-v3.272.0-linux-x64.tar.gz"]).toBe(CI_TOOL_SHA256["pulumi-3.272.0-linux-amd64"]);
|
|
225
|
-
expect(PINNED_SHA256["plunge-v0.2.0-linux-arm64.tar.gz"]).toBe(CI_TOOL_SHA256["plunge-0.2.0-linux-arm64"]);
|
|
226
|
-
// plywood's pinnedSums, which turned ci-image's sums into these words, is this call.
|
|
227
|
-
expect(recordedSums("plunge", "0.2.0")).toEqual({ x64: CI_TOOL_SHA256["plunge-0.2.0-linux-amd64"], arm64: CI_TOOL_SHA256["plunge-0.2.0-linux-arm64"] });
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
test("the floor names the next release", () => {
|
|
231
|
-
expect(PULUMI_CI_SETUP_FLOOR).toBe(CI_SETUP_UNLINKED_FLOOR);
|
|
232
|
-
expect(CI_SETUP_UNLINKED_FLOOR).toBe("0.124.78");
|
|
233
|
-
});
|
|
234
|
-
});
|
package/src/ci-setup.ts
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The engine install lines a Pulumi project's pull request pipeline runs in
|
|
3
|
-
* chant's default image (#4550, `LexiconPlugin.ciSetup`): Pulumi, or plunge
|
|
4
|
-
* when the member's engine is plunge (`pulumiMemberEngine`, #4559).
|
|
5
|
-
*
|
|
6
|
-
* Each line installs one release (#4592), modelled on plywood#12's
|
|
7
|
-
* (INTENTIUS/plywood 9b24b50847, packages/plywood/src/images.ts):
|
|
8
|
-
*
|
|
9
|
-
* - it takes a version, by default {@link PULUMI_CI_VERSION} or
|
|
10
|
-
* {@link PLUNGE_CI_VERSION};
|
|
11
|
-
* - it downloads the Linux archive for the job's architecture and the
|
|
12
|
-
* release's own checksums file (Pulumi's `pulumi-<ver>-checksums.txt`,
|
|
13
|
-
* plunge's `plunge-v<ver>-checksums.txt`), and fails unless the archive's
|
|
14
|
-
* line is there and matches the archive (`sha256sum -c`);
|
|
15
|
-
* - for a release with a recorded sum ({@link PINNED_SHA256}, or the
|
|
16
|
-
* caller's `sha256`), the line must also hold that sum, so a tampered
|
|
17
|
-
* checksums file fails as a tampered archive does;
|
|
18
|
-
* - it unpacks under a versioned path, `/opt/chant/<engine>-<version>/`,
|
|
19
|
-
* with the language hosts beside the binary, and links the binary into
|
|
20
|
-
* /usr/local/bin;
|
|
21
|
-
* - it skips the download when that directory already holds the binary,
|
|
22
|
-
* and for Pulumi also when the `pulumi` on PATH is that version, so an
|
|
23
|
-
* image that carries the engine pays nothing.
|
|
24
|
-
*
|
|
25
|
-
* A product with images of its own (plywood keeps its engines under
|
|
26
|
-
* /opt/plywood) passes `root`, so the lines find what its image carries.
|
|
27
|
-
*
|
|
28
|
-
* `link: false` (#4814) installs a second release beside the linked one, for
|
|
29
|
-
* a step that runs `<root>/<engine>-<version>/<engine>` itself (pulumi-up's
|
|
30
|
-
* `engineVersion` and `engineRoot`): the line skips only when that directory
|
|
31
|
-
* holds the binary, and never touches PATH. {@link ciFetchScript} is the
|
|
32
|
-
* download and check alone, for an image build's `RUN` with the arch from
|
|
33
|
-
* `$TARGETARCH` ({@link CI_DOCKER_ARCH}) and the checksums URL from a build
|
|
34
|
-
* argument, so a tampered checksums file can be shown to fail the build.
|
|
35
|
-
*
|
|
36
|
-
* Since #4908 the download, the check and the recorded sums are
|
|
37
|
-
* `@intentius/chant/ci-image`'s, the one copy every engine install uses:
|
|
38
|
-
* {@link ciFetchScript} is `ciToolFetchScript` and {@link PINNED_SHA256} is
|
|
39
|
-
* read from `CI_TOOL_SHA256`. This module keeps the Pulumi words (the x64
|
|
40
|
-
* and arm64 archive names, the sums by them) and the install lines.
|
|
41
|
-
*/
|
|
42
|
-
import { CI_SETUP_UNLINKED_FLOOR } from "@intentius/chant/lexicon";
|
|
43
|
-
import { CI_TOOL_DOCKER_ARCH, CI_TOOL_JOB_ARCH, CI_TOOL_SHA256, ciToolFetchScript, ciToolRelease, ciToolSha256, type CiToolArch } from "@intentius/chant/ci-image";
|
|
44
|
-
import { pulumiMemberEngine } from "./member-engine";
|
|
45
|
-
|
|
46
|
-
/** The first chant with `link: false` and {@link ciFetchScript} (#4814). It is core's floor, so it freezes with chant's release. */
|
|
47
|
-
export const PULUMI_CI_SETUP_FLOOR: string = CI_SETUP_UNLINKED_FLOOR;
|
|
48
|
-
|
|
49
|
-
export type CiEngine = "pulumi" | "plunge";
|
|
50
|
-
|
|
51
|
-
/** The Pulumi release the default lines install: the plunge corpus's, which plunge 0.1.0 is built from. */
|
|
52
|
-
export const PULUMI_CI_VERSION = "3.272.0";
|
|
53
|
-
|
|
54
|
-
/** The plunge release the default lines install (INTENTIUS/plunge, tag plunge-v<ver>), not the Pulumi version it is built from. */
|
|
55
|
-
export const PLUNGE_CI_VERSION = "0.1.0";
|
|
56
|
-
|
|
57
|
-
/** Where the lines install each release by default. */
|
|
58
|
-
export const CI_ENGINE_ROOT = "/opt/chant";
|
|
59
|
-
|
|
60
|
-
/** The archive's architecture word, as both projects name their Linux builds. */
|
|
61
|
-
export type CiArch = "x64" | "arm64";
|
|
62
|
-
export const CI_ARCHES: readonly CiArch[] = ["x64", "arm64"];
|
|
63
|
-
|
|
64
|
-
const TOOL_ARCH: Record<CiArch, CiToolArch> = { x64: "amd64", arm64: "arm64" };
|
|
65
|
-
|
|
66
|
-
/** One release's download: the base URL, the archive per architecture, and its checksums file. */
|
|
67
|
-
export interface CiRelease {
|
|
68
|
-
base: string;
|
|
69
|
-
archive(arch: CiArch): string;
|
|
70
|
-
checksums: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const VERSION = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
74
|
-
const ROOT = /^\/[A-Za-z0-9._/-]*$/;
|
|
75
|
-
|
|
76
|
-
/** The release of `engine` at `version`, as ci-image names it (#4908). A version is a plain semver, so it is safe on a shell line. */
|
|
77
|
-
export function ciRelease(engine: CiEngine, version: string): CiRelease {
|
|
78
|
-
if (!VERSION.test(version)) throw new Error(`${engine} version ${JSON.stringify(version)} is not a release version such as 3.272.0`);
|
|
79
|
-
const r = ciToolRelease(engine, version, "amd64");
|
|
80
|
-
return {
|
|
81
|
-
base: r.url.slice(0, r.url.lastIndexOf("/")),
|
|
82
|
-
archive: (arch) => ciToolRelease(engine, version, TOOL_ARCH[arch]).asset,
|
|
83
|
-
checksums: r.checksums!,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* The sha256 of each recorded Linux archive, by its file name: ci-image's
|
|
89
|
-
* `CI_TOOL_SHA256` for Pulumi and plunge (#4908), where a release's two
|
|
90
|
-
* lines are added when a default version moves.
|
|
91
|
-
*/
|
|
92
|
-
export const PINNED_SHA256: Readonly<Record<string, string>> = Object.fromEntries(
|
|
93
|
-
Object.entries(CI_TOOL_SHA256).flatMap(([key, sum]) => {
|
|
94
|
-
const m = /^(pulumi|plunge)-(.+)-linux-(amd64|arm64)$/.exec(key);
|
|
95
|
-
return m ? [[ciRelease(m[1] as CiEngine, m[2]!).archive(m[3] === "amd64" ? "x64" : "arm64"), sum]] : [];
|
|
96
|
-
}),
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
/** What a caller may set on an install line. */
|
|
100
|
-
export interface CiInstallOptions {
|
|
101
|
-
/** Where the versioned directories live. Default {@link CI_ENGINE_ROOT}. */
|
|
102
|
-
root?: string;
|
|
103
|
-
/** Recorded sums by architecture, in place of {@link PINNED_SHA256}'s for this release. */
|
|
104
|
-
sha256?: Partial<Record<CiArch, string>>;
|
|
105
|
-
/**
|
|
106
|
-
* Link the binary into /usr/local/bin (default true). `false` (#4814)
|
|
107
|
-
* leaves PATH alone and skips only on the versioned directory, for a pin
|
|
108
|
-
* a step runs by its path.
|
|
109
|
-
*/
|
|
110
|
-
link?: boolean;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/** Where one release of one engine lives after its line runs. */
|
|
114
|
-
export function ciEngineDir(engine: CiEngine, version: string, root = CI_ENGINE_ROOT): string {
|
|
115
|
-
if (!ROOT.test(root)) throw new Error(`an engine root is an absolute path of letters, digits and ._/-, not ${JSON.stringify(root)}`);
|
|
116
|
-
return `${root.replace(/\/+$/, "")}/${engine}-${version}`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** The caller's sums by ci-image's architecture names. */
|
|
120
|
-
function toolSums(given: Partial<Record<CiArch, string>> | undefined): Partial<Record<CiToolArch, string>> | undefined {
|
|
121
|
-
if (!given) return undefined;
|
|
122
|
-
const out: Partial<Record<CiToolArch, string>> = {};
|
|
123
|
-
for (const arch of CI_ARCHES) if (given[arch] !== undefined) out[TOOL_ARCH[arch]] = given[arch];
|
|
124
|
-
return out;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** The recorded sums for `version`, by architecture: the caller's, else {@link PINNED_SHA256}'s. */
|
|
128
|
-
export function recordedSums(engine: CiEngine, version: string, given?: Partial<Record<CiArch, string>>): Partial<Record<CiArch, string>> {
|
|
129
|
-
ciRelease(engine, version);
|
|
130
|
-
const sums = ciToolSha256(engine, version, toolSums(given));
|
|
131
|
-
const out: Partial<Record<CiArch, string>> = {};
|
|
132
|
-
for (const arch of CI_ARCHES) if (sums[TOOL_ARCH[arch]] !== undefined) out[arch] = sums[TOOL_ARCH[arch]];
|
|
133
|
-
return out;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** A shell expression giving the job's architecture as x64 or arm64. */
|
|
137
|
-
export const CI_JOB_ARCH = `"$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')"`;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* A shell expression giving a Docker build's target architecture
|
|
141
|
-
* (`ARG TARGETARCH`) as x64 or arm64. Each case pattern opens with "(":
|
|
142
|
-
* bash 3.2 (macOS sh) cannot parse a bare `arm64)` inside `$(...)`.
|
|
143
|
-
*/
|
|
144
|
-
export const CI_DOCKER_ARCH = `"$(case "$TARGETARCH" in (arm64) echo arm64 ;; (*) echo x64 ;; esac)"`;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* `arch`, an expression giving x64 or arm64, as ci-image's amd64 or arm64.
|
|
148
|
-
* The two expressions here are ci-image's own; another is mapped in the
|
|
149
|
-
* shell.
|
|
150
|
-
*/
|
|
151
|
-
function toolArch(arch: string | undefined): string {
|
|
152
|
-
if (arch === undefined || arch === CI_JOB_ARCH) return CI_TOOL_JOB_ARCH;
|
|
153
|
-
if (arch === CI_DOCKER_ARCH) return CI_TOOL_DOCKER_ARCH;
|
|
154
|
-
return `"$(case ${arch} in (x64) echo amd64 ;; (*) echo ${arch} ;; esac)"`;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** Where {@link ciFetchScript} puts a release and what it checks it against. */
|
|
158
|
-
export interface CiFetchOptions {
|
|
159
|
-
/** The directory the archive unpacks into, an absolute path: `/out/opt/plywood/pulumi-3.272.0` in an image's fetch stage. */
|
|
160
|
-
dir: string;
|
|
161
|
-
/** A shell expression giving x64 or arm64. Default {@link CI_JOB_ARCH}; an image build passes {@link CI_DOCKER_ARCH}. */
|
|
162
|
-
arch?: string;
|
|
163
|
-
/** A shell word for the checksums file's URL, such as `"$CHECKSUMS_URL"`. Default the release's own. */
|
|
164
|
-
checksumsUrl?: string;
|
|
165
|
-
/** Recorded sums by architecture, in place of {@link PINNED_SHA256}'s for this release. */
|
|
166
|
-
sha256?: Partial<Record<CiArch, string>>;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Shell that downloads one release into `dir` and checks it against the
|
|
171
|
-
* release's checksums file and, when recorded, the sum per architecture
|
|
172
|
-
* (#4814): ci-image's `ciToolFetchScript` (#4908). Run it under `set -e`.
|
|
173
|
-
* Both archives unpack a top directory named after the engine, which
|
|
174
|
-
* `--strip-components=1` drops. `arch` and `checksumsUrl` go onto the line
|
|
175
|
-
* as they are, so they are the caller's shell, never a value from outside.
|
|
176
|
-
*/
|
|
177
|
-
export function ciFetchScript(engine: CiEngine, version: string, options: CiFetchOptions): string {
|
|
178
|
-
if (!ROOT.test(options.dir)) throw new Error(`a fetch directory is an absolute path of letters, digits and ._/-, not ${JSON.stringify(options.dir)}`);
|
|
179
|
-
ciRelease(engine, version);
|
|
180
|
-
const sha256 = toolSums(options.sha256);
|
|
181
|
-
return ciToolFetchScript(engine, version, {
|
|
182
|
-
dir: options.dir,
|
|
183
|
-
arch: toolArch(options.arch),
|
|
184
|
-
...(sha256 ? { sha256 } : {}),
|
|
185
|
-
...(options.checksumsUrl !== undefined ? { checksumsUrl: options.checksumsUrl } : {}),
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/** The line for one engine: skip when present, else fetch and check, then link into /usr/local/bin unless `link` is false. */
|
|
190
|
-
function installLine(engine: CiEngine, version: string, options: CiInstallOptions, present?: string): string {
|
|
191
|
-
const dir = ciEngineDir(engine, version, options.root);
|
|
192
|
-
const install = `(set -e; ${ciFetchScript(engine, version, { dir, ...(options.sha256 ? { sha256: options.sha256 } : {}) })})`;
|
|
193
|
-
// Unlinked: the versioned directory alone says whether this release is there.
|
|
194
|
-
if (options.link === false) return `[ -x "${dir}/${engine}" ] || ${install}`;
|
|
195
|
-
const link = `ln -sf "${dir}/${engine}" /usr/local/bin/${engine}`;
|
|
196
|
-
const inDir = `[ -x "${dir}/${engine}" ]`;
|
|
197
|
-
return present ? `${present} || { { ${inDir} || ${install}; } && ${link}; }` : `{ ${inDir} || ${install}; } && ${link}`;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Pulumi at `version` under `<root>/pulumi-<version>/`, checked against the
|
|
202
|
-
* release checksums. Linked, it skips when the `pulumi` on PATH is that
|
|
203
|
-
* version; with `link: false` only when the versioned directory holds it.
|
|
204
|
-
*/
|
|
205
|
-
export function pulumiInstallLine(version = PULUMI_CI_VERSION, options: CiInstallOptions = {}): string {
|
|
206
|
-
ciRelease("pulumi", version);
|
|
207
|
-
const present = `{ command -v pulumi >/dev/null 2>&1 && [ "$(pulumi version 2>/dev/null)" = "v${version}" ]; }`;
|
|
208
|
-
return installLine("pulumi", version, options, present);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* plunge at `version` under `<root>/plunge-<version>/`, its language hosts
|
|
213
|
-
* beside it, checked against the release checksums. plunge reports the
|
|
214
|
-
* Pulumi version it is built from, not its own release, so only the
|
|
215
|
-
* versioned directory tells an installed release apart.
|
|
216
|
-
*/
|
|
217
|
-
export function plungeInstallLine(version = PLUNGE_CI_VERSION, options: CiInstallOptions = {}): string {
|
|
218
|
-
return installLine("plunge", version, options);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/** The lines for the project at `dir`. */
|
|
222
|
-
export function pulumiCiSetup(ctx: { dir: string }): string[] {
|
|
223
|
-
return [pulumiMemberEngine(ctx.dir).engine === "plunge" ? plungeInstallLine() : pulumiInstallLine()];
|
|
224
|
-
}
|
package/src/codegen/docs-cli.ts
DELETED
package/src/codegen/docs.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { dirname, join } from "path";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import { docsPipeline, writeDocsSite } from "@intentius/chant/codegen/docs";
|
|
4
|
-
import type { DocsConfig } from "@intentius/chant/codegen/docs";
|
|
5
|
-
|
|
6
|
-
const overview = `
|
|
7
|
-
The Pulumi lexicon makes a Pulumi program a chant workspace member. It
|
|
8
|
-
declares no resource types and writes nothing: the program stays as it is,
|
|
9
|
-
applied by \`pulumi up\` as before. chant reads it four ways.
|
|
10
|
-
|
|
11
|
-
| Read | Source |
|
|
12
|
-
|---|---|
|
|
13
|
-
| the member's graph | the \`pulumi stack export\` checked in beside \`Pulumi.yaml\` as \`stack-export.json\` |
|
|
14
|
-
| its part of the change set | \`pulumi preview --json\` |
|
|
15
|
-
| its drift records | \`pulumi refresh --preview-only --json\`, one resource at a time, or \`plunge drift --stream\` |
|
|
16
|
-
| its outputs, for another member's parameters | \`pulumi stack output --json --show-secrets=false\` (applied) and the preview (planned) |
|
|
17
|
-
|
|
18
|
-
The graph read never runs \`pulumi\`. The other reads run those commands, or
|
|
19
|
-
\`plunge preview\`, \`plunge stack output\` and \`plunge drift\` for a member on
|
|
20
|
-
plunge, as ruled on [#4476](https://github.com/INTENTIUS/chant/issues/4476).
|
|
21
|
-
A member on plunge also has its engine facts read with \`plunge graph --json\`
|
|
22
|
-
([#4529](https://github.com/INTENTIUS/chant/issues/4529)), which reads
|
|
23
|
-
plunge's records and calls no provider. Nothing else runs, so chant never
|
|
24
|
-
changes a stack.
|
|
25
|
-
|
|
26
|
-
See [Getting Started](getting-started/) to add a Pulumi member to a
|
|
27
|
-
workspace, and [The pulumi member](member/) for what each read returns.
|
|
28
|
-
[The stack export](stack-export/) covers the file the graph is read from and
|
|
29
|
-
the checks that read it, [Watching a member](watching/) the \`PulumiWatchOp\`
|
|
30
|
-
composite, and [A member on plunge](plunge/) members that run on plunge.
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Generate the docs section for the pulumi lexicon (#4468). Authored pages
|
|
35
|
-
* come from `docs/pages/`; the overview, the rules page and the sidebar are
|
|
36
|
-
* the pipeline's.
|
|
37
|
-
*/
|
|
38
|
-
export async function generateDocs(options?: { verbose?: boolean }): Promise<void> {
|
|
39
|
-
const pkgDir = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
|
|
40
|
-
|
|
41
|
-
const config: DocsConfig = {
|
|
42
|
-
name: "pulumi",
|
|
43
|
-
displayName: "Pulumi",
|
|
44
|
-
description: "A Pulumi program as a workspace member: its graph, change set, drift and outputs",
|
|
45
|
-
distDir: join(pkgDir, "dist"),
|
|
46
|
-
outDir: join(pkgDir, "docs"),
|
|
47
|
-
basePath: process.env.DOCS_BASE_PATH ?? "/chant/lexicons/pulumi/",
|
|
48
|
-
overview,
|
|
49
|
-
suppressPages: ["serialization"],
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const result = docsPipeline(config);
|
|
53
|
-
writeDocsSite(config, result);
|
|
54
|
-
|
|
55
|
-
if (options?.verbose) {
|
|
56
|
-
console.error(`Generated ${result.pages.size} documentation pages`);
|
|
57
|
-
}
|
|
58
|
-
}
|
package/src/codegen/package.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Packaging for the pulumi lexicon (#4468): `dist/manifest.json` and the
|
|
3
|
-
* rest of the bundle core's `packagePipeline` writes.
|
|
4
|
-
*
|
|
5
|
-
* The lexicon declares no resource types, so there is nothing to generate:
|
|
6
|
-
* the registry is `{}` and the types barrel is empty, the honest statement
|
|
7
|
-
* that it exports no generated classes (the terraform lexicon packages the
|
|
8
|
-
* same way). What the bundle does carry is the manifest, with the
|
|
9
|
-
* `chantVersion` a consumer checks, and the lint and post-synth rule sources
|
|
10
|
-
* under `dist/rules/`, which the docs pipeline reads for the rules page, and
|
|
11
|
-
* the skills under `src/skills/` (#4494, #4510).
|
|
12
|
-
*/
|
|
13
|
-
import { readFileSync } from "fs";
|
|
14
|
-
import { dirname, join } from "path";
|
|
15
|
-
import { moduleSourceDir } from "@intentius/chant/module-source";
|
|
16
|
-
import { packagePipeline, collectSkills } from "@intentius/chant/codegen/package";
|
|
17
|
-
import { pulumiPlugin } from "../plugin";
|
|
18
|
-
import type { GenerateResult } from "@intentius/chant/codegen/generate";
|
|
19
|
-
|
|
20
|
-
/** This package's `src/`, which `packagePipeline` scans for `lint/rules` and `lint/post-synth`. */
|
|
21
|
-
const srcDir = dirname(moduleSourceDir(import.meta.url));
|
|
22
|
-
|
|
23
|
-
/** The published version, so the manifest cannot drift from package.json. */
|
|
24
|
-
function packageVersion(): string {
|
|
25
|
-
try {
|
|
26
|
-
const pkg = JSON.parse(readFileSync(join(srcDir, "..", "package.json"), "utf-8")) as { version?: string };
|
|
27
|
-
return pkg.version ?? "0.0.0";
|
|
28
|
-
} catch {
|
|
29
|
-
return "0.0.0";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** The empty generate result: no upstream schema, no generated classes. */
|
|
34
|
-
export function emptyGenerateResult(): GenerateResult {
|
|
35
|
-
return {
|
|
36
|
-
lexiconJSON: `${JSON.stringify({}, null, 2)}\n`,
|
|
37
|
-
typesDTS: "// Code generated by chant package. DO NOT EDIT.\n// The pulumi lexicon declares no resource types.\nexport {};\n",
|
|
38
|
-
indexTS: "// Code generated by chant package. DO NOT EDIT.\nexport {};\n",
|
|
39
|
-
resources: 0,
|
|
40
|
-
properties: 0,
|
|
41
|
-
enums: 0,
|
|
42
|
-
warnings: [],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export async function packageLexicon(options?: { verbose?: boolean; force?: boolean }) {
|
|
47
|
-
const version = packageVersion();
|
|
48
|
-
return packagePipeline(
|
|
49
|
-
{
|
|
50
|
-
generate: async () => emptyGenerateResult(),
|
|
51
|
-
buildManifest: () => ({
|
|
52
|
-
name: "pulumi",
|
|
53
|
-
version,
|
|
54
|
-
chantVersion: ">=0.1.0",
|
|
55
|
-
namespace: "Pulumi",
|
|
56
|
-
}),
|
|
57
|
-
srcDir,
|
|
58
|
-
collectSkills: () => collectSkills(pulumiPlugin.skills?.() ?? []),
|
|
59
|
-
version,
|
|
60
|
-
},
|
|
61
|
-
options,
|
|
62
|
-
);
|
|
63
|
-
}
|