Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ | Rejoignez-nous sur le Chat 💬

Skip to content

Extend “info:report” Job to Emit JSON Status Report on GitLab Pages

We need to enhance the existing info:report CI job so that, in addition to printing a human-readable summary, it emits a machine-readable JSON file (status.json) and publishes it via GitLab Pages. This will allow other tools or badges (via Shields.io) to consume the report automatically.

Objectives

  • Modify the info:report job (templates/info.yml) to generate a JSON file reflecting each test’s status.
  • Copy the JSON into the public/ directory so it is published on the Pages site.
  • Ensure the JSON schema follows Shields.io endpoint format for easy badge integration.

Proposed Implementation

  1. Update bin/final_report.sh

    • After collecting each job status, assemble a JSON object:
      {
        "schemaVersion": 1,
        "pipelineId": 1234,
        "updatedAt": "2025-07-13T12:34:56Z",
        "label": "GitLab status",
        "message": "OK|x failed", # x = number of test failed
        "color": "green|red", # OK = green, red = failed
        "results": {
          "api": "success",
          "pages": "failed",
          
        },
      }
    • Write this JSON to public/status.json.
  2. Adjust templates/info.yml

    • In the info:report job’s script:
      • Run bin/final_report.sh to generate both console output and public/status.json.
    • Declare public as an artifacts:paths: so that GitLab Pages picks it up:
      artifacts:
        paths:
          - public
        expire_in: 1 week
  3. Expose via GitLab Pages

    • Ensure .gitlab-ci.yml includes the Pages job (templates/pages.yml) so that public/status.json is deployed.
    • Confirm that visiting https://<NAMESPACE>.gitlab.io/<PROJECT>/status.json returns the file.
  4. Badge Integration (example)

    • Consumers can add:
      [![MGCI Status](https://img.shields.io/endpoint?url=https://<YOUR-PAGES-URL>/status.json)]()

References

Acceptance Criteria

  • bin/final_report.sh writes a valid public/status.json file.
  • info:report job artifacts include public/status.json.
  • GitLab Pages publishes the JSON at a stable URL.
  • Sample Shields.io badge in README correctly reflects pipeline health.
  • Documentation (docs/setup-fr.md & docs/setup.md) updated with instructions.
Edited by Placeholder Christophe Chaudier