@intentius/chant-lexicon-pulumi 0.124.76 → 0.124.78

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.
@@ -1,3 +1,5 @@
1
+ /** The first chant with `link: false` and {@link ciFetchScript} (#4814). It is core's floor, so it freezes with chant's release. */
2
+ export declare const PULUMI_CI_SETUP_FLOOR: string;
1
3
  export type CiEngine = "pulumi" | "plunge";
2
4
  /** The Pulumi release the default lines install: the plunge corpus's, which plunge 0.1.0 is built from. */
3
5
  export declare const PULUMI_CI_VERSION = "3.272.0";
@@ -21,6 +23,12 @@ export interface CiInstallOptions {
21
23
  root?: string;
22
24
  /** Recorded sums by architecture, in place of {@link PINNED_SHA256}'s for this release. */
23
25
  sha256?: Partial<Record<CiArch, string>>;
26
+ /**
27
+ * Link the binary into /usr/local/bin (default true). `false` (#4814)
28
+ * leaves PATH alone and skips only on the versioned directory, for a pin
29
+ * a step runs by its path.
30
+ */
31
+ link?: boolean;
24
32
  }
25
33
  /** One release's download: the base URL, the archive per architecture, and its checksums file. */
26
34
  export interface CiRelease {
@@ -34,9 +42,38 @@ export declare function ciRelease(engine: CiEngine, version: string): CiRelease;
34
42
  export declare function ciEngineDir(engine: CiEngine, version: string, root?: string): string;
35
43
  /** The recorded sums for `version`, by architecture: the caller's, else {@link PINNED_SHA256}'s. */
36
44
  export declare function recordedSums(engine: CiEngine, version: string, given?: Partial<Record<CiArch, string>>): Partial<Record<CiArch, string>>;
45
+ /** A shell expression giving the job's architecture as x64 or arm64. */
46
+ export declare const CI_JOB_ARCH = "\"$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')\"";
47
+ /**
48
+ * A shell expression giving a Docker build's target architecture
49
+ * (`ARG TARGETARCH`) as x64 or arm64. Each case pattern opens with "(":
50
+ * bash 3.2 (macOS sh) cannot parse a bare `arm64)` inside `$(...)`.
51
+ */
52
+ export declare const CI_DOCKER_ARCH = "\"$(case \"$TARGETARCH\" in (arm64) echo arm64 ;; (*) echo x64 ;; esac)\"";
53
+ /** Where {@link ciFetchScript} puts a release and what it checks it against. */
54
+ export interface CiFetchOptions {
55
+ /** The directory the archive unpacks into, an absolute path: `/out/opt/plywood/pulumi-3.272.0` in an image's fetch stage. */
56
+ dir: string;
57
+ /** A shell expression giving x64 or arm64. Default {@link CI_JOB_ARCH}; an image build passes {@link CI_DOCKER_ARCH}. */
58
+ arch?: string;
59
+ /** A shell word for the checksums file's URL, such as `"$CHECKSUMS_URL"`. Default the release's own. */
60
+ checksumsUrl?: string;
61
+ /** Recorded sums by architecture, in place of {@link PINNED_SHA256}'s for this release. */
62
+ sha256?: Partial<Record<CiArch, string>>;
63
+ }
64
+ /**
65
+ * Shell that downloads one release into `dir` and checks it against the
66
+ * release's checksums file and, when recorded, the sum per architecture
67
+ * (#4814). Run it under `set -e`. Both archives unpack a top directory named
68
+ * after the engine, which `--strip-components=1` drops. `arch` and
69
+ * `checksumsUrl` go onto the line as they are, so they are the caller's
70
+ * shell, never a value from outside.
71
+ */
72
+ export declare function ciFetchScript(engine: CiEngine, version: string, options: CiFetchOptions): string;
37
73
  /**
38
74
  * Pulumi at `version` under `<root>/pulumi-<version>/`, checked against the
39
- * release checksums. Skips when the `pulumi` on PATH is that version.
75
+ * release checksums. Linked, it skips when the `pulumi` on PATH is that
76
+ * version; with `link: false` only when the versioned directory holds it.
40
77
  */
41
78
  export declare function pulumiInstallLine(version?: string, options?: CiInstallOptions): string;
42
79
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ci-setup.d.ts","sourceRoot":"","sources":["../src/ci-setup.ts"],"names":[],"mappings":"AA6BA,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3C,2GAA2G;AAC3G,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,mIAAmI;AACnI,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,uDAAuD;AACvD,eAAO,MAAM,cAAc,eAAe,CAAC;AAE3C,iFAAi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25
25
  * A product with images of its own (plywood keeps its engines under
26
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.
27
35
  */
36
+ import { CI_SETUP_UNLINKED_FLOOR } from "@intentius/chant/lexicon";
28
37
  import { pulumiMemberEngine } from "./member-engine.js";
38
+ /** The first chant with `link: false` and {@link ciFetchScript} (#4814). It is core's floor, so it freezes with chant's release. */
39
+ export const PULUMI_CI_SETUP_FLOOR = CI_SETUP_UNLINKED_FLOOR;
29
40
  /** The Pulumi release the default lines install: the plunge corpus's, which plunge 0.1.0 is built from. */
30
41
  export const PULUMI_CI_VERSION = "3.272.0";
31
42
  /** The plunge release the default lines install (INTENTIUS/plunge, tag plunge-v<ver>), not the Pulumi version it is built from. */
@@ -85,25 +96,38 @@ export function recordedSums(engine, version, given) {
85
96
  }
86
97
  return out;
87
98
  }
88
- /** The job's architecture as x64 or arm64. */
89
- const JOB_ARCH = `"$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')"`;
99
+ /** A shell expression giving the job's architecture as x64 or arm64. */
100
+ export const CI_JOB_ARCH = `"$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')"`;
101
+ /**
102
+ * A shell expression giving a Docker build's target architecture
103
+ * (`ARG TARGETARCH`) as x64 or arm64. Each case pattern opens with "(":
104
+ * bash 3.2 (macOS sh) cannot parse a bare `arm64)` inside `$(...)`.
105
+ */
106
+ export const CI_DOCKER_ARCH = `"$(case "$TARGETARCH" in (arm64) echo arm64 ;; (*) echo x64 ;; esac)"`;
90
107
  /**
91
108
  * Shell that downloads one release into `dir` and checks it against the
92
- * release's checksums file and, when recorded, the sum per architecture.
93
- * Both archives unpack a top directory named after the engine, which
94
- * `--strip-components=1` drops.
109
+ * release's checksums file and, when recorded, the sum per architecture
110
+ * (#4814). Run it under `set -e`. Both archives unpack a top directory named
111
+ * after the engine, which `--strip-components=1` drops. `arch` and
112
+ * `checksumsUrl` go onto the line as they are, so they are the caller's
113
+ * shell, never a value from outside.
95
114
  */
96
- function fetchScript(engine, version, dir, sums) {
115
+ export function ciFetchScript(engine, version, options) {
116
+ if (!ROOT.test(options.dir))
117
+ throw new Error(`a fetch directory is an absolute path of letters, digits and ._/-, not ${JSON.stringify(options.dir)}`);
118
+ return fetchScript(engine, version, options.dir, recordedSums(engine, version, options.sha256), options.arch ?? CI_JOB_ARCH, options.checksumsUrl);
119
+ }
120
+ function fetchScript(engine, version, dir, sums, arch, checksumsUrl) {
97
121
  const r = ciRelease(engine, version);
98
122
  const recorded = CI_ARCHES.filter((a) => sums[a]);
99
123
  const pinCase = recorded.length > 0 ? `case "$a" in ${recorded.map((a) => `${a}) want=${sums[a]} ;;`).join(" ")} *) want= ;; esac` : "want=";
100
124
  const file = r.archive("x64").replace("-x64.", "-$a.");
101
125
  return [
102
- `a=${JOB_ARCH}`,
126
+ `a=${arch}`,
103
127
  `f="${file}"`,
104
128
  `t="$(mktemp -d)"`,
105
129
  `curl -fsSLo "$t/$f" "${r.base}/$f"`,
106
- `curl -fsSLo "$t/sums" "${r.base}/${r.checksums}"`,
130
+ `curl -fsSLo "$t/sums" ${checksumsUrl ?? `"${r.base}/${r.checksums}"`}`,
107
131
  // The archive's line, with any ./ or * before the name taken off.
108
132
  `line="$(sed -n "s#^\\([0-9a-f]\\{64\\}\\) *[*.]*/*$f\\$#\\1#p" "$t/sums")"`,
109
133
  `{ [ -n "$line" ] || { echo "${engine} ${version}: $f is not in ${r.checksums}" >&2; exit 1; }; }`,
@@ -114,17 +138,21 @@ function fetchScript(engine, version, dir, sums) {
114
138
  `tar -xzf "$t/$f" -C "${dir}" --strip-components=1`,
115
139
  ].join(" && ");
116
140
  }
117
- /** The line for one engine: skip when present, else fetch and check, then link into /usr/local/bin. */
141
+ /** The line for one engine: skip when present, else fetch and check, then link into /usr/local/bin unless `link` is false. */
118
142
  function installLine(engine, version, options, present) {
119
143
  const dir = ciEngineDir(engine, version, options.root);
120
- const install = `(set -e; ${fetchScript(engine, version, dir, recordedSums(engine, version, options.sha256))})`;
144
+ const install = `(set -e; ${fetchScript(engine, version, dir, recordedSums(engine, version, options.sha256), CI_JOB_ARCH)})`;
145
+ // Unlinked: the versioned directory alone says whether this release is there.
146
+ if (options.link === false)
147
+ return `[ -x "${dir}/${engine}" ] || ${install}`;
121
148
  const link = `ln -sf "${dir}/${engine}" /usr/local/bin/${engine}`;
122
149
  const inDir = `[ -x "${dir}/${engine}" ]`;
123
150
  return present ? `${present} || { { ${inDir} || ${install}; } && ${link}; }` : `{ ${inDir} || ${install}; } && ${link}`;
124
151
  }
125
152
  /**
126
153
  * Pulumi at `version` under `<root>/pulumi-<version>/`, checked against the
127
- * release checksums. Skips when the `pulumi` on PATH is that version.
154
+ * release checksums. Linked, it skips when the `pulumi` on PATH is that
155
+ * version; with `link: false` only when the versioned directory holds it.
128
156
  */
129
157
  export function pulumiInstallLine(version = PULUMI_CI_VERSION, options = {}) {
130
158
  ciRelease("pulumi", version);
@@ -1 +1 @@
1
- {"version":3,"file":"engine-events.d.ts","sourceRoot":"","sources":["../src/engine-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAChE,OAAO,EAAsE,KAAK,IAAI,EAAE,MAAM,UAAU,CAAC;AAEzG,kIAAkI;AAClI,eAAO,MAAM,4BAA4B,yCAAyC,CAAC;AAE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MAAM,GAAG,SAAS,iBAAiB,EAAE,GAAG,MAAM,GAAG,SAAS,CAOnG"}
@@ -104,7 +104,12 @@ function blinded(v) {
104
104
  return PULUMI_BLINDED_SECRET;
105
105
  return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, blinded(x)]));
106
106
  }
107
- /** A step state in the printed document's form (`apitype.ResourceV3`, empty fields omitted). */
107
+ /**
108
+ * A step state in the printed document's form (`apitype.ResourceV3`, empty
109
+ * fields omitted). The stream's `custom` is `omitempty`, so a state without
110
+ * it is a component: it reads as `custom: false`, as the printed document
111
+ * keeps it (#4640).
112
+ */
108
113
  function stateOf(s) {
109
114
  if (!s || typeof s !== "object" || Array.isArray(s))
110
115
  return undefined;
@@ -113,7 +118,7 @@ function stateOf(s) {
113
118
  const outputs = map(s.outputs);
114
119
  return {
115
120
  ...(s.urn ? { urn: s.urn } : {}),
116
- ...(typeof s.custom === "boolean" ? { custom: s.custom } : {}),
121
+ custom: s.custom === true,
117
122
  ...(s.delete ? { delete: true } : {}),
118
123
  ...(s.id ? { id: s.id } : {}),
119
124
  ...(s.type ? { type: s.type } : {}),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "algorithm": "sha256",
3
3
  "artifacts": {
4
- "manifest.json": "c2b85d8b1140995e85afa28f8b0aa9a1f824fd93943b34a14d94ddd7d548d912",
4
+ "manifest.json": "dd5c57a82a0caba7be924c8717a872c97b7dad4ffb3d2d995b1bd522f2c81210",
5
5
  "meta.json": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
6
6
  "types/index.d.ts": "883bcdf6a960e21360e79df010ca2087719fffec60fc39541c5ecd32d661e328",
7
7
  "rules/member-dir-absolute.ts": "4805d5e247ad544f942e1b2c36fc15a5087ca0aacaf804183a269021bd60e276",
@@ -25,5 +25,5 @@
25
25
  "skills/chant-pulumi-stack-export.md": "aadd67f5e067de61dfda43d57492bca08bd22429e4baf314d6856a810dc0e8dc",
26
26
  "skills/chant-pulumi-plunge.md": "8a7f2f9f1124744dee9645905f141057ca01f5a88e34e1bc3858d69406d7ff3a"
27
27
  },
28
- "composite": "85e46b1d1a149c7d19ddfe64477977839117234d1be4b87357ce89e27a28b8e6"
28
+ "composite": "4478559916bc27e26c9ecd8da5720945095ebd991fedada35187abe96bdd4e09"
29
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulumi",
3
- "version": "0.124.76",
3
+ "version": "0.124.78",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "Pulumi"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-pulumi",
3
- "version": "0.124.76",
3
+ "version": "0.124.78",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/",
@@ -54,7 +54,7 @@
54
54
  "access": "public"
55
55
  },
56
56
  "peerDependencies": {
57
- "@intentius/chant": "^0.124.76",
57
+ "@intentius/chant": "^0.124.78",
58
58
  "zod": "^4.3.6"
59
59
  },
60
60
  "description": "pulumi lexicon for chant: a Pulumi program as a workspace member, its preview in the change set and its refresh as drift records",
@@ -5,11 +5,22 @@
5
5
  * only; nothing is downloaded.
6
6
  */
7
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";
8
13
  import { describe, expect, test } from "vitest";
14
+ import { CI_SETUP_UNLINKED_FLOOR } from "@intentius/chant/lexicon";
15
+ import { NEXT_RELEASE } from "@intentius/chant/release-floors";
9
16
  import {
10
17
  ciEngineDir,
18
+ ciFetchScript,
11
19
  ciRelease,
20
+ CI_DOCKER_ARCH,
12
21
  CI_ENGINE_ROOT,
22
+ CI_JOB_ARCH,
23
+ PULUMI_CI_SETUP_FLOOR,
13
24
  PINNED_SHA256,
14
25
  PLUNGE_CI_VERSION,
15
26
  plungeInstallLine,
@@ -121,3 +132,89 @@ describe("pulumi-up's pinned binary (#4592)", () => {
121
132
  expect(() => engineRunnerAt("pulumi")).toThrow(/absolute/);
122
133
  });
123
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
+ expect(s.startsWith(`a=${CI_DOCKER_ARCH} && `)).toBe(true);
170
+ expect(CI_DOCKER_ARCH).toBe(`"$(case "$TARGETARCH" in (arm64) echo arm64 ;; (*) echo x64 ;; esac)"`);
171
+ expect(s).toContain('curl -fsSLo "$t/sums" "$CHECKSUMS_URL"');
172
+ expect(s).toContain('tar -xzf "$t/$f" -C "/out/opt/plywood/pulumi-3.272.0" --strip-components=1');
173
+ expect(s).toContain(`x64) want=${PINNED_SHA256["pulumi-v3.272.0-linux-x64.tar.gz"]} ;;`);
174
+ });
175
+
176
+ test("defaults to the job's architecture and the release's own checksums file", () => {
177
+ const s = ciFetchScript("plunge", "0.1.0", { dir: "/opt/chant/plunge-0.1.0" });
178
+ expect(s.startsWith(`a=${CI_JOB_ARCH} && `)).toBe(true);
179
+ expect(s).toContain('curl -fsSLo "$t/sums" "https://github.com/INTENTIUS/plunge/releases/download/plunge-v0.1.0/plunge-v0.1.0-checksums.txt"');
180
+ expect(() => ciFetchScript("plunge", "0.1.0", { dir: "relative" })).toThrow(/absolute/);
181
+ });
182
+
183
+ test.skipIf(!["sha256sum", "tar", "sh"].every((b) => spawnSync("sh", ["-c", `command -v ${b}`]).status === 0))(
184
+ "run: installs a release whose sum matches, and refuses a tampered checksums file",
185
+ () => {
186
+ const work = mkdtempSync(join(tmpdir(), "chant-ci-fetch-"));
187
+ const served = join(work, "served");
188
+ mkdirSync(join(served, "src", "pulumi"), { recursive: true });
189
+ writeFileSync(join(served, "src", "pulumi", "pulumi"), "#!/bin/sh\necho v3.272.0\n");
190
+ chmodSync(join(served, "src", "pulumi", "pulumi"), 0o755);
191
+ const archive = "pulumi-v3.272.0-linux-x64.tar.gz";
192
+ execFileSync("tar", ["-czf", join(served, archive), "-C", join(served, "src"), "pulumi"]);
193
+ const sum = createHash("sha256").update(readFileSync(join(served, archive))).digest("hex");
194
+ writeFileSync(join(served, "pulumi-3.272.0-checksums.txt"), `${sum} ${archive}\n`);
195
+ writeFileSync(join(served, "tampered.txt"), `${"0".repeat(64)} ${archive}\n`);
196
+ // curl -fsSLo <out> <url>: serve the file the URL names from the served directory.
197
+ const bin = join(work, "bin");
198
+ mkdirSync(bin);
199
+ writeFileSync(join(bin, "curl"), `#!/bin/sh\ncp "${served}/$(basename "$3")" "$2"\n`);
200
+ chmodSync(join(bin, "curl"), 0o755);
201
+ const env = { ...process.env, PATH: `${bin}:${process.env.PATH}` };
202
+ const run = (script: string) => spawnSync("sh", ["-c", `set -e; ${script}`], { env, encoding: "utf8" });
203
+
204
+ const dir = join(work, "opt", "pulumi-3.272.0");
205
+ const ok = run(ciFetchScript("pulumi", "3.272.0", { dir, arch: '"x64"', sha256: { x64: sum } }));
206
+ expect(ok.stderr).toBe("");
207
+ expect(ok.status).toBe(0);
208
+ expect(existsSync(join(dir, "pulumi"))).toBe(true);
209
+
210
+ const tampered = run(ciFetchScript("pulumi", "3.272.0", { dir: join(work, "t"), arch: '"x64"', checksumsUrl: '"https://example.test/tampered.txt"', sha256: { x64: sum } }));
211
+ expect(tampered.status).not.toBe(0);
212
+ expect(tampered.stderr).toContain(`lists ${"0".repeat(64)} for ${archive}; chant records ${sum}`);
213
+ },
214
+ );
215
+
216
+ test("the floor names the next release", () => {
217
+ expect(PULUMI_CI_SETUP_FLOOR).toBe(CI_SETUP_UNLINKED_FLOOR);
218
+ expect(CI_SETUP_UNLINKED_FLOOR).toBe(NEXT_RELEASE);
219
+ });
220
+ });
package/src/ci-setup.ts CHANGED
@@ -24,9 +24,21 @@
24
24
  *
25
25
  * A product with images of its own (plywood keeps its engines under
26
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.
27
35
  */
36
+ import { CI_SETUP_UNLINKED_FLOOR } from "@intentius/chant/lexicon";
28
37
  import { pulumiMemberEngine } from "./member-engine";
29
38
 
39
+ /** The first chant with `link: false` and {@link ciFetchScript} (#4814). It is core's floor, so it freezes with chant's release. */
40
+ export const PULUMI_CI_SETUP_FLOOR: string = CI_SETUP_UNLINKED_FLOOR;
41
+
30
42
  export type CiEngine = "pulumi" | "plunge";
31
43
 
32
44
  /** The Pulumi release the default lines install: the plunge corpus's, which plunge 0.1.0 is built from. */
@@ -61,6 +73,12 @@ export interface CiInstallOptions {
61
73
  root?: string;
62
74
  /** Recorded sums by architecture, in place of {@link PINNED_SHA256}'s for this release. */
63
75
  sha256?: Partial<Record<CiArch, string>>;
76
+ /**
77
+ * Link the binary into /usr/local/bin (default true). `false` (#4814)
78
+ * leaves PATH alone and skips only on the versioned directory, for a pin
79
+ * a step runs by its path.
80
+ */
81
+ link?: boolean;
64
82
  }
65
83
 
66
84
  /** One release's download: the base URL, the archive per architecture, and its checksums file. */
@@ -110,26 +128,52 @@ export function recordedSums(engine: CiEngine, version: string, given?: Partial<
110
128
  return out;
111
129
  }
112
130
 
113
- /** The job's architecture as x64 or arm64. */
114
- const JOB_ARCH = `"$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')"`;
131
+ /** A shell expression giving the job's architecture as x64 or arm64. */
132
+ export const CI_JOB_ARCH = `"$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')"`;
133
+
134
+ /**
135
+ * A shell expression giving a Docker build's target architecture
136
+ * (`ARG TARGETARCH`) as x64 or arm64. Each case pattern opens with "(":
137
+ * bash 3.2 (macOS sh) cannot parse a bare `arm64)` inside `$(...)`.
138
+ */
139
+ export const CI_DOCKER_ARCH = `"$(case "$TARGETARCH" in (arm64) echo arm64 ;; (*) echo x64 ;; esac)"`;
140
+
141
+ /** Where {@link ciFetchScript} puts a release and what it checks it against. */
142
+ export interface CiFetchOptions {
143
+ /** The directory the archive unpacks into, an absolute path: `/out/opt/plywood/pulumi-3.272.0` in an image's fetch stage. */
144
+ dir: string;
145
+ /** A shell expression giving x64 or arm64. Default {@link CI_JOB_ARCH}; an image build passes {@link CI_DOCKER_ARCH}. */
146
+ arch?: string;
147
+ /** A shell word for the checksums file's URL, such as `"$CHECKSUMS_URL"`. Default the release's own. */
148
+ checksumsUrl?: string;
149
+ /** Recorded sums by architecture, in place of {@link PINNED_SHA256}'s for this release. */
150
+ sha256?: Partial<Record<CiArch, string>>;
151
+ }
115
152
 
116
153
  /**
117
154
  * Shell that downloads one release into `dir` and checks it against the
118
- * release's checksums file and, when recorded, the sum per architecture.
119
- * Both archives unpack a top directory named after the engine, which
120
- * `--strip-components=1` drops.
155
+ * release's checksums file and, when recorded, the sum per architecture
156
+ * (#4814). Run it under `set -e`. Both archives unpack a top directory named
157
+ * after the engine, which `--strip-components=1` drops. `arch` and
158
+ * `checksumsUrl` go onto the line as they are, so they are the caller's
159
+ * shell, never a value from outside.
121
160
  */
122
- function fetchScript(engine: CiEngine, version: string, dir: string, sums: Partial<Record<CiArch, string>>): string {
161
+ export function ciFetchScript(engine: CiEngine, version: string, options: CiFetchOptions): string {
162
+ if (!ROOT.test(options.dir)) throw new Error(`a fetch directory is an absolute path of letters, digits and ._/-, not ${JSON.stringify(options.dir)}`);
163
+ return fetchScript(engine, version, options.dir, recordedSums(engine, version, options.sha256), options.arch ?? CI_JOB_ARCH, options.checksumsUrl);
164
+ }
165
+
166
+ function fetchScript(engine: CiEngine, version: string, dir: string, sums: Partial<Record<CiArch, string>>, arch: string, checksumsUrl?: string): string {
123
167
  const r = ciRelease(engine, version);
124
168
  const recorded = CI_ARCHES.filter((a) => sums[a]);
125
169
  const pinCase = recorded.length > 0 ? `case "$a" in ${recorded.map((a) => `${a}) want=${sums[a]} ;;`).join(" ")} *) want= ;; esac` : "want=";
126
170
  const file = r.archive("x64").replace("-x64.", "-$a.");
127
171
  return [
128
- `a=${JOB_ARCH}`,
172
+ `a=${arch}`,
129
173
  `f="${file}"`,
130
174
  `t="$(mktemp -d)"`,
131
175
  `curl -fsSLo "$t/$f" "${r.base}/$f"`,
132
- `curl -fsSLo "$t/sums" "${r.base}/${r.checksums}"`,
176
+ `curl -fsSLo "$t/sums" ${checksumsUrl ?? `"${r.base}/${r.checksums}"`}`,
133
177
  // The archive's line, with any ./ or * before the name taken off.
134
178
  `line="$(sed -n "s#^\\([0-9a-f]\\{64\\}\\) *[*.]*/*$f\\$#\\1#p" "$t/sums")"`,
135
179
  `{ [ -n "$line" ] || { echo "${engine} ${version}: $f is not in ${r.checksums}" >&2; exit 1; }; }`,
@@ -141,10 +185,12 @@ function fetchScript(engine: CiEngine, version: string, dir: string, sums: Parti
141
185
  ].join(" && ");
142
186
  }
143
187
 
144
- /** The line for one engine: skip when present, else fetch and check, then link into /usr/local/bin. */
188
+ /** The line for one engine: skip when present, else fetch and check, then link into /usr/local/bin unless `link` is false. */
145
189
  function installLine(engine: CiEngine, version: string, options: CiInstallOptions, present?: string): string {
146
190
  const dir = ciEngineDir(engine, version, options.root);
147
- const install = `(set -e; ${fetchScript(engine, version, dir, recordedSums(engine, version, options.sha256))})`;
191
+ const install = `(set -e; ${fetchScript(engine, version, dir, recordedSums(engine, version, options.sha256), CI_JOB_ARCH)})`;
192
+ // Unlinked: the versioned directory alone says whether this release is there.
193
+ if (options.link === false) return `[ -x "${dir}/${engine}" ] || ${install}`;
148
194
  const link = `ln -sf "${dir}/${engine}" /usr/local/bin/${engine}`;
149
195
  const inDir = `[ -x "${dir}/${engine}" ]`;
150
196
  return present ? `${present} || { { ${inDir} || ${install}; } && ${link}; }` : `{ ${inDir} || ${install}; } && ${link}`;
@@ -152,7 +198,8 @@ function installLine(engine: CiEngine, version: string, options: CiInstallOption
152
198
 
153
199
  /**
154
200
  * Pulumi at `version` under `<root>/pulumi-<version>/`, checked against the
155
- * release checksums. Skips when the `pulumi` on PATH is that version.
201
+ * release checksums. Linked, it skips when the `pulumi` on PATH is that
202
+ * version; with `link: false` only when the versioned directory holds it.
156
203
  */
157
204
  export function pulumiInstallLine(version = PULUMI_CI_VERSION, options: CiInstallOptions = {}): string {
158
205
  ciRelease("pulumi", version);
@@ -11,7 +11,8 @@
11
11
  import { readFileSync } from "node:fs";
12
12
  import { join } from "node:path";
13
13
  import { describe, expect, test } from "vitest";
14
- import { pulumiPreviewDigest, pulumiPreviewPart } from "./change-set";
14
+ import { pulumiMayAppearAddress } from "@intentius/chant/pulumi-urn";
15
+ import { pulumiPreviewDigest, pulumiPreviewPart, type PulumiStep } from "./change-set";
15
16
  import {
16
17
  crossGuardRule,
17
18
  pulumiAppliedSteps,
@@ -56,6 +57,31 @@ describe("a streamed preview reads as the printed document", () => {
56
57
  expect(fromStream).toEqual(fromPrinted);
57
58
  });
58
59
 
60
+ test("a component's state, whose custom: false the stream omits, reads as custom: false", () => {
61
+ expect(stream).not.toContain('"custom":false');
62
+ const steps = pulumiStreamPreview(stream).steps;
63
+ const docs = steps.find((s) => s.urn === urn("corpus:index:Site", "docs"))!;
64
+ expect(docs.oldState?.custom).toBe(false);
65
+ expect(docs.newState?.custom).toBe(false);
66
+ });
67
+
68
+ test("change-set signal 1 marks the same components from the stream as from the printed document (#4640)", () => {
69
+ // docs-assets, a child of the docs component, given an input preview does not know.
70
+ const waiting = (steps: PulumiStep[]): PulumiStep[] =>
71
+ structuredClone(steps).map((s) =>
72
+ s.urn?.endsWith("Site$aws:s3/bucket:Bucket::docs-assets")
73
+ ? { ...s, op: "update", diffReasons: ["tags"], newState: { ...s.newState!, inputs: { ...(s.newState!.inputs as object), tags: "04da6b54-80e4-46f7-96ec-b56ff0331ba9" } } }
74
+ : s,
75
+ );
76
+ const mayAppear = (steps: PulumiStep[]) =>
77
+ pulumiPreviewPart({ member: "site/floci", preview: { steps: waiting(steps) }, stack: "floci" })
78
+ .entries.filter((e) => e.mayAppear === true)
79
+ .map((e) => e.address);
80
+ const fromPrinted = mayAppear(printed.steps as PulumiStep[]);
81
+ expect(fromPrinted).toEqual([pulumiMayAppearAddress(urn("corpus:index:Site", "docs"))]);
82
+ expect(mayAppear(pulumiStreamPreview(stream).steps)).toEqual(fromPrinted);
83
+ });
84
+
59
85
  test("an ephemeral diagnostic is left out, and the summary gives changeSummary", () => {
60
86
  const doc = pulumiStreamPreview(stream);
61
87
  expect(doc.diagnostics.some((d) => d.message === "progress\n")).toBe(false);
@@ -186,7 +186,12 @@ function blinded(v: unknown): unknown {
186
186
  return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, blinded(x)]));
187
187
  }
188
188
 
189
- /** A step state in the printed document's form (`apitype.ResourceV3`, empty fields omitted). */
189
+ /**
190
+ * A step state in the printed document's form (`apitype.ResourceV3`, empty
191
+ * fields omitted). The stream's `custom` is `omitempty`, so a state without
192
+ * it is a component: it reads as `custom: false`, as the printed document
193
+ * keeps it (#4640).
194
+ */
190
195
  function stateOf(s: PulumiEventState | null | undefined): PulumiStepState | undefined {
191
196
  if (!s || typeof s !== "object" || Array.isArray(s)) return undefined;
192
197
  const map = (m: Json | null | undefined): Json | undefined => (isObject(m) && Object.keys(m).length > 0 ? (blinded(m) as Json) : undefined);
@@ -194,7 +199,7 @@ function stateOf(s: PulumiEventState | null | undefined): PulumiStepState | unde
194
199
  const outputs = map(s.outputs);
195
200
  return {
196
201
  ...(s.urn ? { urn: s.urn } : {}),
197
- ...(typeof s.custom === "boolean" ? { custom: s.custom } : {}),
202
+ custom: s.custom === true,
198
203
  ...(s.delete ? { delete: true } : {}),
199
204
  ...(s.id ? { id: s.id } : {}),
200
205
  ...(s.type ? { type: s.type } : {}),
@@ -99,8 +99,7 @@ describe("replace-on-name", () => {
99
99
 
100
100
  describe("unknown-in-apply", () => {
101
101
  test("a component whose child waits on an unknown may register more at up", () => {
102
- // The JSON recording: the stream omits a component's custom: false, which signal 1 of the change set reads.
103
- const steps = structuredClone((JSON.parse(readFileSync(join(TESTDATA, "pulumi-preview", "preview.json"), "utf8")) as { steps: PulumiStep[] }).steps);
102
+ const steps = recorded();
104
103
  const child = steps.find((s) => s.urn?.endsWith("Site$aws:s3/bucket:Bucket::docs-assets"))!;
105
104
  child.op = "update";
106
105
  child.newState = { ...child.newState!, inputs: { ...(child.newState!.inputs as object), tags: "04da6b54-80e4-46f7-96ec-b56ff0331ba9" } };