From 78bb6c8f067fe8f84f335fd9a2ed139e5662b7bf Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg <t.r.vanwoudenberg@tudelft.nl> Date: Thu, 29 Aug 2024 11:56:07 +0200 Subject: [PATCH 01/17] Fix tyebe on main --- book/_config.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/book/_config.yml b/book/_config.yml index f2110045..4842550d 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -12,12 +12,18 @@ sphinx: config: # Bibliography style bibtex_reference_style: author_year - html_js_files: - - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js patch_config: disabled-patches: [] html_show_copyright: false html_last_updated_fmt: '%B %-d, %Y' + html_js_files: + - https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js + thebe_config: + use_thebe_lite: true + exclude_patterns: ["**/_*.yml", "**/*.md", "**/*.ipynb"] + html_theme_options: + launch_buttons: + thebe: true extra_extensions: - sphinx_inline_tabs - sphinx_grasple @@ -29,9 +35,6 @@ sphinx: bibtex_bibfiles: - _bibliography/references_pd.bib -launch_buttons: - thebe: true - html: # announcement: "<p>This book is archived from the 2023-24 academic year. The most recent version is at <a href='https://mude.citg.tudelft.nl/book' style='color: cyan;'>mude.citg.tudelft.nl/book</a>; find out more at the <a href='https://mude.citg.tudelft.nl/archive' target='_blank' style='color: cyan;'>MUDE Archive</a>.</p>" use_multitoc_numbering: false -- GitLab From 0f057e3bf0580f622a13776d2702fd402e85610c Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg <t.r.vanwoudenberg@tudelft.nl> Date: Thu, 29 Aug 2024 12:00:07 +0200 Subject: [PATCH 02/17] Update requirements.txt --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 739676f2..1465dbe9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,5 @@ docutils == 0.17.1 --extra-index-url https://gitlab.tudelft.nl/api/v4/projects/17983/packages/pypi/simple jupyterbook_patches ~= 0.1.4 +--extra-index-url https://gitlab.tudelft.nl/api/v4/projects/11239/packages/pypi/simple +sphinx-thebe ~= 0.9.9 -- GitLab From e583d928a95d8ad1ea3c71da13f151a2e88d8c5d Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 14:35:55 +0200 Subject: [PATCH 03/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 103 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d1cf875..38495c73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,6 @@ image: python:3.10-bullseye stages: - - test - build - deploy @@ -13,39 +12,85 @@ cache: - .cache/pip - venv/ -# Before running other jobs, setup Python before_script: - python -V - pip install virtualenv - virtualenv venv - source venv/bin/activate + - pip install -r requirements.txt -# This job tests if the book compiles gracefully after a new addition -test-build: - stage: test +build-draft: + stage: build + script: + - echo "Building draft version" + - teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) + artifacts: + paths: + - book/_build/html + - stdout.log + - stderr.log rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - - if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push" - - if: $CI_COMMIT_BRANCH == "publish" && $CI_PIPELINE_SOURCE == "push" + - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" + when: always + +build-production: + stage: build + script: + - echo "Building production version" + - teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) + artifacts: + paths: + - book/_build/html + - stdout.log + - stderr.log + rules: + - if: $CI_COMMIT_BRANCH == "publish" + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" + when: always + +deploy-draft: + stage: deploy + needs: ["build-draft"] script: - - pip install -r requirements.txt - - jupyter-book clean book/ - - jupyter-book build book/ - -# This job commits the built HTML to the publish-html branch -# push-html: -# stage: deploy -# only: -# - publish -# before_script: -# - apt-get update -y -# - apt-get install rsync -y -# - git config --global user.name "$GITLAB_USER_NAME" -# - git config --global user.email "$GITLAB_USER_EMAIL" -# - git fetch origin publish-html -# - git checkout publish-html -# script: -# - rsync -av --delete-after --exclude=".git/" --exclude=".cache/" --exclude="venv/" ./book/_build/html/ . -# - git add --all -- ':!.cache/*' -# - git commit --allow-empty -m "$CI_COMMIT_MESSAGE" -# - git push https://gitlab-ci-token:$ACCESS_TOKEN@gitlab.tudelft.nl/$CI_PROJECT_PATH.git publish-html + - | + curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \ + -H "Content-Type: application/json" \ + -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ + -d '{ + "object_kind": "pipeline", + "object_attributes": { + "status": "success", + "ref": "main" + } + }' + environment: + name: draft + url: https://mude.citg.tudelft.nl/2024/book/draft + rules: + - if: $CI_COMMIT_BRANCH == "main" + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" + when: always + +deploy-production: + stage: deploy + needs: ["build-production"] + script: + - | + curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy \ + -H "Content-Type: application/json" \ + -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ + -d '{ + "object_kind": "pipeline", + "object_attributes": { + "status": "success", + "ref": "publish" + } + }' + environment: + name: production + url: https://mude.citg.tudelft.nl/2024/book + rules: + - if: $CI_COMMIT_BRANCH == "publish" + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" + when: always \ No newline at end of file -- GitLab From 1e0ac76152fa7626bca04fc1d42bb33c90e4a7f2 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 14:41:35 +0200 Subject: [PATCH 04/17] Update intro.md --- book/intro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/intro.md b/book/intro.md index 297e2607..f41a3545 100644 --- a/book/intro.md +++ b/book/intro.md @@ -2,7 +2,7 @@ ````{admonition} Textbook Website Under Construction :class: warning -This website is the home of the MUDE Textbook, which will be published at the beginning of Q1. +This website is the home of the MUDE Textbook, which will be published at the beginning of Q1. test For now, you can read the course description [here](https://www.studiegids.tudelft.nl/a101_displayCourse.do?course_id=69347). -- GitLab From 141b59ae32f10fda341f5c975054062548dda418 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 16:55:58 +0200 Subject: [PATCH 05/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38495c73..00381368 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,39 +19,30 @@ before_script: - source venv/bin/activate - pip install -r requirements.txt -build-draft: +build-book: stage: build script: - - echo "Building draft version" - - teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) - artifacts: - paths: - - book/_build/html - - stdout.log - - stderr.log - rules: - - if: $CI_COMMIT_BRANCH == "main" - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" - when: always - -build-production: - stage: build - script: - - echo "Building production version" - - teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) + - | + if [ "$CI_COMMIT_BRANCH" == "publish" ]; then + echo "Building production version" + teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) + else + echo "Building draft version" + teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) + fi artifacts: paths: - book/_build/html - stdout.log - stderr.log rules: - - if: $CI_COMMIT_BRANCH == "publish" - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" + - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish" + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" when: always deploy-draft: stage: deploy - needs: ["build-draft"] + needs: ["build-book"] script: - | curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \ @@ -69,12 +60,10 @@ deploy-draft: url: https://mude.citg.tudelft.nl/2024/book/draft rules: - if: $CI_COMMIT_BRANCH == "main" - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" - when: always deploy-production: stage: deploy - needs: ["build-production"] + needs: ["build-book"] script: - | curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy \ @@ -91,6 +80,4 @@ deploy-production: name: production url: https://mude.citg.tudelft.nl/2024/book rules: - - if: $CI_COMMIT_BRANCH == "publish" - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" - when: always \ No newline at end of file + - if: $CI_COMMIT_BRANCH == "publish" \ No newline at end of file -- GitLab From a0f3aea95b54b8d3b576449deb2651202d217e35 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:12:27 +0200 Subject: [PATCH 06/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 00381368..64e30edc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,7 +53,8 @@ deploy-draft: "object_attributes": { "status": "success", "ref": "main" - } + }, + "build_id": "'$CI_JOB_ID'" }' environment: name: draft @@ -74,7 +75,8 @@ deploy-production: "object_attributes": { "status": "success", "ref": "publish" - } + }, + "build_id": "'$CI_JOB_ID'" }' environment: name: production -- GitLab From 360d7021ba33f91e0882b2c053c9badbd2514ede Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:22:36 +0200 Subject: [PATCH 07/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64e30edc..c7861ca1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,7 @@ build-book: - book/_build/html - stdout.log - stderr.log + expire_in: 1 week rules: - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish" - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" @@ -54,7 +55,8 @@ deploy-draft: "status": "success", "ref": "main" }, - "build_id": "'$CI_JOB_ID'" + "build_id": "'$CI_JOB_ID'", + "build_status": "success" }' environment: name: draft @@ -76,7 +78,8 @@ deploy-production: "status": "success", "ref": "publish" }, - "build_id": "'$CI_JOB_ID'" + "build_id": "'$CI_JOB_ID'", + "build_status": "success" }' environment: name: production -- GitLab From cd455877c3b5bd6b10437e5992bde472fbb73e4a Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:36:01 +0200 Subject: [PATCH 08/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c7861ca1..028b63b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,8 +55,7 @@ deploy-draft: "status": "success", "ref": "main" }, - "build_id": "'$CI_JOB_ID'", - "build_status": "success" + "build_job_id": "'$CI_JOB_ID'" }' environment: name: draft @@ -69,7 +68,7 @@ deploy-production: needs: ["build-book"] script: - | - curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy \ + curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \ -H "Content-Type: application/json" \ -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ -d '{ @@ -78,8 +77,7 @@ deploy-production: "status": "success", "ref": "publish" }, - "build_id": "'$CI_JOB_ID'", - "build_status": "success" + "build_job_id": "'$CI_JOB_ID'" }' environment: name: production -- GitLab From 02b854a3306852fd2079a57e043378d71797caa5 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:40:47 +0200 Subject: [PATCH 09/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 028b63b6..f4e27a40 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,6 +46,7 @@ deploy-draft: needs: ["build-book"] script: - | + BUILD_JOB_ID=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success" | jq '.[] | select(.name=="build-book") | .id') curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \ -H "Content-Type: application/json" \ -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ @@ -55,7 +56,7 @@ deploy-draft: "status": "success", "ref": "main" }, - "build_job_id": "'$CI_JOB_ID'" + "build_job_id": "'$BUILD_JOB_ID'" }' environment: name: draft @@ -68,6 +69,7 @@ deploy-production: needs: ["build-book"] script: - | + BUILD_JOB_ID=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success" | jq '.[] | select(.name=="build-book") | .id') curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \ -H "Content-Type: application/json" \ -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ @@ -77,7 +79,7 @@ deploy-production: "status": "success", "ref": "publish" }, - "build_job_id": "'$CI_JOB_ID'" + "build_job_id": "'$BUILD_JOB_ID'" }' environment: name: production -- GitLab From ed22f516a1b0e8fbaaaf2d4a0d5f0cc42ed15dbf Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:45:33 +0200 Subject: [PATCH 10/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f4e27a40..7fdfc2be 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,8 @@ before_script: - pip install virtualenv - virtualenv venv - source venv/bin/activate - - pip install -r requirements.txt + - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - apt-get update && apt-get install -y jq build-book: stage: build -- GitLab From 283a7b7f15e1e3f07c4790eec54268d19e1ea26b Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:50:10 +0200 Subject: [PATCH 11/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7fdfc2be..065c3f49 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -47,7 +47,15 @@ deploy-draft: needs: ["build-book"] script: - | - BUILD_JOB_ID=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success" | jq '.[] | select(.name=="build-book") | .id') + echo "Fetching job information..." + API_RESPONSE=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success") + echo "Parsing build job ID..." + BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq '.[] | select(.name=="build-book") | .id') + if [ -z "$BUILD_JOB_ID" ]; then + echo "Failed to find build-book job ID. Using current job ID as fallback." + BUILD_JOB_ID=$CI_JOB_ID + fi + echo "Build Job ID: $BUILD_JOB_ID" curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \ -H "Content-Type: application/json" \ -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ @@ -57,7 +65,7 @@ deploy-draft: "status": "success", "ref": "main" }, - "build_job_id": "'$BUILD_JOB_ID'" + "build_job_id": '"$BUILD_JOB_ID"' }' environment: name: draft @@ -70,7 +78,15 @@ deploy-production: needs: ["build-book"] script: - | - BUILD_JOB_ID=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success" | jq '.[] | select(.name=="build-book") | .id') + echo "Fetching job information..." + API_RESPONSE=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success") + echo "Parsing build job ID..." + BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq '.[] | select(.name=="build-book") | .id') + if [ -z "$BUILD_JOB_ID" ]; then + echo "Failed to find build-book job ID. Using current job ID as fallback." + BUILD_JOB_ID=$CI_JOB_ID + fi + echo "Build Job ID: $BUILD_JOB_ID" curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \ -H "Content-Type: application/json" \ -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ @@ -80,7 +96,7 @@ deploy-production: "status": "success", "ref": "publish" }, - "build_job_id": "'$BUILD_JOB_ID'" + "build_job_id": '"$BUILD_JOB_ID"' }' environment: name: production -- GitLab From be55e4b1dcf78de280a5972b6a449079527df157 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:52:35 +0200 Subject: [PATCH 12/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 065c3f49..babe285f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -49,8 +49,10 @@ deploy-draft: - | echo "Fetching job information..." API_RESPONSE=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success") + echo "API Response:" + echo "$API_RESPONSE" echo "Parsing build job ID..." - BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq '.[] | select(.name=="build-book") | .id') + BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq -r '.[] | select(.name=="build-book") | .id') if [ -z "$BUILD_JOB_ID" ]; then echo "Failed to find build-book job ID. Using current job ID as fallback." BUILD_JOB_ID=$CI_JOB_ID @@ -80,8 +82,10 @@ deploy-production: - | echo "Fetching job information..." API_RESPONSE=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success") + echo "API Response:" + echo "$API_RESPONSE" echo "Parsing build job ID..." - BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq '.[] | select(.name=="build-book") | .id') + BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq -r '.[] | select(.name=="build-book") | .id') if [ -z "$BUILD_JOB_ID" ]; then echo "Failed to find build-book job ID. Using current job ID as fallback." BUILD_JOB_ID=$CI_JOB_ID -- GitLab From 535dbb0d9761c4bd35402aaa716e082f45e629c5 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:55:26 +0200 Subject: [PATCH 13/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 71 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index babe285f..90e28d9d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,22 +42,58 @@ build-book: - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" when: always +image: python:3.10-bullseye + +stages: + - build + - deploy + +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +cache: + paths: + - .cache/pip + - venv/ + +before_script: + - python -V + - pip install virtualenv + - virtualenv venv + - source venv/bin/activate + - pip install -r requirements.txt + +build-book: + stage: build + script: + - | + if [ "$CI_COMMIT_BRANCH" == "publish" ]; then + echo "Building production version" + teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) + else + echo "Building draft version" + teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) + fi + - echo $CI_JOB_ID > build_job_id.txt + artifacts: + paths: + - book/_build/html + - stdout.log + - stderr.log + - build_job_id.txt + expire_in: 1 week + rules: + - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish" + - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" + when: always + deploy-draft: stage: deploy needs: ["build-book"] script: + - BUILD_JOB_ID=$(cat build_job_id.txt) + - echo "Build Job ID: $BUILD_JOB_ID" - | - echo "Fetching job information..." - API_RESPONSE=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success") - echo "API Response:" - echo "$API_RESPONSE" - echo "Parsing build job ID..." - BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq -r '.[] | select(.name=="build-book") | .id') - if [ -z "$BUILD_JOB_ID" ]; then - echo "Failed to find build-book job ID. Using current job ID as fallback." - BUILD_JOB_ID=$CI_JOB_ID - fi - echo "Build Job ID: $BUILD_JOB_ID" curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \ -H "Content-Type: application/json" \ -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ @@ -79,18 +115,9 @@ deploy-production: stage: deploy needs: ["build-book"] script: + - BUILD_JOB_ID=$(cat build_job_id.txt) + - echo "Build Job ID: $BUILD_JOB_ID" - | - echo "Fetching job information..." - API_RESPONSE=$(curl -s -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${CI_PIPELINE_ID}/jobs?scope[]=success") - echo "API Response:" - echo "$API_RESPONSE" - echo "Parsing build job ID..." - BUILD_JOB_ID=$(echo "$API_RESPONSE" | jq -r '.[] | select(.name=="build-book") | .id') - if [ -z "$BUILD_JOB_ID" ]; then - echo "Failed to find build-book job ID. Using current job ID as fallback." - BUILD_JOB_ID=$CI_JOB_ID - fi - echo "Build Job ID: $BUILD_JOB_ID" curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \ -H "Content-Type: application/json" \ -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ -- GitLab From ed32a2920c3016db0625ecd7481fac73adae1de0 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 17:59:09 +0200 Subject: [PATCH 14/17] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 72 +++++--------------------------------------------- 1 file changed, 6 insertions(+), 66 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90e28d9d..475fd78a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,49 +1,5 @@ image: python:3.10-bullseye -stages: - - build - - deploy - -variables: - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - -cache: - paths: - - .cache/pip - - venv/ - -before_script: - - python -V - - pip install virtualenv - - virtualenv venv - - source venv/bin/activate - - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - apt-get update && apt-get install -y jq - -build-book: - stage: build - script: - - | - if [ "$CI_COMMIT_BRANCH" == "publish" ]; then - echo "Building production version" - teachbooks build --publish book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) - else - echo "Building draft version" - teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2) - fi - artifacts: - paths: - - book/_build/html - - stdout.log - - stderr.log - expire_in: 1 week - rules: - - if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "publish" - - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "publish" - when: always - -image: python:3.10-bullseye - stages: - build - deploy @@ -92,19 +48,11 @@ deploy-draft: needs: ["build-book"] script: - BUILD_JOB_ID=$(cat build_job_id.txt) - - echo "Build Job ID: $BUILD_JOB_ID" - | curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-draft \ - -H "Content-Type: application/json" \ - -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ - -d '{ - "object_kind": "pipeline", - "object_attributes": { - "status": "success", - "ref": "main" - }, - "build_job_id": '"$BUILD_JOB_ID"' - }' + -H "Content-Type: application/json" \ + -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ + -d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"main\"},\"build_job_id\":$BUILD_JOB_ID}" environment: name: draft url: https://mude.citg.tudelft.nl/2024/book/draft @@ -116,19 +64,11 @@ deploy-production: needs: ["build-book"] script: - BUILD_JOB_ID=$(cat build_job_id.txt) - - echo "Build Job ID: $BUILD_JOB_ID" - | curl -X POST https://mude.citg.tudelft.nl/hooks/book-deploy-production \ - -H "Content-Type: application/json" \ - -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ - -d '{ - "object_kind": "pipeline", - "object_attributes": { - "status": "success", - "ref": "publish" - }, - "build_job_id": '"$BUILD_JOB_ID"' - }' + -H "Content-Type: application/json" \ + -H "X-Gitlab-Token: glpat-m4CzsDqHnXNn3Pf5Whyd" \ + -d "{\"object_kind\":\"pipeline\",\"object_attributes\":{\"status\":\"success\",\"ref\":\"publish\"},\"build_job_id\":$BUILD_JOB_ID}" environment: name: production url: https://mude.citg.tudelft.nl/2024/book -- GitLab From 08f7581d6b18d01f0ae5fc5688e98934d8b4cdfa Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 18:01:48 +0200 Subject: [PATCH 15/17] Update intro.md --- book/intro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/intro.md b/book/intro.md index f41a3545..918143ac 100644 --- a/book/intro.md +++ b/book/intro.md @@ -2,7 +2,7 @@ ````{admonition} Textbook Website Under Construction :class: warning -This website is the home of the MUDE Textbook, which will be published at the beginning of Q1. test +This website is the home of the MUDE Textbook, which will be published at the beginning of Q1. test2 For now, you can read the course description [here](https://www.studiegids.tudelft.nl/a101_displayCourse.do?course_id=69347). -- GitLab From 5fbb98d3d078dbb9053f6079b06cca29b99ef915 Mon Sep 17 00:00:00 2001 From: Kwangjin Lee <k.lee-5@student.tudelft.nl> Date: Fri, 30 Aug 2024 18:05:12 +0200 Subject: [PATCH 16/17] Update intro.md --- book/intro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/intro.md b/book/intro.md index 918143ac..297e2607 100644 --- a/book/intro.md +++ b/book/intro.md @@ -2,7 +2,7 @@ ````{admonition} Textbook Website Under Construction :class: warning -This website is the home of the MUDE Textbook, which will be published at the beginning of Q1. test2 +This website is the home of the MUDE Textbook, which will be published at the beginning of Q1. For now, you can read the course description [here](https://www.studiegids.tudelft.nl/a101_displayCourse.do?course_id=69347). -- GitLab From 7df49da68faef67fe1c959fd96f5c530f0b90f14 Mon Sep 17 00:00:00 2001 From: Robert Lanzafame <R.C.Lanzafame@tudelft.nl> Date: Sat, 31 Aug 2024 06:46:37 +0200 Subject: [PATCH 17/17] test --- book/.teachbooks/server/state.pickle | Bin 0 -> 216 bytes book/_config.yml | 1 + book/intro.md | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 book/.teachbooks/server/state.pickle diff --git a/book/.teachbooks/server/state.pickle b/book/.teachbooks/server/state.pickle new file mode 100644 index 0000000000000000000000000000000000000000..b1c31b779db9b010bd8bd0438bf984116d34a223 GIT binary patch literal 216 zcmYL?u?oU45QZIswpOr@Q9=491<}E=G)*9((S#(mlc1B!ZJtl$?C#^3w1c-C_uv2h z|BbvpvuPmrylDm1x^t!D_QDb7hqx_1adXEj7Lbe&CN09kG+ro45wfE^Gd;Ln5P}s* z%m{Ezd#PBsg+D2L;66Zuwq3+UB2vi8e`WBG*>*A#qpip4{RL7R$*|haVOcxhcpiHL WUx-w!MGmV`ERAeC#nFeBo|Zo&wNvl_ literal 0 HcmV?d00001 diff --git a/book/_config.yml b/book/_config.yml index 4842550d..11f54116 100644 --- a/book/_config.yml +++ b/book/_config.yml @@ -36,6 +36,7 @@ bibtex_bibfiles: - _bibliography/references_pd.bib html: + # announcement: "Content in this book will be released one week at a time, beginning Sep 3." # announcement: "<p>This book is archived from the 2023-24 academic year. The most recent version is at <a href='https://mude.citg.tudelft.nl/book' style='color: cyan;'>mude.citg.tudelft.nl/book</a>; find out more at the <a href='https://mude.citg.tudelft.nl/archive' target='_blank' style='color: cyan;'>MUDE Archive</a>.</p>" use_multitoc_numbering: false # comments: diff --git a/book/intro.md b/book/intro.md index 297e2607..c55878d0 100644 --- a/book/intro.md +++ b/book/intro.md @@ -9,7 +9,6 @@ For now, you can read the course description [here](https://www.studiegids.tudel Material from last year is also available, but note that this should be used for general information only as **the material can change significantly!** - Use these links to visit the [book](https://mude.citg.tudelft.nl/2023/) and [website](https://mude.citg.tudelft.nl/2023/book) from last year. - For more information, visit the [MUDE Archive](https://mude.citg.tudelft.nl/archive/). - ```` -- GitLab