Shared Marvin

A shared Jenkins instance to run tests for Epitech’s projects.

Usage

Use an instance

To use the shared Marvin, you need to setup a webhook on your GitHub repository. Your repository MUST be public (so Jenkins can clone it). URL of the webhook: http://localhost:80/webhook/:Module/:Project/:Snowflake Parameters :

  • Module is the name of the module (ex: B-PSU-210)
  • Project is the name of the project (ex: 42sh)
  • Snowflake is a Discord User ID (ex: 235090646946283520), you can get yours by executing the /id command with the bot on Discord. The webhook only accept push, pull_request and ping events. In the webhook panel, you can see requests made by GitHub, if a request fails, you can see why by viewing the response of Marvin. If tests doesn’t exists for this project, the request will fail. We ask you to remove the webhook if this is the case. You MUST be on the Discord server, otherwise the bot can’t identify you.

Writing tests

In the organization, you must have an repository with name : “$Module-$Project”. At the root, you MUST have a manifest.json, with the required data to run the tests. Here’s an example of a manifest.json :

{
    "module": "B-PSU-210",
    "project": "42sh",
    "agent-image": "epitechcontent/epitest-docker:latest",
    "build-commands": [
        "make",
        "make clean"
    ],
    "skills": [
        {
            "name": "01 - basic tests",
            "tests": [
               {
                    "name": "Empty",
                    "command": "./tester.sh -test 1",
                    "expected": "^OK"
               },
               {
                    "name": "Simple command",
                    "command": "./tester.sh -test 2",
                    "expected": "^OK"
               }
            ]
        }
    ]
}

The agent-image property is the Docker image used to run the tests, we recommand you to use the epitest image. All the content of the tests repository will be available in the job, so you can create a .sh (like in the example) to run tests. In the example, the tester.sh MUST print only ^OK, otherwise the tests will be marked as failed, and the output will be used as trace for the student.

Host your own Marvin

Configuration

Rename the sample.env to .env, so Docker-compose can use values inside.

Name Description
JENKINS_ADMIN_ID Administrator ID in Jenkins (used to log in)
JENKINS_ADMIN_NAME Display name for the admin in Jenkins, not important
JENKINS_ADMIN_PASSWORD Admin’s password (a strong password is recommanded)
JENKINS_NG_AGENTS Number of tests nodes, (default : 3) you can add more if you have a powerful machine
JENKINS_API_TOKEN Launch your instance, go to http://localhost:8080/user/JENKINS_ADMIN_ID/configure and create an API token
DISCORD_TOKEN Your Discord bot token
DISCORD_CLIENTID Your Discord bot Client ID
GITHUB_ORGANIZATION Organization name on GitHub
GITHUB_TOKEN Your GitHub token (Can be generated on https://github.com/settings/tokens)
DOCKER_SOCK_PATH Path to the Docker socket (docker.sock file)
DOCUMENTATION_URL Link to the documentation (here)
BLACKLISTED_SNOWFLAKES A list of string of blacklisted users

Run the bot & the instance

Open a shell in your Marvin directory and run docker-compose up If you’ve completed the configuration right, you should have your own instance !

Supported projects in this instance

Semester 0

Semester 1

B-BOO-101 – Bootcamp Phoenix
B-CPE-100 – Unix & C Lab Seminar (Part I)
B-CPE-101 – Unix & C Lab Seminar (Part II)
B-CPE-110 – Elementary Programming in C
B-MAT-100 – Mathematics
B-MUL-100 – C Graphical Programming
B-PSU-100 – Unix System Programming (Part I)
B-PSU-101 – Unix System Programming (Part II)

Semester 2

Semester 3

Semester 4

Semester 5

Semester 6

Others

Tests wrote for debug, testing, templating…

M-OTH-420

GitHub

View Github