@ucm-kit/cli 0.1.39 → 0.1.40
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 +30 -12
- package/aides/resolution-token.md +8 -1
- package/package.json +2 -2
- package/src/init.mjs +92 -40
- package/src/rapport-gitlab.mjs +2 -2
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ next to the component's code. This command reads those files and says whether
|
|
|
11
11
|
they still hold together.
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
15
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
14
|
+
npx --yes @ucm-kit/cli@0.1.40 init
|
|
15
|
+
npx --yes @ucm-kit/cli@0.1.40 check --report ci-report.md
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
Pin an exact version, without `^`. A range would let npx install a build this
|
|
@@ -64,7 +64,7 @@ not write React states its own extension here, rather than carrying a `.tsx`
|
|
|
64
64
|
that was wrong the day it was installed:
|
|
65
65
|
|
|
66
66
|
```sh
|
|
67
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
67
|
+
npx --yes @ucm-kit/cli@0.1.40 init --components Sources/DesignSystem --implementation '{dir}/{id}.swift'
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
All three act only on a first install: `ucm init` never overwrites an existing
|
|
@@ -219,7 +219,7 @@ is, and the command names what it left alone.
|
|
|
219
219
|
| `.gitattributes` | Keeps contracts and tokens in LF, so a re-export from a Windows machine does not produce a whole-file diff |
|
|
220
220
|
| `.vscode/settings.json` | Binds `*.contract.json` to the JSON Schema of the installed package, so the editor validates as you read |
|
|
221
221
|
| `.gitignore` | Keeps `ci-report.md` out of the repository; it is regenerated on every run and describes only that run |
|
|
222
|
-
| `.github/workflows/ucm.yml` | Runs the check on every pull request and posts the report as a comment |
|
|
222
|
+
| `.github/workflows/ucm.yml` | Runs the check on every pull request and posts the report as a comment, from a second job |
|
|
223
223
|
| `.agents/skills/ucm-implementer/SKILL.md`, `.claude/skills/ucm-implementer/SKILL.md` | Two identical relays: an agent loads one before writing a component, and runs `ucm guide` at the pinned version |
|
|
224
224
|
| `.ucm/conventions.md` | The repository's stack and writings, with its instructions in a comment |
|
|
225
225
|
| `.ucm/gabarits/` | The templates of the installed stack adapter, when it publishes some |
|
|
@@ -256,6 +256,12 @@ is malformed is refused on both sides.
|
|
|
256
256
|
`implementation` is a pattern with two tokens, `{dir}` for the contract's folder
|
|
257
257
|
and `{id}` for its identifier. Replace it with the pattern your repository uses.
|
|
258
258
|
|
|
259
|
+
Each of the three paths is relative to the repository root and written with
|
|
260
|
+
`/`. A path that starts with `/` or a drive letter, contains `\`, or has an
|
|
261
|
+
empty, `.` or `..` segment is refused on both sides: the plugin would write
|
|
262
|
+
outside the repository with the designer's token, and the check would read
|
|
263
|
+
outside it.
|
|
264
|
+
|
|
259
265
|
No version number goes in this file. Which contract versions can be read belongs
|
|
260
266
|
to the installed package, and repeating it here would create a second authority
|
|
261
267
|
that drifts on the first update.
|
|
@@ -317,28 +323,40 @@ when an orchestrator passes it in through `UCM_ECHECS_DE_TESTS`.
|
|
|
317
323
|
of the `origin` remote does, then the presence of `.gitlab-ci.yml`, and GitHub
|
|
318
324
|
otherwise. The command names the forge and the signal it followed.
|
|
319
325
|
|
|
320
|
-
For GitLab it writes `.gitlab/ucm.gitlab-ci.yml`,
|
|
321
|
-
|
|
322
|
-
request pipelines and on the default branch
|
|
323
|
-
|
|
326
|
+
For GitLab it writes `.gitlab/ucm.gitlab-ci.yml`, two jobs with no global key,
|
|
327
|
+
so the project's other jobs keep their rules. `ucm` runs the check in merge
|
|
328
|
+
request pipelines and on the default branch; `ucm-rapport` posts the note in
|
|
329
|
+
merge request pipelines. Both take the default `test` stage. A new
|
|
330
|
+
`.gitlab-ci.yml` includes the file; an existing one is left alone, and the
|
|
324
331
|
command prints the `include` line to add. It also prints three settings it
|
|
325
332
|
cannot make:
|
|
326
333
|
|
|
327
334
|
- create the CI/CD variable `UCM_GITLAB_TOKEN`, masked and not protected,
|
|
328
|
-
holding
|
|
329
|
-
|
|
335
|
+
holding an `api` token of an account with the Reporter role on this project
|
|
336
|
+
only: a service account's personal token, or a project access token where
|
|
337
|
+
the GitLab plan offers one. Export branches are not protected, so a
|
|
338
|
+
protected variable would be empty there. Every pipeline of every branch reads
|
|
339
|
+
an unprotected variable, and whoever pushes a branch can print it: the
|
|
340
|
+
Reporter role limits that token to reading and commenting;
|
|
330
341
|
- tick "Pipelines must succeed" in the merge request settings. Without it, a red
|
|
331
342
|
report does not block the merge it says is blocked;
|
|
332
343
|
- keep `test` in `stages:` when `.gitlab-ci.yml` declares them: GitLab refuses a
|
|
333
344
|
pipeline whose job names a missing stage.
|
|
334
345
|
|
|
335
|
-
`
|
|
346
|
+
`ucm` unsets `UCM_GITLAB_TOKEN` before `npm ci`, so install scripts do not
|
|
347
|
+
inherit it on executors that set variables in the job script. `ucm-rapport`
|
|
348
|
+
runs no code from the repository: it clones nothing, receives `ci-report.md`
|
|
349
|
+
as an artifact, disables install scripts, and runs `npx` from an empty
|
|
350
|
+
directory. It writes a minimal report when the check stopped before writing
|
|
336
351
|
one, then posts the report:
|
|
337
352
|
|
|
338
353
|
```sh
|
|
339
|
-
npx --yes @ucm-kit/cli@0.1.
|
|
354
|
+
npx --yes @ucm-kit/cli@0.1.40 rapport-gitlab --projet "$CI_PROJECT_ID" --merge-request "$CI_MERGE_REQUEST_IID" --fichier "$CI_PROJECT_DIR/ci-report.md" --api "$CI_API_V4_URL"
|
|
340
355
|
```
|
|
341
356
|
|
|
357
|
+
The job allows failure: a refused token leaves the pipeline the colour of the
|
|
358
|
+
check, and the report stays in the artifacts.
|
|
359
|
+
|
|
342
360
|
The command reads the token from `UCM_GITLAB_TOKEN` and never prints it. It
|
|
343
361
|
replaces the note that the token's account wrote with the `<!-- ucm-rapport -->`
|
|
344
362
|
marker, across every page of notes, and creates one otherwise. Without the
|
|
@@ -12,7 +12,14 @@ pistes de grille sont les seules valeurs brutes prévues. Les références d'un
|
|
|
12
12
|
contrat se relèvent partout sauf dans `samples` et `meta`, dont une chaîne en
|
|
13
13
|
forme de référence est un texte.
|
|
14
14
|
|
|
15
|
+
Quand ce moyen est une propriété personnalisée CSS, son nom est celui que
|
|
16
|
+
`tokenCssVariable` donne, et la feuille d'`ucm tokens css` le déclare. Une
|
|
17
|
+
projection recopiée tient la même règle : l'accent tombe et la lettre reste.
|
|
18
|
+
`café.fond` donne `--cafe-fond` ; une copie qui remplace tout caractère non
|
|
19
|
+
ASCII vise `--caf-fond`, une variable absente, sans erreur.
|
|
20
|
+
|
|
15
21
|
## Preuve
|
|
16
22
|
|
|
17
23
|
`ucm check`, section tokens. Relecture : aucune valeur littérale à la place
|
|
18
|
-
d'une référence
|
|
24
|
+
d'une référence, et aucune projection de nom qui s'écarte de
|
|
25
|
+
`tokenCssVariable`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucm-kit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.40",
|
|
4
4
|
"description": "La ligne de commande UCM : initialiser un repository, lister ce qu'il doit couvrir.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test": "node scripts/run-tests.cjs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ucm-kit/core": "0.1.
|
|
32
|
+
"@ucm-kit/core": "0.1.36"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"yaml": "^2.9.1"
|
package/src/init.mjs
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
CONFIGURATION_PAR_DEFAUT,
|
|
32
32
|
MOTIF_IMPLEMENTATION_PAR_DEFAUT,
|
|
33
33
|
NOM_CONFIGURATION,
|
|
34
|
+
estCheminDuRepository,
|
|
34
35
|
} from "@ucm-kit/core/format";
|
|
35
36
|
import { lireConfiguration } from "@ucm-kit/core/lecteurs";
|
|
36
37
|
|
|
@@ -51,18 +52,14 @@ const OPTIONS_DE_DOSSIER = { "--components": "components", "--tokens": "tokens"
|
|
|
51
52
|
const NOM_FICHIER_TOKENS = CONFIGURATION_PAR_DEFAUT.tokens.split("/").pop();
|
|
52
53
|
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* est une autre question, et c'est celle-là qui se pose ici.
|
|
55
|
+
* Le chemin tapé, écrit comme la grammaire du kit l'accepte, ou `null`.
|
|
56
|
+
*
|
|
57
|
+
* Le clavier tolère `\` et des barres obliques de bord ; le fichier écrit n'en
|
|
58
|
+
* garde aucune, et la grammaire décide du reste.
|
|
59
59
|
*/
|
|
60
60
|
function cheminAcceptable(valeur) {
|
|
61
61
|
const normalise = valeur.trim().replace(/\\/g, "/").replace(/^\/+|\/+$/g, "");
|
|
62
|
-
|
|
63
|
-
const segments = normalise.split("/");
|
|
64
|
-
if (segments.some((segment) => !segment || segment === "." || segment === "..")) return null;
|
|
65
|
-
return segments.join("/");
|
|
62
|
+
return estCheminDuRepository(normalise) ? normalise : null;
|
|
66
63
|
}
|
|
67
64
|
|
|
68
65
|
/**
|
|
@@ -407,6 +404,14 @@ function lignesRestantes(racine, version, configuration) {
|
|
|
407
404
|
* « le rapport manque ». Le premier décrit sa chaîne de construction, qu'un
|
|
408
405
|
* repo Swift n'a pas. Le second est universel : une pull request refusée sans
|
|
409
406
|
* un mot laisse le designer sans recours.
|
|
407
|
+
*
|
|
408
|
+
* **Le job qui exécute le code du repository n'écrit nulle part.** `npm ci`
|
|
409
|
+
* lance les scripts d'installation des dépendances, et un paquet compromis
|
|
410
|
+
* lirait le jeton du job, même hors de l'environnement. Le commentaire part
|
|
411
|
+
* donc d'un second job, sans checkout ni npm, qui reçoit le rapport en
|
|
412
|
+
* artefact. L'auteur d'une branche du repository peut réécrire ce fichier :
|
|
413
|
+
* la séparation ne borne que ce qu'une dépendance obtient. Une fourche reçoit
|
|
414
|
+
* de GitHub un jeton en lecture seule, et son commentaire échoue.
|
|
410
415
|
*/
|
|
411
416
|
function workflow(version) {
|
|
412
417
|
const commande = `npx --yes @ucm-kit/cli@${version} check --report ci-report.md`;
|
|
@@ -417,6 +422,10 @@ function workflow(version) {
|
|
|
417
422
|
"# designer qui valide un export : il n'ouvre pas les logs de la CI. Toute",
|
|
418
423
|
"# étape qui refuse une fusion doit donc lui laisser un message.",
|
|
419
424
|
"#",
|
|
425
|
+
"# Le job `contrats` exécute le code du repository et ses dépendances : il",
|
|
426
|
+
"# ne porte aucun droit d'écriture. Seul `commentaire`, qui n'exécute rien",
|
|
427
|
+
"# du repository, écrit sur la pull request.",
|
|
428
|
+
"#",
|
|
420
429
|
"# Écrit par `ucm init`. Adaptez-le : il ne sera jamais réécrit par-dessus.",
|
|
421
430
|
"name: ucm",
|
|
422
431
|
"",
|
|
@@ -425,17 +434,15 @@ function workflow(version) {
|
|
|
425
434
|
" branches: [main]",
|
|
426
435
|
" pull_request:",
|
|
427
436
|
"",
|
|
428
|
-
"# Nécessaire pour publier le diagnostic en commentaire de pull request.",
|
|
429
437
|
"permissions:",
|
|
430
438
|
" contents: read",
|
|
431
|
-
" pull-requests: write",
|
|
432
439
|
"",
|
|
433
440
|
"jobs:",
|
|
434
441
|
" contrats:",
|
|
435
442
|
" runs-on: ubuntu-latest",
|
|
436
443
|
" steps:",
|
|
437
444
|
" # Le job exécute le code de la pull request : il n'a aucune raison de",
|
|
438
|
-
" # garder un jeton git utilisable.
|
|
445
|
+
" # garder un jeton git utilisable.",
|
|
439
446
|
" - uses: actions/checkout@v4",
|
|
440
447
|
" with:",
|
|
441
448
|
" persist-credentials: false",
|
|
@@ -484,33 +491,59 @@ function workflow(version) {
|
|
|
484
491
|
" **Action attendue :** un développeur doit ouvrir [l'exécution de la CI]($RUN_URL) pour en connaître la raison.",
|
|
485
492
|
" EOF",
|
|
486
493
|
"",
|
|
487
|
-
" #
|
|
494
|
+
" # Le rapport passe au job `commentaire`. Une dépendance a pu le",
|
|
495
|
+
" # réécrire : il part en corps de commentaire, jamais en commande.",
|
|
496
|
+
" - name: Transmettre le rapport",
|
|
497
|
+
" if: always() && github.event_name == 'pull_request'",
|
|
498
|
+
" uses: actions/upload-artifact@v4",
|
|
499
|
+
" with:",
|
|
500
|
+
" name: ucm-rapport",
|
|
501
|
+
" path: ci-report.md",
|
|
502
|
+
" retention-days: 1",
|
|
503
|
+
"",
|
|
504
|
+
" commentaire:",
|
|
505
|
+
" needs: contrats",
|
|
506
|
+
" # `!cancelled()` et non `always()` : un run annulé ne commente pas.",
|
|
507
|
+
" if: ${{ !cancelled() && github.event_name == 'pull_request' }}",
|
|
508
|
+
" runs-on: ubuntu-latest",
|
|
509
|
+
" permissions:",
|
|
510
|
+
" pull-requests: write",
|
|
511
|
+
" steps:",
|
|
512
|
+
" - uses: actions/download-artifact@v4",
|
|
513
|
+
" with:",
|
|
514
|
+
" name: ucm-rapport",
|
|
515
|
+
"",
|
|
488
516
|
" - name: Publier le diagnostic sur la pull request",
|
|
489
|
-
" if: always() && github.event_name == 'pull_request' && hashFiles('ci-report.md') != ''",
|
|
490
517
|
" env:",
|
|
491
518
|
" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}",
|
|
492
519
|
" NUMERO: ${{ github.event.number }}",
|
|
493
520
|
" # --edit-last met à jour le commentaire précédent au lieu d'en empiler",
|
|
494
521
|
" # un nouveau à chaque push ; s'il n'en existe pas encore, on en crée un.",
|
|
495
522
|
" run: |",
|
|
496
|
-
' gh pr comment "$NUMERO" --body-file ci-report.md --edit-last \\',
|
|
497
|
-
' || gh pr comment "$NUMERO" --body-file ci-report.md',
|
|
523
|
+
' gh pr comment "$NUMERO" -R "$GITHUB_REPOSITORY" --body-file ci-report.md --edit-last \\',
|
|
524
|
+
' || gh pr comment "$NUMERO" -R "$GITHUB_REPOSITORY" --body-file ci-report.md',
|
|
498
525
|
"",
|
|
499
526
|
].join("\n");
|
|
500
527
|
}
|
|
501
528
|
|
|
502
529
|
/**
|
|
503
|
-
* Le
|
|
530
|
+
* Le contrôle pour GitLab, dans un fichier que `.gitlab-ci.yml` inclut.
|
|
531
|
+
*
|
|
532
|
+
* **Deux jobs, aucune clé globale.** Ni `workflow`, ni `image`, ni `variables`,
|
|
533
|
+
* ni `stages` : un fichier inclus qui en déclarerait changerait les pipelines
|
|
534
|
+
* de tous les jobs du projet. Chaque job porte ses propres règles.
|
|
504
535
|
*
|
|
505
|
-
* **
|
|
506
|
-
*
|
|
507
|
-
*
|
|
508
|
-
*
|
|
536
|
+
* **Le job qui installe les dépendances ne publie pas la note.** Une variable
|
|
537
|
+
* CI/CD non protégée entre dans l'environnement de tous les jobs, et un script
|
|
538
|
+
* d'installation la lirait. `ucm` la retire avant `npm ci`, ce qui ne vaut que
|
|
539
|
+
* pour les exécuteurs qui posent les variables dans le script ; `ucm-rapport`
|
|
540
|
+
* publie sans clone, depuis un dossier vide, sans script d'installation. Qui
|
|
541
|
+
* pousse une branche peut réécrire ce fichier et lire la variable : seul le
|
|
542
|
+
* rôle du compte qui porte le jeton borne ce qu'il en tire.
|
|
509
543
|
*
|
|
510
|
-
* **
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
* journal, et le rapport reste dans les artefacts.
|
|
544
|
+
* **La note ne refuse jamais une fusion.** `ucm-rapport` tourne après un échec
|
|
545
|
+
* de `ucm`, et `allow_failure` garde le pipeline de la couleur du contrôle
|
|
546
|
+
* quand GitLab refuse le jeton : le rapport reste dans les artefacts.
|
|
514
547
|
*/
|
|
515
548
|
function workflowGitlab(version) {
|
|
516
549
|
const cli = `npx --yes @ucm-kit/cli@${version}`;
|
|
@@ -521,12 +554,14 @@ function workflowGitlab(version) {
|
|
|
521
554
|
"# reçoit le designer qui valide un export : il n'ouvre pas les journaux de",
|
|
522
555
|
"# la CI. Toute étape qui refuse une fusion doit donc lui laisser un message.",
|
|
523
556
|
"#",
|
|
524
|
-
"# Ce fichier ne déclare
|
|
525
|
-
"# projet gardent leurs règles.
|
|
557
|
+
"# Ce fichier ne déclare que deux jobs et aucune clé globale : les autres jobs",
|
|
558
|
+
"# du projet gardent leurs règles. Les deux jobs prennent le stage `test`.",
|
|
526
559
|
"#",
|
|
527
560
|
"# Un job rouge ne bloque la fusion que si « Pipelines must succeed » est",
|
|
528
561
|
"# coché dans Settings > Merge requests. La note demande la variable",
|
|
529
|
-
"# UCM_GITLAB_TOKEN, masquée et non protégée
|
|
562
|
+
"# UCM_GITLAB_TOKEN, masquée et non protégée. Tout pipeline d'une branche du",
|
|
563
|
+
"# projet la lit : son jeton, de scope api, appartient à un compte de rôle",
|
|
564
|
+
"# Reporter sur ce seul projet.",
|
|
530
565
|
"#",
|
|
531
566
|
"# Écrit par `ucm init`. Adaptez-le : il ne sera jamais réécrit par-dessus.",
|
|
532
567
|
"ucm:",
|
|
@@ -538,6 +573,8 @@ function workflowGitlab(version) {
|
|
|
538
573
|
' - if: $CI_PIPELINE_SOURCE == "merge_request_event"',
|
|
539
574
|
" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH",
|
|
540
575
|
" script:",
|
|
576
|
+
" # Les scripts d'installation ne reçoivent pas le jeton de la note.",
|
|
577
|
+
" - unset UCM_GITLAB_TOKEN",
|
|
541
578
|
" # Un adaptateur appartient à la stack du repository. Sans lockfile, le",
|
|
542
579
|
" # noyau portable reste seul.",
|
|
543
580
|
" - if [ -f package-lock.json ]; then npm ci; fi",
|
|
@@ -547,25 +584,40 @@ function workflowGitlab(version) {
|
|
|
547
584
|
" else",
|
|
548
585
|
` ${cli} check --report ci-report.md`,
|
|
549
586
|
" fi",
|
|
550
|
-
"
|
|
551
|
-
"
|
|
587
|
+
" artifacts:",
|
|
588
|
+
" when: always",
|
|
589
|
+
" paths:",
|
|
590
|
+
" - ci-report.md",
|
|
591
|
+
"",
|
|
592
|
+
"ucm-rapport:",
|
|
593
|
+
" image: node:22",
|
|
594
|
+
" needs:",
|
|
595
|
+
" - job: ucm",
|
|
596
|
+
" artifacts: true",
|
|
597
|
+
" rules:",
|
|
598
|
+
' - if: $CI_PIPELINE_SOURCE == "merge_request_event"',
|
|
599
|
+
" when: always",
|
|
600
|
+
" # Un jeton refusé ne rend pas rouge un pipeline dont les contrats sont verts.",
|
|
601
|
+
" allow_failure: true",
|
|
602
|
+
" variables:",
|
|
603
|
+
" # Aucun clone : ni .npmrc ni node_modules du repository.",
|
|
604
|
+
" GIT_STRATEGY: none",
|
|
605
|
+
' NPM_CONFIG_IGNORE_SCRIPTS: "true"',
|
|
606
|
+
" script:",
|
|
607
|
+
" # Filet : sans rapport, `ucm` s'est arrêté avant le contrôle (clone,",
|
|
552
608
|
" # installation, plantage).",
|
|
553
609
|
" - |",
|
|
554
610
|
" if [ ! -f ci-report.md ]; then",
|
|
555
611
|
" printf '%s\\n\\n%s\\n\\n%s\\n' \\",
|
|
556
612
|
" \"## ❌ La vérification n'a pas pu rendre son diagnostic\" \\",
|
|
557
613
|
" \"Les contrôles se sont arrêtés avant d'avoir pu analyser cet export : le rapport habituel n'a pas été produit. **Votre design n'est pas en cause** et réexporter depuis Figma n'y changerait rien.\" \\",
|
|
558
|
-
" \"**Action attendue :** un développeur doit ouvrir [le
|
|
614
|
+
" \"**Action attendue :** un développeur doit ouvrir [le pipeline de la CI]($CI_PIPELINE_URL) pour en connaître la raison.\" \\",
|
|
559
615
|
" > ci-report.md",
|
|
560
616
|
" fi",
|
|
561
|
-
"
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
"
|
|
565
|
-
" artifacts:",
|
|
566
|
-
" when: always",
|
|
567
|
-
" paths:",
|
|
568
|
-
" - ci-report.md",
|
|
617
|
+
" # Depuis un dossier vide, npx ne lit ni configuration ni paquet laissés",
|
|
618
|
+
" # par un job précédent sur le runner.",
|
|
619
|
+
" - cd \"$(mktemp -d)\"",
|
|
620
|
+
` - ${cli} rapport-gitlab --projet "$CI_PROJECT_ID" --merge-request "$CI_MERGE_REQUEST_IID" --fichier "$CI_PROJECT_DIR/ci-report.md" --api "$CI_API_V4_URL"`,
|
|
569
621
|
"",
|
|
570
622
|
].join("\n");
|
|
571
623
|
}
|
|
@@ -578,7 +630,7 @@ function lignesGitlab(racine) {
|
|
|
578
630
|
const lignes = [
|
|
579
631
|
{
|
|
580
632
|
fichier: "Settings > CI/CD > Variables",
|
|
581
|
-
ligne: "créez `UCM_GITLAB_TOKEN`, masquée et non protégée, avec un jeton de scope api. Sans elle, le rapport n'est pas publié sur la merge request. Non protégée, parce que les branches d'export ne le sont pas.",
|
|
633
|
+
ligne: "créez `UCM_GITLAB_TOKEN`, masquée et non protégée, avec un jeton de scope api d'un compte de service membre de ce seul projet, au rôle Reporter, ou un jeton d'accès de projet au rôle Reporter si l'offre le permet. Sans elle, le rapport n'est pas publié sur la merge request. Non protégée, parce que les branches d'export ne le sont pas ; tout pipeline d'une branche la lit, et le rôle Reporter borne ce qu'on en tire à lire et commenter.",
|
|
582
634
|
},
|
|
583
635
|
{
|
|
584
636
|
fichier: "Settings > Merge requests",
|
package/src/rapport-gitlab.mjs
CHANGED
|
@@ -62,7 +62,7 @@ function gesteDuStatut(statut, action) {
|
|
|
62
62
|
}
|
|
63
63
|
if (statut === 403) {
|
|
64
64
|
return `Le jeton de UCM_GITLAB_TOKEN n'a pas le droit de ${action} (403). `
|
|
65
|
-
+ "Un mainteneur du projet doit lui donner le scope api et le rôle
|
|
65
|
+
+ "Un mainteneur du projet doit lui donner le scope api et le rôle Reporter sur ce projet.";
|
|
66
66
|
}
|
|
67
67
|
if (statut === 404) {
|
|
68
68
|
return `GitLab ne trouve pas la merge request en voulant ${action} (404). `
|
|
@@ -94,7 +94,7 @@ export async function rapportGitlab(arguments_, {
|
|
|
94
94
|
if (!jeton) {
|
|
95
95
|
ecrire("UCM_GITLAB_TOKEN est absente : le rapport n'est pas publié sur la merge request. "
|
|
96
96
|
+ "Il reste dans les artefacts du job. Pour le publier, un mainteneur du projet doit créer "
|
|
97
|
-
+ "cette variable, masquée et non protégée, avec un jeton de scope api.");
|
|
97
|
+
+ "cette variable, masquée et non protégée, avec un jeton de scope api d'un compte au rôle Reporter sur ce projet.");
|
|
98
98
|
return 0;
|
|
99
99
|
}
|
|
100
100
|
|