diff --git a/docs/source/installation/docker.md b/docs/source/installation/docker.md index 7787f5ef..ee00cfa4 100644 --- a/docs/source/installation/docker.md +++ b/docs/source/installation/docker.md @@ -17,7 +17,7 @@ the containers together with their services. Run the following command: ```bash -DATABASE_TYPE=sqlite docker compose up --build -d +docker compose up --build -d ``` This command builds the images and starts the containers in detached mode. It sets SQLite as its database that is integrated in `Grader Service`. @@ -43,5 +43,3 @@ To stop and remove the containers, run: ```bash docker compose -f docker-compose.yml -f docker-compose-postgres.yml down -v ``` - - diff --git a/examples/docker_compose/Dockerfile-DBInit b/examples/docker_compose/Dockerfile-DBInit index 5e2053e3..9e6ce8f8 100644 --- a/examples/docker_compose/Dockerfile-DBInit +++ b/examples/docker_compose/Dockerfile-DBInit @@ -1,20 +1,24 @@ FROM postgres -# Install git +# Install python RUN apt-get update && \ - apt-get install -y python3 python3-venv && \ + apt-get install -y python3 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# Install uv +COPY --from=ghcr.io/astral-sh/uv:0.9.3 /uv /uvx /bin/ + WORKDIR /app -# Copy necessary files and folders +# Install python dependencies, only copying necessary files COPY ./pyproject.toml MANIFEST.in ./ -COPY ./grader_service ./grader_service -# Create a virtual environment -RUN python3 -m venv /venv +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync --no-dev -# Activate venv and install the package -RUN /venv/bin/pip install . +# Copy the project files and install the package itself +COPY ./grader_service ./grader_service +RUN --mount=type=cache,target=/root/.cache/uv \ + uv pip install . -CMD ["sh", "-c", "/app/init-db.sh"] +CMD ["sh", "-c", "/app/init-db-postgres.sh"] diff --git a/examples/docker_compose/Dockerfile-Hub b/examples/docker_compose/Dockerfile-Hub index e10a1373..b836c2ec 100644 --- a/examples/docker_compose/Dockerfile-Hub +++ b/examples/docker_compose/Dockerfile-Hub @@ -6,12 +6,14 @@ RUN apt-get update && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# Install uv +COPY --from=ghcr.io/astral-sh/uv:0.9.3 /uv /uvx /bin/ + WORKDIR /app ENV JUPYTERHUB_CRYPT_KEY=e3f92a0d5e37446c7e894a2ef6c6ec3bcb4aa3c38d2a442eb567adf780597aa0 -RUN pip install grader_labextension - -RUN python3 -m pip install dockerspawner oauthenticator +RUN --mount=type=cache,target=/root/.cache/uv \ + uv pip install grader_labextension dockerspawner oauthenticator -CMD ["jupyterhub", "-f", "/app/jupyterhub_config.py"] \ No newline at end of file +CMD ["jupyterhub", "-f", "/app/jupyterhub_config.py"] diff --git a/examples/docker_compose/Dockerfile-Service b/examples/docker_compose/Dockerfile-Service index 9e9aafdf..0a0fc90f 100644 --- a/examples/docker_compose/Dockerfile-Service +++ b/examples/docker_compose/Dockerfile-Service @@ -1,19 +1,26 @@ FROM python:3.13-slim -# Install git +# Install git and sqlite RUN apt-get update && \ - apt-get install -y git && \ + apt-get install -y git sqlite3 && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +# Install uv +COPY --from=ghcr.io/astral-sh/uv:0.9.3 /uv /uvx /bin/ +ENV UV_SYSTEM_PYTHON=true + WORKDIR /app -# Copy necessary files and folders +# Install python dependencies, only copying necessary files COPY ./pyproject.toml MANIFEST.in ./ -COPY ./grader_service ./grader_service +RUN --mount=type=cache,target=/root/.cache/uv \ + uv sync -RUN pip install . -RUN pip install numpy ipykernel +# Copy the project files and install the package itself +COPY ./grader_service ./grader_service +RUN --mount=type=cache,target=/root/.cache/uv \ + uv pip install . # Set default branch to main and default user RUN git config --global init.defaultBranch main && \ diff --git a/examples/docker_compose/README.md b/examples/docker_compose/README.md index fa95399e..cc9d5568 100644 --- a/examples/docker_compose/README.md +++ b/examples/docker_compose/README.md @@ -16,7 +16,7 @@ the containers together with their services. Run the following command: ```bash -DATABASE_TYPE=sqlite docker compose up --build -d +docker compose up --build -d ``` This command builds the images and starts the containers in detached mode. It sets SQLite as its database that is integrated in `Grader Service`. @@ -42,5 +42,3 @@ To stop and remove the containers, run: ```bash docker compose -f docker-compose.yml -f docker-compose-postgres.yml down -v ``` - - diff --git a/examples/docker_compose/data_only.sql b/examples/docker_compose/data_only.sql index 0919f6e7..627a4fd1 100644 --- a/examples/docker_compose/data_only.sql +++ b/examples/docker_compose/data_only.sql @@ -1,42 +1,15 @@ -INSERT INTO "user" VALUES('admin',NULL,'b3c349f83ef94143b644221523e04ca2','admin'); -INSERT INTO "user" VALUES('instructor',NULL,'3b80476d54ef49848f1dd00b436e9380','instructor'); -INSERT INTO "user" VALUES('student',NULL,'935f9b72143f40459ad7f5e32a94a4c1','student'); -INSERT INTO "user" VALUES('tutor',NULL,'77f888fee7f84bfbba6b226fce292115','tutor'); -INSERT INTO "user" VALUES('user1',NULL,'393ced73010a47a198edc44609c0d1b6','user1'); -INSERT INTO lecture VALUES(1,'lect1','lect1','active','active','2025-04-15 11:58:36.963401','2025-04-15 11:58:36.963405'); -INSERT INTO lecture VALUES(2,'lecture1','lecture1','active','active','2025-05-08 13:15:46.405114','2025-05-08 13:15:46.405118'); -INSERT INTO assignment VALUES(1,'Assignment',1,1,'pushed','deleted','{"notebooks": {"sum_numbers": {"id": "sum_numbers", "name": "sum_numbers", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-1e1d884e2e83e97f": {"max_score": 1.0, "cell_type": "code", "notebook_id": null, "name": "cell-1e1d884e2e83e97f", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-ec1c0a6598d73f81": {"notebook_id": null, "name": "cell-ec1c0a6598d73f81", "id": null, "grade_id": null, "comment_id": null, "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-ec1c0a6598d73f81": {"notebook_id": null, "name": "cell-ec1c0a6598d73f81", "id": null, "cell_type": "code", "locked": false, "source": "\ndef sum_numbers(num):\n # YOUR CODE HERE\n raise NotImplementedError()\n", "checksum": "3abfdaf7b8b9569fc58d25d6471d4cbd", "_type": "SourceCell"}, "cell-1e1d884e2e83e97f": {"notebook_id": null, "name": "cell-1e1d884e2e83e97f", "id": null, "cell_type": "code", "locked": true, "source": "assert sum_numbers(1) == 1\nassert sum_numbers(2) == 3\nassert sum_numbers(5) == 15", "checksum": "6453ffdd62ea1a1eabcf95616174dd88", "_type": "SourceCell"}}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": ["title.md"], "_type": "GradeBookModel", "schema_version": "1"}','2025-04-15 13:09:04.651575','2025-06-03 12:20:17.821961','{"deadline": "2025-04-17T12:10:18.317000+00:00", "max_submissions": null, "allowed_files": [], "late_submission": null, "autograde_type": "auto"}'); -INSERT INTO assignment VALUES(2,'Assignment 2',1,2,'pushed','deleted','{"notebooks": {"add_numbers": {"id": "add_numbers", "name": "add_numbers", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-3df764e6d829e6ef": {"max_score": 2.0, "cell_type": "code", "notebook_id": null, "name": "cell-3df764e6d829e6ef", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-7d6a4f3241ca6383": {"notebook_id": null, "name": "cell-7d6a4f3241ca6383", "id": null, "grade_id": null, "comment_id": null, "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-7d6a4f3241ca6383": {"notebook_id": null, "name": "cell-7d6a4f3241ca6383", "id": null, "cell_type": "code", "locked": false, "source": "# YOUR CODE HERE\nraise NotImplementedError()", "checksum": "bb2a9f9fb0716b1f5a0ca91a1720f598", "_type": "SourceCell"}, "cell-3df764e6d829e6ef": {"notebook_id": null, "name": "cell-3df764e6d829e6ef", "id": null, "cell_type": "code", "locked": true, "source": "assert add_numbers(1,2) == 3\nassert add_numbers(1,6) == 7\nassert add_numbers(111,2) == 113\nassert add_numbers(5,2) == 7\nassert add_numbers(3,2) == 5", "checksum": "b9d6c3f56495b529e96ab79696dbe8a8", "_type": "SourceCell"}}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": [], "_type": "GradeBookModel", "schema_version": "1"}','2025-04-16 09:20:50.853495','2025-06-03 12:21:08.093437','{"deadline": "2025-04-23T09:20:26.339000+00:00", "max_submissions": null, "allowed_files": [], "late_submission": null, "autograde_type": "auto"}'); -INSERT INTO assignment VALUES(3,'Assignment 3',1,0,'pushed','deleted','{"notebooks": {"sub_numbers": {"id": "sub_numbers", "name": "sub_numbers", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {}, "solution_cells_dict": {}, "task_cells_dict": {}, "source_cells_dict": {}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": [], "_type": "GradeBookModel", "schema_version": "1"}','2025-04-16 09:41:14.941462','2025-06-03 12:21:20.765016','{"deadline": "2025-04-24T09:41:25.309000+00:00", "max_submissions": null, "allowed_files": [], "late_submission": [], "autograde_type": "auto"}'); -INSERT INTO assignment VALUES(4,'Assignment 4',1,0,'created','deleted',NULL,'2025-05-06 11:28:40.331742','2025-06-03 12:20:37.613322','{"deadline": "2025-05-10T11:28:22.412000+00:00", "max_submissions": null, "allowed_files": [], "late_submission": null, "autograde_type": "auto"}'); -INSERT INTO assignment VALUES(5,'Currency Conversion',1,5,'released','active','{"notebooks": {"convert_dollar": {"id": "convert_dollar", "name": "convert_dollar", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-ac6f865522fb45c0": {"max_score": 1.0, "cell_type": "code", "notebook_id": null, "name": "cell-ac6f865522fb45c0", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}, "cell-97b08476829c31b2": {"max_score": 4.0, "cell_type": "code", "notebook_id": null, "name": "cell-97b08476829c31b2", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-87e7eb777dedef14": {"notebook_id": null, "name": "cell-87e7eb777dedef14", "id": null, "grade_id": null, "comment_id": null, "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-87e7eb777dedef14": {"notebook_id": null, "name": "cell-87e7eb777dedef14", "id": null, "cell_type": "code", "locked": false, "source": "def convert_dollar(dollar):\n # YOUR CODE HERE\n raise NotImplementedError()", "checksum": "5ed5fb06cd04ff189fa63b6345d4f246", "_type": "SourceCell"}, "cell-ac6f865522fb45c0": {"notebook_id": null, "name": "cell-ac6f865522fb45c0", "id": null, "cell_type": "code", "locked": true, "source": "eur, gbp = convert_dollar(5)\nassert eur == 4.6548194\nassert gbp == 4.0059821499999995", "checksum": "721905ff987abff4d78f1fa62f764059", "_type": "SourceCell"}, "cell-97b08476829c31b2": {"notebook_id": null, "name": "cell-97b08476829c31b2", "id": null, "cell_type": "code", "locked": true, "source": "assert convert_dollar(20) == (18.6192776, 16.023928599999998)\n### BEGIN HIDDEN TESTS\nassert convert_dollar(1923810) == (1790997.6219827998, 1541349.7039983)\nassert convert_dollar(0) == (0.0, 0.0)\nassert convert_dollar(999) == (930.03291612, 800.39523357)\n### END HIDDEN TESTS", "checksum": "a10b1b507cc9ecafa74b3cbfdf59bd3a", "_type": "SourceCell"}}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": ["Currency Conversion.md"], "_type": "GradeBookModel", "schema_version": "1"}','2025-06-03 12:23:27.310610','2025-06-04 10:12:32.878997','{"deadline": "2025-06-03T12:23:04+00:00", "max_submissions": null, "allowed_files": [], "late_submission": [], "autograde_type": "auto"}'); -INSERT INTO assignment VALUES(6,'Introduction to numpy',1,2,'released','active','{"notebooks": {"introduction_to_numpy": {"id": "introduction_to_numpy", "name": "introduction_to_numpy", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-35637aad1a42d8a0": {"max_score": 2.0, "cell_type": "code", "notebook_id": null, "name": "cell-35637aad1a42d8a0", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-25eebd639059cd56": {"notebook_id": null, "name": "cell-25eebd639059cd56", "id": null, "grade_id": null, "comment_id": null, "_type": "SolutionCell"}, "cell-180fb26ddc489bfc": {"notebook_id": null, "name": "cell-180fb26ddc489bfc", "id": null, "grade_id": null, "comment_id": null, "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-25eebd639059cd56": {"notebook_id": null, "name": "cell-25eebd639059cd56", "id": null, "cell_type": "code", "locked": false, "source": "import numpy as np\n\ndef create_array_with_zeros(length):\n # YOUR CODE HERE\n raise NotImplementedError()", "checksum": "d324a6aeb5afd8f8f93166e12701880f", "_type": "SourceCell"}, "cell-180fb26ddc489bfc": {"notebook_id": null, "name": "cell-180fb26ddc489bfc", "id": null, "cell_type": "code", "locked": false, "source": "import numpy as np\n\ndef create_array_with_value(length, value):\n # YOUR CODE HERE\n raise NotImplementedError()\n ", "checksum": "d93f5938b7a2cd8dd16f41cd81170f0f", "_type": "SourceCell"}, "cell-35637aad1a42d8a0": {"notebook_id": null, "name": "cell-35637aad1a42d8a0", "id": null, "cell_type": "code", "locked": true, "source": "import numpy as np\n\nassert np.array_equal(create_array_with_zeros(5), np.array([0, 0, 0, 0, 0]))\nassert np.array_equal(create_array_with_value(5, 2), np.array([2, 2, 2, 2, 2]))\n\n### BEGIN HIDDEN TESTS\nassert np.array_equal(create_array_with_zeros(10), np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))\nassert np.array_equal(create_array_with_value(7, 3), np.array([3, 3, 3, 3, 3, 3, 3]))\n### END HIDDEN TESTS", "checksum": "d29660fbfeb3ef146b119b849cd90791", "_type": "SourceCell"}}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": ["Introduction to numpy.md"], "_type": "GradeBookModel", "schema_version": "1"}','2025-06-04 09:13:01.470737','2025-06-04 09:42:48.682905','{"deadline": null, "max_submissions": null, "allowed_files": [], "late_submission": [], "autograde_type": "auto"}'); -INSERT INTO assignment VALUES(7,'Repeated List',1,4,'pushed','active','{"notebooks": {"repeat_list": {"id": "repeat_list", "name": "repeat_list", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-c163851be78a4581": {"max_score": 4.0, "cell_type": "code", "notebook_id": null, "name": "cell-c163851be78a4581", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-4706c7c4d2dc5c83": {"notebook_id": null, "name": "cell-4706c7c4d2dc5c83", "id": null, "grade_id": null, "comment_id": null, "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-4706c7c4d2dc5c83": {"notebook_id": null, "name": "cell-4706c7c4d2dc5c83", "id": null, "cell_type": "code", "locked": false, "source": "def repeat_list(item, times):\n # YOUR CODE HERE\n raise NotImplementedError()\n", "checksum": "c86c729bb6799cf30e47aaeb05f3a19d", "_type": "SourceCell"}, "cell-c163851be78a4581": {"notebook_id": null, "name": "cell-c163851be78a4581", "id": null, "cell_type": "code", "locked": true, "source": "assert repeat_list(''x'', 5) == [''x'', ''x'', ''x'', ''x'', ''x'']\nassert repeat_list(0, 3) == [0, 0, 0]\n### BEGIN HIDDEN TESTS\nassert repeat_list(True, 2) == [True, True]\nassert repeat_list(''hi'', 0) == []\n### END HIDDEN TESTS", "checksum": "de72b3aa803cdc9c9e7b2cf5dc425176", "_type": "SourceCell"}}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": [], "_type": "GradeBookModel", "schema_version": "1"}','2025-06-04 09:45:14.998759','2025-06-04 09:54:32.374718','{"deadline": null, "max_submissions": null, "allowed_files": [], "late_submission": null, "autograde_type": "auto"}'); -INSERT INTO takepart VALUES('admin',1,'instructor'); -INSERT INTO takepart VALUES('instructor',1,'instructor'); -INSERT INTO takepart VALUES('student',1,'student'); -INSERT INTO takepart VALUES('tutor',1,'tutor'); -INSERT INTO submission VALUES(1,'2025-04-16 08:32:44.856742','grading_failed','not_graded',NULL,NULL,1,'admin','287b17b30bb46764eb106b2194e0fae8fc72bb17','2025-04-16 08:32:44.926463',NULL,1,'not_generated','active'); -INSERT INTO submission VALUES(2,'2025-04-16 08:46:07.458149','grading_failed','not_graded',NULL,NULL,1,'admin','9e519305e1f009ad31c3ccd46fe326b3c7993b40','2025-04-16 08:46:07.530051',NULL,1,'not_generated','active'); -INSERT INTO submission VALUES(3,'2025-04-16 09:16:43.602760','automatically_graded','not_graded',NULL,0,1,'admin','c5d9c676595ac13ad2abc8ea93ac4ecfec72b47c','2025-04-16 09:16:45.704466',0,1,'not_generated','active'); -INSERT INTO submission VALUES(4,'2025-04-16 09:30:40.750970','automatically_graded','manually_graded',true,1.125,2,'admin','7412d697155511de7c88d7990ad3616cc3437f79','2025-04-16 10:16:11.630340',1.25,0.900000000000000022,'generated','active'); -INSERT INTO submission VALUES(5,'2025-04-16 09:47:23.946933','automatically_graded','not_graded',NULL,0,3,'admin','79ca26a5f2b560432454c05a0c7c2fb7846fdb91','2025-04-16 09:47:25.484453',0,1,'not_generated','active'); -INSERT INTO submission VALUES(6,'2025-04-16 09:48:33.323631','automatically_graded','manually_graded',true,0,3,'admin','6611b94515027e5e3a3818ff1a18a1e43b9e724b','2025-04-16 09:53:18.163605',0,1,'not_generated','active'); -INSERT INTO submission VALUES(7,'2025-05-22 09:49:01.106028','not_graded','not_graded',true,NULL,3,'student','0000000000000000000000000000000000000000','2025-05-22 09:49:01.244816',NULL,0,'not_generated','active'); -INSERT INTO submission VALUES(8,'2025-06-04 10:01:20.607586','automatically_graded','not_graded',NULL,0,5,'admin','b03cd5004521bdbaf362267a5f9acd12ff699cb2','2025-06-04 10:09:11.726552',5,0,'not_generated','active'); -INSERT INTO submission VALUES(9,'2025-06-04 10:11:30.572845','automatically_graded','not_graded',NULL,5,5,'student','97ca42691d63d727826d966a7a8d574e25abab0b','2025-06-04 10:11:31.784424',5,1,'not_generated','active'); -INSERT INTO submission_logs VALUES(1,replace('[2025-04-16 10:32:44] [WARNING] No notebooks were matched by ''/home/nadja/work/service/service_dir/convert_in/submission_1/*.ipynb''\n[2025-04-16 10:32:44] [INFO] Reading 1335 bytes from /home/nadja/work/service/service_dir/convert_out/submission_1/gradebook.json\n[2025-04-16 10:32:44] [INFO] Found additional file patterns: []\n[2025-04-16 10:32:44] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_1 to /home/nadja/work/service/service_dir/convert_out/submission_1 that match allowed patterns and don''t match ignored patterns.\n[2025-04-16 10:32:44] [INFO] Copied the following files: []\n','\n',E'\n')); -INSERT INTO submission_logs VALUES(2,replace('[2025-04-16 10:46:07] [INFO] Reading 1345 bytes from /home/nadja/work/service/service_dir/convert_out/submission_2/gradebook.json\n[2025-04-16 10:46:07] [INFO] Found additional file patterns: []\n[2025-04-16 10:46:07] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_2 to /home/nadja/work/service/service_dir/convert_out/submission_2 that match allowed patterns and don''t match ignored patterns.\n[2025-04-16 10:46:07] [INFO] Copied the following files: []\n','\n',E'\n')); -INSERT INTO submission_logs VALUES(3,replace('[2025-04-16 11:16:43] [INFO] Reading 1345 bytes from /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:43] [INFO] Found additional file patterns: []\n[2025-04-16 11:16:43] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_3 to /home/nadja/work/service/service_dir/convert_out/submission_3 that match allowed patterns and don''t match ignored patterns.\n[2025-04-16 11:16:43] [INFO] Copied the following files: [''title.md'']\n[2025-04-16 11:16:43] [INFO] Writing 1345 bytes to /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:43] [INFO] Reading 1345 bytes from /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:43] [INFO] Sanitizing /home/nadja/work/service/service_dir/convert_in/submission_3/sum_numbers.ipynb\n[2025-04-16 11:16:43] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_in/submission_3/sum_numbers.ipynb\n[2025-04-16 11:16:43] [INFO] Reading 1345 bytes from /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:43] [INFO] Overwriting submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\n[2025-04-16 11:16:43] [INFO] Reading 1345 bytes from /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:43] [INFO] Writing 1625 bytes to /home/nadja/work/service/service_dir/convert_out/submission_3/sum_numbers.ipynb\n[2025-04-16 11:16:43] [INFO] Autograding /home/nadja/work/service/service_dir/convert_out/submission_3/sum_numbers.ipynb\n[2025-04-16 11:16:43] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_out/submission_3/sum_numbers.ipynb\n[2025-04-16 11:16:45] [INFO] Reading 1345 bytes from /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:45] [INFO] Writing 1907 bytes to /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:45] [INFO] Writing 3814 bytes to /home/nadja/work/service/service_dir/convert_out/submission_3/sum_numbers.ipynb\n[2025-04-16 11:16:45] [INFO] Setting destination file permissions to 664\n[2025-04-16 11:16:45] [INFO] Reading 1907 bytes from /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n[2025-04-16 11:16:45] [INFO] Found additional file patterns: []\n[2025-04-16 11:16:45] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_3 to /home/nadja/work/service/service_dir/convert_out/submission_3 that match allowed patterns and don''t match ignored patterns.\n[2025-04-16 11:16:45] [INFO] Copied the following files: [''title.md'']\n[2025-04-16 11:16:45] [INFO] Writing 1907 bytes to /home/nadja/work/service/service_dir/convert_out/submission_3/gradebook.json\n','\n',E'\n')); -INSERT INTO submission_logs VALUES(4,replace('[2025-04-16 11:30:40] [INFO] Reading 1404 bytes from /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:40] [INFO] Found additional file patterns: []\n[2025-04-16 11:30:40] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_4 to /home/nadja/work/service/service_dir/convert_out/submission_4 that match allowed patterns and don''t match ignored patterns.\n[2025-04-16 11:30:40] [INFO] Copied the following files: []\n[2025-04-16 11:30:40] [INFO] Writing 1404 bytes to /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:40] [INFO] Reading 1404 bytes from /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:40] [INFO] Sanitizing /home/nadja/work/service/service_dir/convert_in/submission_4/add_numbers.ipynb\n[2025-04-16 11:30:40] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_in/submission_4/add_numbers.ipynb\n[2025-04-16 11:30:40] [INFO] Reading 1404 bytes from /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:40] [INFO] Overwriting submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\n[2025-04-16 11:30:40] [INFO] Reading 1404 bytes from /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:40] [INFO] Writing 1731 bytes to /home/nadja/work/service/service_dir/convert_out/submission_4/add_numbers.ipynb\n[2025-04-16 11:30:40] [INFO] Autograding /home/nadja/work/service/service_dir/convert_out/submission_4/add_numbers.ipynb\n[2025-04-16 11:30:40] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_out/submission_4/add_numbers.ipynb\n[2025-04-16 11:30:42] [INFO] Reading 1404 bytes from /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:42] [INFO] Writing 1958 bytes to /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:42] [INFO] Writing 2239 bytes to /home/nadja/work/service/service_dir/convert_out/submission_4/add_numbers.ipynb\n[2025-04-16 11:30:42] [INFO] Setting destination file permissions to 664\n[2025-04-16 11:30:42] [INFO] Reading 1958 bytes from /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n[2025-04-16 11:30:42] [INFO] Found additional file patterns: []\n[2025-04-16 11:30:42] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_4 to /home/nadja/work/service/service_dir/convert_out/submission_4 that match allowed patterns and don''t match ignored patterns.\n[2025-04-16 11:30:42] [INFO] Copied the following files: []\n[2025-04-16 11:30:42] [INFO] Writing 1958 bytes to /home/nadja/work/service/service_dir/convert_out/submission_4/gradebook.json\n','\n',E'\n')); -INSERT INTO submission_logs VALUES(5,replace('[2025-04-16 11:47:23] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012[2025-04-16 11:47:23] [INFO] Found additional file patterns: []\012[2025-04-16 11:47:23] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_5 to /home/nadja/work/service/service_dir/convert_out/submission_5 that match allowed patterns and don''t match ignored patterns.\012[2025-04-16 11:47:23] [INFO] Copied the following files: []\012[2025-04-16 11:47:23] [INFO] Writing 434 bytes to /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012[2025-04-16 11:47:23] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012[2025-04-16 11:47:23] [INFO] Sanitizing /home/nadja/work/service/service_dir/convert_in/submission_5/sub_numbers.ipynb\012[2025-04-16 11:47:23] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_in/submission_5/sub_numbers.ipynb\012[2025-04-16 11:47:23] [DEBUG] Applying preprocessor: ClearOutput\012[2025-04-16 11:47:24] [DEBUG] Applying preprocessor: DeduplicateIds\012[2025-04-16 11:47:24] [WARNING] cell above\012[2025-04-16 11:47:24] [WARNING] cell above\012[2025-04-16 11:47:24] [DEBUG] Applying preprocessor: OverwriteKernelspec\012[2025-04-16 11:47:24] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012[2025-04-16 11:47:24] [DEBUG] Source notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\012[2025-04-16 11:47:24] [DEBUG] Submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\012[2025-04-16 11:47:24] [INFO] Overwriting submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\012[2025-04-16 11:47:24] [DEBUG] Applying preprocessor: OverwriteCells\012[2025-04-16 11:47:24] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012[2025-04-16 11:47:24] [DEBUG] Applying preprocessor: CheckCellMetadata\012[2025-04-16 11:47:24] [INFO] Writing 1146 bytes to /home/nadja/work/service/service_dir/convert_out/submission_5/sub_numbers.ipynb\012[2025-04-16 11:47:24] [INFO] Autograding /home/nadja/work/service/service_dir/convert_out/submission_5/sub_numbers.ipynb\012[2025-04-16 11:47:24] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_out/submission_5/sub_numbers.ipynb\012[2025-04-16 11:47:24] [DEBUG] Applying preprocessor: Execute\012[2025-04-16 11:47:24] [DEBUG] Instantiating kernel ''Python 3 (ipykernel)'' with kernel provisioner: local-provisioner\012[2025-04-16 11:47:24] [DEBUG] Starting kernel: [''/home/nadja/micromamba/envs/grader/bin/python'', ''-m'', ''ipykernel_launcher'', ''-f'', ''/tmp/tmpq7hkzjyb.json'', ''--HistoryManager.hist_file=:memory:'']\012[2025-04-16 11:47:24] [DEBUG] Connecting to: tcp://127.0.0.1:37235\012[2025-04-16 11:47:24] [DEBUG] connecting iopub channel to tcp://127.0.0.1:41609\012[2025-04-16 11:47:24] [DEBUG] Connecting to: tcp://127.0.0.1:41609\012[2025-04-16 11:47:24] [DEBUG] connecting shell channel to tcp://127.0.0.1:56029\012[2025-04-16 11:47:24] [DEBUG] Connecting to: tcp://127.0.0.1:56029\012[2025-04-16 11:47:24] [DEBUG] connecting stdin channel to tcp://127.0.0.1:48669\012[2025-04-16 11:47:24] [DEBUG] Connecting to: tcp://127.0.0.1:48669\012[2025-04-16 11:47:24] [DEBUG] connecting heartbeat channel to tcp://127.0.0.1:56613\012[2025-04-16 11:47:24] [DEBUG] connecting control channel to tcp://127.0.0.1:37235\012[2025-04-16 11:47:24] [DEBUG] Connecting to: tcp://127.0.0.1:37235\012[2025-04-16 11:47:24] [DEBUG] Executing cell:\012# YOUR CODE HERE\012[2025-04-16 11:47:24] [DEBUG] msg_type: status\012[2025-04-16 11:47:24] [DEBUG] content: {''execution_state'': ''busy''}\012[2025-04-16 11:47:24] [DEBUG] msg_type: execute_input\012[2025-04-16 11:47:24] [DEBUG] content: {''code'': ''# YOUR CODE HERE'', ''execution_count'': 1}\012[2025-04-16 11:47:24] [DEBUG] msg_type: status\012[2025-04-16 11:47:24] [DEBUG] content: {''execution_state'': ''idle''}\012[2025-04-16 11:47:24] [DEBUG] Executing cell:\012assert sub_numbers(3,1) == 2\012assert sub_numbers(6,21) == -15\012assert sub_numbers(7,1) == 6\012assert sub_numbers(94,5) == 89\012[2025-04-16 11:47:24] [DEBUG] msg_type: status\012[2025-04-16 11:47:24] [DEBUG] content: {''execution_state'': ''busy''}\012[2025-04-16 11:47:24] [DEBUG] msg_type: execute_input\012[2025-04-16 11:47:24] [DEBUG] content: {''code'': ''assert sub_numbers(3,1) == 2\nassert sub_numbers(6,21) == -15\nassert sub_numbers(7,1) == 6\nassert sub_numbers(94,5) == 89'', ''execution_count'': 2}\012[2025-04-16 11:47:24] [DEBUG] msg_type: error\012[2025-04-16 11:47:24] [DEBUG] content: {''traceback'': [''\x1b[31m---------------------------------------------------------------------------\x1b[39m'', ''\x1b[31mNameError\x1b[39m Traceback (most recent call last)'', ''\x1b[36mCell\x1b[39m\x1b[36m \x1b[39m\x1b[32mIn[2]\x1b[39m\x1b[32m, line 1\x1b[39m\n\x1b[32m----> \x1b[39m\x1b[32m1\x1b[39m \x1b[38;5;28;01massert\x1b[39;00m \x1b[43msub_numbers\x1b[49m(\x1b[32m3\x1b[39m,\x1b[32m1\x1b[39m) == \x1b[32m2\x1b[39m\n\x1b[32m 2\x1b[39m \x1b[38;5;28;01massert\x1b[39;00m sub_numbers(\x1b[32m6\x1b[39m,\x1b[32m21\x1b[39m) == -\x1b[32m15\x1b[39m\n\x1b[32m 3\x1b[39m \x1b[38;5;28;01massert\x1b[39;00m sub_numbers(\x1b[32m7\x1b[39m,\x1b[32m1\x1b[39m) == \x1b[32m6\x1b[39m\n'', "\x1b[31mNameError\x1b[39m: name ''sub_numbers'' is not defined"], ''ename'': ''NameError'', ''evalue'': "name ''sub_numbers'' is not defined"}\012[2025-04-16 11:47:24] [DEBUG] msg_type: status\012[2025-04-16 11:47:24] [DEBUG] content: {''execution_state'': ''idle''}\012[2025-04-16 11:47:25] [DEBUG] Destroying zmq context for \012[2025-04-16 11:47:25] [DEBUG] Applying preprocessor: LimitOutput\012[2025-04-16 11:47:25] [DEBUG] Applying preprocessor: SaveAutoGrades\012[2025-04-16 11:47:25] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012[2025-04-16 11:47:25] [DEBUG] Applying preprocessor: CheckCellMetadata\012[2025-04-16 11:47:25] [DEBUG] Applying preprocessor: ClearAlwaysHiddenTests\012[2025-04-16 11:47:25] [INFO] Writing 2688 bytes to /home/nadja/work/service/service_dir/convert_out/submission_5/sub_numbers.ipynb\012[2025-04-16 11:47:25] [INFO] Setting destination file permissions to 664\012[2025-04-16 11:47:25] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012[2025-04-16 11:47:25] [INFO] Found additional file patterns: []\012[2025-04-16 11:47:25] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_5 to /home/nadja/work/service/service_dir/convert_out/submission_5 that match allowed patterns and don''t match ignored patterns.\012[2025-04-16 11:47:25] [INFO] Copied the following files: []\012[2025-04-16 11:47:25] [INFO] Writing 434 bytes to /home/nadja/work/service/service_dir/convert_out/submission_5/gradebook.json\012','\012',E'\n')); -INSERT INTO submission_logs VALUES(6,replace('[2025-04-16 11:53:16] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012[2025-04-16 11:53:16] [INFO] Found additional file patterns: []\012[2025-04-16 11:53:16] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_6 to /home/nadja/work/service/service_dir/convert_out/submission_6 that match allowed patterns and don''t match ignored patterns.\012[2025-04-16 11:53:16] [INFO] Copied the following files: []\012[2025-04-16 11:53:16] [INFO] Writing 434 bytes to /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012[2025-04-16 11:53:16] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012[2025-04-16 11:53:16] [INFO] Sanitizing /home/nadja/work/service/service_dir/convert_in/submission_6/sub_numbers.ipynb\012[2025-04-16 11:53:16] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_in/submission_6/sub_numbers.ipynb\012[2025-04-16 11:53:16] [DEBUG] Applying preprocessor: ClearOutput\012[2025-04-16 11:53:16] [DEBUG] Applying preprocessor: DeduplicateIds\012[2025-04-16 11:53:16] [WARNING] cell above\012[2025-04-16 11:53:16] [WARNING] cell above\012[2025-04-16 11:53:16] [DEBUG] Applying preprocessor: OverwriteKernelspec\012[2025-04-16 11:53:16] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012[2025-04-16 11:53:16] [DEBUG] Source notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\012[2025-04-16 11:53:16] [DEBUG] Submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\012[2025-04-16 11:53:16] [INFO] Overwriting submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\012[2025-04-16 11:53:16] [DEBUG] Applying preprocessor: OverwriteCells\012[2025-04-16 11:53:16] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012[2025-04-16 11:53:16] [DEBUG] Applying preprocessor: CheckCellMetadata\012[2025-04-16 11:53:16] [INFO] Writing 1228 bytes to /home/nadja/work/service/service_dir/convert_out/submission_6/sub_numbers.ipynb\012[2025-04-16 11:53:16] [INFO] Autograding /home/nadja/work/service/service_dir/convert_out/submission_6/sub_numbers.ipynb\012[2025-04-16 11:53:16] [INFO] Converting notebook /home/nadja/work/service/service_dir/convert_out/submission_6/sub_numbers.ipynb\012[2025-04-16 11:53:16] [DEBUG] Applying preprocessor: Execute\012[2025-04-16 11:53:16] [DEBUG] Instantiating kernel ''Python 3 (ipykernel)'' with kernel provisioner: local-provisioner\012[2025-04-16 11:53:16] [DEBUG] Starting kernel: [''/home/nadja/micromamba/envs/grader/bin/python'', ''-m'', ''ipykernel_launcher'', ''-f'', ''/tmp/tmpfku4x2w6.json'', ''--HistoryManager.hist_file=:memory:'']\012[2025-04-16 11:53:16] [DEBUG] Connecting to: tcp://127.0.0.1:45351\012[2025-04-16 11:53:16] [DEBUG] connecting iopub channel to tcp://127.0.0.1:41693\012[2025-04-16 11:53:16] [DEBUG] Connecting to: tcp://127.0.0.1:41693\012[2025-04-16 11:53:16] [DEBUG] connecting shell channel to tcp://127.0.0.1:47441\012[2025-04-16 11:53:16] [DEBUG] Connecting to: tcp://127.0.0.1:47441\012[2025-04-16 11:53:16] [DEBUG] connecting stdin channel to tcp://127.0.0.1:34463\012[2025-04-16 11:53:16] [DEBUG] Connecting to: tcp://127.0.0.1:34463\012[2025-04-16 11:53:16] [DEBUG] connecting heartbeat channel to tcp://127.0.0.1:47001\012[2025-04-16 11:53:16] [DEBUG] connecting control channel to tcp://127.0.0.1:45351\012[2025-04-16 11:53:16] [DEBUG] Connecting to: tcp://127.0.0.1:45351\012[2025-04-16 11:53:17] [DEBUG] Executing cell:\012# YOUR CODE HERE\012def sub_numbers(a, b):\012 return a - b\012 # good job\012[2025-04-16 11:53:17] [DEBUG] msg_type: status\012[2025-04-16 11:53:17] [DEBUG] content: {''execution_state'': ''busy''}\012[2025-04-16 11:53:17] [DEBUG] msg_type: execute_input\012[2025-04-16 11:53:17] [DEBUG] content: {''code'': ''# YOUR CODE HERE\ndef sub_numbers(a, b):\n return a - b\n # good job'', ''execution_count'': 1}\012[2025-04-16 11:53:17] [DEBUG] msg_type: status\012[2025-04-16 11:53:17] [DEBUG] content: {''execution_state'': ''idle''}\012[2025-04-16 11:53:17] [DEBUG] Executing cell:\012assert sub_numbers(3,1) == 2\012assert sub_numbers(6,21) == -15\012assert sub_numbers(7,1) == 6\012assert sub_numbers(94,5) == 89\012[2025-04-16 11:53:17] [DEBUG] msg_type: status\012[2025-04-16 11:53:17] [DEBUG] content: {''execution_state'': ''busy''}\012[2025-04-16 11:53:17] [DEBUG] msg_type: execute_input\012[2025-04-16 11:53:17] [DEBUG] content: {''code'': ''assert sub_numbers(3,1) == 2\nassert sub_numbers(6,21) == -15\nassert sub_numbers(7,1) == 6\nassert sub_numbers(94,5) == 89'', ''execution_count'': 2}\012[2025-04-16 11:53:17] [DEBUG] msg_type: status\012[2025-04-16 11:53:17] [DEBUG] content: {''execution_state'': ''idle''}\012[2025-04-16 11:53:17] [DEBUG] Destroying zmq context for \012[2025-04-16 11:53:17] [DEBUG] Applying preprocessor: LimitOutput\012[2025-04-16 11:53:18] [DEBUG] Applying preprocessor: SaveAutoGrades\012[2025-04-16 11:53:18] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012[2025-04-16 11:53:18] [DEBUG] Applying preprocessor: CheckCellMetadata\012[2025-04-16 11:53:18] [DEBUG] Applying preprocessor: ClearAlwaysHiddenTests\012[2025-04-16 11:53:18] [INFO] Writing 1736 bytes to /home/nadja/work/service/service_dir/convert_out/submission_6/sub_numbers.ipynb\012[2025-04-16 11:53:18] [INFO] Setting destination file permissions to 664\012[2025-04-16 11:53:18] [INFO] Reading 434 bytes from /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012[2025-04-16 11:53:18] [INFO] Found additional file patterns: []\012[2025-04-16 11:53:18] [INFO] Copying files from /home/nadja/work/service/service_dir/convert_in/submission_6 to /home/nadja/work/service/service_dir/convert_out/submission_6 that match allowed patterns and don''t match ignored patterns.\012[2025-04-16 11:53:18] [INFO] Copied the following files: []\012[2025-04-16 11:53:18] [INFO] Writing 434 bytes to /home/nadja/work/service/service_dir/convert_out/submission_6/gradebook.json\012','\012',E'\n')); -INSERT INTO submission_logs VALUES(7,replace('fatal: reference is not a tree: 0000000000000000000000000000000000000000\n','\n',E'\n')); -INSERT INTO submission_logs VALUES(8,replace('[2025-06-04 10:09:10] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:10] [INFO] Found additional file patterns: []\n[2025-06-04 10:09:10] [INFO] Copying files from /app/service_dir/convert_in/submission_8 to /app/service_dir/convert_out/submission_8 that match allowed patterns and don''t match ignored patterns.\n[2025-06-04 10:09:10] [INFO] Copied the following files: [''Currency Conversion.md'']\n[2025-06-04 10:09:10] [INFO] Writing 2096 bytes to /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:10] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:10] [INFO] Sanitizing /app/service_dir/convert_in/submission_8/convert_dollar.ipynb\n[2025-06-04 10:09:10] [INFO] Converting notebook /app/service_dir/convert_in/submission_8/convert_dollar.ipynb\n[2025-06-04 10:09:10] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:10] [INFO] Overwriting submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\n[2025-06-04 10:09:10] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:10] [INFO] Source of cell cell-97b08476829c31b2 in overwritten order to prove checksum.\n[2025-06-04 10:09:10] [INFO] Writing 2549 bytes to /app/service_dir/convert_out/submission_8/convert_dollar.ipynb\n[2025-06-04 10:09:10] [INFO] Autograding /app/service_dir/convert_out/submission_8/convert_dollar.ipynb\n[2025-06-04 10:09:10] [INFO] Converting notebook /app/service_dir/convert_out/submission_8/convert_dollar.ipynb\n[2025-06-04 10:09:11] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:11] [INFO] Writing 3008 bytes to /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:11] [INFO] Writing 3311 bytes to /app/service_dir/convert_out/submission_8/convert_dollar.ipynb\n[2025-06-04 10:09:11] [INFO] Setting destination file permissions to 664\n[2025-06-04 10:09:11] [INFO] Reading 3008 bytes from /app/service_dir/convert_out/submission_8/gradebook.json\n[2025-06-04 10:09:11] [INFO] Found additional file patterns: []\n[2025-06-04 10:09:11] [INFO] Copying files from /app/service_dir/convert_in/submission_8 to /app/service_dir/convert_out/submission_8 that match allowed patterns and don''t match ignored patterns.\n[2025-06-04 10:09:11] [INFO] Copied the following files: [''Currency Conversion.md'']\n[2025-06-04 10:09:11] [INFO] Writing 3008 bytes to /app/service_dir/convert_out/submission_8/gradebook.json\n','\n',E'\n')); -INSERT INTO submission_logs VALUES(9,replace('[2025-06-04 10:11:30] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:30] [INFO] Found additional file patterns: []\n[2025-06-04 10:11:30] [INFO] Copying files from /app/service_dir/convert_in/submission_9 to /app/service_dir/convert_out/submission_9 that match allowed patterns and don''t match ignored patterns.\n[2025-06-04 10:11:30] [INFO] Copied the following files: [''Currency Conversion.md'']\n[2025-06-04 10:11:30] [INFO] Writing 2096 bytes to /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:30] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:30] [INFO] Sanitizing /app/service_dir/convert_in/submission_9/convert_dollar.ipynb\n[2025-06-04 10:11:30] [INFO] Converting notebook /app/service_dir/convert_in/submission_9/convert_dollar.ipynb\n[2025-06-04 10:11:30] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:30] [INFO] Overwriting submitted notebook kernelspec: {''display_name'': ''Python 3 (ipykernel)'', ''language'': ''python'', ''name'': ''python3''}\n[2025-06-04 10:11:30] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:30] [INFO] Source of cell cell-97b08476829c31b2 in overwritten order to prove checksum.\n[2025-06-04 10:11:30] [INFO] Writing 2549 bytes to /app/service_dir/convert_out/submission_9/convert_dollar.ipynb\n[2025-06-04 10:11:30] [INFO] Autograding /app/service_dir/convert_out/submission_9/convert_dollar.ipynb\n[2025-06-04 10:11:30] [INFO] Converting notebook /app/service_dir/convert_out/submission_9/convert_dollar.ipynb\n[2025-06-04 10:11:31] [INFO] Reading 2096 bytes from /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:31] [INFO] Writing 3008 bytes to /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:31] [INFO] Writing 3311 bytes to /app/service_dir/convert_out/submission_9/convert_dollar.ipynb\n[2025-06-04 10:11:31] [INFO] Setting destination file permissions to 664\n[2025-06-04 10:11:31] [INFO] Reading 3008 bytes from /app/service_dir/convert_out/submission_9/gradebook.json\n[2025-06-04 10:11:31] [INFO] Found additional file patterns: []\n[2025-06-04 10:11:31] [INFO] Copying files from /app/service_dir/convert_in/submission_9 to /app/service_dir/convert_out/submission_9 that match allowed patterns and don''t match ignored patterns.\n[2025-06-04 10:11:31] [INFO] Copied the following files: [''Currency Conversion.md'']\n[2025-06-04 10:11:31] [INFO] Writing 3008 bytes to /app/service_dir/convert_out/submission_9/gradebook.json\n','\n',E'\n')); -INSERT INTO submission_properties VALUES(3,'{"notebooks": {"sum_numbers": {"id": "sum_numbers", "name": "sum_numbers", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-1e1d884e2e83e97f": {"max_score": 1.0, "cell_type": "code", "notebook_id": null, "name": "cell-1e1d884e2e83e97f", "id": null, "grade_id": "cell-1e1d884e2e83e97f", "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-ec1c0a6598d73f81": {"notebook_id": null, "name": "cell-ec1c0a6598d73f81", "id": null, "grade_id": null, "comment_id": "cell-ec1c0a6598d73f81", "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-ec1c0a6598d73f81": {"notebook_id": null, "name": "cell-ec1c0a6598d73f81", "id": null, "cell_type": "code", "locked": false, "source": "# YOUR CODE HERE\nraise NotImplementedError()", "checksum": "4249b24f09b6278a68bae93a067d84e7", "_type": "SourceCell"}, "cell-1e1d884e2e83e97f": {"notebook_id": null, "name": "cell-1e1d884e2e83e97f", "id": null, "cell_type": "code", "locked": true, "source": "assert sum_numbers(1) == 1\nassert sum_numbers(2) == 3\nassert sum_numbers(5) == 15", "checksum": "6453ffdd62ea1a1eabcf95616174dd88", "_type": "SourceCell"}}, "grades_dict": {"cell-1e1d884e2e83e97f": {"cell_id": "cell-1e1d884e2e83e97f", "notebook_id": "sum_numbers", "id": "cell-1e1d884e2e83e97f", "auto_score": 0, "manual_score": null, "extra_credit": null, "needs_manual_grade": false, "max_score_gradecell": 1.0, "max_score_taskcell": null, "failed_tests": null, "_type": "Grade", "max_score": 1.0}}, "comments_dict": {"cell-ec1c0a6598d73f81": {"cell_id": "cell-ec1c0a6598d73f81", "notebook_id": "sum_numbers", "id": "cell-ec1c0a6598d73f81", "auto_comment": "No response.", "manual_comment": null, "_type": "Comment"}}, "_type": "Notebook"}}, "extra_files": ["title.md"], "_type": "GradeBookModel", "schema_version": "1"}'); -INSERT INTO submission_properties VALUES(4,'{"notebooks":{"add_numbers":{"id":"add_numbers","name":"add_numbers","flagged":false,"kernelspec":"{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}","grade_cells_dict":{"cell-3df764e6d829e6ef":{"max_score":2,"cell_type":"code","notebook_id":null,"name":"cell-3df764e6d829e6ef","id":null,"grade_id":"cell-3df764e6d829e6ef","comment_id":null,"_type":"GradeCell"}},"solution_cells_dict":{"cell-7d6a4f3241ca6383":{"notebook_id":null,"name":"cell-7d6a4f3241ca6383","id":null,"grade_id":null,"comment_id":"cell-7d6a4f3241ca6383","_type":"SolutionCell"}},"task_cells_dict":{},"source_cells_dict":{"cell-7d6a4f3241ca6383":{"notebook_id":null,"name":"cell-7d6a4f3241ca6383","id":null,"cell_type":"code","locked":false,"source":"# YOUR CODE HERE\nraise NotImplementedError()","checksum":"bb2a9f9fb0716b1f5a0ca91a1720f598","_type":"SourceCell"},"cell-3df764e6d829e6ef":{"notebook_id":null,"name":"cell-3df764e6d829e6ef","id":null,"cell_type":"code","locked":true,"source":"assert add_numbers(1,2) == 3\nassert add_numbers(1,6) == 7\nassert add_numbers(111,2) == 113\nassert add_numbers(5,2) == 7\nassert add_numbers(3,2) == 5","checksum":"b9d6c3f56495b529e96ab79696dbe8a8","_type":"SourceCell"}},"grades_dict":{"cell-3df764e6d829e6ef":{"cell_id":"cell-3df764e6d829e6ef","notebook_id":"add_numbers","id":"cell-3df764e6d829e6ef","auto_score":2,"manual_score":1.25,"extra_credit":null,"needs_manual_grade":false,"max_score_gradecell":2,"max_score_taskcell":null,"failed_tests":null,"_type":"Grade","max_score":2}},"comments_dict":{"cell-7d6a4f3241ca6383":{"cell_id":"cell-7d6a4f3241ca6383","notebook_id":"add_numbers","id":"cell-7d6a4f3241ca6383","auto_comment":null,"manual_comment":null,"_type":"Comment"}},"_type":"Notebook"}},"extra_files":[],"_type":"GradeBookModel","schema_version":"1"}'); -INSERT INTO submission_properties VALUES(5,'{"notebooks": {"sub_numbers": {"id": "sub_numbers", "name": "sub_numbers", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {}, "solution_cells_dict": {}, "task_cells_dict": {}, "source_cells_dict": {}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": [], "_type": "GradeBookModel", "schema_version": "1"}'); -INSERT INTO submission_properties VALUES(6,'{"notebooks": {"sub_numbers": {"id": "sub_numbers", "name": "sub_numbers", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {}, "solution_cells_dict": {}, "task_cells_dict": {}, "source_cells_dict": {}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": [], "_type": "GradeBookModel", "schema_version": "1"}'); -INSERT INTO submission_properties VALUES(8,'{"notebooks": {"convert_dollar": {"id": "convert_dollar", "name": "convert_dollar", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-ac6f865522fb45c0": {"max_score": 1.0, "cell_type": "code", "notebook_id": null, "name": "cell-ac6f865522fb45c0", "id": null, "grade_id": "cell-ac6f865522fb45c0", "comment_id": null, "_type": "GradeCell"}, "cell-97b08476829c31b2": {"max_score": 4.0, "cell_type": "code", "notebook_id": null, "name": "cell-97b08476829c31b2", "id": null, "grade_id": "cell-97b08476829c31b2", "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-87e7eb777dedef14": {"notebook_id": null, "name": "cell-87e7eb777dedef14", "id": null, "grade_id": null, "comment_id": "cell-87e7eb777dedef14", "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-87e7eb777dedef14": {"notebook_id": null, "name": "cell-87e7eb777dedef14", "id": null, "cell_type": "code", "locked": false, "source": "def convert_dollar(dollar):\n # YOUR CODE HERE\n raise NotImplementedError()", "checksum": "5ed5fb06cd04ff189fa63b6345d4f246", "_type": "SourceCell"}, "cell-ac6f865522fb45c0": {"notebook_id": null, "name": "cell-ac6f865522fb45c0", "id": null, "cell_type": "code", "locked": true, "source": "eur, gbp = convert_dollar(5)\nassert eur == 4.6548194\nassert gbp == 4.0059821499999995", "checksum": "721905ff987abff4d78f1fa62f764059", "_type": "SourceCell"}, "cell-97b08476829c31b2": {"notebook_id": null, "name": "cell-97b08476829c31b2", "id": null, "cell_type": "code", "locked": true, "source": "assert convert_dollar(20) == (18.6192776, 16.023928599999998)\n### BEGIN HIDDEN TESTS\nassert convert_dollar(1923810) == (1790997.6219827998, 1541349.7039983)\nassert convert_dollar(0) == (0.0, 0.0)\nassert convert_dollar(999) == (930.03291612, 800.39523357)\n### END HIDDEN TESTS", "checksum": "a10b1b507cc9ecafa74b3cbfdf59bd3a", "_type": "SourceCell"}}, "grades_dict": {"cell-ac6f865522fb45c0": {"cell_id": "cell-ac6f865522fb45c0", "notebook_id": "convert_dollar", "id": "cell-ac6f865522fb45c0", "auto_score": 1.0, "manual_score": null, "extra_credit": null, "needs_manual_grade": false, "max_score_gradecell": 1.0, "max_score_taskcell": null, "failed_tests": null, "_type": "Grade", "max_score": 1.0}, "cell-97b08476829c31b2": {"cell_id": "cell-97b08476829c31b2", "notebook_id": "convert_dollar", "id": "cell-97b08476829c31b2", "auto_score": 4.0, "manual_score": null, "extra_credit": null, "needs_manual_grade": false, "max_score_gradecell": 4.0, "max_score_taskcell": null, "failed_tests": null, "_type": "Grade", "max_score": 4.0}}, "comments_dict": {"cell-87e7eb777dedef14": {"cell_id": "cell-87e7eb777dedef14", "notebook_id": "convert_dollar", "id": "cell-87e7eb777dedef14", "auto_comment": null, "manual_comment": null, "_type": "Comment"}}, "_type": "Notebook"}}, "extra_files": ["Currency Conversion.md"], "_type": "GradeBookModel", "schema_version": "1"}'); -INSERT INTO submission_properties VALUES(9,'{"notebooks": {"convert_dollar": {"id": "convert_dollar", "name": "convert_dollar", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-ac6f865522fb45c0": {"max_score": 1.0, "cell_type": "code", "notebook_id": null, "name": "cell-ac6f865522fb45c0", "id": null, "grade_id": "cell-ac6f865522fb45c0", "comment_id": null, "_type": "GradeCell"}, "cell-97b08476829c31b2": {"max_score": 4.0, "cell_type": "code", "notebook_id": null, "name": "cell-97b08476829c31b2", "id": null, "grade_id": "cell-97b08476829c31b2", "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-87e7eb777dedef14": {"notebook_id": null, "name": "cell-87e7eb777dedef14", "id": null, "grade_id": null, "comment_id": "cell-87e7eb777dedef14", "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-87e7eb777dedef14": {"notebook_id": null, "name": "cell-87e7eb777dedef14", "id": null, "cell_type": "code", "locked": false, "source": "def convert_dollar(dollar):\n # YOUR CODE HERE\n raise NotImplementedError()", "checksum": "5ed5fb06cd04ff189fa63b6345d4f246", "_type": "SourceCell"}, "cell-ac6f865522fb45c0": {"notebook_id": null, "name": "cell-ac6f865522fb45c0", "id": null, "cell_type": "code", "locked": true, "source": "eur, gbp = convert_dollar(5)\nassert eur == 4.6548194\nassert gbp == 4.0059821499999995", "checksum": "721905ff987abff4d78f1fa62f764059", "_type": "SourceCell"}, "cell-97b08476829c31b2": {"notebook_id": null, "name": "cell-97b08476829c31b2", "id": null, "cell_type": "code", "locked": true, "source": "assert convert_dollar(20) == (18.6192776, 16.023928599999998)\n### BEGIN HIDDEN TESTS\nassert convert_dollar(1923810) == (1790997.6219827998, 1541349.7039983)\nassert convert_dollar(0) == (0.0, 0.0)\nassert convert_dollar(999) == (930.03291612, 800.39523357)\n### END HIDDEN TESTS", "checksum": "a10b1b507cc9ecafa74b3cbfdf59bd3a", "_type": "SourceCell"}}, "grades_dict": {"cell-ac6f865522fb45c0": {"cell_id": "cell-ac6f865522fb45c0", "notebook_id": "convert_dollar", "id": "cell-ac6f865522fb45c0", "auto_score": 1.0, "manual_score": null, "extra_credit": null, "needs_manual_grade": false, "max_score_gradecell": 1.0, "max_score_taskcell": null, "failed_tests": null, "_type": "Grade", "max_score": 1.0}, "cell-97b08476829c31b2": {"cell_id": "cell-97b08476829c31b2", "notebook_id": "convert_dollar", "id": "cell-97b08476829c31b2", "auto_score": 4.0, "manual_score": null, "extra_credit": null, "needs_manual_grade": false, "max_score_gradecell": 4.0, "max_score_taskcell": null, "failed_tests": null, "_type": "Grade", "max_score": 4.0}}, "comments_dict": {"cell-87e7eb777dedef14": {"cell_id": "cell-87e7eb777dedef14", "notebook_id": "convert_dollar", "id": "cell-87e7eb777dedef14", "auto_comment": null, "manual_comment": null, "_type": "Comment"}}, "_type": "Notebook"}}, "extra_files": ["Currency Conversion.md"], "_type": "GradeBookModel", "schema_version": "1"}'); +INSERT INTO "user" VALUES ('admin', NULL, 'b3c349f83ef94143b644221523e04ca2', 'admin', 1); +INSERT INTO "user" VALUES ('instructor', NULL, '3b80476d54ef49848f1dd00b436e9380', 'instructor', 2); +INSERT INTO "user" VALUES ('student', NULL, '935f9b72143f40459ad7f5e32a94a4c1', 'student', 3); +INSERT INTO "user" VALUES ('tutor', NULL, '77f888fee7f84bfbba6b226fce292115', 'tutor', 4); +INSERT INTO "user" VALUES ('user1', NULL, '393ced73010a47a198edc44609c0d1b6', 'user1', 5); +INSERT INTO lecture VALUES (1, 'lect1', 'lect1', 'active', 'active', '2025-04-15 11:58:36.963401', '2025-04-15 11:58:36.963405'); +INSERT INTO "assignment" ("id", "name", "lectid", "points", "status", "deleted", "properties", "created_at", "updated_at", "settings") +VALUES (1, 'Currency Conversion', 1, 5, 'released', 'active', + '{"notebooks": {"convert_dollar": {"id": "convert_dollar", "name": "convert_dollar", "flagged": false, "kernelspec": "{\"display_name\": \"Python 3 (ipykernel)\", \"language\": \"python\", \"name\": \"python3\"}", "grade_cells_dict": {"cell-6b8b46445e701ed6": {"max_score": 1.0, "cell_type": "code", "notebook_id": null, "name": "cell-6b8b46445e701ed6", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}, "cell-cc740884dba75f9d": {"max_score": 4.0, "cell_type": "code", "notebook_id": null, "name": "cell-cc740884dba75f9d", "id": null, "grade_id": null, "comment_id": null, "_type": "GradeCell"}}, "solution_cells_dict": {"cell-b830f4cea076409b": {"notebook_id": null, "name": "cell-b830f4cea076409b", "id": null, "grade_id": null, "comment_id": null, "_type": "SolutionCell"}}, "task_cells_dict": {}, "source_cells_dict": {"cell-0a18dfa4b887faf3": {"notebook_id": null, "name": "cell-0a18dfa4b887faf3", "id": null, "cell_type": "markdown", "locked": true, "source": "# Currency Conversion Assignment", "checksum": "44ff1a9784ca989b71235092c135c1d8", "_type": "SourceCell"}, "cell-b830f4cea076409b": {"notebook_id": null, "name": "cell-b830f4cea076409b", "id": null, "cell_type": "code", "locked": false, "source": "# YOUR CODE HERE\nraise NotImplementedError()", "checksum": "5c575adfbb0bd8c9f2ca4391076a32bb", "_type": "SourceCell"}, "cell-6b8b46445e701ed6": {"notebook_id": null, "name": "cell-6b8b46445e701ed6", "id": null, "cell_type": "code", "locked": true, "source": "eur, gbp = convert_dollar(5)\nassert eur == 4.6548194\nassert gbp == 4.0059821499999995", "checksum": "50f93537e80cd52a8e32c3fb884e2887", "_type": "SourceCell"}, "cell-cc740884dba75f9d": {"notebook_id": null, "name": "cell-cc740884dba75f9d", "id": null, "cell_type": "code", "locked": true, "source": "assert convert_dollar(20) == (18.6192776, 16.023928599999998)\n### BEGIN HIDDEN TESTS\nassert convert_dollar(1923810) == (1790997.6219827998, 1541349.7039983)\nassert convert_dollar(0) == (0.0, 0.0)\nassert convert_dollar(999) == (930.03291612, 800.39523357)\n### END HIDDEN TESTS", "checksum": "a3bd87367c79c1a0b2015260b7b59357", "_type": "SourceCell"}}, "grades_dict": {}, "comments_dict": {}, "_type": "Notebook"}}, "extra_files": ["CurrencyConversion.md"], "_type": "GradeBookModel", "schema_version": "1"}', + '2025-10-30 17:20:35.317757', '2025-10-30 17:30:46.101408', + '{"deadline": "2059-06-03T23:00:00+00:00", "max_submissions": null, "allowed_files": [], "late_submission": null, "autograde_type": "auto"}'); +INSERT INTO takepart VALUES(1,'instructor',1); +INSERT INTO takepart VALUES(1,'instructor',2); +INSERT INTO takepart VALUES(1,'student',3); +INSERT INTO takepart VALUES(1,'tutor',4); diff --git a/examples/docker_compose/docker-compose-postgres.yml b/examples/docker_compose/docker-compose-postgres.yml index c20f4229..68995008 100644 --- a/examples/docker_compose/docker-compose-postgres.yml +++ b/examples/docker_compose/docker-compose-postgres.yml @@ -1,4 +1,8 @@ services: + + service: + command: [] # Use the default CMD from Dockerfile-Service, i.e. just run grader-service + db-init: build: context: ../.. @@ -8,24 +12,22 @@ services: DATABASE_TYPE: postgres volumes: - ./grader_service_config.py:/app/grader_service_config.py + - service_dir:/app/service_dir - ./data_only.sql:/app/data_only.sql - - ./init-db.sh:/app/init-db.sh - networks: - - network + - ./init-db-postgres.sh:/app/init-db-postgres.sh + - ./init_repos:/app/init_repos depends_on: postgres: condition: service_healthy postgres: image: postgres - restart: always + restart: unless-stopped environment: # required for using postgres image POSTGRES_PASSWORD: postgres POSTGRES_DB: grader - networks: - - network healthcheck: test: [ "CMD", "pg_isready", "-U", "postgres" ] interval: 5s - retries: 5 \ No newline at end of file + retries: 5 diff --git a/examples/docker_compose/docker-compose.yml b/examples/docker_compose/docker-compose.yml index 044573d3..77d9f892 100644 --- a/examples/docker_compose/docker-compose.yml +++ b/examples/docker_compose/docker-compose.yml @@ -5,21 +5,24 @@ services: build: context: ../.. dockerfile: examples/docker_compose/Dockerfile-Service + command: bash -c " + /app/init-db.sh + && grader-service -f /app/grader_service_config.py + " volumes: - ./grader_service_config.py:/app/grader_service_config.py - service_dir:/app/service_dir + - ./init-db.sh:/app/init-db.sh + - ./data_only.sql:/app/data_only.sql + - ./init_repos:/app/init_repos environment: - DATABASE_TYPE: ${DATABASE_TYPE} + DATABASE_TYPE: ${DATABASE_TYPE:-sqlite} RABBITMQ_GRADER_SERVICE_USERNAME: grader_user RABBITMQ_GRADER_SERVICE_PASSWORD: grader_password - restart: always + restart: unless-stopped depends_on: init-volume: condition: service_completed_successfully - networks: - - network - expose: - - "4010" hub: build: @@ -29,18 +32,14 @@ services: - /var/run/docker.sock:/var/run/docker.sock:rw - ./jupyterhub_config.py:/app/jupyterhub_config.py - ./data-hub:/data - restart: always + restart: unless-stopped depends_on: - service - networks: - - network ports: - "8080:8080" rabbitmq: image: rabbitmq:latest - networks: - - network environment: RABBITMQ_DEFAULT_VHOST: grader RABBITMQ_DEFAULT_USER: grader_user @@ -54,8 +53,6 @@ services: build: context: ../.. dockerfile: examples/docker_compose/Dockerfile-Service - networks: - - network command: - "grader-worker" - "-f" @@ -68,7 +65,7 @@ services: environment: RABBITMQ_GRADER_SERVICE_USERNAME: grader_user RABBITMQ_GRADER_SERVICE_PASSWORD: grader_password - DATABASE_TYPE: ${DATABASE_TYPE} + DATABASE_TYPE: ${DATABASE_TYPE:-sqlite} init-volume: build: @@ -77,14 +74,7 @@ services: volumes: - ./service_dir:/local_service_dir - service_dir:/volume_service_dir - networks: - - network - volumes: jupyterhub-data: service_dir: - -networks: - network: - driver: bridge diff --git a/examples/docker_compose/init-db-postgres.sh b/examples/docker_compose/init-db-postgres.sh new file mode 100755 index 00000000..50db8a7e --- /dev/null +++ b/examples/docker_compose/init-db-postgres.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -e + +echo "Initialize a PostgreSQL database: run migrations, load initial data, and create initial repos." + +/app/.venv/bin/grader-service-migrate -f /app/grader_service_config.py +# Try to load the initial data. This will fail on the first error (e.g. if the data already exists) +# and roll back the transaction. +if ! psql -v ON_ERROR_STOP=1 -h postgres -U postgres -d grader --single-transaction -f /app/data_only.sql; then + echo "Initial data import failed; probably the database already exists and contains the data." +fi + +cp -r /app/init_repos/* /app/service_dir/git diff --git a/examples/docker_compose/init-db.sh b/examples/docker_compose/init-db.sh index 00bf839d..91f97a90 100755 --- a/examples/docker_compose/init-db.sh +++ b/examples/docker_compose/init-db.sh @@ -1,4 +1,14 @@ +#!/usr/bin/env bash +set -e -/venv/bin/grader-service-migrate -f /app/grader_service_config.py +echo "Initialize an sqlite database: run migrations, load initial data, and create initial repos." -psql -h postgres -U postgres -d grader -f /app/data_only.sql \ No newline at end of file +grader-service-migrate -f /app/grader_service_config.py +# Insert some initial data into the database. The import will fail if the data already +# has been inserted, so we ignore errors and just continue. +# Note: For debugging, remove the stderr redirection: `2>/dev/null`. +if ! sqlite3 /app/service_dir/grader.db < /app/data_only.sql 2>/dev/null; then + echo "Initial data import failed; probably the database already exists and contains the data." +fi + +cp -r /app/init_repos/* /app/service_dir/git diff --git a/examples/docker_compose/init-service-dir.sh b/examples/docker_compose/init-service-dir.sh index 586cfbb1..bac10e12 100755 --- a/examples/docker_compose/init-service-dir.sh +++ b/examples/docker_compose/init-service-dir.sh @@ -1,3 +1,6 @@ +#!/bin/sh +set -e + echo "Populate docker volume" -cp -r /local_service_dir/. /volume_service_dir \ No newline at end of file +cp -r /local_service_dir/. /volume_service_dir diff --git a/examples/docker_compose/init_repos/lect1/1/release/HEAD b/examples/docker_compose/init_repos/lect1/1/release/HEAD new file mode 100644 index 00000000..b870d826 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/HEAD @@ -0,0 +1 @@ +ref: refs/heads/main diff --git a/examples/docker_compose/init_repos/lect1/1/release/config b/examples/docker_compose/init_repos/lect1/1/release/config new file mode 100644 index 00000000..07d359d0 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/config @@ -0,0 +1,4 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true diff --git a/examples/docker_compose/init_repos/lect1/1/release/description b/examples/docker_compose/init_repos/lect1/1/release/description new file mode 100644 index 00000000..498b267a --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/applypatch-msg.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/applypatch-msg.sample new file mode 100755 index 00000000..a5d7b84a --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/commit-msg.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/commit-msg.sample new file mode 100755 index 00000000..b58d1184 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/fsmonitor-watchman.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/fsmonitor-watchman.sample new file mode 100755 index 00000000..23e856f5 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/fsmonitor-watchman.sample @@ -0,0 +1,174 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 2) and last update token +# formatted as a string and outputs to stdout a new update token and +# all files that have been modified since the update token. Paths must +# be relative to the root of the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $last_update_token) = @ARGV; + +# Uncomment for debugging +# print STDERR "$0 $version $last_update_token\n"; + +# Check the hook interface version +if ($version ne 2) { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree = get_working_dir(); + +my $retry = 1; + +my $json_pkg; +eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; +} or do { + require JSON::PP; + $json_pkg = "JSON::PP"; +}; + +launch_watchman(); + +sub launch_watchman { + my $o = watchman_query(); + if (is_work_tree_watched($o)) { + output_result($o->{clock}, @{$o->{files}}); + } +} + +sub output_result { + my ($clockid, @files) = @_; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # binmode $fh, ":utf8"; + # print $fh "$clockid\n@files\n"; + # close $fh; + + binmode STDOUT, ":utf8"; + print $clockid; + print "\0"; + local $, = "\0"; + print @files; +} + +sub watchman_clock { + my $response = qx/watchman clock "$git_work_tree"/; + die "Failed to get clock id on '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + return $json_pkg->new->utf8->decode($response); +} + +sub watchman_query { + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $last_update_token but not from the .git folder. + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + my $last_update_line = ""; + if (substr($last_update_token, 0, 1) eq "c") { + $last_update_token = "\"$last_update_token\""; + $last_update_line = qq[\n"since": $last_update_token,]; + } + my $query = <<" END"; + ["query", "$git_work_tree", {$last_update_line + "fields": ["name"], + "expression": ["not", ["dirname", ".git"]] + }] + END + + # Uncomment for debugging the watchman query + # open (my $fh, ">", ".git/watchman-query.json"); + # print $fh $query; + # close $fh; + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; }; + + # Uncomment for debugging the watch response + # open ($fh, ">", ".git/watchman-response.json"); + # print $fh $response; + # close $fh; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + return $json_pkg->new->utf8->decode($response); +} + +sub is_work_tree_watched { + my ($output) = @_; + my $error = $output->{error}; + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { + $retry--; + my $response = qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + $output = $json_pkg->new->utf8->decode($response); + $error = $output->{error}; + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # close $fh; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + my $o = watchman_clock(); + $error = $output->{error}; + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + output_result($o->{clock}, ("/")); + $last_update_token = $o->{clock}; + + eval { launch_watchman() }; + return 0; + } + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + return 1; +} + +sub get_working_dir { + my $working_dir; + if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $working_dir = Win32::GetCwd(); + $working_dir =~ tr/\\/\//; + } else { + require Cwd; + $working_dir = Cwd::cwd(); + } + + return $working_dir; +} diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/post-update.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/post-update.sample new file mode 100755 index 00000000..ec17ec19 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-applypatch.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-applypatch.sample new file mode 100755 index 00000000..4142082b --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-commit.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-commit.sample new file mode 100755 index 00000000..29ed5ee4 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --type=bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff-index --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-merge-commit.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-merge-commit.sample new file mode 100755 index 00000000..399eab19 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-merge-commit.sample @@ -0,0 +1,13 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git merge" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message to +# stderr if it wants to stop the merge commit. +# +# To enable this hook, rename this file to "pre-merge-commit". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" +: diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-push.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-push.sample new file mode 100755 index 00000000..4ce688d3 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-push.sample @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +zero=$(git hash-object --stdin &2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-rebase.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-rebase.sample new file mode 100755 index 00000000..6cbef5c3 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-receive b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-receive new file mode 100755 index 00000000..c9757ca0 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-receive @@ -0,0 +1,81 @@ +#!/bin/bash + +# from: https://gist.github.com/nauar/826f85d25d692d9bc009312cb71577dd + +# TEMPLATING VALUES +MAX_SIZE_MB="80" +FILE_ALLOW_PATTERN=".+()" +MAX_FILE_COUNT="512" + +MAX_BYTES=$((MAX_SIZE_MB * 1000000)) +GITCMD="git" +NULL_SHA="0000000000000000000000000000000000000000" +EMPTY_TREE_SHA=$($GITCMD hash-object -t tree /dev/null) # SHA1: "4b825dc642cb6eb9a060e54bf8d69288fbee4904" +LOGFILE="/tmp/git_private.log" + +function file_log() { + moment=$(date '+%d/%m/%Y %H:%M:%S') + echo "[ $moment ] [ POLICY CHECK ] $1" >> $LOGFILE +} + +function echo_log() { + echo "[ POLICY CHECK ] $1" +} + +echo_log "Starting validation..." +while read -r sha1_old sha1_new refname; do + + file_log "old: $sha1_old new: $sha1_new refname: $refname" + + # Avoid removed branches + if [ "${sha1_new}" = "${NULL_SHA}" ]; then + continue + fi + + # Set sha1_old properly if this is branch creation. + if [ "${sha1_old}" = "${NULL_SHA}" ]; then + sha1_old=$EMPTY_TREE_SHA + fi + + # Ignore case + shopt -s nocaseglob + + # get the total number of files that are in the new commit (sha1_new) | xargs to trim whitespace + total_files_count=$($GITCMD ls-tree --full-tree -r --name-only "$sha1_new" | wc -l | xargs) + + if [[ ${total_files_count} -gt ${MAX_FILE_COUNT} ]]; then + echo_log "ERROR: Exceeded maximum number of files! The maximum was set to $MAX_FILE_COUNT but the commit contains $total_files_count!" + exit 1 + fi + + newFiles=$($GITCMD diff --stat --name-only --diff-filter=ACMRT "${sha1_old}".."${sha1_new}") + + if [[ $? -ne 0 ]]; then + echo_log "ERROR: Could not read files! Cancelling push..." + exit 1 + fi + + old_IFS=$IFS + IFS=' + ' + for filename in $newFiles; do + file_log "Filename: $filename" + filesize=$($GITCMD cat-file -s "${sha1_new}:${filename}") + + if [[ -z $filesize ]]; then filesize=0; fi + + if [ "${filesize}" -gt "${MAX_BYTES}" ]; then + filesize_mb=$((filesize / 1000000)) + echo_log "ERROR: The file $filename is larger than $MAX_SIZE_MB MB. Its size is $filesize_mb MB." + exit 1 + fi + + if ! [[ "$filename" =~ ${FILE_ALLOW_PATTERN} ]]; then + echo_log "ERROR: The file $filename has a file extension that has been disallowed!" + exit 1 + fi + + done + IFS=$old_IFS +done +echo_log "Validation successful!" diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-receive.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-receive.sample new file mode 100755 index 00000000..a1fd29ec --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/pre-receive.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/prepare-commit-msg.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/prepare-commit-msg.sample new file mode 100755 index 00000000..10fa14c5 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/prepare-commit-msg.sample @@ -0,0 +1,42 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/push-to-checkout.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/push-to-checkout.sample new file mode 100755 index 00000000..af5a0c00 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/push-to-checkout.sample @@ -0,0 +1,78 @@ +#!/bin/sh + +# An example hook script to update a checked-out tree on a git push. +# +# This hook is invoked by git-receive-pack(1) when it reacts to git +# push and updates reference(s) in its repository, and when the push +# tries to update the branch that is currently checked out and the +# receive.denyCurrentBranch configuration variable is set to +# updateInstead. +# +# By default, such a push is refused if the working tree and the index +# of the remote repository has any difference from the currently +# checked out commit; when both the working tree and the index match +# the current commit, they are updated to match the newly pushed tip +# of the branch. This hook is to be used to override the default +# behaviour; however the code below reimplements the default behaviour +# as a starting point for convenient modification. +# +# The hook receives the commit with which the tip of the current +# branch is going to be updated: +commit=$1 + +# It can exit with a non-zero status to refuse the push (when it does +# so, it must not modify the index or the working tree). +die () { + echo >&2 "$*" + exit 1 +} + +# Or it can make any necessary changes to the working tree and to the +# index to bring them to the desired state when the tip of the current +# branch is updated to the new commit, and exit with a zero status. +# +# For example, the hook can simply run git read-tree -u -m HEAD "$1" +# in order to emulate git fetch that is run in the reverse direction +# with git push, as the two-tree form of git read-tree -u -m is +# essentially the same as git switch or git checkout that switches +# branches while keeping the local changes in the working tree that do +# not interfere with the difference between the branches. + +# The below is a more-or-less exact translation to shell of the C code +# for the default behaviour for git's push-to-checkout hook defined in +# the push_to_deploy() function in builtin/receive-pack.c. +# +# Note that the hook will be executed from the repository directory, +# not from the working tree, so if you want to perform operations on +# the working tree, you will have to adapt your code accordingly, e.g. +# by adding "cd .." or using relative paths. + +if ! git update-index -q --ignore-submodules --refresh +then + die "Up-to-date check failed" +fi + +if ! git diff-files --quiet --ignore-submodules -- +then + die "Working directory has unstaged changes" +fi + +# This is a rough translation of: +# +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX +if git cat-file -e HEAD 2>/dev/null +then + head=HEAD +else + head=$(git hash-object -t tree --stdin &2 + exit 1 +} + +unset GIT_DIR GIT_WORK_TREE +cd "$worktree" && + +if grep -q "^diff --git " "$1" +then + validate_patch "$1" +else + validate_cover_letter "$1" +fi && + +if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL" +then + git config --unset-all sendemail.validateWorktree && + trap 'git worktree remove -ff "$worktree"' EXIT && + validate_series +fi diff --git a/examples/docker_compose/init_repos/lect1/1/release/hooks/update.sample b/examples/docker_compose/init_repos/lect1/1/release/hooks/update.sample new file mode 100755 index 00000000..c4d426bc --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --type=bool hooks.allowunannotated) +allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) +denycreatebranch=$(git config --type=bool hooks.denycreatebranch) +allowdeletetag=$(git config --type=bool hooks.allowdeletetag) +allowmodifytag=$(git config --type=bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero=$(git hash-object --stdin &2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/examples/docker_compose/init_repos/lect1/1/release/info/exclude b/examples/docker_compose/init_repos/lect1/1/release/info/exclude new file mode 100644 index 00000000..a5196d1b --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/examples/docker_compose/init_repos/lect1/1/release/objects/06/8db68fd13c1f3904aff1c9d714784ea7cce641 b/examples/docker_compose/init_repos/lect1/1/release/objects/06/8db68fd13c1f3904aff1c9d714784ea7cce641 new file mode 100644 index 00000000..4a5f9cd4 Binary files /dev/null and b/examples/docker_compose/init_repos/lect1/1/release/objects/06/8db68fd13c1f3904aff1c9d714784ea7cce641 differ diff --git a/examples/docker_compose/init_repos/lect1/1/release/objects/ad/4920f052dfeb29078b09d2a16ac7950954db10 b/examples/docker_compose/init_repos/lect1/1/release/objects/ad/4920f052dfeb29078b09d2a16ac7950954db10 new file mode 100644 index 00000000..13abae46 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/objects/ad/4920f052dfeb29078b09d2a16ac7950954db10 @@ -0,0 +1,2 @@ +x] +B!F{vD0Xs\m| i̠]/JF-)fSbgQw~np${Pm徂jMhԢhzS7mB7V \ No newline at end of file diff --git a/examples/docker_compose/init_repos/lect1/1/release/objects/b0/9dc2819da3401a5e4cd0fb7bee2af596fb8a89 b/examples/docker_compose/init_repos/lect1/1/release/objects/b0/9dc2819da3401a5e4cd0fb7bee2af596fb8a89 new file mode 100644 index 00000000..a64ad7da Binary files /dev/null and b/examples/docker_compose/init_repos/lect1/1/release/objects/b0/9dc2819da3401a5e4cd0fb7bee2af596fb8a89 differ diff --git a/examples/docker_compose/init_repos/lect1/1/release/objects/ce/9a55b1ebd5aeeb540ea8c28f2140dacf87d546 b/examples/docker_compose/init_repos/lect1/1/release/objects/ce/9a55b1ebd5aeeb540ea8c28f2140dacf87d546 new file mode 100644 index 00000000..9e36d4af Binary files /dev/null and b/examples/docker_compose/init_repos/lect1/1/release/objects/ce/9a55b1ebd5aeeb540ea8c28f2140dacf87d546 differ diff --git a/examples/docker_compose/init_repos/lect1/1/release/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/examples/docker_compose/init_repos/lect1/1/release/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 00000000..71122389 Binary files /dev/null and b/examples/docker_compose/init_repos/lect1/1/release/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/examples/docker_compose/init_repos/lect1/1/release/refs/heads/main b/examples/docker_compose/init_repos/lect1/1/release/refs/heads/main new file mode 100644 index 00000000..786b7ea5 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/release/refs/heads/main @@ -0,0 +1 @@ +ce9a55b1ebd5aeeb540ea8c28f2140dacf87d546 diff --git a/examples/docker_compose/init_repos/lect1/1/source/HEAD b/examples/docker_compose/init_repos/lect1/1/source/HEAD new file mode 100644 index 00000000..b870d826 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/HEAD @@ -0,0 +1 @@ +ref: refs/heads/main diff --git a/examples/docker_compose/init_repos/lect1/1/source/config b/examples/docker_compose/init_repos/lect1/1/source/config new file mode 100644 index 00000000..07d359d0 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/config @@ -0,0 +1,4 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = true diff --git a/examples/docker_compose/init_repos/lect1/1/source/description b/examples/docker_compose/init_repos/lect1/1/source/description new file mode 100644 index 00000000..498b267a --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/applypatch-msg.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/applypatch-msg.sample new file mode 100755 index 00000000..a5d7b84a --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/applypatch-msg.sample @@ -0,0 +1,15 @@ +#!/bin/sh +# +# An example hook script to check the commit log message taken by +# applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. The hook is +# allowed to edit the commit message file. +# +# To enable this hook, rename this file to "applypatch-msg". + +. git-sh-setup +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} +: diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/commit-msg.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/commit-msg.sample new file mode 100755 index 00000000..b58d1184 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/commit-msg.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to check the commit log message. +# Called by "git commit" with one argument, the name of the file +# that has the commit message. The hook should exit with non-zero +# status after issuing an appropriate message if it wants to stop the +# commit. The hook is allowed to edit the commit message file. +# +# To enable this hook, rename this file to "commit-msg". + +# Uncomment the below to add a Signed-off-by line to the message. +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg +# hook is more suited to it. +# +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" + +# This example catches duplicate Signed-off-by lines. + +test "" = "$(grep '^Signed-off-by: ' "$1" | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { + echo >&2 Duplicate Signed-off-by lines. + exit 1 +} diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/fsmonitor-watchman.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/fsmonitor-watchman.sample new file mode 100755 index 00000000..23e856f5 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/fsmonitor-watchman.sample @@ -0,0 +1,174 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use IPC::Open2; + +# An example hook script to integrate Watchman +# (https://facebook.github.io/watchman/) with git to speed up detecting +# new and modified files. +# +# The hook is passed a version (currently 2) and last update token +# formatted as a string and outputs to stdout a new update token and +# all files that have been modified since the update token. Paths must +# be relative to the root of the working tree and separated by a single NUL. +# +# To enable this hook, rename this file to "query-watchman" and set +# 'git config core.fsmonitor .git/hooks/query-watchman' +# +my ($version, $last_update_token) = @ARGV; + +# Uncomment for debugging +# print STDERR "$0 $version $last_update_token\n"; + +# Check the hook interface version +if ($version ne 2) { + die "Unsupported query-fsmonitor hook version '$version'.\n" . + "Falling back to scanning...\n"; +} + +my $git_work_tree = get_working_dir(); + +my $retry = 1; + +my $json_pkg; +eval { + require JSON::XS; + $json_pkg = "JSON::XS"; + 1; +} or do { + require JSON::PP; + $json_pkg = "JSON::PP"; +}; + +launch_watchman(); + +sub launch_watchman { + my $o = watchman_query(); + if (is_work_tree_watched($o)) { + output_result($o->{clock}, @{$o->{files}}); + } +} + +sub output_result { + my ($clockid, @files) = @_; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # binmode $fh, ":utf8"; + # print $fh "$clockid\n@files\n"; + # close $fh; + + binmode STDOUT, ":utf8"; + print $clockid; + print "\0"; + local $, = "\0"; + print @files; +} + +sub watchman_clock { + my $response = qx/watchman clock "$git_work_tree"/; + die "Failed to get clock id on '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + + return $json_pkg->new->utf8->decode($response); +} + +sub watchman_query { + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') + or die "open2() failed: $!\n" . + "Falling back to scanning...\n"; + + # In the query expression below we're asking for names of files that + # changed since $last_update_token but not from the .git folder. + # + # To accomplish this, we're using the "since" generator to use the + # recency index to select candidate nodes and "fields" to limit the + # output to file names only. Then we're using the "expression" term to + # further constrain the results. + my $last_update_line = ""; + if (substr($last_update_token, 0, 1) eq "c") { + $last_update_token = "\"$last_update_token\""; + $last_update_line = qq[\n"since": $last_update_token,]; + } + my $query = <<" END"; + ["query", "$git_work_tree", {$last_update_line + "fields": ["name"], + "expression": ["not", ["dirname", ".git"]] + }] + END + + # Uncomment for debugging the watchman query + # open (my $fh, ">", ".git/watchman-query.json"); + # print $fh $query; + # close $fh; + + print CHLD_IN $query; + close CHLD_IN; + my $response = do {local $/; }; + + # Uncomment for debugging the watch response + # open ($fh, ">", ".git/watchman-response.json"); + # print $fh $response; + # close $fh; + + die "Watchman: command returned no output.\n" . + "Falling back to scanning...\n" if $response eq ""; + die "Watchman: command returned invalid output: $response\n" . + "Falling back to scanning...\n" unless $response =~ /^\{/; + + return $json_pkg->new->utf8->decode($response); +} + +sub is_work_tree_watched { + my ($output) = @_; + my $error = $output->{error}; + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { + $retry--; + my $response = qx/watchman watch "$git_work_tree"/; + die "Failed to make watchman watch '$git_work_tree'.\n" . + "Falling back to scanning...\n" if $? != 0; + $output = $json_pkg->new->utf8->decode($response); + $error = $output->{error}; + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + # Uncomment for debugging watchman output + # open (my $fh, ">", ".git/watchman-output.out"); + # close $fh; + + # Watchman will always return all files on the first query so + # return the fast "everything is dirty" flag to git and do the + # Watchman query just to get it over with now so we won't pay + # the cost in git to look up each individual file. + my $o = watchman_clock(); + $error = $output->{error}; + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + output_result($o->{clock}, ("/")); + $last_update_token = $o->{clock}; + + eval { launch_watchman() }; + return 0; + } + + die "Watchman: $error.\n" . + "Falling back to scanning...\n" if $error; + + return 1; +} + +sub get_working_dir { + my $working_dir; + if ($^O =~ 'msys' || $^O =~ 'cygwin') { + $working_dir = Win32::GetCwd(); + $working_dir =~ tr/\\/\//; + } else { + require Cwd; + $working_dir = Cwd::cwd(); + } + + return $working_dir; +} diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/post-update.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/post-update.sample new file mode 100755 index 00000000..ec17ec19 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/post-update.sample @@ -0,0 +1,8 @@ +#!/bin/sh +# +# An example hook script to prepare a packed repository for use over +# dumb transports. +# +# To enable this hook, rename this file to "post-update". + +exec git update-server-info diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-applypatch.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-applypatch.sample new file mode 100755 index 00000000..4142082b --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-applypatch.sample @@ -0,0 +1,14 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed +# by applypatch from an e-mail message. +# +# The hook should exit with non-zero status after issuing an +# appropriate message if it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-applypatch". + +. git-sh-setup +precommit="$(git rev-parse --git-path hooks/pre-commit)" +test -x "$precommit" && exec "$precommit" ${1+"$@"} +: diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-commit.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-commit.sample new file mode 100755 index 00000000..29ed5ee4 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-commit.sample @@ -0,0 +1,49 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git commit" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message if +# it wants to stop the commit. +# +# To enable this hook, rename this file to "pre-commit". + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(git hash-object -t tree /dev/null) +fi + +# If you want to allow non-ASCII filenames set this variable to true. +allownonascii=$(git config --type=bool hooks.allownonascii) + +# Redirect output to stderr. +exec 1>&2 + +# Cross platform projects tend to avoid non-ASCII filenames; prevent +# them from being added to the repository. We exploit the fact that the +# printable range starts at the space character and ends with tilde. +if [ "$allownonascii" != "true" ] && + # Note that the use of brackets around a tr range is ok here, (it's + # even required, for portability to Solaris 10's /usr/bin/tr), since + # the square bracket bytes happen to fall in the designated range. + test $(git diff-index --cached --name-only --diff-filter=A -z $against | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 +then + cat <<\EOF +Error: Attempt to add a non-ASCII file name. + +This can cause problems if you want to work with people on other platforms. + +To be portable it is advisable to rename the file. + +If you know what you are doing you can disable this check using: + + git config hooks.allownonascii true +EOF + exit 1 +fi + +# If there are whitespace errors, print the offending file names and fail. +exec git diff-index --check --cached $against -- diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-merge-commit.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-merge-commit.sample new file mode 100755 index 00000000..399eab19 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-merge-commit.sample @@ -0,0 +1,13 @@ +#!/bin/sh +# +# An example hook script to verify what is about to be committed. +# Called by "git merge" with no arguments. The hook should +# exit with non-zero status after issuing an appropriate message to +# stderr if it wants to stop the merge commit. +# +# To enable this hook, rename this file to "pre-merge-commit". + +. git-sh-setup +test -x "$GIT_DIR/hooks/pre-commit" && + exec "$GIT_DIR/hooks/pre-commit" +: diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-push.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-push.sample new file mode 100755 index 00000000..4ce688d3 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-push.sample @@ -0,0 +1,53 @@ +#!/bin/sh + +# An example hook script to verify what is about to be pushed. Called by "git +# push" after it has checked the remote status, but before anything has been +# pushed. If this script exits with a non-zero status nothing will be pushed. +# +# This hook is called with the following parameters: +# +# $1 -- Name of the remote to which the push is being done +# $2 -- URL to which the push is being done +# +# If pushing without using a named remote those arguments will be equal. +# +# Information about the commits which are being pushed is supplied as lines to +# the standard input in the form: +# +# +# +# This sample shows how to prevent push of commits where the log message starts +# with "WIP" (work in progress). + +remote="$1" +url="$2" + +zero=$(git hash-object --stdin &2 "Found WIP commit in $local_ref, not pushing" + exit 1 + fi + fi +done + +exit 0 diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-rebase.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-rebase.sample new file mode 100755 index 00000000..6cbef5c3 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-rebase.sample @@ -0,0 +1,169 @@ +#!/bin/sh +# +# Copyright (c) 2006, 2008 Junio C Hamano +# +# The "pre-rebase" hook is run just before "git rebase" starts doing +# its job, and can prevent the command from running by exiting with +# non-zero status. +# +# The hook is called with the following parameters: +# +# $1 -- the upstream the series was forked from. +# $2 -- the branch being rebased (or empty when rebasing the current branch). +# +# This sample shows how to prevent topic branches that are already +# merged to 'next' branch from getting rebased, because allowing it +# would result in rebasing already published history. + +publish=next +basebranch="$1" +if test "$#" = 2 +then + topic="refs/heads/$2" +else + topic=`git symbolic-ref HEAD` || + exit 0 ;# we do not interrupt rebasing detached HEAD +fi + +case "$topic" in +refs/heads/??/*) + ;; +*) + exit 0 ;# we do not interrupt others. + ;; +esac + +# Now we are dealing with a topic branch being rebased +# on top of master. Is it OK to rebase it? + +# Does the topic really exist? +git show-ref -q "$topic" || { + echo >&2 "No such branch $topic" + exit 1 +} + +# Is topic fully merged to master? +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` +if test -z "$not_in_master" +then + echo >&2 "$topic is fully merged to master; better remove it." + exit 1 ;# we could allow it, but there is no point. +fi + +# Is topic ever merged to next? If so you should not be rebasing it. +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` +only_next_2=`git rev-list ^master ${publish} | sort` +if test "$only_next_1" = "$only_next_2" +then + not_in_topic=`git rev-list "^$topic" master` + if test -z "$not_in_topic" + then + echo >&2 "$topic is already up to date with master" + exit 1 ;# we could allow it, but there is no point. + else + exit 0 + fi +else + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` + /usr/bin/perl -e ' + my $topic = $ARGV[0]; + my $msg = "* $topic has commits already merged to public branch:\n"; + my (%not_in_next) = map { + /^([0-9a-f]+) /; + ($1 => 1); + } split(/\n/, $ARGV[1]); + for my $elem (map { + /^([0-9a-f]+) (.*)$/; + [$1 => $2]; + } split(/\n/, $ARGV[2])) { + if (!exists $not_in_next{$elem->[0]}) { + if ($msg) { + print STDERR $msg; + undef $msg; + } + print STDERR " $elem->[1]\n"; + } + } + ' "$topic" "$not_in_next" "$not_in_master" + exit 1 +fi + +<<\DOC_END + +This sample hook safeguards topic branches that have been +published from being rewound. + +The workflow assumed here is: + + * Once a topic branch forks from "master", "master" is never + merged into it again (either directly or indirectly). + + * Once a topic branch is fully cooked and merged into "master", + it is deleted. If you need to build on top of it to correct + earlier mistakes, a new topic branch is created by forking at + the tip of the "master". This is not strictly necessary, but + it makes it easier to keep your history simple. + + * Whenever you need to test or publish your changes to topic + branches, merge them into "next" branch. + +The script, being an example, hardcodes the publish branch name +to be "next", but it is trivial to make it configurable via +$GIT_DIR/config mechanism. + +With this workflow, you would want to know: + +(1) ... if a topic branch has ever been merged to "next". Young + topic branches can have stupid mistakes you would rather + clean up before publishing, and things that have not been + merged into other branches can be easily rebased without + affecting other people. But once it is published, you would + not want to rewind it. + +(2) ... if a topic branch has been fully merged to "master". + Then you can delete it. More importantly, you should not + build on top of it -- other people may already want to + change things related to the topic as patches against your + "master", so if you need further changes, it is better to + fork the topic (perhaps with the same name) afresh from the + tip of "master". + +Let's look at this example: + + o---o---o---o---o---o---o---o---o---o "next" + / / / / + / a---a---b A / / + / / / / + / / c---c---c---c B / + / / / \ / + / / / b---b C \ / + / / / / \ / + ---o---o---o---o---o---o---o---o---o---o---o "master" + + +A, B and C are topic branches. + + * A has one fix since it was merged up to "next". + + * B has finished. It has been fully merged up to "master" and "next", + and is ready to be deleted. + + * C has not merged to "next" at all. + +We would want to allow C to be rebased, refuse A, and encourage +B to be deleted. + +To compute (1): + + git rev-list ^master ^topic next + git rev-list ^master next + + if these match, topic has not merged in next at all. + +To compute (2): + + git rev-list master..topic + + if this is empty, it is fully merged to "master". + +DOC_END diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-receive b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-receive new file mode 100755 index 00000000..c9757ca0 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-receive @@ -0,0 +1,81 @@ +#!/bin/bash + +# from: https://gist.github.com/nauar/826f85d25d692d9bc009312cb71577dd + +# TEMPLATING VALUES +MAX_SIZE_MB="80" +FILE_ALLOW_PATTERN=".+()" +MAX_FILE_COUNT="512" + +MAX_BYTES=$((MAX_SIZE_MB * 1000000)) +GITCMD="git" +NULL_SHA="0000000000000000000000000000000000000000" +EMPTY_TREE_SHA=$($GITCMD hash-object -t tree /dev/null) # SHA1: "4b825dc642cb6eb9a060e54bf8d69288fbee4904" +LOGFILE="/tmp/git_private.log" + +function file_log() { + moment=$(date '+%d/%m/%Y %H:%M:%S') + echo "[ $moment ] [ POLICY CHECK ] $1" >> $LOGFILE +} + +function echo_log() { + echo "[ POLICY CHECK ] $1" +} + +echo_log "Starting validation..." +while read -r sha1_old sha1_new refname; do + + file_log "old: $sha1_old new: $sha1_new refname: $refname" + + # Avoid removed branches + if [ "${sha1_new}" = "${NULL_SHA}" ]; then + continue + fi + + # Set sha1_old properly if this is branch creation. + if [ "${sha1_old}" = "${NULL_SHA}" ]; then + sha1_old=$EMPTY_TREE_SHA + fi + + # Ignore case + shopt -s nocaseglob + + # get the total number of files that are in the new commit (sha1_new) | xargs to trim whitespace + total_files_count=$($GITCMD ls-tree --full-tree -r --name-only "$sha1_new" | wc -l | xargs) + + if [[ ${total_files_count} -gt ${MAX_FILE_COUNT} ]]; then + echo_log "ERROR: Exceeded maximum number of files! The maximum was set to $MAX_FILE_COUNT but the commit contains $total_files_count!" + exit 1 + fi + + newFiles=$($GITCMD diff --stat --name-only --diff-filter=ACMRT "${sha1_old}".."${sha1_new}") + + if [[ $? -ne 0 ]]; then + echo_log "ERROR: Could not read files! Cancelling push..." + exit 1 + fi + + old_IFS=$IFS + IFS=' + ' + for filename in $newFiles; do + file_log "Filename: $filename" + filesize=$($GITCMD cat-file -s "${sha1_new}:${filename}") + + if [[ -z $filesize ]]; then filesize=0; fi + + if [ "${filesize}" -gt "${MAX_BYTES}" ]; then + filesize_mb=$((filesize / 1000000)) + echo_log "ERROR: The file $filename is larger than $MAX_SIZE_MB MB. Its size is $filesize_mb MB." + exit 1 + fi + + if ! [[ "$filename" =~ ${FILE_ALLOW_PATTERN} ]]; then + echo_log "ERROR: The file $filename has a file extension that has been disallowed!" + exit 1 + fi + + done + IFS=$old_IFS +done +echo_log "Validation successful!" diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-receive.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-receive.sample new file mode 100755 index 00000000..a1fd29ec --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/pre-receive.sample @@ -0,0 +1,24 @@ +#!/bin/sh +# +# An example hook script to make use of push options. +# The example simply echoes all push options that start with 'echoback=' +# and rejects all pushes when the "reject" push option is used. +# +# To enable this hook, rename this file to "pre-receive". + +if test -n "$GIT_PUSH_OPTION_COUNT" +then + i=0 + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" + do + eval "value=\$GIT_PUSH_OPTION_$i" + case "$value" in + echoback=*) + echo "echo from the pre-receive-hook: ${value#*=}" >&2 + ;; + reject) + exit 1 + esac + i=$((i + 1)) + done +fi diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/prepare-commit-msg.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/prepare-commit-msg.sample new file mode 100755 index 00000000..10fa14c5 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/prepare-commit-msg.sample @@ -0,0 +1,42 @@ +#!/bin/sh +# +# An example hook script to prepare the commit log message. +# Called by "git commit" with the name of the file that has the +# commit message, followed by the description of the commit +# message's source. The hook's purpose is to edit the commit +# message file. If the hook fails with a non-zero status, +# the commit is aborted. +# +# To enable this hook, rename this file to "prepare-commit-msg". + +# This hook includes three examples. The first one removes the +# "# Please enter the commit message..." help message. +# +# The second includes the output of "git diff --name-status -r" +# into the message, just before the "git status" output. It is +# commented because it doesn't cope with --amend or with squashed +# commits. +# +# The third example adds a Signed-off-by line to the message, that can +# still be edited. This is rarely a good idea. + +COMMIT_MSG_FILE=$1 +COMMIT_SOURCE=$2 +SHA1=$3 + +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" + +# case "$COMMIT_SOURCE,$SHA1" in +# ,|template,) +# /usr/bin/perl -i.bak -pe ' +# print "\n" . `git diff --cached --name-status -r` +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; +# *) ;; +# esac + +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" +# if test -z "$COMMIT_SOURCE" +# then +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" +# fi diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/push-to-checkout.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/push-to-checkout.sample new file mode 100755 index 00000000..af5a0c00 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/push-to-checkout.sample @@ -0,0 +1,78 @@ +#!/bin/sh + +# An example hook script to update a checked-out tree on a git push. +# +# This hook is invoked by git-receive-pack(1) when it reacts to git +# push and updates reference(s) in its repository, and when the push +# tries to update the branch that is currently checked out and the +# receive.denyCurrentBranch configuration variable is set to +# updateInstead. +# +# By default, such a push is refused if the working tree and the index +# of the remote repository has any difference from the currently +# checked out commit; when both the working tree and the index match +# the current commit, they are updated to match the newly pushed tip +# of the branch. This hook is to be used to override the default +# behaviour; however the code below reimplements the default behaviour +# as a starting point for convenient modification. +# +# The hook receives the commit with which the tip of the current +# branch is going to be updated: +commit=$1 + +# It can exit with a non-zero status to refuse the push (when it does +# so, it must not modify the index or the working tree). +die () { + echo >&2 "$*" + exit 1 +} + +# Or it can make any necessary changes to the working tree and to the +# index to bring them to the desired state when the tip of the current +# branch is updated to the new commit, and exit with a zero status. +# +# For example, the hook can simply run git read-tree -u -m HEAD "$1" +# in order to emulate git fetch that is run in the reverse direction +# with git push, as the two-tree form of git read-tree -u -m is +# essentially the same as git switch or git checkout that switches +# branches while keeping the local changes in the working tree that do +# not interfere with the difference between the branches. + +# The below is a more-or-less exact translation to shell of the C code +# for the default behaviour for git's push-to-checkout hook defined in +# the push_to_deploy() function in builtin/receive-pack.c. +# +# Note that the hook will be executed from the repository directory, +# not from the working tree, so if you want to perform operations on +# the working tree, you will have to adapt your code accordingly, e.g. +# by adding "cd .." or using relative paths. + +if ! git update-index -q --ignore-submodules --refresh +then + die "Up-to-date check failed" +fi + +if ! git diff-files --quiet --ignore-submodules -- +then + die "Working directory has unstaged changes" +fi + +# This is a rough translation of: +# +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX +if git cat-file -e HEAD 2>/dev/null +then + head=HEAD +else + head=$(git hash-object -t tree --stdin &2 + exit 1 +} + +unset GIT_DIR GIT_WORK_TREE +cd "$worktree" && + +if grep -q "^diff --git " "$1" +then + validate_patch "$1" +else + validate_cover_letter "$1" +fi && + +if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL" +then + git config --unset-all sendemail.validateWorktree && + trap 'git worktree remove -ff "$worktree"' EXIT && + validate_series +fi diff --git a/examples/docker_compose/init_repos/lect1/1/source/hooks/update.sample b/examples/docker_compose/init_repos/lect1/1/source/hooks/update.sample new file mode 100755 index 00000000..c4d426bc --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/hooks/update.sample @@ -0,0 +1,128 @@ +#!/bin/sh +# +# An example hook script to block unannotated tags from entering. +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new +# +# To enable this hook, rename this file to "update". +# +# Config +# ------ +# hooks.allowunannotated +# This boolean sets whether unannotated tags will be allowed into the +# repository. By default they won't be. +# hooks.allowdeletetag +# This boolean sets whether deleting tags will be allowed in the +# repository. By default they won't be. +# hooks.allowmodifytag +# This boolean sets whether a tag may be modified after creation. By default +# it won't be. +# hooks.allowdeletebranch +# This boolean sets whether deleting branches will be allowed in the +# repository. By default they won't be. +# hooks.denycreatebranch +# This boolean sets whether remotely creating branches will be denied +# in the repository. By default this is allowed. +# + +# --- Command line +refname="$1" +oldrev="$2" +newrev="$3" + +# --- Safety check +if [ -z "$GIT_DIR" ]; then + echo "Don't run this script from the command line." >&2 + echo " (if you want, you could supply GIT_DIR then run" >&2 + echo " $0 )" >&2 + exit 1 +fi + +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +# --- Config +allowunannotated=$(git config --type=bool hooks.allowunannotated) +allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) +denycreatebranch=$(git config --type=bool hooks.denycreatebranch) +allowdeletetag=$(git config --type=bool hooks.allowdeletetag) +allowmodifytag=$(git config --type=bool hooks.allowmodifytag) + +# check for no description +projectdesc=$(sed -e '1q' "$GIT_DIR/description") +case "$projectdesc" in +"Unnamed repository"* | "") + echo "*** Project description file hasn't been set" >&2 + exit 1 + ;; +esac + +# --- Check types +# if $newrev is 0000...0000, it's a commit to delete a ref. +zero=$(git hash-object --stdin &2 + echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 + exit 1 + fi + ;; + refs/tags/*,delete) + # delete tag + if [ "$allowdeletetag" != "true" ]; then + echo "*** Deleting a tag is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/tags/*,tag) + # annotated tag + if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 + then + echo "*** Tag '$refname' already exists." >&2 + echo "*** Modifying a tag is not allowed in this repository." >&2 + exit 1 + fi + ;; + refs/heads/*,commit) + # branch + if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then + echo "*** Creating a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/heads/*,delete) + # delete branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + refs/remotes/*,commit) + # tracking branch + ;; + refs/remotes/*,delete) + # delete tracking branch + if [ "$allowdeletebranch" != "true" ]; then + echo "*** Deleting a tracking branch is not allowed in this repository" >&2 + exit 1 + fi + ;; + *) + # Anything else (is there anything else?) + echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 + exit 1 + ;; +esac + +# --- Finished +exit 0 diff --git a/examples/docker_compose/init_repos/lect1/1/source/info/exclude b/examples/docker_compose/init_repos/lect1/1/source/info/exclude new file mode 100644 index 00000000..a5196d1b --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/examples/docker_compose/init_repos/lect1/1/source/objects/13/0d994dfadd62fe72947db6e1a5bf45e457b94c b/examples/docker_compose/init_repos/lect1/1/source/objects/13/0d994dfadd62fe72947db6e1a5bf45e457b94c new file mode 100644 index 00000000..9f0a8706 --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/objects/13/0d994dfadd62fe72947db6e1a5bf45e457b94c @@ -0,0 +1 @@ +xA E]sٛ$x 0TI\|{?Vx$v./DC1ޡ] 'pҼEʹ\b^-̠yrn-7Ú4%6S \ No newline at end of file diff --git a/examples/docker_compose/init_repos/lect1/1/source/objects/34/b0dc9e4c35ccbbb93ab57ae757fe9c08a0dab0 b/examples/docker_compose/init_repos/lect1/1/source/objects/34/b0dc9e4c35ccbbb93ab57ae757fe9c08a0dab0 new file mode 100644 index 00000000..6b86c53b --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/objects/34/b0dc9e4c35ccbbb93ab57ae757fe9c08a0dab0 @@ -0,0 +1,3 @@ +xK +!?Bΐ&83 ++T[q2C,Q-ƫ%ꔭ1PHrTeH+:ys.u@cE6ǀIw|(S;V~6-;&8 p16xƇzF5D diff --git a/examples/docker_compose/init_repos/lect1/1/source/objects/d0/e04183718b2cd53393a9c4cd9904201f82c305 b/examples/docker_compose/init_repos/lect1/1/source/objects/d0/e04183718b2cd53393a9c4cd9904201f82c305 new file mode 100644 index 00000000..c15b1143 Binary files /dev/null and b/examples/docker_compose/init_repos/lect1/1/source/objects/d0/e04183718b2cd53393a9c4cd9904201f82c305 differ diff --git a/examples/docker_compose/init_repos/lect1/1/source/objects/d6/0bfaf6b3201ebbb94a6e6884b7e585b06b2cf8 b/examples/docker_compose/init_repos/lect1/1/source/objects/d6/0bfaf6b3201ebbb94a6e6884b7e585b06b2cf8 new file mode 100644 index 00000000..7bfa07b8 Binary files /dev/null and b/examples/docker_compose/init_repos/lect1/1/source/objects/d6/0bfaf6b3201ebbb94a6e6884b7e585b06b2cf8 differ diff --git a/examples/docker_compose/init_repos/lect1/1/source/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/examples/docker_compose/init_repos/lect1/1/source/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 new file mode 100644 index 00000000..71122389 Binary files /dev/null and b/examples/docker_compose/init_repos/lect1/1/source/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 differ diff --git a/examples/docker_compose/init_repos/lect1/1/source/refs/heads/main b/examples/docker_compose/init_repos/lect1/1/source/refs/heads/main new file mode 100644 index 00000000..4780fb4b --- /dev/null +++ b/examples/docker_compose/init_repos/lect1/1/source/refs/heads/main @@ -0,0 +1 @@ +34b0dc9e4c35ccbbb93ab57ae757fe9c08a0dab0 diff --git a/examples/docker_compose/jupyterhub_config.py b/examples/docker_compose/jupyterhub_config.py index 3d8a081c..d625ced7 100644 --- a/examples/docker_compose/jupyterhub_config.py +++ b/examples/docker_compose/jupyterhub_config.py @@ -26,7 +26,7 @@ c.JupyterHub.spawner_class = "dockerspawner.DockerSpawner" c.DockerSpawner.use_internal_ip = True -c.DockerSpawner.network_name = "grader_network" +c.DockerSpawner.network_name = "grader_default" c.DockerSpawner.remove = True