@roomi-fields/grillhouse 0.54.1 → 0.55.2
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/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +73 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
- package/cadre/templates/projet/CONTRIBUTING.md +0 -5
- package/cadre/templates/projet/README.md +0 -126
- package/cadre/templates/projet/_npmignore +1 -6
- package/cadre/templates/projet/package.json +5 -32
- package/cadre/templates/projet/tsconfig.json +4 -4
- package/cadre/templates/projet/vitest.config.cjs +3 -2
- package/charte/tests.md +14 -0
- package/dist/machine/part-par-sorte.d.ts +9 -9
- package/dist/machine/part-par-sorte.js +20 -24
- package/dist/machine/part-par-sorte.js.map +1 -1
- package/dist/machine/table-des-consommations.d.ts +65 -0
- package/dist/machine/table-des-consommations.js +94 -0
- package/dist/machine/table-des-consommations.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +2 -0
- package/dist/temporal/circuit/activites.js +87 -3
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/client.js +9 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +32 -4
- package/dist/temporal/circuit/deroule.js +54 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/circuit/versions.d.ts +12 -0
- package/dist/temporal/circuit/versions.js +22 -0
- package/dist/temporal/circuit/versions.js.map +1 -0
- package/dist/temporal/consommation/activites.d.ts +2 -0
- package/dist/temporal/consommation/activites.js +9 -0
- package/dist/temporal/consommation/activites.js.map +1 -0
- package/dist/temporal/consommation/actualisation.d.ts +2 -0
- package/dist/temporal/consommation/actualisation.js +71 -0
- package/dist/temporal/consommation/actualisation.js.map +1 -0
- package/dist/temporal/consommation/client.d.ts +12 -0
- package/dist/temporal/consommation/client.js +28 -0
- package/dist/temporal/consommation/client.js.map +1 -0
- package/dist/temporal/consommation/commande.d.ts +5 -0
- package/dist/temporal/consommation/commande.js +32 -0
- package/dist/temporal/consommation/commande.js.map +1 -0
- package/dist/temporal/consommation/contrat.d.ts +15 -0
- package/dist/temporal/consommation/contrat.js +13 -0
- package/dist/temporal/consommation/contrat.js.map +1 -0
- package/dist/temporal/consommation/deroule.d.ts +2 -0
- package/dist/temporal/consommation/deroule.js +14 -0
- package/dist/temporal/consommation/deroule.js.map +1 -0
- package/dist/temporal/deroules.d.ts +2 -1
- package/dist/temporal/deroules.js +3 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/file/deroule.js +14 -4
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +6 -0
- package/dist/temporal/installation.js +15 -0
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +2 -1
- package/dist/temporal/nuits/activites.js +127 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/client.d.ts +19 -5
- package/dist/temporal/nuits/client.js +33 -23
- package/dist/temporal/nuits/client.js.map +1 -1
- package/dist/temporal/nuits/commande.js +16 -11
- package/dist/temporal/nuits/commande.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +29 -0
- package/dist/temporal/nuits/contrat.js +10 -0
- package/dist/temporal/nuits/contrat.js.map +1 -1
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +18 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/nuits/pc2.d.ts +72 -0
- package/dist/temporal/nuits/pc2.js +206 -0
- package/dist/temporal/nuits/pc2.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +23 -1
- package/dist/temporal/places/activites.js +38 -2
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +18 -2
- package/dist/temporal/places/client.js +28 -3
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +79 -14
- package/dist/temporal/places/contrat.js +7 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +159 -23
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/places/reservation.d.ts +54 -0
- package/dist/temporal/places/reservation.js +69 -0
- package/dist/temporal/places/reservation.js.map +1 -0
- package/dist/temporal/planification.d.ts +6 -0
- package/dist/temporal/planification.js +26 -0
- package/dist/temporal/planification.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +0 -2
- package/dist/temporal/tickets/activites.js +2 -52
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +7 -26
- package/dist/temporal/tickets/deroule.js +35 -23
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.js +2 -0
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/CADRE.md +1 -1
- package/docs/INTERFACE.md +16 -11
- package/docs/architecture/circuit.md +62 -58
- package/docs/architecture/entree.md +87 -63
- package/docs/architecture/greffon.md +24 -21
- package/docs/architecture/installation.md +35 -30
- package/docs/architecture/machine.md +48 -40
- package/docs/architecture/tests.md +37 -33
- package/docs/lexique.md +4 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +351 -180
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +3 -22
- package/scripts/avancement.mjs +21 -30
- package/scripts/bilan.mjs +22 -2
- package/scripts/branche-de-nuit.mjs +1 -1
- package/scripts/circuit.mjs +75 -39
- package/scripts/codes-de-sortie.mjs +0 -6
- package/scripts/coeurs-dedies.mjs +19 -2
- package/scripts/consommation-des-passes.mjs +67 -35
- package/scripts/consommation.mjs +152 -24
- package/scripts/copies-finies.mjs +15 -35
- package/scripts/dernier-vert.mjs +4 -5
- package/scripts/dette.mjs +5 -3
- package/scripts/droits.mjs +2 -2
- package/scripts/echantillonneur-de-la-passe.mjs +7 -31
- package/scripts/engendres.mjs +5 -61
- package/scripts/enveloppe/enveloppe.mjs +30 -34
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
- package/scripts/etapes.mjs +21 -7
- package/scripts/etat-du-depot.mjs +61 -0
- package/scripts/faits-du-circuit.mjs +7 -4
- package/scripts/fermeture-de-la-machine.d.mts +6 -4
- package/scripts/fermeture-de-la-machine.mjs +12 -16
- package/scripts/fichier-du-poste.d.mts +9 -0
- package/scripts/file-des-tickets.d.mts +0 -18
- package/scripts/file-des-tickets.mjs +0 -42
- package/scripts/fusion-du-changelog.mjs +1 -1
- package/scripts/grillhouse-maj.mjs +1 -1
- package/scripts/index-des-rouges.d.mts +40 -0
- package/scripts/index-des-rouges.mjs +104 -0
- package/scripts/integration/file.mjs +13 -63
- package/scripts/integration/integrer.mjs +157 -424
- package/scripts/integration/jugement.mjs +109 -0
- package/scripts/integration/rejeu.mjs +94 -71
- package/scripts/jointure.d.ts +34 -27
- package/scripts/journal-des-etats.d.mts +1 -1
- package/scripts/langages/c/commandes.mjs +27 -12
- package/scripts/langages/cargo/commandes.mjs +148 -94
- package/scripts/langages/cargo/index.mjs +2 -1
- package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
- package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/python/commandes.mjs +31 -15
- package/scripts/langages/python/index.mjs +2 -1
- package/scripts/langages/python/lectures-des-tests.mjs +148 -0
- package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
- package/scripts/langages/typescript/index.mjs +4 -0
- package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
- package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
- package/scripts/langages/typescript/tests.mjs +11 -37
- package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
- package/scripts/langages/typescript/verifier.mjs +74 -44
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
- package/scripts/lectures-communes.mjs +234 -0
- package/scripts/machine.mjs +11 -18
- package/scripts/mesure/base-de-passe.mjs +1 -2
- package/scripts/mesure-de-la-machine.d.mts +43 -3
- package/scripts/mesure-de-la-machine.mjs +209 -11
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
- package/scripts/migrations/nuit-yml-retire.mjs +25 -0
- package/scripts/migrations/part-retiree.mjs +31 -0
- package/scripts/migrations/table-des-consommations.mjs +36 -0
- package/scripts/migrations.mjs +6 -0
- package/scripts/montee.mjs +9 -0
- package/scripts/nuit-de-pc2.mjs +628 -0
- package/scripts/nuit.sh +8 -131
- package/scripts/paquets.mjs +1 -1
- package/scripts/passe-de-la-machine.mjs +365 -105
- package/scripts/place-du-circuit.d.mts +15 -0
- package/scripts/place-du-circuit.mjs +32 -0
- package/scripts/places-de-la-machine.mjs +148 -627
- package/scripts/places-du-serveur.mjs +43 -16
- package/scripts/plafond-de-la-machine.d.mts +8 -13
- package/scripts/plafond-de-la-machine.mjs +37 -69
- package/scripts/registre-des-entrees.mjs +57 -0
- package/scripts/regles-des-places.d.mts +84 -50
- package/scripts/regles-des-places.mjs +200 -156
- package/scripts/retirer-copie.sh +2 -2
- package/scripts/seances.mjs +181 -63
- package/scripts/secours.mjs +95 -0
- package/scripts/services-du-noyau.mjs +11 -19
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/sous-modules.sh +1 -1
- package/scripts/superviseur.mjs +16 -7
- package/scripts/table-des-consommations.d.mts +9 -0
- package/scripts/table-des-consommations.mjs +35 -0
- package/scripts/tableau.mjs +33 -19
- package/scripts/taches-du-graphe.mjs +124 -2
- package/scripts/transitions.d.mts +27 -5
- package/scripts/transitions.mjs +125 -104
- package/scripts/verdict-de-la-nuit.d.mts +13 -0
- package/scripts/verdict-de-la-nuit.mjs +34 -7
- package/scripts/verrou-de-fichier.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +2 -2
- package/skills/developpeur/SKILL.md +8 -2
- package/skills/direct/SKILL.md +5 -0
- package/skills/explorateur/SKILL.md +10 -1
- package/skills/grill/SKILL.md +2 -4
- package/skills/pitmaster/SKILL.md +7 -5
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +4 -1
- package/skills/testwriter/SKILL.md +15 -2
- package/cadre/templates/projet/.env.example +0 -57
- package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
- package/cadre/templates/projet/deployment/README.md +0 -98
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
- package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
- package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
- package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
- package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
- package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
- package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
- package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
- package/cadre/templates/projet/ecosystem.config.cjs +0 -73
- package/cadre/templates/projet/src/config.ts +0 -68
- package/cadre/templates/projet/src/errors.ts +0 -102
- package/cadre/templates/projet/src/index.ts +0 -46
- package/cadre/templates/projet/src/services/.gitkeep +0 -8
- package/cadre/templates/projet/src/types/index.ts +0 -24
- package/cadre/templates/projet/src/utils/logger.ts +0 -106
- package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
- package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
- package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
- package/cadre/templates/projet/tsconfig.build.json +0 -14
- package/scripts/flux-de-la-nuit.mjs +0 -39
- package/scripts/garde-de-la-memoire.mjs +0 -231
- package/scripts/repli-de-la-nuit.mjs +0 -184
|
@@ -19,10 +19,24 @@ export declare function optionsDeLaPlanification(heure: number, fuseau: string,
|
|
|
19
19
|
file?: string;
|
|
20
20
|
id?: string;
|
|
21
21
|
}): ScheduleOptions<ScheduleOptionsStartWorkflowAction<() => Promise<void>>>;
|
|
22
|
-
/** The hour of the schedule <id> as the server keeps it, or null when it does not exist. */
|
|
23
|
-
export declare function heureDeLaPlanification(client: Client, id?: string): Promise<number | null>;
|
|
24
22
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* The second schedule of the machine: the night of PC2, every day at 01:45 in Paris (`Europe/Paris`,
|
|
24
|
+
* whatever the zone of the machine and the hour of the first schedule), the workflow NUIT_DE_PC2 on
|
|
25
|
+
* <file>; overlap SKIP, a start missed taken within the slot (2 h), no later.
|
|
27
26
|
*/
|
|
28
|
-
export declare function
|
|
27
|
+
export declare function optionsDeLaPlanificationDePc2({ file, id, }?: {
|
|
28
|
+
file?: string;
|
|
29
|
+
id?: string;
|
|
30
|
+
}): ReturnType<typeof optionsDeLaPlanification>;
|
|
31
|
+
/** The hour of the schedule <id> as the server keeps it, or null when it does not exist. */
|
|
32
|
+
export declare function heureDeLaPlanification(client: Client, id?: string): Promise<number | null>;
|
|
33
|
+
/** Creates or updates the schedule of the nights (`planifier`): whether it was created. */
|
|
34
|
+
export declare const planifierLesNuits: (client: Client, options: ReturnType<typeof optionsDeLaPlanification>) => Promise<boolean>;
|
|
35
|
+
/** Creates or updates the two schedules of the machine at <heure> and <fuseau>: whether each was created. */
|
|
36
|
+
export declare function planifierToutesLesNuits(client: Client, heure: number, fuseau: string, options?: {
|
|
37
|
+
file?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
nuits: boolean;
|
|
41
|
+
pc2: boolean;
|
|
42
|
+
}>;
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// the workflow of the nights started when none runs), reads them (the query L_ETAT_DES_NUITS), and
|
|
4
4
|
// creates or updates the one schedule of the machine, which starts the workflow NUIT_PLANIFIEE
|
|
5
5
|
// every day at its hour, and reads that hour back.
|
|
6
|
-
import {
|
|
6
|
+
import { ScheduleNotFoundError, } from '@temporalio/client';
|
|
7
7
|
import { FILE_DE_LA_MACHINE } from '../installation.js';
|
|
8
|
-
import {
|
|
8
|
+
import { planifier } from '../planification.js';
|
|
9
|
+
import { DEMANDER, FUSEAU_DE_PC2, ID_DE_LA_NUIT_DE_PC2, ID_DE_LA_NUIT_PLANIFIEE, ID_DE_LA_PLANIFICATION, ID_DE_LA_PLANIFICATION_DE_PC2, ID_DES_NUITS, L_ETAT_DES_NUITS, NUIT_DE_PC2, NUIT_PLANIFIEE, NUITS, RATTRAPAGE, RATTRAPAGE_DE_PC2, } from './contrat.js';
|
|
9
10
|
/** Asks the workflow of the nights for <demande>, started on <file> when none runs. */
|
|
10
11
|
export async function demanderDesNuits(client, demande, { file = FILE_DE_LA_MACHINE, id = ID_DES_NUITS } = {}) {
|
|
11
12
|
await client.workflow.signalWithStart(NUITS, {
|
|
@@ -45,6 +46,28 @@ export function optionsDeLaPlanification(heure, fuseau, { file = FILE_DE_LA_MACH
|
|
|
45
46
|
policies: { overlap: 'SKIP', catchupWindow: RATTRAPAGE },
|
|
46
47
|
};
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* The second schedule of the machine: the night of PC2, every day at 01:45 in Paris (`Europe/Paris`,
|
|
51
|
+
* whatever the zone of the machine and the hour of the first schedule), the workflow NUIT_DE_PC2 on
|
|
52
|
+
* <file>; overlap SKIP, a start missed taken within the slot (2 h), no later.
|
|
53
|
+
*/
|
|
54
|
+
export function optionsDeLaPlanificationDePc2({ file = FILE_DE_LA_MACHINE, id = ID_DE_LA_PLANIFICATION_DE_PC2, } = {}) {
|
|
55
|
+
return {
|
|
56
|
+
scheduleId: id,
|
|
57
|
+
spec: {
|
|
58
|
+
calendars: [{ hour: 1, minute: 45, comment: 'la nuit de PC2' }],
|
|
59
|
+
timezone: FUSEAU_DE_PC2,
|
|
60
|
+
},
|
|
61
|
+
action: {
|
|
62
|
+
type: 'startWorkflow',
|
|
63
|
+
workflowType: NUIT_DE_PC2,
|
|
64
|
+
workflowId: ID_DE_LA_NUIT_DE_PC2,
|
|
65
|
+
taskQueue: file,
|
|
66
|
+
args: [],
|
|
67
|
+
},
|
|
68
|
+
policies: { overlap: 'SKIP', catchupWindow: RATTRAPAGE_DE_PC2 },
|
|
69
|
+
};
|
|
70
|
+
}
|
|
48
71
|
/** The hour of the schedule <id> as the server keeps it, or null when it does not exist. */
|
|
49
72
|
export async function heureDeLaPlanification(client, id = ID_DE_LA_PLANIFICATION) {
|
|
50
73
|
try {
|
|
@@ -59,26 +82,13 @@ export async function heureDeLaPlanification(client, id = ID_DE_LA_PLANIFICATION
|
|
|
59
82
|
throw e;
|
|
60
83
|
}
|
|
61
84
|
}
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
catch (e) {
|
|
72
|
-
if (!(e instanceof ScheduleAlreadyRunning)) {
|
|
73
|
-
throw e;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
await client.schedule.getHandle(options.scheduleId).update(avant => ({
|
|
77
|
-
...avant,
|
|
78
|
-
spec: options.spec,
|
|
79
|
-
action: options.action,
|
|
80
|
-
policies: { ...avant.policies, ...options.policies },
|
|
81
|
-
}));
|
|
82
|
-
return false;
|
|
85
|
+
/** Creates or updates the schedule of the nights (`planifier`): whether it was created. */
|
|
86
|
+
export const planifierLesNuits = planifier;
|
|
87
|
+
/** Creates or updates the two schedules of the machine at <heure> and <fuseau>: whether each was created. */
|
|
88
|
+
export async function planifierToutesLesNuits(client, heure, fuseau, options = {}) {
|
|
89
|
+
const nuits = await planifierLesNuits(client, optionsDeLaPlanification(heure, fuseau, options));
|
|
90
|
+
const { file } = options;
|
|
91
|
+
const pc2 = await planifierLesNuits(client, optionsDeLaPlanificationDePc2({ file }));
|
|
92
|
+
return { nuits, pc2 };
|
|
83
93
|
}
|
|
84
94
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/temporal/nuits/client.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,8FAA8F;AAC9F,mGAAmG;AACnG,+FAA+F;AAC/F,mDAAmD;AACnD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/temporal/nuits/client.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,8FAA8F;AAC9F,mGAAmG;AACnG,+FAA+F;AAC/F,mDAAmD;AACnD,OAAO,EACL,qBAAqB,GAItB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,QAAQ,EACR,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,EAC7B,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,KAAK,EACL,UAAU,EACV,iBAAiB,GAIlB,MAAM,cAAc,CAAC;AAEtB,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,OAAsB,EACtB,EAAE,IAAI,GAAG,kBAAkB,EAAE,EAAE,GAAG,YAAY,KAAqC,EAAE;IAErF,MAAM,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE;QAC3C,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,CAAC,EAA2B,CAAC;QACnC,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,CAAC,OAAO,CAAC;KACtB,CAAC,CAAC;AACL,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAc,EAAE,EAAE,G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ts/nuit.sh), which the workflow of the nights launches
|
|
8
8
|
// grillhouse nuit <projet> asks for the night of <projet> (a folder of its repository)
|
|
9
9
|
// grillhouse nuit --planifier [--heure <0-23>]
|
|
10
|
-
// creates or updates the
|
|
10
|
+
// creates or updates the two schedules of the machine
|
|
11
11
|
// grillhouse nuit --help the usage on the output (also -h), exit 0
|
|
12
12
|
//
|
|
13
13
|
// - Alone, it plays the pass (scripts/nuit.sh, with this process's streams; its exit code is the
|
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
// it in its turn, its marker unread; a project already in its queue or under way is not put in
|
|
17
17
|
// twice. A project left out of the nights (its root gone, no night wired: ./choix.ts) is
|
|
18
18
|
// refused, by its reason, exit 2.
|
|
19
|
-
// - `--planifier` creates the
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
19
|
+
// - `--planifier` creates the two schedules of the machine, or updates those that exist (id fixed,
|
|
20
|
+
// overlap SKIP). The nights: every day at <heure>, in the time zone of the machine, a missed
|
|
21
|
+
// firing taken within 24 h; without `--heure`, the hour the schedule already has, 1 h for a new
|
|
22
|
+
// one. The night of PC2: every day at 01:45 in Europe/Paris, whatever `--heure`, which dispatches
|
|
23
|
+
// the Nuit flow of the projects whose flow plays on PC2, a missed start taken within 2 h. Played
|
|
24
|
+
// again, it leaves one of each.
|
|
23
25
|
// - A server that does not answer is said on the error stream, exit 1; a malformed call writes the
|
|
24
26
|
// usage on the error stream, exit 2.
|
|
25
27
|
import { spawn } from 'node:child_process';
|
|
@@ -29,14 +31,15 @@ import { sansReponseEn } from '../../../scripts/sans-reponse.mjs';
|
|
|
29
31
|
import { DELAI_JOIGNABLE_MS, adresseDuServeur, ouvrirLeClient, serveurJoignable, } from '../client.js';
|
|
30
32
|
import { arbrePrincipalDe, lireLAppel } from './appel.js';
|
|
31
33
|
import { ecartDuProjet } from './choix.js';
|
|
32
|
-
import { demanderDesNuits, HEURE_PAR_DEFAUT, heureDeLaPlanification,
|
|
34
|
+
import { demanderDesNuits, HEURE_PAR_DEFAUT, heureDeLaPlanification, planifierToutesLesNuits, } from './client.js';
|
|
33
35
|
const PASSE = fileURLToPath(new URL('../../../scripts/nuit.sh', import.meta.url));
|
|
34
36
|
const USAGE = 'Usage : grillhouse nuit [<projet> | --planifier [--heure <0-23>]]\n' +
|
|
35
37
|
'Seule, la passe de nuit du projet du dossier courant (la passe complète jouée pour de vrai,\n' +
|
|
36
38
|
'puis les tests de nuit et les bancs de temps), que le déroulé des nuits lance.\n' +
|
|
37
39
|
' <projet> demande la nuit de ce projet au déroulé des nuits, qui la joue à son tour\n' +
|
|
38
|
-
' --planifier crée ou met à jour
|
|
39
|
-
' à --heure (0-23) ; sans elle, l’heure qu’elle a déjà, 1 h pour une neuve
|
|
40
|
+
' --planifier crée ou met à jour les deux planifications de la machine : les nuits, chaque jour\n' +
|
|
41
|
+
' à --heure (0-23) ; sans elle, l’heure qu’elle a déjà, 1 h pour une neuve ;\n' +
|
|
42
|
+
' la nuit de PC2, chaque jour à 01:45 (Europe/Paris), qui joue la part de PC2 par ssh\n' +
|
|
40
43
|
' -h, --help affiche cette aide\n';
|
|
41
44
|
// The pass of the night, with this process's streams: its exit code.
|
|
42
45
|
function jouerLaPasse() {
|
|
@@ -86,9 +89,11 @@ async function principal(argv) {
|
|
|
86
89
|
(await heureDeLaPlanification(c.client)) ??
|
|
87
90
|
HEURE_PAR_DEFAUT;
|
|
88
91
|
const fuseau = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
89
|
-
const
|
|
90
|
-
process.stdout.write(`▶ la planification des nuits est ${
|
|
91
|
-
'les projets du registre qui ont bougé depuis leur dernière nuit verte, l’un après l’autre.\n'
|
|
92
|
+
const { nuits, pc2 } = await planifierToutesLesNuits(c.client, heure, fuseau);
|
|
93
|
+
process.stdout.write(`▶ la planification des nuits est ${nuits ? 'créée' : 'à jour'} : chaque jour à ${heure} h (${fuseau}), ` +
|
|
94
|
+
'les projets du registre qui ont bougé depuis leur dernière nuit verte, l’un après l’autre.\n' +
|
|
95
|
+
`▶ la planification de la nuit de PC2 est ${pc2 ? 'créée' : 'à jour'} : chaque jour à 01:45 (Europe/Paris), ` +
|
|
96
|
+
'la part de PC2 jouée par ssh pour chaque projet du registre.\n');
|
|
92
97
|
return 0;
|
|
93
98
|
}
|
|
94
99
|
finally {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commande.js","sourceRoot":"","sources":["../../../src/temporal/nuits/commande.ts"],"names":[],"mappings":";AACA,+FAA+F;AAC/F,oGAAoG;AACpG,eAAe;AACf,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,+FAA+F;AAC/F,iDAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"commande.js","sourceRoot":"","sources":["../../../src/temporal/nuits/commande.ts"],"names":[],"mappings":";AACA,+FAA+F;AAC/F,oGAAoG;AACpG,eAAe;AACf,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,+FAA+F;AAC/F,iDAAiD;AACjD,uFAAuF;AACvF,6EAA6E;AAC7E,EAAE;AACF,iGAAiG;AACjG,+FAA+F;AAC/F,+FAA+F;AAC/F,iGAAiG;AACjG,2FAA2F;AAC3F,oCAAoC;AACpC,mGAAmG;AACnG,+FAA+F;AAC/F,kGAAkG;AAClG,oGAAoG;AACpG,mGAAmG;AACnG,kCAAkC;AAClC,mGAAmG;AACnG,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,M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AO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC/E,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAEhB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CACnC,IAAI,CAAC,EAAE;IACL,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1B,CAAC,EACD,CAAC,CAAU,EAAE,EAAE;IACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CACF,CAAC"}
|
|
@@ -12,6 +12,16 @@ export declare const NUIT_PLANIFIEE = "nuitPlanifiee";
|
|
|
12
12
|
export declare const ID_DE_LA_NUIT_PLANIFIEE = "grillhouse-nuit-planifiee";
|
|
13
13
|
/** The id of the one schedule of the machine. */
|
|
14
14
|
export declare const ID_DE_LA_PLANIFICATION = "grillhouse-nuits";
|
|
15
|
+
/** The workflow's type that the second schedule starts: it dispatches the night of PC2, once a day. */
|
|
16
|
+
export declare const NUIT_DE_PC2 = "nuitDePc2";
|
|
17
|
+
/** The id of the second schedule of the machine: the night of PC2, 01:45 Paris time. */
|
|
18
|
+
export declare const ID_DE_LA_PLANIFICATION_DE_PC2 = "grillhouse-nuit-de-pc2";
|
|
19
|
+
/** The id the second schedule gives the workflow it starts (suffixed by the server with its time). */
|
|
20
|
+
export declare const ID_DE_LA_NUIT_DE_PC2 = "grillhouse-nuit-de-pc2-planifiee";
|
|
21
|
+
/** The window within which a start of the night of PC2 missed is taken: the slot, 2 h at most. */
|
|
22
|
+
export declare const RATTRAPAGE_DE_PC2 = "2 hours";
|
|
23
|
+
/** The time zone of the slot of PC2, fixed whatever the zone of the machine. */
|
|
24
|
+
export declare const FUSEAU_DE_PC2 = "Europe/Paris";
|
|
15
25
|
/** The window within which a firing missed (the machine off) is taken at the server's return. */
|
|
16
26
|
export declare const RATTRAPAGE = "24 hours";
|
|
17
27
|
/**
|
|
@@ -106,5 +116,24 @@ export interface ActivitesDesNuits {
|
|
|
106
116
|
}): Promise<Saut>;
|
|
107
117
|
/** The scheduled nights asked of the workflow of the nights, started when none runs. */
|
|
108
118
|
demanderLesNuitsPlanifiees(): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* The part of PC2 of the night of each project of the register that is wired, played from PC3 by
|
|
121
|
+
* ssh (./pc2.ts): the pass started on PC2 (`lancer`), followed (`etat`, with a heartbeat), its
|
|
122
|
+
* verdict read, checked against its schema and written to `nuit/verdict-pc2`. A project is
|
|
123
|
+
* left alone when no host of PC2 is set (`GRILLHOUSE_NUIT_PC2_HOTE` of `nuit.env`); ssh failing
|
|
124
|
+
* is 75 with its reason, never replayed on the poste.
|
|
125
|
+
*/
|
|
126
|
+
jouerLaNuitDePc2(): Promise<PartDeProjetDePc2[]>;
|
|
127
|
+
}
|
|
128
|
+
/** The part of PC2 of a project's night: its code (0 green, 1 red, 75 to replay), tranches and reason of a 75. */
|
|
129
|
+
export interface PartDeProjetDePc2 {
|
|
130
|
+
racine: string;
|
|
131
|
+
code: number;
|
|
132
|
+
tranches: {
|
|
133
|
+
nom: string;
|
|
134
|
+
verdict: 'vert' | 'rouge';
|
|
135
|
+
sortie: string;
|
|
136
|
+
}[];
|
|
137
|
+
raison: string | null;
|
|
109
138
|
}
|
|
110
139
|
export {};
|
|
@@ -18,6 +18,16 @@ export const NUIT_PLANIFIEE = 'nuitPlanifiee';
|
|
|
18
18
|
export const ID_DE_LA_NUIT_PLANIFIEE = 'grillhouse-nuit-planifiee';
|
|
19
19
|
/** The id of the one schedule of the machine. */
|
|
20
20
|
export const ID_DE_LA_PLANIFICATION = 'grillhouse-nuits';
|
|
21
|
+
/** The workflow's type that the second schedule starts: it dispatches the night of PC2, once a day. */
|
|
22
|
+
export const NUIT_DE_PC2 = 'nuitDePc2';
|
|
23
|
+
/** The id of the second schedule of the machine: the night of PC2, 01:45 Paris time. */
|
|
24
|
+
export const ID_DE_LA_PLANIFICATION_DE_PC2 = 'grillhouse-nuit-de-pc2';
|
|
25
|
+
/** The id the second schedule gives the workflow it starts (suffixed by the server with its time). */
|
|
26
|
+
export const ID_DE_LA_NUIT_DE_PC2 = 'grillhouse-nuit-de-pc2-planifiee';
|
|
27
|
+
/** The window within which a start of the night of PC2 missed is taken: the slot, 2 h at most. */
|
|
28
|
+
export const RATTRAPAGE_DE_PC2 = '2 hours';
|
|
29
|
+
/** The time zone of the slot of PC2, fixed whatever the zone of the machine. */
|
|
30
|
+
export const FUSEAU_DE_PC2 = 'Europe/Paris';
|
|
21
31
|
/** The window within which a firing missed (the machine off) is taken at the server's return. */
|
|
22
32
|
export const RATTRAPAGE = '24 hours';
|
|
23
33
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contrat.js","sourceRoot":"","sources":["../../../src/temporal/nuits/contrat.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,oDAAoD;AACpD,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,gDAAgD;AAEhD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AACxC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,gCAAgC,CAAC;AAC7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;AAC9C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AACnE,iDAAiD;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AACzD,iGAAiG;AACjG,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AACrC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,wGAAwG;AACxG,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"contrat.js","sourceRoot":"","sources":["../../../src/temporal/nuits/contrat.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,oDAAoD;AACpD,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,gDAAgD;AAEhD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AACxC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,gCAAgC,CAAC;AAC7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;AAC9C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AACnE,iDAAiD;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AACzD,uGAAuG;AACvG,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AACvC,wFAAwF;AACxF,MAAM,CAAC,MAAM,6BAA6B,GAAG,wBAAwB,CAAC;AACtE,sGAAsG;AACtG,MAAM,CAAC,MAAM,oBAAoB,GAAG,kCAAkC,CAAC;AACvE,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAC3C,gFAAgF;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;AAE5C,iGAAiG;AACjG,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAC;AACrC;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AACnC,wGAAwG;AACxG,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC"}
|
|
@@ -3,3 +3,8 @@ import { type EntreeDesNuits, type VueDesNuits } from './contrat.js';
|
|
|
3
3
|
export declare function nuitsDeLaMachine(entree?: EntreeDesNuits): Promise<VueDesNuits>;
|
|
4
4
|
/** The workflow the schedule starts: it asks for the scheduled nights, and ends. */
|
|
5
5
|
export declare function nuitPlanifiee(): Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* The workflow the second schedule starts at 01:45 Paris time: it plays the part of PC2 of the
|
|
8
|
+
* night by ssh (the activity `jouerLaNuitDePc2`), then ends.
|
|
9
|
+
*/
|
|
10
|
+
export declare function nuitDePc2(): Promise<void>;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// - Once the queue is empty and no request waits, the workflow ends; the next request starts it
|
|
16
16
|
// again. Past its length of history it continues as new with its queue.
|
|
17
17
|
// Deterministic: it imports the workflow API and the contract.
|
|
18
|
-
import { allHandlersFinished, condition, continueAsNew, defineQuery, defineSignal, proxyActivities, setHandler, workflowInfo, setWorkflowOptions, } from '@temporalio/workflow';
|
|
18
|
+
import { allHandlersFinished, condition, deprecatePatch, continueAsNew, defineQuery, defineSignal, proxyActivities, setHandler, workflowInfo, setWorkflowOptions, } from '@temporalio/workflow';
|
|
19
19
|
import { DEMANDER, L_ETAT_DES_NUITS, } from './contrat.js';
|
|
20
20
|
const actes = proxyActivities({
|
|
21
21
|
startToCloseTimeout: '5 minutes',
|
|
@@ -28,6 +28,13 @@ const { jouerLaNuit } = proxyActivities({
|
|
|
28
28
|
heartbeatTimeout: '5 minutes',
|
|
29
29
|
retry: { maximumAttempts: 2 },
|
|
30
30
|
});
|
|
31
|
+
// The part of PC2 of the nights, played by ssh from this worker: it lasts hours, its heartbeat says
|
|
32
|
+
// it lives. A second attempt follows the pass already started on PC2 (the same id of pass).
|
|
33
|
+
const { jouerLaNuitDePc2 } = proxyActivities({
|
|
34
|
+
startToCloseTimeout: '12 hours',
|
|
35
|
+
heartbeatTimeout: '5 minutes',
|
|
36
|
+
retry: { maximumAttempts: 3 },
|
|
37
|
+
});
|
|
31
38
|
const demander = defineSignal(DEMANDER);
|
|
32
39
|
const lEtat = defineQuery(L_ETAT_DES_NUITS);
|
|
33
40
|
const LIMITE_D_HISTOIRE = 2000;
|
|
@@ -106,4 +113,14 @@ export async function nuitPlanifiee() {
|
|
|
106
113
|
await actes.demanderLesNuitsPlanifiees();
|
|
107
114
|
}
|
|
108
115
|
setWorkflowOptions({ versioningBehavior: 'AUTO_UPGRADE' }, nuitPlanifiee);
|
|
116
|
+
/**
|
|
117
|
+
* The workflow the second schedule starts at 01:45 Paris time: it plays the part of PC2 of the
|
|
118
|
+
* night by ssh (the activity `jouerLaNuitDePc2`), then ends.
|
|
119
|
+
*/
|
|
120
|
+
export async function nuitDePc2() {
|
|
121
|
+
// The marker of the histories that played the part of PC2 by ssh; its total removal is the next ticket's.
|
|
122
|
+
deprecatePatch('nuit-de-pc2-par-ssh');
|
|
123
|
+
await jouerLaNuitDePc2();
|
|
124
|
+
}
|
|
125
|
+
setWorkflowOptions({ versioningBehavior: 'AUTO_UPGRADE' }, nuitDePc2);
|
|
109
126
|
//# sourceMappingURL=deroule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deroule.js","sourceRoot":"","sources":["../../../src/temporal/nuits/deroule.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,4DAA4D;AAC5D,mGAAmG;AACnG,qFAAqF;AACrF,6FAA6F;AAC7F,8FAA8F;AAC9F,EAAE;AACF,+FAA+F;AAC/F,8FAA8F;AAC9F,wEAAwE;AACxE,wEAAwE;AACxE,qEAAqE;AACrE,kGAAkG;AAClG,iFAAiF;AACjF,gGAAgG;AAChG,0EAA0E;AAC1E,+DAA+D;AAC/D,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,aAAa,EACb,WAAW,EACX,YAAY,EACZ,eAAe,EACf,UAAU,EACV,YAAY,EACZ,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,QAAQ,EACR,gBAAgB,GAKjB,MAAM,cAAc,CAAC;AAEtB,MAAM,KAAK,GAAG,eAAe,CAAoB;IAC/C,mBAAmB,EAAE,WAAW;IAChC,KAAK,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,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MAAM,aAAa,CAA0B;gBAC3C,GAAG,MAAM;gBACT,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE;aAC3C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC;AAED,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,EAAE,gBAAgB,CAAC,CAAC;AAE7E,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,KAAK,CAAC,0BAA0B,EAAE,CAAC;AAC3C,CAAC;AAED,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,EAAE,aAAa,CAAC,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,0GAA0G;IAC1G,cAAc,CAAC,qBAAqB,CAAC,CAAC;IACtC,MAAM,gBAAgB,EAAE,CAAC;AAC3B,CAAC;AAED,kBAAkB,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/** The most a verdict of PC2 weighs, in bytes. */
|
|
2
|
+
export declare const TAILLE_MAX_DU_VERDICT: number;
|
|
3
|
+
/** The only verbs that leave for PC2. */
|
|
4
|
+
export declare const VERBES_DE_PC2: readonly ["sonde", "lancer", "etat", "verdict"];
|
|
5
|
+
type Verbe = (typeof VERBES_DE_PC2)[number];
|
|
6
|
+
/** A tranche of the verdict of PC2: a task, its verdict and its output (text). */
|
|
7
|
+
export interface Tranche {
|
|
8
|
+
nom: string;
|
|
9
|
+
verdict: 'vert' | 'rouge';
|
|
10
|
+
sortie: string;
|
|
11
|
+
}
|
|
12
|
+
/** What the part of PC2 gives back: its exit code (0 green, 1 red, 75 to replay) and its tranches. */
|
|
13
|
+
export interface PartDePc2 {
|
|
14
|
+
code: number;
|
|
15
|
+
tranches: Tranche[];
|
|
16
|
+
raison?: string;
|
|
17
|
+
}
|
|
18
|
+
/** `nuit-<projet>-<date in Paris>`: one pass per night. */
|
|
19
|
+
export declare function identifiantDePc2(projet: string, d: Date): string;
|
|
20
|
+
/** The ssh alias of PC2 that `GRILLHOUSE_NUIT_PC2_HOTE` names; undefined when none is set. */
|
|
21
|
+
export declare function hoteDePc2(env: Record<string, string | undefined>): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The verdict text of PC2 read against its schema `{ identifiant, commit, verdict, taches: [{ nom,
|
|
24
|
+
* verdict, sortie }] }` (no other key), 256 KiB at most, the names of the tasks among <taches>.
|
|
25
|
+
*/
|
|
26
|
+
export declare function lireLeVerdictDePc2(texte: string, taches: string[]): {
|
|
27
|
+
ok: true;
|
|
28
|
+
code: number;
|
|
29
|
+
tranches: Tranche[];
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
raison: string;
|
|
33
|
+
};
|
|
34
|
+
/** What goes to PC2 before `lancer`: the push of the night copy and of the tool by rsync. */
|
|
35
|
+
interface PousseeDePc2 {
|
|
36
|
+
/** The version of the frame on PC3: `sonde` must say the same. */
|
|
37
|
+
version: string;
|
|
38
|
+
/** Runs `rsync <args>` (the ssh of the transfer is its own): its exit code and its output. */
|
|
39
|
+
rsync: (args: string[]) => Promise<{
|
|
40
|
+
code: number;
|
|
41
|
+
sortie: string;
|
|
42
|
+
}>;
|
|
43
|
+
/** The night copy of the project (`.git` and submodules included), or what makes it. */
|
|
44
|
+
copie: string | (() => Promise<string>);
|
|
45
|
+
/** The tool of the version of PC3. */
|
|
46
|
+
outil: string | (() => Promise<string>);
|
|
47
|
+
}
|
|
48
|
+
export interface EntreeDePc2 {
|
|
49
|
+
/** The push to PC2 before the start of the pass; absent, nothing is pushed nor probed. */
|
|
50
|
+
poussee?: PousseeDePc2;
|
|
51
|
+
projet: string;
|
|
52
|
+
/** The git common dir of the project, where `nuit/verdict-pc2` is written. */
|
|
53
|
+
commun: string;
|
|
54
|
+
/** The ssh alias of PC2; undefined: the poste plays everything. */
|
|
55
|
+
hote: string | undefined;
|
|
56
|
+
/** The tasks the project declares. */
|
|
57
|
+
taches: string[];
|
|
58
|
+
maintenant: () => Date;
|
|
59
|
+
/** Runs `ssh <hote> <verbe> <args>`: its exit code (255 a cut connection) and its output. */
|
|
60
|
+
ssh: (hote: string, verbe: Verbe, args: string[]) => Promise<{
|
|
61
|
+
code: number;
|
|
62
|
+
sortie: string;
|
|
63
|
+
}>;
|
|
64
|
+
attendre: (ms: number) => Promise<void>;
|
|
65
|
+
battre: () => void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Plays the part of PC2 of the night of <e.projet>: null without a host (the poste plays all), else
|
|
69
|
+
* its code and tranches; 75 with its `raison` when ssh fails, the previous verdict kept.
|
|
70
|
+
*/
|
|
71
|
+
export declare function jouerLaPartDePc2(e: EntreeDePc2): Promise<PartDePc2 | null>;
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// The part of PC2 of the night, played from PC3 by ssh (packages/grillhouse/docs/architecture/
|
|
2
|
+
// entree.md §3.1 « Part de PC2, côté PC3 », §3.3 « PC2 et PC3 », §5.3 « Quand ssh échoue »): a
|
|
3
|
+
// worker of PC3 starts the pass on PC2 (`ssh <alias> lancer <projet> <identifiant>`), follows it
|
|
4
|
+
// (`etat`, once a minute, with a heartbeat), reads its verdict (`verdict`), checks it against its
|
|
5
|
+
// schema and writes it to `nuit/verdict-pc2`. What PC2 gives back is untrusted data: bounded,
|
|
6
|
+
// validated, never executed. Every failure is 75 (« à repasser ») with its reason, never replayed
|
|
7
|
+
// on the poste. The ssh, the clock and the heartbeat are seams, so that a small test plays it.
|
|
8
|
+
import { noterLeVerdict } from '../../../scripts/verdict-de-la-nuit.mjs';
|
|
9
|
+
import { FUSEAU_DE_PC2 } from './contrat.js';
|
|
10
|
+
/** The most a verdict of PC2 weighs, in bytes. */
|
|
11
|
+
export const TAILLE_MAX_DU_VERDICT = 256 * 1024;
|
|
12
|
+
/** The delay past which the follow of a pass ends (the closing delay of the activity). */
|
|
13
|
+
const DELAI_DE_FERMETURE_MS = 12 * 3600_000;
|
|
14
|
+
const SUIVI_MS = 60_000;
|
|
15
|
+
const ESSAIS = 3;
|
|
16
|
+
const PAUSE_ENTRE_ESSAIS_MS = 5_000;
|
|
17
|
+
/** The only verbs that leave for PC2. */
|
|
18
|
+
export const VERBES_DE_PC2 = ['sonde', 'lancer', 'etat', 'verdict'];
|
|
19
|
+
const slug = (s) => s
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
22
|
+
.replace(/^-+|-+$/g, '') || 'projet';
|
|
23
|
+
/** `nuit-<projet>-<date in Paris>`: one pass per night. */
|
|
24
|
+
export function identifiantDePc2(projet, d) {
|
|
25
|
+
const jour = new Intl.DateTimeFormat('en-CA', {
|
|
26
|
+
timeZone: FUSEAU_DE_PC2,
|
|
27
|
+
year: 'numeric',
|
|
28
|
+
month: '2-digit',
|
|
29
|
+
day: '2-digit',
|
|
30
|
+
}).format(d);
|
|
31
|
+
return `nuit-${slug(projet)}-${jour}`;
|
|
32
|
+
}
|
|
33
|
+
/** The ssh alias of PC2 that `GRILLHOUSE_NUIT_PC2_HOTE` names; undefined when none is set. */
|
|
34
|
+
export function hoteDePc2(env) {
|
|
35
|
+
const h = env.GRILLHOUSE_NUIT_PC2_HOTE?.trim();
|
|
36
|
+
return h ? h : undefined;
|
|
37
|
+
}
|
|
38
|
+
const ILLISIBLE = { ok: false, raison: 'verdict illisible' };
|
|
39
|
+
const estVerdict = (v) => v === 'vert' || v === 'rouge';
|
|
40
|
+
const memesCles = (o, cles) => {
|
|
41
|
+
const k = Object.keys(o).sort();
|
|
42
|
+
return k.length === cles.length && cles.every((c, i) => c === k[i]);
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The verdict text of PC2 read against its schema `{ identifiant, commit, verdict, taches: [{ nom,
|
|
46
|
+
* verdict, sortie }] }` (no other key), 256 KiB at most, the names of the tasks among <taches>.
|
|
47
|
+
*/
|
|
48
|
+
export function lireLeVerdictDePc2(texte, taches) {
|
|
49
|
+
if (Buffer.byteLength(texte, 'utf8') > TAILLE_MAX_DU_VERDICT) {
|
|
50
|
+
return ILLISIBLE;
|
|
51
|
+
}
|
|
52
|
+
let v;
|
|
53
|
+
try {
|
|
54
|
+
v = JSON.parse(texte);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return ILLISIBLE;
|
|
58
|
+
}
|
|
59
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v)) {
|
|
60
|
+
return ILLISIBLE;
|
|
61
|
+
}
|
|
62
|
+
const o = v;
|
|
63
|
+
if (!memesCles(o, ['commit', 'identifiant', 'taches', 'verdict']) ||
|
|
64
|
+
typeof o.identifiant !== 'string' ||
|
|
65
|
+
typeof o.commit !== 'string' ||
|
|
66
|
+
!estVerdict(o.verdict) ||
|
|
67
|
+
!Array.isArray(o.taches)) {
|
|
68
|
+
return ILLISIBLE;
|
|
69
|
+
}
|
|
70
|
+
const tranches = [];
|
|
71
|
+
for (const t of o.taches) {
|
|
72
|
+
if (typeof t !== 'object' || t === null || Array.isArray(t)) {
|
|
73
|
+
return ILLISIBLE;
|
|
74
|
+
}
|
|
75
|
+
const x = t;
|
|
76
|
+
if (!memesCles(x, ['nom', 'sortie', 'verdict']) ||
|
|
77
|
+
typeof x.nom !== 'string' ||
|
|
78
|
+
!taches.includes(x.nom) ||
|
|
79
|
+
typeof x.sortie !== 'string' ||
|
|
80
|
+
!estVerdict(x.verdict)) {
|
|
81
|
+
return ILLISIBLE;
|
|
82
|
+
}
|
|
83
|
+
tranches.push({ nom: x.nom, verdict: x.verdict, sortie: x.sortie });
|
|
84
|
+
}
|
|
85
|
+
return { ok: true, code: o.verdict === 'vert' ? 0 : 1, tranches };
|
|
86
|
+
}
|
|
87
|
+
// The probe, then the push of the copy and of the tool (rsync, `-a --delete`: nothing excluded, the
|
|
88
|
+
// `.git` and the submodules go with it); the reason of a « à repasser », or null when all is set.
|
|
89
|
+
async function pousser(p, hote, id, essayer) {
|
|
90
|
+
const sonde = await essayer('sonde');
|
|
91
|
+
if (sonde === null) {
|
|
92
|
+
return 'PC2 injoignable';
|
|
93
|
+
}
|
|
94
|
+
const versionDePc2 = sonde.sortie.trim();
|
|
95
|
+
if (versionDePc2 !== p.version) {
|
|
96
|
+
return `version du cadre sur PC2 : ${versionDePc2.slice(0, 40)}, attendue ${p.version}`;
|
|
97
|
+
}
|
|
98
|
+
for (const [source, sous] of [
|
|
99
|
+
[p.copie, 'copie'],
|
|
100
|
+
[p.outil, 'outil'],
|
|
101
|
+
]) {
|
|
102
|
+
let dossier;
|
|
103
|
+
try {
|
|
104
|
+
dossier = typeof source === 'string' ? source : await source();
|
|
105
|
+
}
|
|
106
|
+
catch (erreur) {
|
|
107
|
+
return `${sous} à pousser : ${String(erreur instanceof Error ? erreur.message : erreur).slice(0, 200)}`;
|
|
108
|
+
}
|
|
109
|
+
const r = await p.rsync([
|
|
110
|
+
'-a',
|
|
111
|
+
'--delete',
|
|
112
|
+
'--numeric-ids',
|
|
113
|
+
`${dossier.replace(/\/+$/, '')}/`,
|
|
114
|
+
`${hote}:${id}/${sous}/`,
|
|
115
|
+
]);
|
|
116
|
+
if (r.code !== 0) {
|
|
117
|
+
return `poussée de la ${sous} : rsync sort en ${r.code} ${r.sortie.trim().slice(0, 200)}`.trim();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Plays the part of PC2 of the night of <e.projet>: null without a host (the poste plays all), else
|
|
124
|
+
* its code and tranches; 75 with its `raison` when ssh fails, the previous verdict kept.
|
|
125
|
+
*/
|
|
126
|
+
export async function jouerLaPartDePc2(e) {
|
|
127
|
+
const { hote } = e;
|
|
128
|
+
if (hote === undefined) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
const debut = e.maintenant().getTime();
|
|
132
|
+
const projet = slug(e.projet);
|
|
133
|
+
const id = identifiantDePc2(e.projet, e.maintenant());
|
|
134
|
+
const appeler = async (verbe) => {
|
|
135
|
+
try {
|
|
136
|
+
return await e.ssh(hote, verbe, verbe === 'sonde' ? [] : [projet, id]);
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return { code: 255, sortie: '' };
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
// A verb tried three times: its answer, or null when PC2 does not answer.
|
|
143
|
+
const essayer = async (verbe) => {
|
|
144
|
+
for (let i = 0; i < ESSAIS; i++) {
|
|
145
|
+
if (i > 0) {
|
|
146
|
+
await e.attendre(PAUSE_ENTRE_ESSAIS_MS);
|
|
147
|
+
}
|
|
148
|
+
const r = await appeler(verbe);
|
|
149
|
+
if (r.code === 0) {
|
|
150
|
+
return r;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
};
|
|
155
|
+
const arreter = (raison) => {
|
|
156
|
+
noterLeVerdict(e.commun, 75, 'pc2', [raison]);
|
|
157
|
+
return { code: 75, tranches: [], raison };
|
|
158
|
+
};
|
|
159
|
+
const premier = await essayer('etat');
|
|
160
|
+
if (premier === null) {
|
|
161
|
+
return arreter('PC2 injoignable');
|
|
162
|
+
}
|
|
163
|
+
let etat = premier.sortie.trim();
|
|
164
|
+
if (etat === 'inconnue') {
|
|
165
|
+
if (e.poussee !== undefined) {
|
|
166
|
+
const raison = await pousser(e.poussee, hote, id, essayer);
|
|
167
|
+
if (raison !== null) {
|
|
168
|
+
return arreter(raison);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if ((await essayer('lancer')) === null) {
|
|
172
|
+
return arreter('PC2 injoignable');
|
|
173
|
+
}
|
|
174
|
+
etat = 'en-cours';
|
|
175
|
+
}
|
|
176
|
+
while (etat !== 'finie') {
|
|
177
|
+
if (etat !== 'en-cours' || e.maintenant().getTime() - debut >= DELAI_DE_FERMETURE_MS) {
|
|
178
|
+
return arreter('connexion perdue');
|
|
179
|
+
}
|
|
180
|
+
await e.attendre(SUIVI_MS);
|
|
181
|
+
e.battre();
|
|
182
|
+
const r = await appeler('etat');
|
|
183
|
+
if (r.code !== 0) {
|
|
184
|
+
return arreter('connexion perdue');
|
|
185
|
+
}
|
|
186
|
+
etat = r.sortie.trim();
|
|
187
|
+
}
|
|
188
|
+
const v = await appeler('verdict');
|
|
189
|
+
if (v.code === 75) {
|
|
190
|
+
// PC2 says it could not judge: its reason is a text of an untrusted source, bounded, never run.
|
|
191
|
+
const lisible = [...v.sortie]
|
|
192
|
+
.map(c => (c.charCodeAt(0) < 32 || c === '\u007f' ? ' ' : c))
|
|
193
|
+
.join('');
|
|
194
|
+
return arreter(lisible.trim().slice(0, 200) || 'passe de PC2 à repasser');
|
|
195
|
+
}
|
|
196
|
+
if (v.code !== 0) {
|
|
197
|
+
return arreter('connexion perdue');
|
|
198
|
+
}
|
|
199
|
+
const lu = lireLeVerdictDePc2(v.sortie, e.taches);
|
|
200
|
+
if (!lu.ok) {
|
|
201
|
+
return arreter(lu.raison);
|
|
202
|
+
}
|
|
203
|
+
noterLeVerdict(e.commun, lu.code, 'pc2');
|
|
204
|
+
return { code: lu.code, tranches: lu.tranches };
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=pc2.js.map
|