@git.zone/cli 12.0.1 → 12.1.1

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.
@@ -21,6 +21,7 @@ import {
21
21
  assertGiteaAssetsGitDestination,
22
22
  type IResolvedReleaseResumeConfiguration,
23
23
  type IResolvedReleaseWorkflow,
24
+ type TResolvedReleaseDockerConfiguration,
24
25
  } from "../helpers.workflow.js";
25
26
  import type * as commitHelpers from "../mod_commit/mod.helpers.js";
26
27
  import type { IVersionSource } from "../helpers.versionsource.js";
@@ -143,10 +144,12 @@ import {
143
144
  TsdockerReleaseCommandError,
144
145
  canonicalReleaseJson,
145
146
  createReleaseQualificationRequest,
147
+ describeReleaseImageChecks,
146
148
  type ITsdockerReleaseClient,
147
149
  type IReleaseQualificationRequest,
148
150
  type IReleaseValidationResult,
149
151
  } from "./helpers.tsdockerprotocol.js";
152
+ import { readSmartconfigFile } from "../helpers.smartconfig.js";
150
153
  import {
151
154
  assertResolvedCurrentVersion,
152
155
  isSameReleasePrerelease,
@@ -665,9 +668,10 @@ const assertFreshReleaseCapabilities = async (
665
668
  if (!tsdockerArg) {
666
669
  throw new Error("Docker release target requires project-local tSDocker.");
667
670
  }
668
- await tsdockerArg.assertCapabilities(
669
- getReleaseDockerAliasPolicy(workflowArg.line),
670
- );
671
+ await tsdockerArg.assertCapabilities({
672
+ aliasPolicy: getReleaseDockerAliasPolicy(workflowArg.line),
673
+ checks: workflowArg.dockerChecks,
674
+ });
671
675
  }
672
676
  if (workflowArg.targets.includes("git") && !pushUrlArg) {
673
677
  throw new Error(
@@ -810,8 +814,13 @@ interface ICreateReleaseJournalOptions {
810
814
  ensurePublicationState: (expectedRemoteMainOidArg?: string) => Promise<void>;
811
815
  }
812
816
 
813
- const createDockerQualificationRequest = (
814
- workflowArg: IResolvedReleaseWorkflow,
817
+ /**
818
+ * The qualification request of a release, built the same way for a fresh
819
+ * release and for the resume that compares it with its journal.
820
+ */
821
+ export const createDockerQualificationRequest = (
822
+ workflowArg: Pick<IResolvedReleaseWorkflow, "line"> &
823
+ TResolvedReleaseDockerConfiguration,
815
824
  cwdArg: string,
816
825
  versionArg: string,
817
826
  revisionArg: string,
@@ -820,6 +829,7 @@ const createDockerQualificationRequest = (
820
829
  aliasPolicy: getReleaseDockerAliasPolicy(workflowArg.line),
821
830
  buildRegistries: workflowArg.dockerBuildRegistries,
822
831
  cached: workflowArg.dockerCached,
832
+ checks: workflowArg.dockerChecks,
823
833
  context: workflowArg.dockerContext,
824
834
  cwd: cwdArg,
825
835
  parallel: workflowArg.dockerParallel,
@@ -966,9 +976,10 @@ const prepareTaggedRelease = async (
966
976
  const tsdocker = workflow.targets.includes("docker")
967
977
  ? new TsdockerReleaseClient(smartshell, releaseCwd)
968
978
  : undefined;
969
- await tsdocker?.assertCapabilities(
970
- getReleaseDockerAliasPolicy(workflow.line),
971
- );
979
+ await tsdocker?.assertCapabilities({
980
+ aliasPolicy: getReleaseDockerAliasPolicy(workflow.line),
981
+ checks: workflow.dockerChecks,
982
+ });
972
983
  const cargoEngine = workflow.cargo
973
984
  ? await openCargoReleaseEngine(smartshell, releaseCwd)
974
985
  : undefined;
@@ -2015,19 +2026,12 @@ const runReleaseResumeFromStore = async (optionsArg: {
2015
2026
  "Journaled Docker qualification always builds; release.targets.docker.noBuild must be false or absent.",
2016
2027
  );
2017
2028
  }
2018
- const currentRequest = createReleaseQualificationRequest({
2019
- aliasPolicy: getReleaseDockerAliasPolicy(resumeConfiguration.line),
2020
- buildRegistries: dockerConfiguration.dockerBuildRegistries,
2021
- cached: dockerConfiguration.dockerCached,
2022
- context: dockerConfiguration.dockerContext,
2023
- cwd: paths.cwd,
2024
- parallel: dockerConfiguration.dockerParallel,
2025
- patterns: dockerConfiguration.dockerPatterns,
2026
- registry: dockerConfiguration.dockerRegistry,
2027
- revision: journal.release.mainOid,
2028
- test: dockerConfiguration.dockerTest,
2029
- version: journal.release.version,
2030
- });
2029
+ const currentRequest = createDockerQualificationRequest(
2030
+ { ...dockerConfiguration, line: resumeConfiguration.line },
2031
+ paths.cwd,
2032
+ journal.release.version,
2033
+ journal.release.mainOid,
2034
+ );
2031
2035
  if (
2032
2036
  canonicalReleaseJson(currentRequest) !==
2033
2037
  canonicalReleaseJson(journal.docker.request)
@@ -2037,9 +2041,7 @@ const runReleaseResumeFromStore = async (optionsArg: {
2037
2041
  );
2038
2042
  }
2039
2043
  tsdocker = new TsdockerReleaseClient(smartshellInstance, paths.cwd);
2040
- await tsdocker.assertCapabilities(
2041
- journal.docker.request.options.aliasPolicy,
2042
- );
2044
+ await tsdocker.assertCapabilities(journal.docker.request.options);
2043
2045
  await tsdocker.validate(journal.docker.request);
2044
2046
  }
2045
2047
  let pnpmCapability: IPnpmReleaseCapability | undefined;
@@ -2322,6 +2324,17 @@ const printReleaseJournalSummary = (journalArg: TReleaseJournal): void => {
2322
2324
  console.log(
2323
2325
  `docker qualification ${journalArg.docker.request.candidateId}: ${journalArg.docker.qualification.state}`,
2324
2326
  );
2327
+ if (journalArg.docker.request.options.checks) {
2328
+ console.log(
2329
+ `docker checks: ${journalArg.docker.request.options.checks}`,
2330
+ );
2331
+ }
2332
+ if (journalArg.docker.qualification.result) {
2333
+ for (const line of describeReleaseImageChecks(
2334
+ journalArg.docker.qualification.result,
2335
+ ))
2336
+ console.log(line);
2337
+ }
2325
2338
  for (const promotion of journalArg.docker.promotions) {
2326
2339
  console.log(
2327
2340
  `docker promotion ${promotion.promotionId}: ${promotion.state}`,
@@ -2845,7 +2858,10 @@ const describeReleaseLineDockerImages = async (
2845
2858
  smartshellArg,
2846
2859
  branchContextArg.sourceCwd,
2847
2860
  );
2848
- await tsdocker.assertCapabilities(aliasPolicy);
2861
+ await tsdocker.assertCapabilities({
2862
+ aliasPolicy,
2863
+ checks: workflowArg.dockerChecks,
2864
+ });
2849
2865
  let validation: IReleaseValidationResult;
2850
2866
  try {
2851
2867
  validation = await tsdocker.validate(
@@ -2962,9 +2978,13 @@ async function printReleasePlan(
2962
2978
  console.log(
2963
2979
  `docker build authentication: ${workflow.dockerBuildRegistries.length > 0 ? workflow.dockerBuildRegistries.join(", ") : "all configured registries"}`,
2964
2980
  );
2965
- console.log(
2966
- `docker image tests: ${workflow.dockerTest ? "required before destination publication" : "not requested"}`,
2967
- );
2981
+ console.log(`docker image tests: ${describeDockerImageTests(workflow)}`);
2982
+ if (workflow.dockerChecks) {
2983
+ for (const line of await describeDockerNativeChecksPlan(
2984
+ branchContextArg.sourceCwd,
2985
+ ))
2986
+ console.log(line);
2987
+ }
2968
2988
  console.log(
2969
2989
  `docker patterns: ${workflow.dockerPatterns.length > 0 ? workflow.dockerPatterns.join(", ") : "all Dockerfiles"}`,
2970
2990
  );
@@ -2980,6 +3000,56 @@ async function printReleasePlan(
2980
3000
  console.log("");
2981
3001
  }
2982
3002
 
3003
+ function describeDockerImageTests(workflow: IResolvedReleaseWorkflow): string {
3004
+ if (workflow.dockerChecks)
3005
+ return "native per-platform checks and scan gate (tSDocker native-platform-checks) required before destination publication";
3006
+ return workflow.dockerTest
3007
+ ? "required before destination publication"
3008
+ : "not requested";
3009
+ }
3010
+
3011
+ /**
3012
+ * What the plan knows of native checks before tSDocker runs: the platforms
3013
+ * and suites the project configures under `@git.zone/tsdocker`. tSDocker
3014
+ * picks each platform's daemon by its own rule and names it in the evidence;
3015
+ * the plan does not resolve it.
3016
+ */
3017
+ async function describeDockerNativeChecksPlan(
3018
+ cwdArg: string,
3019
+ ): Promise<string[]> {
3020
+ const tsdockerConfig: unknown = (await readSmartconfigFile(cwdArg))[
3021
+ "@git.zone/tsdocker"
3022
+ ];
3023
+ const config =
3024
+ typeof tsdockerConfig === "object" &&
3025
+ tsdockerConfig !== null &&
3026
+ !Array.isArray(tsdockerConfig)
3027
+ ? (tsdockerConfig as Record<string, unknown>)
3028
+ : {};
3029
+ const platforms = Array.isArray(config.platforms)
3030
+ ? config.platforms.map(String)
3031
+ : [];
3032
+ const imageChecks =
3033
+ typeof config.imageChecks === "object" &&
3034
+ config.imageChecks !== null &&
3035
+ !Array.isArray(config.imageChecks)
3036
+ ? (config.imageChecks as Record<string, unknown>)
3037
+ : undefined;
3038
+ const suites = Array.isArray(imageChecks?.suites)
3039
+ ? imageChecks.suites.map((suiteArg: unknown) =>
3040
+ typeof suiteArg === "object" && suiteArg !== null
3041
+ ? String((suiteArg as Record<string, unknown>).name)
3042
+ : String(suiteArg),
3043
+ )
3044
+ : [];
3045
+ return [
3046
+ `docker native check platforms: ${platforms.length > 0 ? platforms.join(", ") : "tSDocker's default"} (each on a daemon of its own architecture: the local daemon for the host's, a configured tSDocker remote builder for another; tSDocker refuses a platform without one and names each executor in the qualification evidence)`,
3047
+ imageChecks
3048
+ ? `docker check suites: ${suites.length > 0 ? suites.join(", ") : "none"}; scan gate: CRITICAL and HIGH findings fail qualification`
3049
+ : "docker check suites: none, @git.zone/tsdocker.imageChecks is missing and tSDocker refuses native checks without it",
3050
+ ];
3051
+ }
3052
+
2983
3053
  function formatDockerOptions(workflow: IResolvedReleaseWorkflow): string {
2984
3054
  const options: string[] = [];
2985
3055
  if (workflow.dockerRegistry)
@@ -2988,6 +3058,7 @@ function formatDockerOptions(workflow: IResolvedReleaseWorkflow): string {
2988
3058
  options.push(`buildRegistries=${workflow.dockerBuildRegistries.join(",")}`);
2989
3059
  }
2990
3060
  if (workflow.dockerTest) options.push("test");
3061
+ if (workflow.dockerChecks) options.push(`checks=${workflow.dockerChecks}`);
2991
3062
  if (workflow.dockerCached) options.push("cached");
2992
3063
  if (workflow.dockerParallel)
2993
3064
  options.push(
package/ts/plugins.ts CHANGED
@@ -33,9 +33,11 @@ export type {
33
33
  IReleaseCapabilitiesResult,
34
34
  IReleaseCleanupResult,
35
35
  IReleaseDestinationEvidence,
36
+ IReleaseImageChecksEvidence,
36
37
  IReleaseProbeResult,
37
38
  IReleasePromotionContext,
38
39
  IReleasePromotionResult,
40
+ IReleaseQualificationOptions,
39
41
  IReleaseQualificationRequest,
40
42
  IReleaseQualificationResult,
41
43
  IReleaseValidationResult,
@@ -43,6 +45,7 @@ export type {
43
45
  TReleasePromotionEvidence,
44
46
  TReleaseProtocolCommand,
45
47
  TReleaseProtocolFeature,
48
+ TReleaseQualificationChecks,
46
49
  } from '@git.zone/tsdocker/dist_ts/interfaces/index.js';
47
50
 
48
51
  // Create smartfs instance for filesystem operations