@numa-tech/numa 1.14.28 → 1.14.30
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/README.md +35 -201
- package/dist/application-onboarding/client.d.ts +3 -17
- package/dist/application-onboarding/client.js +1 -14
- package/dist/application-onboarding/client.js.map +1 -1
- package/dist/application-onboarding/commands.d.ts +0 -2
- package/dist/application-onboarding/commands.js +5 -76
- package/dist/application-onboarding/commands.js.map +1 -1
- package/dist/application-onboarding/schemas.d.ts +28 -301
- package/dist/application-onboarding/schemas.js +13 -91
- package/dist/application-onboarding/schemas.js.map +1 -1
- package/dist/cli.js +0 -2
- package/dist/cli.js.map +1 -1
- package/dist/command-catalog.js +6 -336
- package/dist/command-catalog.js.map +1 -1
- package/dist/gitops/client.d.ts +0 -38
- package/dist/gitops/client.js +1 -9
- package/dist/gitops/client.js.map +1 -1
- package/dist/gitops/commands.js +1 -20
- package/dist/gitops/commands.js.map +1 -1
- package/dist/gitops/schemas.d.ts +0 -112
- package/dist/gitops/schemas.js +0 -38
- package/dist/gitops/schemas.js.map +1 -1
- package/dist/jenkins/commands.d.ts +0 -4
- package/dist/jenkins/commands.js +0 -10
- package/dist/jenkins/commands.js.map +1 -1
- package/dist/jenkins-jobs/commands.d.ts +0 -2
- package/dist/jenkins-jobs/commands.js +0 -2
- package/dist/jenkins-jobs/commands.js.map +1 -1
- package/dist/pipeline/commands.js +0 -2
- package/dist/pipeline/commands.js.map +1 -1
- package/dist/platform-profile.d.ts +2 -0
- package/dist/platform-profile.js +2 -1
- package/dist/platform-profile.js.map +1 -1
- package/package.json +4 -4
- package/skills/numa-create-application/SKILL.md +30 -163
- package/skills/numa-create-application/agents/openai.yaml +2 -2
- package/skills/numa-create-application/evals/evals.json +9 -150
- package/skills/numa-create-application/references/checklist.md +22 -139
- package/skills/numa-create-application/references/numa-cli.md +27 -257
- package/skills/numa-create-application/references/promote-workflows.md +22 -188
- package/skills/numa-create-application/scripts/inspect-project.mjs +1 -1
- package/skills/numa-jenkins-deployment/SKILL.md +21 -132
- package/skills/numa-jenkins-deployment/agents/openai.yaml +2 -2
- package/skills/numa-jenkins-deployment/evals/evals.json +9 -59
- package/skills/numa-jenkins-deployment/references/cli-contract.md +22 -101
- package/skills/numa-jenkins-deployment/references/diagnostics.md +2 -2
- package/skills/numa-jenkins-deployment/references/release-policy.md +19 -85
- package/skills/numa-local-flux-deploy/SKILL.md +1 -1
- package/skills/numa-local-flux-deploy/references/local-flux-release.md +1 -1
- package/dist/integration-bootstrap/client.d.ts +0 -61
- package/dist/integration-bootstrap/client.js +0 -293
- package/dist/integration-bootstrap/client.js.map +0 -1
- package/dist/integration-bootstrap/commands.d.ts +0 -86
- package/dist/integration-bootstrap/commands.js +0 -615
- package/dist/integration-bootstrap/commands.js.map +0 -1
- package/dist/integration-bootstrap/schemas.d.ts +0 -831
- package/dist/integration-bootstrap/schemas.js +0 -565
- package/dist/integration-bootstrap/schemas.js.map +0 -1
- package/dist/jenkins-gitops-rollouts/client.d.ts +0 -197
- package/dist/jenkins-gitops-rollouts/client.js +0 -126
- package/dist/jenkins-gitops-rollouts/client.js.map +0 -1
- package/dist/jenkins-gitops-rollouts/commands.d.ts +0 -50
- package/dist/jenkins-gitops-rollouts/commands.js +0 -358
- package/dist/jenkins-gitops-rollouts/commands.js.map +0 -1
- package/dist/jenkins-gitops-rollouts/schemas.d.ts +0 -217
- package/dist/jenkins-gitops-rollouts/schemas.js +0 -131
- package/dist/jenkins-gitops-rollouts/schemas.js.map +0 -1
- package/dist/platform-build-job-replans/client.d.ts +0 -291
- package/dist/platform-build-job-replans/client.js +0 -148
- package/dist/platform-build-job-replans/client.js.map +0 -1
- package/dist/platform-build-job-replans/commands.d.ts +0 -6
- package/dist/platform-build-job-replans/commands.js +0 -373
- package/dist/platform-build-job-replans/commands.js.map +0 -1
- package/dist/platform-build-job-replans/schemas.d.ts +0 -147
- package/dist/platform-build-job-replans/schemas.js +0 -151
- package/dist/platform-build-job-replans/schemas.js.map +0 -1
- package/dist/platform-build-rollouts/client.d.ts +0 -346
- package/dist/platform-build-rollouts/client.js +0 -153
- package/dist/platform-build-rollouts/client.js.map +0 -1
- package/dist/platform-build-rollouts/commands.d.ts +0 -98
- package/dist/platform-build-rollouts/commands.js +0 -465
- package/dist/platform-build-rollouts/commands.js.map +0 -1
- package/dist/platform-build-rollouts/schemas.d.ts +0 -348
- package/dist/platform-build-rollouts/schemas.js +0 -257
- package/dist/platform-build-rollouts/schemas.js.map +0 -1
- package/dist/platform-builds/client.d.ts +0 -147
- package/dist/platform-builds/client.js +0 -115
- package/dist/platform-builds/client.js.map +0 -1
- package/dist/platform-builds/commands.d.ts +0 -7
- package/dist/platform-builds/commands.js +0 -226
- package/dist/platform-builds/commands.js.map +0 -1
- package/dist/platform-builds/schemas.d.ts +0 -127
- package/dist/platform-builds/schemas.js +0 -66
- package/dist/platform-builds/schemas.js.map +0 -1
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
const NonEmpty = z.string().trim().min(1);
|
|
3
|
-
const OptionalString = NonEmpty.nullable();
|
|
4
|
-
const Sha256 = z.string().regex(/^[0-9a-f]{64}$/u);
|
|
5
|
-
const ApplicationCode = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/u);
|
|
6
|
-
const InstanceCode = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/u);
|
|
7
|
-
const SafeKey = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:/+-]{0,199}$/u);
|
|
8
|
-
export const PLATFORM_BUILD_JOB_POLICY = "jenkins-job-plan/v2";
|
|
9
|
-
export const PlatformBuildJobTierSchema = z.enum([
|
|
10
|
-
"DEVELOP", "STAGING", "PRODUCTION", "UNKNOWN"
|
|
11
|
-
]);
|
|
12
|
-
export const PlatformBuildJobPlanRequestSchema = z.object({
|
|
13
|
-
applicationCode: ApplicationCode,
|
|
14
|
-
instanceCode: InstanceCode,
|
|
15
|
-
tier: PlatformBuildJobTierSchema,
|
|
16
|
-
clientRequestId: SafeKey,
|
|
17
|
-
idempotencyKey: SafeKey
|
|
18
|
-
}).strict();
|
|
19
|
-
export const PlatformBuildJobApplyRequestSchema = z.object({
|
|
20
|
-
planNo: NonEmpty,
|
|
21
|
-
planHash: Sha256,
|
|
22
|
-
clientRequestId: SafeKey,
|
|
23
|
-
idempotencyKey: SafeKey
|
|
24
|
-
}).strict();
|
|
25
|
-
export const PlatformBuildJobActionRequestSchema = z.object({
|
|
26
|
-
idempotencyKey: SafeKey
|
|
27
|
-
}).strict();
|
|
28
|
-
const PlatformBuildJobPlanObjectSchema = z.object({
|
|
29
|
-
planNo: NonEmpty,
|
|
30
|
-
operation: z.literal("USE_EXISTING"),
|
|
31
|
-
scanMode: z.literal("INDEX_ONLY"),
|
|
32
|
-
state: z.enum(["READY", "BLOCKED", "CONSUMED", "EXPIRED"]),
|
|
33
|
-
planHash: Sha256,
|
|
34
|
-
policyVersion: z.literal(PLATFORM_BUILD_JOB_POLICY),
|
|
35
|
-
clientRequestId: SafeKey,
|
|
36
|
-
requestDigest: Sha256,
|
|
37
|
-
applicationCode: ApplicationCode,
|
|
38
|
-
instanceCode: InstanceCode,
|
|
39
|
-
canonicalJobId: z.number().int().positive(),
|
|
40
|
-
canonicalJobFullName: NonEmpty,
|
|
41
|
-
repositoryKey: NonEmpty,
|
|
42
|
-
tier: PlatformBuildJobTierSchema,
|
|
43
|
-
observedConfigDigest: Sha256,
|
|
44
|
-
sideEffects: z.array(NonEmpty).default([]),
|
|
45
|
-
warnings: z.array(NonEmpty).default([]),
|
|
46
|
-
blockers: z.array(NonEmpty).default([]),
|
|
47
|
-
expiresAt: NonEmpty
|
|
48
|
-
}).strict();
|
|
49
|
-
export const PlatformBuildJobPlanSchema = PlatformBuildJobPlanObjectSchema.superRefine((plan, context) => {
|
|
50
|
-
const blockerShape = plan.state === "BLOCKED"
|
|
51
|
-
? plan.blockers.length > 0
|
|
52
|
-
: plan.blockers.length === 0;
|
|
53
|
-
if (!blockerShape) {
|
|
54
|
-
context.addIssue({
|
|
55
|
-
code: "custom",
|
|
56
|
-
path: ["blockers"],
|
|
57
|
-
message: "Plan blockers do not match the immutable plan state"
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
export const PlatformBuildJobRunSchema = z.object({
|
|
62
|
-
runNo: NonEmpty,
|
|
63
|
-
planNo: NonEmpty,
|
|
64
|
-
clientRequestId: SafeKey,
|
|
65
|
-
requestDigest: Sha256,
|
|
66
|
-
state: z.enum(["ACCEPTED", "RUNNING", "SUCCEEDED", "UNKNOWN", "FAILED"]),
|
|
67
|
-
stepCode: NonEmpty,
|
|
68
|
-
canonicalJobId: z.number().int().positive(),
|
|
69
|
-
canonicalJobFullName: NonEmpty,
|
|
70
|
-
bindingId: z.number().int().positive(),
|
|
71
|
-
observedConfigDigest: Sha256.nullable(),
|
|
72
|
-
retryable: z.boolean(),
|
|
73
|
-
errorCode: OptionalString,
|
|
74
|
-
errorMessage: OptionalString,
|
|
75
|
-
acceptedAt: NonEmpty,
|
|
76
|
-
startedAt: OptionalString,
|
|
77
|
-
completedAt: OptionalString
|
|
78
|
-
}).strict();
|
|
79
|
-
const PlatformBuildJobReplanObjectSchema = z.object({
|
|
80
|
-
policyVersion: z.literal(PLATFORM_BUILD_JOB_POLICY),
|
|
81
|
-
plan: PlatformBuildJobPlanSchema,
|
|
82
|
-
run: PlatformBuildJobRunSchema
|
|
83
|
-
}).strict();
|
|
84
|
-
export const PlatformBuildJobReplanSchema = PlatformBuildJobReplanObjectSchema.superRefine((view, context) => {
|
|
85
|
-
const exactIdentity = view.plan.state === "CONSUMED"
|
|
86
|
-
&& view.plan.blockers.length === 0
|
|
87
|
-
&& view.run.planNo === view.plan.planNo
|
|
88
|
-
&& view.run.canonicalJobId === view.plan.canonicalJobId
|
|
89
|
-
&& view.run.canonicalJobFullName === view.plan.canonicalJobFullName
|
|
90
|
-
&& (view.run.observedConfigDigest == null
|
|
91
|
-
|| view.run.observedConfigDigest === view.plan.observedConfigDigest);
|
|
92
|
-
if (!exactIdentity) {
|
|
93
|
-
context.addIssue({
|
|
94
|
-
code: "custom",
|
|
95
|
-
path: ["run"],
|
|
96
|
-
message: "Replan run does not match its immutable plan"
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (view.run.state === "SUCCEEDED"
|
|
100
|
-
&& (view.run.observedConfigDigest !== view.plan.observedConfigDigest
|
|
101
|
-
|| view.run.startedAt == null || view.run.completedAt == null
|
|
102
|
-
|| view.run.errorCode != null || view.run.errorMessage != null
|
|
103
|
-
|| view.run.retryable)) {
|
|
104
|
-
context.addIssue({
|
|
105
|
-
code: "custom",
|
|
106
|
-
path: ["run"],
|
|
107
|
-
message: "Succeeded replan requires exact terminal configuration evidence"
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (view.run.state === "UNKNOWN"
|
|
111
|
-
&& (view.run.startedAt == null || view.run.errorCode == null
|
|
112
|
-
|| view.run.observedConfigDigest != null || !view.run.retryable
|
|
113
|
-
|| view.run.completedAt != null)) {
|
|
114
|
-
context.addIssue({
|
|
115
|
-
code: "custom",
|
|
116
|
-
path: ["run"],
|
|
117
|
-
message: "Unknown replan requires retryable non-terminal evidence"
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
if (view.run.state === "FAILED"
|
|
121
|
-
&& (view.run.startedAt == null || view.run.errorCode == null
|
|
122
|
-
|| view.run.completedAt == null || view.run.observedConfigDigest != null
|
|
123
|
-
|| view.run.retryable)) {
|
|
124
|
-
context.addIssue({
|
|
125
|
-
code: "custom",
|
|
126
|
-
path: ["run"],
|
|
127
|
-
message: "Failed replan requires terminal error evidence"
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
if (view.run.state === "ACCEPTED"
|
|
131
|
-
&& (view.run.startedAt != null || view.run.completedAt != null
|
|
132
|
-
|| view.run.observedConfigDigest != null || view.run.errorCode != null
|
|
133
|
-
|| view.run.errorMessage != null || view.run.retryable)) {
|
|
134
|
-
context.addIssue({
|
|
135
|
-
code: "custom",
|
|
136
|
-
path: ["run"],
|
|
137
|
-
message: "Accepted replan cannot carry execution or terminal evidence"
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
if (view.run.state === "RUNNING"
|
|
141
|
-
&& (view.run.startedAt == null || view.run.completedAt != null
|
|
142
|
-
|| view.run.observedConfigDigest != null || view.run.errorCode != null
|
|
143
|
-
|| view.run.errorMessage != null || view.run.retryable)) {
|
|
144
|
-
context.addIssue({
|
|
145
|
-
code: "custom",
|
|
146
|
-
path: ["run"],
|
|
147
|
-
message: "Running replan requires exact non-terminal execution evidence"
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/platform-build-job-replans/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC1C,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC3C,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACnD,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC/E,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;AAC5E,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,yBAAyB,GAAG,qBAA8B,CAAC;A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C,EAAE,CAAC;QAC9D,OAAO,CAAC,QAAQ,CAAC;YACf,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,KAAK,CAAC;YACb,OAAO,EAAE,+DAA+D;SACzE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC"}
|
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import type { AuthConfig } from "../config.js";
|
|
2
|
-
import { type KeycloakTokenProvider } from "../oauth.js";
|
|
3
|
-
import { type PlatformBuildRolloutApplyRequest, type PlatformBuildRolloutConfigureRequest, type PlatformBuildRolloutPlanRequest } from "./schemas.js";
|
|
4
|
-
export declare const PLATFORM_BUILD_ROLLOUT_API_ROOT = "/api/v1/admin/jenkins";
|
|
5
|
-
export interface PlatformBuildRolloutClientDependencies {
|
|
6
|
-
fetch?: typeof fetch;
|
|
7
|
-
tokenProvider?: KeycloakTokenProvider;
|
|
8
|
-
}
|
|
9
|
-
export declare class PlatformBuildRolloutClient {
|
|
10
|
-
private readonly config;
|
|
11
|
-
private readonly fetchImpl;
|
|
12
|
-
private readonly tokenProvider;
|
|
13
|
-
constructor(config: AuthConfig, dependencies?: PlatformBuildRolloutClientDependencies);
|
|
14
|
-
private authenticatedFetch;
|
|
15
|
-
private json;
|
|
16
|
-
createPlan(input: PlatformBuildRolloutPlanRequest, key: string): Promise<{
|
|
17
|
-
planNo: string;
|
|
18
|
-
operation: "DISABLE_PLATFORM" | "ENABLE_PLATFORM";
|
|
19
|
-
state: "BLOCKED" | "CONSUMED" | "EXPIRED" | "READY";
|
|
20
|
-
planHash: string;
|
|
21
|
-
applicationCode: string;
|
|
22
|
-
instanceCode: string;
|
|
23
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
24
|
-
sharedLibraryRevision: string | null;
|
|
25
|
-
readiness: {
|
|
26
|
-
verificationMode?: "JENKINS_API_VERIFIED" | undefined;
|
|
27
|
-
publicConfiguration?: {
|
|
28
|
-
contractVersion?: "gitops-image-delivery/v2" | null | undefined;
|
|
29
|
-
sharedLibraryRevision?: string | null | undefined;
|
|
30
|
-
platformUrl?: string | null | undefined;
|
|
31
|
-
oidcEndpoint?: string | null | undefined;
|
|
32
|
-
jenkinsInstanceCode?: string | null | undefined;
|
|
33
|
-
audience?: string | null | undefined;
|
|
34
|
-
rolloutMode?: "platform" | null | undefined;
|
|
35
|
-
legacyFallback?: false | null | undefined;
|
|
36
|
-
rolloutEntry?: string | null | undefined;
|
|
37
|
-
snapshotFolderFullName?: "mci-platform-snapshots" | null | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
credentialReferences?: {
|
|
40
|
-
writerCredentialReference?: string | null | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
sourcePolicy?: {
|
|
43
|
-
entrypoint: "platformBuildEntry()";
|
|
44
|
-
jenkinsfileDigest: string;
|
|
45
|
-
buildProfileDigest: string;
|
|
46
|
-
buildProfile: {
|
|
47
|
-
contract: "platform-build/v1";
|
|
48
|
-
agentLabel: string;
|
|
49
|
-
appHome: string;
|
|
50
|
-
buildFlow: "DOCKER";
|
|
51
|
-
nodeVersion: string | null;
|
|
52
|
-
sonarScan: false;
|
|
53
|
-
sendNotify: false;
|
|
54
|
-
};
|
|
55
|
-
} | undefined;
|
|
56
|
-
};
|
|
57
|
-
sideEffects: string[];
|
|
58
|
-
blockers: string[];
|
|
59
|
-
expiresAt: string | null;
|
|
60
|
-
}>;
|
|
61
|
-
getPlan(planNo: string): Promise<{
|
|
62
|
-
planNo: string;
|
|
63
|
-
operation: "DISABLE_PLATFORM" | "ENABLE_PLATFORM";
|
|
64
|
-
state: "BLOCKED" | "CONSUMED" | "EXPIRED" | "READY";
|
|
65
|
-
planHash: string;
|
|
66
|
-
applicationCode: string;
|
|
67
|
-
instanceCode: string;
|
|
68
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
69
|
-
sharedLibraryRevision: string | null;
|
|
70
|
-
readiness: {
|
|
71
|
-
verificationMode?: "JENKINS_API_VERIFIED" | undefined;
|
|
72
|
-
publicConfiguration?: {
|
|
73
|
-
contractVersion?: "gitops-image-delivery/v2" | null | undefined;
|
|
74
|
-
sharedLibraryRevision?: string | null | undefined;
|
|
75
|
-
platformUrl?: string | null | undefined;
|
|
76
|
-
oidcEndpoint?: string | null | undefined;
|
|
77
|
-
jenkinsInstanceCode?: string | null | undefined;
|
|
78
|
-
audience?: string | null | undefined;
|
|
79
|
-
rolloutMode?: "platform" | null | undefined;
|
|
80
|
-
legacyFallback?: false | null | undefined;
|
|
81
|
-
rolloutEntry?: string | null | undefined;
|
|
82
|
-
snapshotFolderFullName?: "mci-platform-snapshots" | null | undefined;
|
|
83
|
-
} | undefined;
|
|
84
|
-
credentialReferences?: {
|
|
85
|
-
writerCredentialReference?: string | null | undefined;
|
|
86
|
-
} | undefined;
|
|
87
|
-
sourcePolicy?: {
|
|
88
|
-
entrypoint: "platformBuildEntry()";
|
|
89
|
-
jenkinsfileDigest: string;
|
|
90
|
-
buildProfileDigest: string;
|
|
91
|
-
buildProfile: {
|
|
92
|
-
contract: "platform-build/v1";
|
|
93
|
-
agentLabel: string;
|
|
94
|
-
appHome: string;
|
|
95
|
-
buildFlow: "DOCKER";
|
|
96
|
-
nodeVersion: string | null;
|
|
97
|
-
sonarScan: false;
|
|
98
|
-
sendNotify: false;
|
|
99
|
-
};
|
|
100
|
-
} | undefined;
|
|
101
|
-
};
|
|
102
|
-
sideEffects: string[];
|
|
103
|
-
blockers: string[];
|
|
104
|
-
expiresAt: string | null;
|
|
105
|
-
}>;
|
|
106
|
-
apply(input: PlatformBuildRolloutApplyRequest, key: string): Promise<{
|
|
107
|
-
rolloutNo: string;
|
|
108
|
-
applicationCode: string;
|
|
109
|
-
instanceCode: string;
|
|
110
|
-
desiredMode: "DISABLED" | "PLATFORM";
|
|
111
|
-
status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
|
|
112
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
113
|
-
sharedLibraryRevision: string | null;
|
|
114
|
-
verificationSource: "JENKINS_API_VERIFIED" | null;
|
|
115
|
-
verificationReference: string | null;
|
|
116
|
-
verifiedAt: string | null;
|
|
117
|
-
version: number;
|
|
118
|
-
expectedPublicConfiguration: Record<string, never> | {
|
|
119
|
-
contractVersion: "gitops-image-delivery/v2";
|
|
120
|
-
sharedLibraryRevision: string;
|
|
121
|
-
platformUrl: string;
|
|
122
|
-
oidcEndpoint: string;
|
|
123
|
-
jenkinsInstanceCode: string;
|
|
124
|
-
audience: string;
|
|
125
|
-
rolloutMode: "platform";
|
|
126
|
-
legacyFallback: false;
|
|
127
|
-
rolloutEntry: string;
|
|
128
|
-
snapshotFolderFullName: "mci-platform-snapshots";
|
|
129
|
-
};
|
|
130
|
-
expectedCredentialReferences: Record<string, never> | {
|
|
131
|
-
writerCredentialReference: string;
|
|
132
|
-
};
|
|
133
|
-
requiredActions: string[];
|
|
134
|
-
verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
|
|
135
|
-
configurationDigest: string | null;
|
|
136
|
-
observedSharedLibraryRevision: string | null;
|
|
137
|
-
writerCredentialConfigured: boolean;
|
|
138
|
-
verifiedSourceRevision: string | null;
|
|
139
|
-
jenkinsfileDigest: string | null;
|
|
140
|
-
}>;
|
|
141
|
-
list(options?: {
|
|
142
|
-
applicationCode?: string;
|
|
143
|
-
instanceCode?: string;
|
|
144
|
-
}): Promise<{
|
|
145
|
-
rolloutNo: string;
|
|
146
|
-
applicationCode: string;
|
|
147
|
-
instanceCode: string;
|
|
148
|
-
desiredMode: "DISABLED" | "PLATFORM";
|
|
149
|
-
status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
|
|
150
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
151
|
-
sharedLibraryRevision: string | null;
|
|
152
|
-
verificationSource: "JENKINS_API_VERIFIED" | null;
|
|
153
|
-
verificationReference: string | null;
|
|
154
|
-
verifiedAt: string | null;
|
|
155
|
-
version: number;
|
|
156
|
-
expectedPublicConfiguration: Record<string, never> | {
|
|
157
|
-
contractVersion: "gitops-image-delivery/v2";
|
|
158
|
-
sharedLibraryRevision: string;
|
|
159
|
-
platformUrl: string;
|
|
160
|
-
oidcEndpoint: string;
|
|
161
|
-
jenkinsInstanceCode: string;
|
|
162
|
-
audience: string;
|
|
163
|
-
rolloutMode: "platform";
|
|
164
|
-
legacyFallback: false;
|
|
165
|
-
rolloutEntry: string;
|
|
166
|
-
snapshotFolderFullName: "mci-platform-snapshots";
|
|
167
|
-
};
|
|
168
|
-
expectedCredentialReferences: Record<string, never> | {
|
|
169
|
-
writerCredentialReference: string;
|
|
170
|
-
};
|
|
171
|
-
requiredActions: string[];
|
|
172
|
-
verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
|
|
173
|
-
configurationDigest: string | null;
|
|
174
|
-
observedSharedLibraryRevision: string | null;
|
|
175
|
-
writerCredentialConfigured: boolean;
|
|
176
|
-
verifiedSourceRevision: string | null;
|
|
177
|
-
jenkinsfileDigest: string | null;
|
|
178
|
-
}[]>;
|
|
179
|
-
get(rolloutNo: string): Promise<{
|
|
180
|
-
rolloutNo: string;
|
|
181
|
-
applicationCode: string;
|
|
182
|
-
instanceCode: string;
|
|
183
|
-
desiredMode: "DISABLED" | "PLATFORM";
|
|
184
|
-
status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
|
|
185
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
186
|
-
sharedLibraryRevision: string | null;
|
|
187
|
-
verificationSource: "JENKINS_API_VERIFIED" | null;
|
|
188
|
-
verificationReference: string | null;
|
|
189
|
-
verifiedAt: string | null;
|
|
190
|
-
version: number;
|
|
191
|
-
expectedPublicConfiguration: Record<string, never> | {
|
|
192
|
-
contractVersion: "gitops-image-delivery/v2";
|
|
193
|
-
sharedLibraryRevision: string;
|
|
194
|
-
platformUrl: string;
|
|
195
|
-
oidcEndpoint: string;
|
|
196
|
-
jenkinsInstanceCode: string;
|
|
197
|
-
audience: string;
|
|
198
|
-
rolloutMode: "platform";
|
|
199
|
-
legacyFallback: false;
|
|
200
|
-
rolloutEntry: string;
|
|
201
|
-
snapshotFolderFullName: "mci-platform-snapshots";
|
|
202
|
-
};
|
|
203
|
-
expectedCredentialReferences: Record<string, never> | {
|
|
204
|
-
writerCredentialReference: string;
|
|
205
|
-
};
|
|
206
|
-
requiredActions: string[];
|
|
207
|
-
verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
|
|
208
|
-
configurationDigest: string | null;
|
|
209
|
-
observedSharedLibraryRevision: string | null;
|
|
210
|
-
writerCredentialConfigured: boolean;
|
|
211
|
-
verifiedSourceRevision: string | null;
|
|
212
|
-
jenkinsfileDigest: string | null;
|
|
213
|
-
}>;
|
|
214
|
-
configure(rolloutNo: string, input: PlatformBuildRolloutConfigureRequest, key: string): Promise<{
|
|
215
|
-
rolloutNo: string;
|
|
216
|
-
applicationCode: string;
|
|
217
|
-
instanceCode: string;
|
|
218
|
-
desiredMode: "DISABLED" | "PLATFORM";
|
|
219
|
-
status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
|
|
220
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
221
|
-
sharedLibraryRevision: string | null;
|
|
222
|
-
verificationSource: "JENKINS_API_VERIFIED" | null;
|
|
223
|
-
verificationReference: string | null;
|
|
224
|
-
verifiedAt: string | null;
|
|
225
|
-
version: number;
|
|
226
|
-
expectedPublicConfiguration: Record<string, never> | {
|
|
227
|
-
contractVersion: "gitops-image-delivery/v2";
|
|
228
|
-
sharedLibraryRevision: string;
|
|
229
|
-
platformUrl: string;
|
|
230
|
-
oidcEndpoint: string;
|
|
231
|
-
jenkinsInstanceCode: string;
|
|
232
|
-
audience: string;
|
|
233
|
-
rolloutMode: "platform";
|
|
234
|
-
legacyFallback: false;
|
|
235
|
-
rolloutEntry: string;
|
|
236
|
-
snapshotFolderFullName: "mci-platform-snapshots";
|
|
237
|
-
};
|
|
238
|
-
expectedCredentialReferences: Record<string, never> | {
|
|
239
|
-
writerCredentialReference: string;
|
|
240
|
-
};
|
|
241
|
-
requiredActions: string[];
|
|
242
|
-
verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
|
|
243
|
-
configurationDigest: string | null;
|
|
244
|
-
observedSharedLibraryRevision: string | null;
|
|
245
|
-
writerCredentialConfigured: boolean;
|
|
246
|
-
verifiedSourceRevision: string | null;
|
|
247
|
-
jenkinsfileDigest: string | null;
|
|
248
|
-
}>;
|
|
249
|
-
private configureRecovery;
|
|
250
|
-
reconcileConfigure(rolloutNo: string, input: PlatformBuildRolloutConfigureRequest, key: string): Promise<{
|
|
251
|
-
rolloutNo: string;
|
|
252
|
-
idempotencyKey: string;
|
|
253
|
-
requestDigest: string;
|
|
254
|
-
expectedVersion: number;
|
|
255
|
-
state: "FAILED" | "PENDING" | "RECOVERING" | "SUCCEEDED" | "UNKNOWN";
|
|
256
|
-
disposition: "CONFLICT" | "FAILED" | "PENDING" | "READBACK_UNKNOWN" | "RECOVERING" | "UNTOUCHED" | "VERIFIED" | "WRITE_UNKNOWN";
|
|
257
|
-
resultVersion: number | null;
|
|
258
|
-
errorCode: string | null;
|
|
259
|
-
retryable: boolean;
|
|
260
|
-
reapplyAllowed: boolean;
|
|
261
|
-
recoveryStartedAt: string | null;
|
|
262
|
-
rollout: {
|
|
263
|
-
rolloutNo: string;
|
|
264
|
-
applicationCode: string;
|
|
265
|
-
instanceCode: string;
|
|
266
|
-
desiredMode: "DISABLED" | "PLATFORM";
|
|
267
|
-
status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
|
|
268
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
269
|
-
sharedLibraryRevision: string | null;
|
|
270
|
-
verificationSource: "JENKINS_API_VERIFIED" | null;
|
|
271
|
-
verificationReference: string | null;
|
|
272
|
-
verifiedAt: string | null;
|
|
273
|
-
version: number;
|
|
274
|
-
expectedPublicConfiguration: Record<string, never> | {
|
|
275
|
-
contractVersion: "gitops-image-delivery/v2";
|
|
276
|
-
sharedLibraryRevision: string;
|
|
277
|
-
platformUrl: string;
|
|
278
|
-
oidcEndpoint: string;
|
|
279
|
-
jenkinsInstanceCode: string;
|
|
280
|
-
audience: string;
|
|
281
|
-
rolloutMode: "platform";
|
|
282
|
-
legacyFallback: false;
|
|
283
|
-
rolloutEntry: string;
|
|
284
|
-
snapshotFolderFullName: "mci-platform-snapshots";
|
|
285
|
-
};
|
|
286
|
-
expectedCredentialReferences: Record<string, never> | {
|
|
287
|
-
writerCredentialReference: string;
|
|
288
|
-
};
|
|
289
|
-
requiredActions: string[];
|
|
290
|
-
verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
|
|
291
|
-
configurationDigest: string | null;
|
|
292
|
-
observedSharedLibraryRevision: string | null;
|
|
293
|
-
writerCredentialConfigured: boolean;
|
|
294
|
-
verifiedSourceRevision: string | null;
|
|
295
|
-
jenkinsfileDigest: string | null;
|
|
296
|
-
};
|
|
297
|
-
}>;
|
|
298
|
-
reapplyConfigure(rolloutNo: string, input: PlatformBuildRolloutConfigureRequest, key: string): Promise<{
|
|
299
|
-
rolloutNo: string;
|
|
300
|
-
idempotencyKey: string;
|
|
301
|
-
requestDigest: string;
|
|
302
|
-
expectedVersion: number;
|
|
303
|
-
state: "FAILED" | "PENDING" | "RECOVERING" | "SUCCEEDED" | "UNKNOWN";
|
|
304
|
-
disposition: "CONFLICT" | "FAILED" | "PENDING" | "READBACK_UNKNOWN" | "RECOVERING" | "UNTOUCHED" | "VERIFIED" | "WRITE_UNKNOWN";
|
|
305
|
-
resultVersion: number | null;
|
|
306
|
-
errorCode: string | null;
|
|
307
|
-
retryable: boolean;
|
|
308
|
-
reapplyAllowed: boolean;
|
|
309
|
-
recoveryStartedAt: string | null;
|
|
310
|
-
rollout: {
|
|
311
|
-
rolloutNo: string;
|
|
312
|
-
applicationCode: string;
|
|
313
|
-
instanceCode: string;
|
|
314
|
-
desiredMode: "DISABLED" | "PLATFORM";
|
|
315
|
-
status: "ACTION_REQUIRED" | "DISABLED" | "DISABLE_ACTION_REQUIRED" | "READY" | "STALE";
|
|
316
|
-
contractVersion: "gitops-image-delivery/v2" | null;
|
|
317
|
-
sharedLibraryRevision: string | null;
|
|
318
|
-
verificationSource: "JENKINS_API_VERIFIED" | null;
|
|
319
|
-
verificationReference: string | null;
|
|
320
|
-
verifiedAt: string | null;
|
|
321
|
-
version: number;
|
|
322
|
-
expectedPublicConfiguration: Record<string, never> | {
|
|
323
|
-
contractVersion: "gitops-image-delivery/v2";
|
|
324
|
-
sharedLibraryRevision: string;
|
|
325
|
-
platformUrl: string;
|
|
326
|
-
oidcEndpoint: string;
|
|
327
|
-
jenkinsInstanceCode: string;
|
|
328
|
-
audience: string;
|
|
329
|
-
rolloutMode: "platform";
|
|
330
|
-
legacyFallback: false;
|
|
331
|
-
rolloutEntry: string;
|
|
332
|
-
snapshotFolderFullName: "mci-platform-snapshots";
|
|
333
|
-
};
|
|
334
|
-
expectedCredentialReferences: Record<string, never> | {
|
|
335
|
-
writerCredentialReference: string;
|
|
336
|
-
};
|
|
337
|
-
requiredActions: string[];
|
|
338
|
-
verificationState: "DRIFTED" | "UNAVAILABLE" | "VERIFIED";
|
|
339
|
-
configurationDigest: string | null;
|
|
340
|
-
observedSharedLibraryRevision: string | null;
|
|
341
|
-
writerCredentialConfigured: boolean;
|
|
342
|
-
verifiedSourceRevision: string | null;
|
|
343
|
-
jenkinsfileDigest: string | null;
|
|
344
|
-
};
|
|
345
|
-
}>;
|
|
346
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { resolveBackendUrl } from "../backend.js";
|
|
2
|
-
import { ensureAccessToken, fetchWithKeycloakIdentity } from "../oauth.js";
|
|
3
|
-
import { PipelineError, redactPipelineText } from "../pipeline/errors.js";
|
|
4
|
-
import { ApiErrorSchema } from "../pipeline/schemas.js";
|
|
5
|
-
import { PlatformBuildRolloutApplyRequestSchema, PlatformBuildRolloutConfigureRequestSchema, PlatformBuildRolloutConfigureActionSchema, PlatformBuildRolloutListSchema, PlatformBuildRolloutPlanRequestSchema, PlatformBuildRolloutPlanSchema, PlatformBuildRolloutSchema } from "./schemas.js";
|
|
6
|
-
export const PLATFORM_BUILD_ROLLOUT_API_ROOT = "/api/v1/admin/jenkins";
|
|
7
|
-
function stableIdentifier(value, label, maximum = 160) {
|
|
8
|
-
const trimmed = value.trim();
|
|
9
|
-
if (!trimmed || trimmed.length > maximum
|
|
10
|
-
|| !/^[A-Za-z0-9][A-Za-z0-9._-]*$/u.test(trimmed)) {
|
|
11
|
-
throw new PipelineError(`${label} is invalid.`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
|
|
12
|
-
}
|
|
13
|
-
return trimmed;
|
|
14
|
-
}
|
|
15
|
-
function idempotencyKey(value) {
|
|
16
|
-
const trimmed = value.trim();
|
|
17
|
-
if (!trimmed || trimmed.length > 200
|
|
18
|
-
|| !/^[A-Za-z0-9][A-Za-z0-9._:/+-]*$/u.test(trimmed)) {
|
|
19
|
-
throw new PipelineError("idempotency-key must be 1-200 safe opaque characters.", "JENKINS_PLATFORM_BUILD_ROLLOUT_IDEMPOTENCY_INVALID");
|
|
20
|
-
}
|
|
21
|
-
return trimmed;
|
|
22
|
-
}
|
|
23
|
-
function queryPath(path, values) {
|
|
24
|
-
const query = new URLSearchParams();
|
|
25
|
-
for (const [key, value] of Object.entries(values)) {
|
|
26
|
-
if (value != null && value !== "")
|
|
27
|
-
query.set(key, value);
|
|
28
|
-
}
|
|
29
|
-
return query.size ? `${path}?${query.toString()}` : path;
|
|
30
|
-
}
|
|
31
|
-
async function responseBody(response) {
|
|
32
|
-
const text = await response.text();
|
|
33
|
-
if (!text)
|
|
34
|
-
return {};
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(text);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return text;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function requestIdFrom(response, body) {
|
|
43
|
-
if (body && typeof body === "object" && "requestId" in body
|
|
44
|
-
&& typeof body.requestId === "string")
|
|
45
|
-
return body.requestId;
|
|
46
|
-
return response.headers.get("x-request-id") ?? undefined;
|
|
47
|
-
}
|
|
48
|
-
function apiFailure(response, body) {
|
|
49
|
-
const parsed = ApiErrorSchema.safeParse(body);
|
|
50
|
-
const message = parsed.success
|
|
51
|
-
? parsed.data.message ?? response.statusText ?? "Platform-build rollout API request failed."
|
|
52
|
-
: typeof body === "string" ? body
|
|
53
|
-
: response.statusText || "Platform-build rollout API request failed.";
|
|
54
|
-
return new PipelineError(`Platform-build rollout API HTTP ${response.status}: ${redactPipelineText(message)}`, parsed.success
|
|
55
|
-
? parsed.data.code ?? "JENKINS_PLATFORM_BUILD_ROLLOUT_API_ERROR"
|
|
56
|
-
: "JENKINS_PLATFORM_BUILD_ROLLOUT_API_ERROR", response.status, requestIdFrom(response, body));
|
|
57
|
-
}
|
|
58
|
-
export class PlatformBuildRolloutClient {
|
|
59
|
-
config;
|
|
60
|
-
fetchImpl;
|
|
61
|
-
tokenProvider;
|
|
62
|
-
constructor(config, dependencies = {}) {
|
|
63
|
-
this.config = config;
|
|
64
|
-
this.fetchImpl = dependencies.fetch ?? fetch;
|
|
65
|
-
this.tokenProvider = dependencies.tokenProvider ?? ensureAccessToken;
|
|
66
|
-
}
|
|
67
|
-
async authenticatedFetch(path, init = {}) {
|
|
68
|
-
const method = String(init.method ?? "GET").toUpperCase();
|
|
69
|
-
const url = resolveBackendUrl(this.config, { method, path });
|
|
70
|
-
const headers = new Headers(init.headers);
|
|
71
|
-
headers.set("Accept", "application/json");
|
|
72
|
-
if (init.body != null)
|
|
73
|
-
headers.set("Content-Type", "application/json");
|
|
74
|
-
return fetchWithKeycloakIdentity(this.config, url, () => ({ ...init, headers }), {
|
|
75
|
-
fetch: this.fetchImpl,
|
|
76
|
-
tokenProvider: this.tokenProvider
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async json(path, schema, init = {}, expectedStatuses) {
|
|
80
|
-
const response = await this.authenticatedFetch(path, init);
|
|
81
|
-
const body = await responseBody(response);
|
|
82
|
-
if (!response.ok)
|
|
83
|
-
throw apiFailure(response, body);
|
|
84
|
-
if (expectedStatuses && !expectedStatuses.includes(response.status)) {
|
|
85
|
-
throw new PipelineError(`Platform-build rollout API returned HTTP ${response.status}; expected ${expectedStatuses.join(" or ")}.`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INVALID_RESPONSE", response.status, requestIdFrom(response, body));
|
|
86
|
-
}
|
|
87
|
-
const parsed = schema.safeParse(body);
|
|
88
|
-
if (!parsed.success) {
|
|
89
|
-
throw new PipelineError(`Platform-build rollout API returned an invalid response: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INVALID_RESPONSE", response.status, requestIdFrom(response, body));
|
|
90
|
-
}
|
|
91
|
-
return parsed.data;
|
|
92
|
-
}
|
|
93
|
-
createPlan(input, key) {
|
|
94
|
-
const parsed = PlatformBuildRolloutPlanRequestSchema.safeParse(input);
|
|
95
|
-
if (!parsed.success) {
|
|
96
|
-
throw new PipelineError(`Platform-build rollout plan input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
|
|
97
|
-
}
|
|
98
|
-
return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollout-plans`, PlatformBuildRolloutPlanSchema, {
|
|
99
|
-
method: "POST",
|
|
100
|
-
headers: { "Idempotency-Key": idempotencyKey(key) },
|
|
101
|
-
body: JSON.stringify(parsed.data)
|
|
102
|
-
}, [200]);
|
|
103
|
-
}
|
|
104
|
-
getPlan(planNo) {
|
|
105
|
-
return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollout-plans/${encodeURIComponent(stableIdentifier(planNo, "plan-no", 120))}`, PlatformBuildRolloutPlanSchema);
|
|
106
|
-
}
|
|
107
|
-
apply(input, key) {
|
|
108
|
-
const parsed = PlatformBuildRolloutApplyRequestSchema.safeParse(input);
|
|
109
|
-
if (!parsed.success) {
|
|
110
|
-
throw new PipelineError(`Platform-build rollout apply input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
|
|
111
|
-
}
|
|
112
|
-
return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts`, PlatformBuildRolloutSchema, {
|
|
113
|
-
method: "POST",
|
|
114
|
-
headers: { "Idempotency-Key": idempotencyKey(key) },
|
|
115
|
-
body: JSON.stringify(parsed.data)
|
|
116
|
-
}, [202]);
|
|
117
|
-
}
|
|
118
|
-
list(options = {}) {
|
|
119
|
-
return this.json(queryPath(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts`, options), PlatformBuildRolloutListSchema);
|
|
120
|
-
}
|
|
121
|
-
get(rolloutNo) {
|
|
122
|
-
return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts/${encodeURIComponent(stableIdentifier(rolloutNo, "rollout-no", 120))}`, PlatformBuildRolloutSchema);
|
|
123
|
-
}
|
|
124
|
-
configure(rolloutNo, input, key) {
|
|
125
|
-
const parsed = PlatformBuildRolloutConfigureRequestSchema.safeParse(input);
|
|
126
|
-
if (!parsed.success) {
|
|
127
|
-
throw new PipelineError(`Platform-build rollout configure input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
|
|
128
|
-
}
|
|
129
|
-
return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts/${encodeURIComponent(stableIdentifier(rolloutNo, "rollout-no", 120))}/configure`, PlatformBuildRolloutSchema, {
|
|
130
|
-
method: "POST",
|
|
131
|
-
headers: { "Idempotency-Key": idempotencyKey(key) },
|
|
132
|
-
body: JSON.stringify(parsed.data)
|
|
133
|
-
}, [200]);
|
|
134
|
-
}
|
|
135
|
-
configureRecovery(operation, rolloutNo, input, key) {
|
|
136
|
-
const parsed = PlatformBuildRolloutConfigureRequestSchema.safeParse(input);
|
|
137
|
-
if (!parsed.success) {
|
|
138
|
-
throw new PipelineError(`Platform-build rollout configure recovery input is invalid: ${parsed.error.message}`, "JENKINS_PLATFORM_BUILD_ROLLOUT_INPUT_INVALID");
|
|
139
|
-
}
|
|
140
|
-
return this.json(`${PLATFORM_BUILD_ROLLOUT_API_ROOT}/platform-build-rollouts/${encodeURIComponent(stableIdentifier(rolloutNo, "rollout-no", 120))}/configure/${operation}`, PlatformBuildRolloutConfigureActionSchema, {
|
|
141
|
-
method: "POST",
|
|
142
|
-
headers: { "Idempotency-Key": idempotencyKey(key) },
|
|
143
|
-
body: JSON.stringify(parsed.data)
|
|
144
|
-
}, [200]);
|
|
145
|
-
}
|
|
146
|
-
reconcileConfigure(rolloutNo, input, key) {
|
|
147
|
-
return this.configureRecovery("reconcile", rolloutNo, input, key);
|
|
148
|
-
}
|
|
149
|
-
reapplyConfigure(rolloutNo, input, key) {
|
|
150
|
-
return this.configureRecovery("reapply", rolloutNo, input, key);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=client.js.map
|