fix: 修正NapCat运行时发布确认门禁
This commit is contained in:
parent
36da962bb0
commit
f9ce9b6015
@ -46,9 +46,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
if (params.CONFIRM_API_PROMOTION_TARGET != 'PROMOTE_KT_TEMPLATE_API_MAIN') {
|
|
||||||
error('CONFIRM_API_PROMOTION_TARGET must equal PROMOTE_KT_TEMPLATE_API_MAIN before API promotion runs.')
|
|
||||||
}
|
|
||||||
requireRuntimeOverrides(
|
requireRuntimeOverrides(
|
||||||
params.QQBOT_NAPCAT_IMAGE_OVERRIDE,
|
params.QQBOT_NAPCAT_IMAGE_OVERRIDE,
|
||||||
params.QQBOT_NAPCAT_DESKTOP_PROFILE_VERSION_OVERRIDE
|
params.QQBOT_NAPCAT_DESKTOP_PROFILE_VERSION_OVERRIDE
|
||||||
@ -72,6 +69,9 @@ pipeline {
|
|||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
if (params.CONFIRM_API_PROMOTION_TARGET != 'PROMOTE_KT_TEMPLATE_API_MAIN') {
|
||||||
|
error('CONFIRM_API_PROMOTION_TARGET must equal PROMOTE_KT_TEMPLATE_API_MAIN before API promotion runs.')
|
||||||
|
}
|
||||||
requireRuntimeOverrides(
|
requireRuntimeOverrides(
|
||||||
params.QQBOT_NAPCAT_IMAGE_OVERRIDE,
|
params.QQBOT_NAPCAT_IMAGE_OVERRIDE,
|
||||||
params.QQBOT_NAPCAT_DESKTOP_PROFILE_VERSION_OVERRIDE
|
params.QQBOT_NAPCAT_DESKTOP_PROFILE_VERSION_OVERRIDE
|
||||||
|
|||||||
@ -524,6 +524,62 @@ export async function runSelfTest(): Promise<void> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const runtimeImageBuildStageStart = runtimeReleaseJenkinsTemplate.indexOf(
|
||||||
|
"stage('Runtime image build and publish')",
|
||||||
|
);
|
||||||
|
const apiPromotionStageStart = runtimeReleaseJenkinsTemplate.indexOf(
|
||||||
|
"stage('API promotion')",
|
||||||
|
);
|
||||||
|
const pipelineEndBeforeRuntimeHelpers = runtimeReleaseJenkinsTemplate.indexOf(
|
||||||
|
"\n}\n\n/**",
|
||||||
|
apiPromotionStageStart,
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
runtimeImageBuildStageStart === -1 ||
|
||||||
|
apiPromotionStageStart === -1 ||
|
||||||
|
pipelineEndBeforeRuntimeHelpers === -1 ||
|
||||||
|
runtimeImageBuildStageStart > apiPromotionStageStart
|
||||||
|
) {
|
||||||
|
throw new Error("NapCat runtime Jenkins template stage slice self-check failed");
|
||||||
|
}
|
||||||
|
const runtimeImageBuildStage = runtimeReleaseJenkinsTemplate.slice(
|
||||||
|
runtimeImageBuildStageStart,
|
||||||
|
apiPromotionStageStart,
|
||||||
|
);
|
||||||
|
const apiPromotionStage = runtimeReleaseJenkinsTemplate.slice(
|
||||||
|
apiPromotionStageStart,
|
||||||
|
pipelineEndBeforeRuntimeHelpers,
|
||||||
|
);
|
||||||
|
if (runtimeImageBuildStage.includes("CONFIRM_API_PROMOTION_TARGET")) {
|
||||||
|
throw new Error(
|
||||||
|
"NapCat runtime Jenkins runtime image build stage must not check API promotion confirmation",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!apiPromotionStage.includes("CONFIRM_API_PROMOTION_TARGET")) {
|
||||||
|
throw new Error(
|
||||||
|
"NapCat runtime Jenkins API promotion stage missing confirmation target check",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!apiPromotionStage.includes("PROMOTE_KT_TEMPLATE_API_MAIN")) {
|
||||||
|
throw new Error(
|
||||||
|
"NapCat runtime Jenkins API promotion stage missing production confirmation value",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const apiPromotionConfirmationIndex = apiPromotionStage.indexOf(
|
||||||
|
"CONFIRM_API_PROMOTION_TARGET",
|
||||||
|
);
|
||||||
|
const apiPromotionBuildIndex = apiPromotionStage.indexOf(
|
||||||
|
"build job: params.API_PROMOTION_JOB",
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
apiPromotionConfirmationIndex === -1 ||
|
||||||
|
apiPromotionBuildIndex === -1 ||
|
||||||
|
apiPromotionConfirmationIndex > apiPromotionBuildIndex
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
"NapCat runtime Jenkins API promotion confirmation must run before API build job",
|
||||||
|
);
|
||||||
|
}
|
||||||
const codexExecutionArtifactRoot = resolveInsideRoot(
|
const codexExecutionArtifactRoot = resolveInsideRoot(
|
||||||
".kt-workspace/test-artifacts/napcat-codex-runner-self-test",
|
".kt-workspace/test-artifacts/napcat-codex-runner-self-test",
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user