@git.zone/cli 12.0.0 → 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.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/helpers.workflow.d.ts +16 -3
- package/dist_ts/helpers.workflow.js +16 -7
- package/dist_ts/mod_config/index.js +59 -14
- package/dist_ts/mod_release/helpers.releasepublication.js +6 -2
- package/dist_ts/mod_release/helpers.tsdockerprotocol.d.ts +15 -4
- package/dist_ts/mod_release/helpers.tsdockerprotocol.js +41 -9
- package/dist_ts/mod_release/index.d.ts +6 -1
- package/dist_ts/mod_release/index.js +77 -21
- package/dist_ts/mod_services/classes.nosqldbengine.d.ts +112 -0
- package/dist_ts/mod_services/classes.nosqldbengine.js +249 -0
- package/dist_ts/mod_services/classes.servicedatamarker.d.ts +5 -0
- package/dist_ts/mod_services/classes.servicedatamarker.js +14 -8
- package/dist_ts/mod_services/classes.servicemanager.d.ts +30 -1
- package/dist_ts/mod_services/classes.servicemanager.js +125 -10
- package/dist_ts/mod_services/index.d.ts +6 -0
- package/dist_ts/mod_services/index.js +44 -1
- package/dist_ts/plugins.d.ts +1 -1
- package/dist_ts/plugins.js +1 -1
- package/package.json +2 -2
- package/readme.md +88 -12
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/helpers.workflow.ts +29 -8
- package/ts/mod_config/index.ts +73 -16
- package/ts/mod_release/helpers.releasepublication.ts +7 -0
- package/ts/mod_release/helpers.tsdockerprotocol.ts +91 -17
- package/ts/mod_release/index.ts +99 -28
- package/ts/mod_services/classes.nosqldbengine.ts +378 -0
- package/ts/mod_services/classes.servicedatamarker.ts +24 -9
- package/ts/mod_services/classes.servicemanager.ts +178 -10
- package/ts/mod_services/index.ts +59 -0
- package/ts/plugins.ts +3 -0
package/ts/mod_config/index.ts
CHANGED
|
@@ -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: "
|
|
984
|
+
const test = await ask<string>({
|
|
985
|
+
type: "list",
|
|
984
986
|
name: "dockerTest",
|
|
985
|
-
message:
|
|
986
|
-
|
|
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
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
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:
|
|
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
|
-
|
|
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(
|
|
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:
|
|
2988
|
-
|
|
2989
|
-
|
|
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
|
-
|
|
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
|
|
80
|
-
* of the requested policy: a release without a policy
|
|
81
|
-
* tSDocker that predates them, and one with a
|
|
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) => !
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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(
|
package/ts/mod_release/index.ts
CHANGED
|
@@ -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
|
-
|
|
814
|
-
|
|
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 =
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
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(
|
|
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
|
-
|
|
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(
|