@git.zone/cli 12.0.1 → 12.1.0

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.
@@ -25,7 +25,7 @@ import * as objectstorage from '@lossless.org/client/objectstorage';
25
25
  import * as s3 from '@aws-sdk/client-s3';
26
26
  import * as tsdockerReleaseProtocol from '@git.zone/tsdocker/dist_ts/classes.releaseprotocol.js';
27
27
  import * as tspublish from '@git.zone/tsrepo/publish';
28
- export type { IReleaseCapabilitiesResult, IReleaseCleanupResult, IReleaseDestinationEvidence, IReleaseProbeResult, IReleasePromotionContext, IReleasePromotionResult, IReleaseQualificationRequest, IReleaseQualificationResult, IReleaseValidationResult, TReleaseAliasPolicy, TReleasePromotionEvidence, TReleaseProtocolCommand, TReleaseProtocolFeature, } from '@git.zone/tsdocker/dist_ts/interfaces/index.js';
28
+ export type { IReleaseCapabilitiesResult, IReleaseCleanupResult, IReleaseDestinationEvidence, IReleaseImageChecksEvidence, IReleaseProbeResult, IReleasePromotionContext, IReleasePromotionResult, IReleaseQualificationOptions, IReleaseQualificationRequest, IReleaseQualificationResult, IReleaseValidationResult, TReleaseAliasPolicy, TReleasePromotionEvidence, TReleaseProtocolCommand, TReleaseProtocolFeature, TReleaseQualificationChecks, } from '@git.zone/tsdocker/dist_ts/interfaces/index.js';
29
29
  export declare const smartfs: SmartFs;
30
30
  export declare const loadDcrouterApi: () => Promise<typeof import("@serve.zone/dcrouter-apiclient")>;
31
31
  export type { DcRouterApiClient, TestingApi } from '@serve.zone/dcrouter-apiclient';
@@ -30,4 +30,4 @@ import * as tspublish from '@git.zone/tsrepo/publish';
30
30
  export const smartfs = new SmartFs(new SmartFsProviderNode());
31
31
  export const loadDcrouterApi = () => import('@serve.zone/dcrouter-apiclient');
32
32
  export { smartlog, smartlogDestinationLocal, smartconfig, path, os, fs, fsConstants, crypto, fsSync, childProcess, tty, nodeModule, nodeUrl, projectinfo, smartconsole, smartpath, smartpromise, smartupdate, smartshell, sm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ZLEVBQ1osR0FBRyxFQUNILFVBQVUsRUFDVixPQUFPLEVBQ1AsV0FBVyxFQUNYLFlBQVksRUFDWixTQUFTLEVBQ1QsWUFBWSxFQUNaLFdBQVcsRUFDWCxVQUFVLEVBQ1YsWUFBWSxFQUNaLFNBQVMsRUFDVCxZQUFZLEVBQ1osYUFBYSxFQUNiLEVBQUUsRUFDRix1QkFBdUIsRUFDdkIsU0FBUyxHQUNWLENBQUMifQ==
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@git.zone/cli",
3
3
  "private": false,
4
- "version": "12.0.1",
4
+ "version": "12.1.0",
5
5
  "description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
6
6
  "main": "dist_ts/index.js",
7
7
  "typings": "dist_ts/index.d.ts",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@aws-sdk/client-s3": "3.1095.0",
48
- "@git.zone/tsdocker": "3.12.0",
48
+ "@git.zone/tsdocker": "3.14.0",
49
49
  "@git.zone/tsrepo": "^1.1.1",
50
50
  "@lossless.org/client": "1.5.1",
51
51
  "@push.rocks/early": "^4.0.4",
package/readme.md CHANGED
@@ -198,7 +198,7 @@ The release core is not configurable plumbing. It always follows the same profes
198
198
  8. Create a disposable detached checkout of that release commit, install its locked dependencies when the commit carries a `package.json` (and run `cargo fetch --locked` in a Rust project), and run the configured release build there. An active Docker target additionally builds the release worktree its qualification reads.
199
199
  9. When npm is selected, prepare every named tspublish module outside the repository, then pack each module and the public root package once into an exact tarball from that checkout. Every tarball must then carry each entry point its packed `package.json` names (`core.packNpmArtifact.entryPoints`), and its estimated publish body must fit each registry's `maxPublishBytes` (`core.packNpmArtifact.publishSize`, planned only when a limit is configured); the packed size and the body per registry are printed either way. See [Package contents](#package-contents).
200
200
  10. Atomically install a durable journal before final publication. A release that publishes only the root package to npm uses journal schema 1, one that also or only publishes tspublish modules uses schema 3, a Docker release uses schema 2 with or without modules, and a Gitea asset release uses schema 4, all in the same storage tree.
201
- 11. For schema 2, run the project-local tSDocker qualification build and configured image tests, then durably record the candidate digest graph and complete ordered promotion set.
201
+ 11. For schema 2, run the project-local tSDocker qualification build and configured image tests (or its native per-platform checks, see [Native platform checks](#native-platform-checks)), then durably record the candidate digest graph and complete ordered promotion set.
202
202
  12. Publish and verify Git, then every npm package at every registry, modules first and the root package last, then each Docker destination. Remove only the exact qualified candidate after every destination is verified, or after a terminal qualification destination conflict before Git/npm publication.
203
203
  13. Remove the test artifacts tstest wrote, so a machine does not accumulate test output release after release. This runs only after a successful publication, leaving the logs in place when a release fails. It runs the project's `node_modules/.bin/tsrepo test clean` when the project installs `@git.zone/tsrepo`, otherwise its `node_modules/.bin/tstest clean` (tstest 6.1.0 or later). It is skipped when the project has neither, and a project opts out with `{"@git.zone/tsrepo": {"test": {"cleanup": {"onRelease": false}}}}`, or the legacy `{"@git.zone/tstest": {"cleanup": {"onRelease": false}}}`, in `.smartconfig.json`; both at once is an error. See the tstest readme for what it removes; snapshots are kept.
204
204
 
@@ -1719,6 +1719,62 @@ request. `noBuild` must remain false or absent because digest qualification
1719
1719
  always builds. The separate release `--no-build` flag only disables the normal
1720
1720
  project build step and does not bypass Docker qualification.
1721
1721
 
1722
+ #### Native platform checks
1723
+
1724
+ `release.targets.docker.test` is `false` (the default), `true` or `"native"`;
1725
+ any other value is a configuration error. `true` runs the Dockerfile test
1726
+ scripts. `"native"` runs tSDocker's native per-platform checks and scan gate
1727
+ instead: the qualification request carries `test: false` and
1728
+ `checks: "native-platforms"`, and tSDocker runs the suites the project declares
1729
+ under `@git.zone/tsdocker.imageChecks` in every runnable platform image on a
1730
+ daemon of that platform's own architecture (the local daemon for the host's,
1731
+ a configured tSDocker remote builder for another) and scans every platform
1732
+ manifest with the pinned scanner; any failure, and any CRITICAL or HIGH
1733
+ finding, fails the qualification before anything is published. The tSDocker
1734
+ readme (Native Platform Checks) describes `imageChecks`.
1735
+
1736
+ ```json
1737
+ "docker": {
1738
+ "enabled": true,
1739
+ "engine": "tsdocker",
1740
+ "patterns": ["Dockerfile_##version##"],
1741
+ "test": "native"
1742
+ }
1743
+ ```
1744
+
1745
+ `"native"` needs project-local `@git.zone/tsdocker` 3.14.0 or later, which
1746
+ advertises the `native-platform-checks` capability; a release, a resume and
1747
+ `gitzone config doctor` refuse an older one and name the version. `true` and
1748
+ `false` send no `checks`, so their requests and candidate IDs are what they
1749
+ were, and they keep working with an older tSDocker. tSDocker refuses
1750
+ `"native"` without `imageChecks` and `imageChecks` without `"native"`;
1751
+ `gitzone config doctor` reports both.
1752
+
1753
+ `gitzone release --plan` shows the checks, the platforms configured in
1754
+ `@git.zone/tsdocker.platforms` and the declared suites. tSDocker chooses each
1755
+ platform's daemon when it qualifies, so the plan does not name executors:
1756
+
1757
+ ```text
1758
+ docker image tests: native per-platform checks and scan gate (tSDocker native-platform-checks) required before destination publication
1759
+ docker native check platforms: linux/amd64, linux/arm64 (each on a daemon of its own architecture: …)
1760
+ docker check suites: packaged-startup, smoke; scan gate: CRITICAL and HIGH findings fail qualification
1761
+ docker options: checks=native-platforms
1762
+ ```
1763
+
1764
+ After qualification, the release output, its closing summary and
1765
+ `gitzone release inspect` show the evidence the journal records for each image:
1766
+ every platform's executor, the daemon's and the image's architecture and the
1767
+ manifest digest, every suite, and the scan counts with the scanner and
1768
+ database digests. The scan states what was known at qualification time; a
1769
+ promotion resumed later does not scan again.
1770
+
1771
+ ```text
1772
+ docker native check cloudly:33.27.0 linux/amd64: local (daemon x86_64, image amd64, sha256:…)
1773
+ docker native check cloudly:33.27.0 linux/arm64: remote-builder:arm64-builder (daemon aarch64, image arm64, sha256:…)
1774
+ docker check suite cloudly:33.27.0 packaged-startup: passed in 30058 ms over 2 platforms
1775
+ docker scan cloudly:33.27.0: CRITICAL 0, HIGH 0, MEDIUM 6, LOW 0, UNKNOWN 0 (scanner sha256:…, database sha256:… updated …, scanned …)
1776
+ ```
1777
+
1722
1778
  Useful config commands:
1723
1779
 
1724
1780
  ```bash
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@git.zone/cli',
6
- version: '12.0.1',
6
+ version: '12.1.0',
7
7
  description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
8
8
  }
@@ -1,3 +1,4 @@
1
+ import type { TReleaseQualificationChecks } from "./plugins.js";
1
2
  import { getCliConfigValue } from "./helpers.smartconfig.js";
2
3
  import { shouldCleanTestArtifactsOnRelease } from "./helpers.tstest.js";
3
4
  import {
@@ -256,7 +257,11 @@ export interface IReleaseDockerTargetConfig {
256
257
  engine?: "tsdocker";
257
258
  registry?: string;
258
259
  buildRegistries?: string[];
259
- test?: boolean;
260
+ /**
261
+ * `true` runs the Dockerfile test scripts; `"native"` runs tSDocker's
262
+ * native per-platform checks and scan gate (`imageChecks`) instead.
263
+ */
264
+ test?: boolean | "native";
260
265
  patterns?: string[];
261
266
  cached?: boolean;
262
267
  parallel?: boolean | number;
@@ -483,6 +488,8 @@ export interface IResolvedReleaseWorkflow {
483
488
  dockerRegistry?: string;
484
489
  dockerBuildRegistries: string[];
485
490
  dockerTest: boolean;
491
+ /** Present only for `release.targets.docker.test: "native"`. */
492
+ dockerChecks?: TReleaseQualificationChecks;
486
493
  dockerPatterns: string[];
487
494
  dockerCached: boolean;
488
495
  dockerParallel: boolean | number;
@@ -522,6 +529,7 @@ export type TResolvedReleaseDockerConfiguration = Pick<
522
529
  | "dockerRegistry"
523
530
  | "dockerBuildRegistries"
524
531
  | "dockerTest"
532
+ | "dockerChecks"
525
533
  | "dockerPatterns"
526
534
  | "dockerCached"
527
535
  | "dockerParallel"
@@ -605,14 +613,27 @@ export const supportsTsdockerMinimumVersion = (
605
613
  return true;
606
614
  };
607
615
 
608
- export const resolveDockerTestSetting = (valueArg: unknown): boolean => {
609
- if (valueArg === undefined) {
610
- return false;
616
+ /**
617
+ * `release.targets.docker.test` as the qualification request carries it.
618
+ * `"native"` asks tSDocker for its native per-platform checks, which replace
619
+ * the Dockerfile test scripts (`test: false`); `true` and `false` send no
620
+ * `checks`, so their requests and candidate IDs stay as they were.
621
+ */
622
+ export const resolveDockerTestSetting = (
623
+ valueArg: unknown,
624
+ ): Pick<TResolvedReleaseDockerConfiguration, "dockerTest" | "dockerChecks"> => {
625
+ if (valueArg === undefined || valueArg === false) {
626
+ return { dockerTest: false };
611
627
  }
612
- if (typeof valueArg !== "boolean") {
613
- throw new Error("release.targets.docker.test must be true or false");
628
+ if (valueArg === true) {
629
+ return { dockerTest: true };
614
630
  }
615
- return valueArg;
631
+ if (valueArg === "native") {
632
+ return { dockerTest: false, dockerChecks: "native-platforms" };
633
+ }
634
+ throw new Error(
635
+ 'release.targets.docker.test must be true, false or "native"',
636
+ );
616
637
  };
617
638
 
618
639
  const resolveDockerConfiguration = (
@@ -694,7 +715,7 @@ const resolveDockerConfiguration = (
694
715
  dockerConfigArg.buildRegistries,
695
716
  "buildRegistries",
696
717
  ),
697
- dockerTest: resolveDockerTestSetting(dockerConfigArg.test),
718
+ ...resolveDockerTestSetting(dockerConfigArg.test),
698
719
  dockerPatterns: normalizeStringList(dockerConfigArg.patterns, "patterns"),
699
720
  dockerCached: dockerConfigArg.cached ?? false,
700
721
  dockerParallel: dockerConfigArg.parallel ?? false,
@@ -33,6 +33,7 @@ import {
33
33
  resolveNpmVerificationWindowMinutes,
34
34
  resolveNpmMaxPublishBytes,
35
35
  normalizeReleaseRegistryUrl,
36
+ resolveDockerTestSetting,
36
37
  } from "../helpers.workflow.js";
37
38
  import { resolvePackageFiles } from "../helpers.packagefiles.js";
38
39
  import { gitzoneProjectTypes } from "../classes.gitzoneconfig.js";
@@ -46,6 +47,7 @@ import { hasInstalledProjectTsdockerBinary } from "../helpers.tsdocker.js";
46
47
  import {
47
48
  TsdockerReleaseClient,
48
49
  type TReleaseAliasPolicy,
50
+ type TReleaseCapabilityOptions,
49
51
  } from "../mod_release/helpers.tsdockerprotocol.js";
50
52
  import {
51
53
  ReleaseVersionError,
@@ -979,11 +981,13 @@ async function handleRelease(mode: ICliMode): Promise<void> {
979
981
  ? currentTargets.docker.patterns.join(", ")
980
982
  : "",
981
983
  });
982
- const test = await ask({
983
- type: "confirm",
984
+ const test = await ask<string>({
985
+ type: "list",
984
986
  name: "dockerTest",
985
- message: "Run configured image tests before destination publication?",
986
- default: currentTargets.docker?.test ?? false,
987
+ message:
988
+ "Image tests before destination publication (true: Dockerfile test scripts, native: tSDocker native per-platform checks and scan gate):",
989
+ choices: stringChoices(["false", "true", "native"]),
990
+ default: String(currentTargets.docker?.test ?? false),
987
991
  });
988
992
  const cached = await ask({
989
993
  type: "confirm",
@@ -1008,7 +1012,7 @@ async function handleRelease(mode: ICliMode): Promise<void> {
1008
1012
  engine: "tsdocker",
1009
1013
  registry: registry.trim() || undefined,
1010
1014
  buildRegistries: parseCsv(buildRegistries),
1011
- test,
1015
+ test: test === "native" ? "native" : test === "true",
1012
1016
  patterns: parseCsv(patterns),
1013
1017
  cached,
1014
1018
  parallel: parseDockerParallel(parallel),
@@ -2821,14 +2825,16 @@ async function validateDockerTarget(
2821
2825
  });
2822
2826
  }
2823
2827
 
2824
- if (
2825
- dockerTarget.test !== undefined &&
2826
- typeof dockerTarget.test !== "boolean"
2827
- ) {
2828
+ let dockerChecks: TReleaseCapabilityOptions["checks"];
2829
+ let dockerTestValid = true;
2830
+ try {
2831
+ dockerChecks = resolveDockerTestSetting(dockerTarget.test).dockerChecks;
2832
+ } catch {
2833
+ dockerTestValid = false;
2828
2834
  findings.push({
2829
2835
  level: "error",
2830
2836
  message: `Invalid tsdocker image test setting: ${formatValue(dockerTarget.test)}`,
2831
- fix: "Set release.targets.docker.test to true or false, or remove it.",
2837
+ fix: 'Set release.targets.docker.test to true, false or "native", or remove it.',
2832
2838
  });
2833
2839
  }
2834
2840
 
@@ -2850,13 +2856,21 @@ async function validateDockerTarget(
2850
2856
  });
2851
2857
  } else {
2852
2858
  validateTsdockerProjectConfig(tsdockerConfig, findings);
2859
+ if (dockerTestValid) {
2860
+ validateTsdockerImageChecksSelection(
2861
+ tsdockerConfig,
2862
+ dockerTarget.test,
2863
+ dockerChecks,
2864
+ findings,
2865
+ );
2866
+ }
2853
2867
  }
2854
2868
 
2855
2869
  await validateTsdockerCommand(
2856
2870
  findings,
2857
2871
  dockerTarget.buildRegistries,
2858
2872
  dockerTarget.test === true,
2859
- aliasPolicyArg,
2873
+ { aliasPolicy: aliasPolicyArg, checks: dockerChecks },
2860
2874
  );
2861
2875
 
2862
2876
  findings.push({
@@ -2941,11 +2955,45 @@ function validateTsdockerProjectConfig(
2941
2955
  });
2942
2956
  }
2943
2957
 
2958
+ /**
2959
+ * tSDocker refuses native checks without `imageChecks` and `imageChecks`
2960
+ * without native checks; the doctor names the half that is missing. The
2961
+ * contents of `imageChecks` are tSDocker's to validate.
2962
+ */
2963
+ function validateTsdockerImageChecksSelection(
2964
+ tsdockerConfig: Record<string, any>,
2965
+ testSettingArg: unknown,
2966
+ checksArg: TReleaseCapabilityOptions["checks"],
2967
+ findings: IDoctorFinding[],
2968
+ ): void {
2969
+ const declared = tsdockerConfig.imageChecks !== undefined;
2970
+ if (checksArg && !declared) {
2971
+ findings.push({
2972
+ level: "error",
2973
+ message:
2974
+ 'release.targets.docker.test "native" requires @git.zone/tsdocker.imageChecks',
2975
+ fix: "Declare the native check suites and the pinned scanner under @git.zone/tsdocker.imageChecks (see the tSDocker readme, Native Platform Checks).",
2976
+ });
2977
+ } else if (!checksArg && declared) {
2978
+ findings.push({
2979
+ level: "error",
2980
+ message: `@git.zone/tsdocker.imageChecks requires release.targets.docker.test "native", but it is ${formatValue(testSettingArg)}`,
2981
+ fix: 'Set release.targets.docker.test to "native", or remove @git.zone/tsdocker.imageChecks.',
2982
+ });
2983
+ } else if (checksArg) {
2984
+ findings.push({
2985
+ level: "ok",
2986
+ message:
2987
+ "Docker release qualification runs tSDocker's native per-platform checks and scan gate (@git.zone/tsdocker.imageChecks)",
2988
+ });
2989
+ }
2990
+ }
2991
+
2944
2992
  async function validateTsdockerCommand(
2945
2993
  findings: IDoctorFinding[],
2946
2994
  _buildRegistriesArg: unknown,
2947
2995
  _imageTestsRequestedArg: boolean,
2948
- aliasPolicyArg: TReleaseAliasPolicy | undefined,
2996
+ capabilityOptionsArg: TReleaseCapabilityOptions,
2949
2997
  ): Promise<void> {
2950
2998
  let packageJson: unknown;
2951
2999
  try {
@@ -2981,12 +3029,21 @@ async function validateTsdockerCommand(
2981
3029
  await new TsdockerReleaseClient(
2982
3030
  smartshellInstance,
2983
3031
  process.cwd(),
2984
- ).assertCapabilities(aliasPolicyArg);
3032
+ ).assertCapabilities(capabilityOptionsArg);
3033
+ const required = [
3034
+ ...(capabilityOptionsArg.aliasPolicy
3035
+ ? [`alias policy ${capabilityOptionsArg.aliasPolicy}`]
3036
+ : []),
3037
+ ...(capabilityOptionsArg.checks
3038
+ ? [`${capabilityOptionsArg.checks} checks`]
3039
+ : []),
3040
+ ];
2985
3041
  findings.push({
2986
3042
  level: "ok",
2987
- message: aliasPolicyArg
2988
- ? `Project-local tSDocker release protocol v1 with alias policy ${aliasPolicyArg} is available`
2989
- : "Project-local tSDocker release protocol v1 is available",
3043
+ message:
3044
+ required.length > 0
3045
+ ? `Project-local tSDocker release protocol v1 with ${required.join(" and ")} is available`
3046
+ : "Project-local tSDocker release protocol v1 is available",
2990
3047
  });
2991
3048
  } catch (error) {
2992
3049
  findings.push({
@@ -82,6 +82,7 @@ import {
82
82
  assertReleasePromotionResult,
83
83
  assertReleaseQualificationResult,
84
84
  classifyReleasePromotionEvidence,
85
+ describeReleaseImageChecks,
85
86
  type ITsdockerReleaseClient,
86
87
  type IReleaseProbeResult,
87
88
  type TReleasePromotionEvidence,
@@ -2683,6 +2684,12 @@ export const executeReleasePublication = async (
2683
2684
  if (journal.schemaVersion === 2) {
2684
2685
  printReleasePhase("Docker qualification");
2685
2686
  journal = await executeDockerQualification(optionsArg, journal);
2687
+ if (journal.docker.qualification.result) {
2688
+ for (const line of describeReleaseImageChecks(
2689
+ journal.docker.qualification.result,
2690
+ ))
2691
+ console.log(line);
2692
+ }
2686
2693
  if (
2687
2694
  journal.docker.cleanup.state === "publishing" ||
2688
2695
  journal.docker.cleanup.state === "failed"
@@ -6,9 +6,11 @@ import type {
6
6
  IReleaseCapabilitiesResult,
7
7
  IReleaseCleanupResult,
8
8
  IReleaseDestinationEvidence,
9
+ IReleaseImageChecksEvidence,
9
10
  IReleaseProbeResult,
10
11
  IReleasePromotionContext,
11
12
  IReleasePromotionResult,
13
+ IReleaseQualificationOptions,
12
14
  IReleaseQualificationRequest,
13
15
  IReleaseQualificationResult,
14
16
  IReleaseValidationResult,
@@ -16,12 +18,14 @@ import type {
16
18
  TReleasePromotionEvidence,
17
19
  TReleaseProtocolCommand,
18
20
  TReleaseProtocolFeature,
21
+ TReleaseQualificationChecks,
19
22
  } from "./mod.plugins.js";
20
23
 
21
24
  export type {
22
25
  IReleaseCapabilitiesResult,
23
26
  IReleaseCleanupResult,
24
27
  IReleaseDestinationEvidence,
28
+ IReleaseImageChecksEvidence,
25
29
  IReleaseProbeResult,
26
30
  IReleasePromotionContext,
27
31
  IReleasePromotionResult,
@@ -31,6 +35,7 @@ export type {
31
35
  TReleaseAliasPolicy,
32
36
  TReleasePromotionEvidence,
33
37
  TReleaseProtocolCommand,
38
+ TReleaseQualificationChecks,
34
39
  } from "./mod.plugins.js";
35
40
 
36
41
  export const assertReleaseCleanupResult =
@@ -73,22 +78,81 @@ const aliasPolicyFeatures: Record<
73
78
  TReleaseAliasPolicy,
74
79
  TReleaseProtocolFeature
75
80
  > = { "release-version": "release-version-alias-policy" };
76
- const policyFeatures = new Set(Object.values(aliasPolicyFeatures));
81
+
82
+ /** The capability a tSDocker that runs each kind of checks advertises. */
83
+ const checksFeatures: Record<
84
+ TReleaseQualificationChecks,
85
+ TReleaseProtocolFeature
86
+ > = { "native-platforms": "native-platform-checks" };
87
+
88
+ /** The first tSDocker release that advertises each kind of checks. */
89
+ const checksMinimumVersions: Record<TReleaseQualificationChecks, string> = {
90
+ "native-platforms": "3.14.0",
91
+ };
92
+
93
+ const optionalFeatures = new Set<TReleaseProtocolFeature>([
94
+ ...Object.values(aliasPolicyFeatures),
95
+ ...Object.values(checksFeatures),
96
+ ]);
97
+
98
+ /**
99
+ * The request options a release needs tSDocker capabilities for. Both are
100
+ * absent unless the release sets them, exactly as in the request.
101
+ */
102
+ export type TReleaseCapabilityOptions = Pick<
103
+ IReleaseQualificationOptions,
104
+ "aliasPolicy" | "checks"
105
+ >;
77
106
 
78
107
  /**
79
- * Every current protocol feature except those of alias policies, plus the one
80
- * of the requested policy: a release without a policy keeps working with a
81
- * tSDocker that predates them, and one with a policy never runs without it.
108
+ * Every current protocol feature except the optional ones of alias policies
109
+ * and checks, plus the one of the requested policy: a release without a policy
110
+ * or checks keeps working with a tSDocker that predates them, and one with a
111
+ * policy never runs without it. The checks feature is asserted on its own, so
112
+ * its refusal can name the tSDocker release that brings it.
82
113
  */
83
114
  const getRequiredReleaseFeatures = (
84
115
  aliasPolicyArg: TReleaseAliasPolicy | undefined,
85
116
  ): TReleaseProtocolFeature[] => [
86
117
  ...plugins.tsdockerReleaseProtocol.releaseProtocolFeatures.filter(
87
- (featureArg) => !policyFeatures.has(featureArg),
118
+ (featureArg) => !optionalFeatures.has(featureArg),
88
119
  ),
89
120
  ...(aliasPolicyArg ? [aliasPolicyFeatures[aliasPolicyArg]] : []),
90
121
  ];
91
122
 
123
+ /**
124
+ * The plan and summary lines of one qualification's checks evidence: per
125
+ * image, every platform's executor and architectures, every suite, and the
126
+ * scan counts. A result without checks has none.
127
+ */
128
+ export const describeReleaseImageChecks = (
129
+ resultArg: IReleaseQualificationResult,
130
+ ): string[] =>
131
+ resultArg.images.flatMap((imageArg) =>
132
+ imageArg.checks
133
+ ? describeImageChecksEvidence(imageArg.imageId, imageArg.checks)
134
+ : [],
135
+ );
136
+
137
+ const scanSeverities = ["CRITICAL", "HIGH", "MEDIUM", "LOW", "UNKNOWN"] as const;
138
+
139
+ const describeImageChecksEvidence = (
140
+ imageIdArg: string,
141
+ checksArg: IReleaseImageChecksEvidence,
142
+ ): string[] => [
143
+ ...checksArg.platforms.map(
144
+ (platformArg) =>
145
+ `docker native check ${imageIdArg} ${platformArg.platform}: ${platformArg.executor} (daemon ${platformArg.daemonArchitecture}, image ${platformArg.imageArchitecture}, ${platformArg.manifestDigest})`,
146
+ ),
147
+ ...checksArg.suites.map(
148
+ (suiteArg) =>
149
+ `docker check suite ${imageIdArg} ${suiteArg.name}: passed in ${suiteArg.durationMs} ms over ${checksArg.platforms.length} platform${checksArg.platforms.length === 1 ? "" : "s"}`,
150
+ ),
151
+ `docker scan ${imageIdArg}: ${scanSeverities
152
+ .map((severityArg) => `${severityArg} ${checksArg.scan.counts[severityArg]}`)
153
+ .join(", ")} (scanner ${checksArg.scan.scannerDigest}, database ${checksArg.scan.db.digest} updated ${checksArg.scan.db.updatedAt}, scanned ${checksArg.scan.scannedAt})`,
154
+ ];
155
+
92
156
  const commandTimeouts: Record<TReleaseProtocolCommand, number> = {
93
157
  "release-capabilities": 30_000,
94
158
  "release-validate": 2 * 60_000,
@@ -132,7 +196,7 @@ export class TsdockerReleaseRequestCleanupError extends Error {
132
196
 
133
197
  export interface ITsdockerReleaseClient {
134
198
  assertCapabilities: (
135
- aliasPolicyArg?: TReleaseAliasPolicy,
199
+ optionsArg?: TReleaseCapabilityOptions,
136
200
  ) => Promise<IReleaseCapabilitiesResult>;
137
201
  validate: (
138
202
  requestArg: IReleaseQualificationRequest,
@@ -291,7 +355,7 @@ export class TsdockerReleaseClient implements ITsdockerReleaseClient {
291
355
  }
292
356
 
293
357
  public async assertCapabilities(
294
- aliasPolicyArg?: TReleaseAliasPolicy,
358
+ optionsArg: TReleaseCapabilityOptions = {},
295
359
  ): Promise<IReleaseCapabilitiesResult> {
296
360
  const installedVersion = await this.readInstalledVersion();
297
361
  await plugins.fs.access(this.binaryPath);
@@ -326,16 +390,26 @@ export class TsdockerReleaseClient implements ITsdockerReleaseClient {
326
390
  }
327
391
 
328
392
  const parsed = await this.run("release-capabilities");
329
- return plugins.tsdockerReleaseProtocol.assertReleaseCapabilitiesResult(
330
- parsed,
331
- this.cwd,
332
- {
333
- requiredCommands: [
334
- ...plugins.tsdockerReleaseProtocol.releaseProtocolCommands,
335
- ],
336
- requiredFeatures: getRequiredReleaseFeatures(aliasPolicyArg),
337
- },
338
- );
393
+ const capabilities =
394
+ plugins.tsdockerReleaseProtocol.assertReleaseCapabilitiesResult(
395
+ parsed,
396
+ this.cwd,
397
+ {
398
+ requiredCommands: [
399
+ ...plugins.tsdockerReleaseProtocol.releaseProtocolCommands,
400
+ ],
401
+ requiredFeatures: getRequiredReleaseFeatures(optionsArg.aliasPolicy),
402
+ },
403
+ );
404
+ if (
405
+ optionsArg.checks !== undefined &&
406
+ !capabilities.features.includes(checksFeatures[optionsArg.checks])
407
+ ) {
408
+ throw new Error(
409
+ `release.targets.docker.test "native" requires project-local @git.zone/tsdocker >= ${checksMinimumVersions[optionsArg.checks]}, which advertises the ${checksFeatures[optionsArg.checks]} capability; the installed tSDocker ${installedVersion} does not.`,
410
+ );
411
+ }
412
+ return capabilities;
339
413
  }
340
414
 
341
415
  public async validate(