From 357f5cc31bb68d3b7e0e254c9586a91c48ffc8fd Mon Sep 17 00:00:00 2001 From: Itay Shakury Date: Thu, 7 Nov 2024 15:08:55 +0200 Subject: [PATCH] fix docs build --- .github/workflows/mkdocs-dev.yaml | 2 +- .github/workflows/mkdocs-latest.yaml | 2 +- docs/build/requirements.in | 1 + docs/build/requirements.txt | 37 +++++++++++++++++++++++----- magefiles/magefile.go | 14 ++++++++--- 5 files changed, 45 insertions(+), 11 deletions(-) diff --git a/.github/workflows/mkdocs-dev.yaml b/.github/workflows/mkdocs-dev.yaml index 1bf79adea86f..68ca817e2259 100644 --- a/.github/workflows/mkdocs-dev.yaml +++ b/.github/workflows/mkdocs-dev.yaml @@ -22,7 +22,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools wheel - pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.4.2-insiders-4.42.0 + pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.5.44-insiders-4.53.14 pip install -r docs/build/requirements.txt env: GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }} diff --git a/.github/workflows/mkdocs-latest.yaml b/.github/workflows/mkdocs-latest.yaml index 0f07db482a05..e709f9d8fa92 100644 --- a/.github/workflows/mkdocs-latest.yaml +++ b/.github/workflows/mkdocs-latest.yaml @@ -24,7 +24,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip setuptools wheel - pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git + pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.5.44-insiders-4.53.14 pip install -r docs/build/requirements.txt env: GH_TOKEN: ${{ secrets.MKDOCS_AQUA_BOT }} diff --git a/docs/build/requirements.in b/docs/build/requirements.in index 631be725d96d..bba465d88306 100644 --- a/docs/build/requirements.in +++ b/docs/build/requirements.in @@ -1 +1,2 @@ +mkdocs-material mkdocs-macros-plugin diff --git a/docs/build/requirements.txt b/docs/build/requirements.txt index 4e3707de4e48..cf76c210c051 100644 --- a/docs/build/requirements.txt +++ b/docs/build/requirements.txt @@ -1,31 +1,51 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.13 # by the following command: # -# pip-compile +# pip-compile --output-file=docs/build/requirements.txt docs/build/requirements.in # +certifi==2024.8.30 + # via requests +charset-normalizer==3.4.0 + # via requests click==8.1.2 # via mkdocs ghp-import==2.0.2 # via mkdocs +idna==3.10 + # via requests importlib-metadata==4.11.3 # via mkdocs jinja2==3.1.1 # via # mkdocs # mkdocs-macros-plugin + # mkdocs-material markdown==3.3.6 - # via mkdocs + # via + # mkdocs + # mkdocs-material + # pymdown-extensions markupsafe==2.1.1 # via jinja2 mergedeep==1.3.4 # via mkdocs mkdocs==1.3.0 - # via mkdocs-macros-plugin + # via + # mkdocs-macros-plugin + # mkdocs-material mkdocs-macros-plugin==0.7.0 - # via -r requirements.in + # via -r docs/build/requirements.in +mkdocs-material==8.5.4 + # via -r docs/build/requirements.in +mkdocs-material-extensions==1.3.1 + # via mkdocs-material packaging==21.3 # via mkdocs +pygments==2.18.0 + # via mkdocs-material +pymdown-extensions==10.4 + # via mkdocs-material pyparsing==3.0.8 # via packaging python-dateutil==2.8.2 @@ -36,14 +56,19 @@ pyyaml==6.0.1 # via # mkdocs # mkdocs-macros-plugin + # pymdown-extensions # pyyaml-env-tag pyyaml-env-tag==0.1 # via mkdocs +requests==2.32.3 + # via mkdocs-material six==1.16.0 # via python-dateutil termcolor==1.1.0 # via mkdocs-macros-plugin +urllib3==2.2.3 + # via requests watchdog==2.1.7 # via mkdocs zipp==3.8.0 - # via importlib-metadata \ No newline at end of file + # via importlib-metadata diff --git a/magefiles/magefile.go b/magefiles/magefile.go index 7182ce56f33d..163b6ac83331 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -420,7 +420,7 @@ func Label() error { type Docs mg.Namespace -// Compile Sass to CSS +// Prepare CSS func (Docs) Css() error { const ( homepageSass = "docs/assets/css/trivy_v1_homepage.scss" @@ -428,13 +428,21 @@ func (Docs) Css() error { return sh.Run("sass", "--no-source-map", "--style=compressed", homepageSass, strings.TrimSuffix(homepageSass, ".scss")+".min.css") } +// Prepare python requirements +func (Docs) Pip() error { + const ( + requirementsIn = "docs/build/requirements.in" + ) + return sh.Run("pip-compile", requirementsIn, "--output-file", strings.TrimSuffix(requirementsIn, ".in")+".txt") +} + // Serve launches MkDocs development server to preview the documentation page func (Docs) Serve() error { const ( - mkdocsImage = "squidfunk/mkdocs-material:9.5" + mkdocsImage = "squidfunk/mkdocs-material:9.5.44" mkdocsPort = "8000" ) - if err := sh.Run("docker", "build", "-t", mkdocsImage, "-f", "docs/build/Dockerfile", "docs/build"); err != nil { + if err := sh.Run("docker", "build", "-t", mkdocsImage, "docs/build"); err != nil { return err } return sh.Run("docker", "run", "--name", "mkdocs-serve", "--rm", "-v", "${PWD}:/docs", "-p", mkdocsPort+":8000", mkdocsImage)