From 7a09fba399aef66d72838c6da80e5820895b0f37 Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Fri, 17 Mar 2023 09:45:11 -0700 Subject: [PATCH 1/2] Add documents from containerd/containerd Signed-off-by: Kazuyoshi Kato --- Makefile | 18 +++++++++++++++--- content/docs/getting-started.md | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1da4a55..1305cbd 100644 --- a/Makefile +++ b/Makefile @@ -15,17 +15,29 @@ clean: rm -rf public resources -serve: +containerd-1.7.x: + git clone --branch v1.7.0 --depth 1 https://github.com/containerd/containerd.git containerd-1.7.x + +content/v1.7.x: containerd-1.7.x + cp -r containerd-1.7.x/docs content/v1.7.x + +containerd-1.6.x: + git clone --branch v1.6.19 --depth 1 https://github.com/containerd/containerd.git containerd-1.6.x + +content/v1.6.x: containerd-1.6.x + cp -r containerd-1.6.x/docs content/v1.6.x + +serve: content/v1.7.x content/v1.6.x hugo server \ --buildDrafts \ --buildFuture \ --disableFastRender -production-build: +production-build: content/v1.7.x content/v1.6.x hugo \ --minify -preview-build: +preview-build: content/v1.7.x content/v1.6.x hugo \ --baseURL $(DEPLOY_PRIME_URL) \ --buildDrafts \ diff --git a/content/docs/getting-started.md b/content/docs/getting-started.md index f4333f5..2349be2 100644 --- a/content/docs/getting-started.md +++ b/content/docs/getting-started.md @@ -4,4 +4,5 @@ short: Getting started weight: 2 --- -Moved to https://github.com/containerd/containerd/blob/main/docs/getting-started.md +- [1.7.x](/v1.7.x/getting-started/) +- [1.6.x](/v1.6.x/getting-started/) From 8c9946d187d40e633c6c32cb7d48163e6e0c9ab2 Mon Sep 17 00:00:00 2001 From: haddscot Date: Tue, 19 Mar 2024 11:48:01 -0700 Subject: [PATCH 2/2] implement doc hosting and syncing Signed-off-by: Scott Haddlesey --- .github/workflows/sync-documentation.yml | 14 ++++++ .gitignore | 5 +++ .gitmodules | 8 ++++ Makefile | 19 +++----- README.md | 8 ++-- containerd1.6 | 1 + containerd1.7 | 1 + content/docs/_index.md | 13 +++--- content/docs/getting-started.md | 3 +- netlify.toml | 2 +- package-lock.json | 18 ++++++++ themes/containerd/layouts/docs/list.html | 16 ++++--- themes/containerd/layouts/docs/single.html | 18 +++++--- themes/containerd/layouts/index.html | 2 +- .../layouts/partials/docs/dropdown.html | 17 +++++++- .../partials/docs/nested-menu-partial.html | 14 ++++++ .../layouts/partials/docs/sidebar.html | 43 +++++++++++++++++++ .../layouts/partials/docs/tabs.html | 17 -------- .../containerd/layouts/partials/footer.html | 27 +++++++++--- themes/containerd/layouts/partials/hero.html | 2 +- .../containerd/layouts/partials/navbar.html | 16 ++----- tools/refresh-docs.sh | 41 ++++++++++++++++++ yarn.lock | 2 +- 23 files changed, 227 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/sync-documentation.yml create mode 100644 .gitmodules create mode 160000 containerd1.6 create mode 160000 containerd1.7 create mode 100644 package-lock.json create mode 100644 themes/containerd/layouts/partials/docs/nested-menu-partial.html create mode 100644 themes/containerd/layouts/partials/docs/sidebar.html delete mode 100644 themes/containerd/layouts/partials/docs/tabs.html create mode 100755 tools/refresh-docs.sh diff --git a/.github/workflows/sync-documentation.yml b/.github/workflows/sync-documentation.yml new file mode 100644 index 0000000..1cbd5c8 --- /dev/null +++ b/.github/workflows/sync-documentation.yml @@ -0,0 +1,14 @@ +name: Sync-Documentation + +on: + schedule: + - cron: '0 3 * * *' + +jobs: + update-documentationmd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Update documentation + id: vars + run: make refresh-docs diff --git a/.gitignore b/.gitignore index 5a8fcbe..704951b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,12 @@ node_modules/ # Hugo-generated assets public/ resources/ +.hugo_build.lock # Link checker assets bin/ tmp/ + +# Documentation synced from other repos +content/docs/v* +static/docs/* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4264dbf --- /dev/null +++ b/.gitmodules @@ -0,0 +1,8 @@ +[submodule "containerd1.7"] + path = containerd1.7 + url = https://github.com/containerd/containerd.git + branch = release/1.7 +[submodule "containerd1.6"] + path = containerd1.6 + url = https://github.com/containerd/containerd.git + branch = release/1.6 diff --git a/Makefile b/Makefile index 1305cbd..1a71d08 100644 --- a/Makefile +++ b/Makefile @@ -15,29 +15,20 @@ clean: rm -rf public resources -containerd-1.7.x: - git clone --branch v1.7.0 --depth 1 https://github.com/containerd/containerd.git containerd-1.7.x +refresh-docs: + ./tools/refresh-docs.sh -content/v1.7.x: containerd-1.7.x - cp -r containerd-1.7.x/docs content/v1.7.x - -containerd-1.6.x: - git clone --branch v1.6.19 --depth 1 https://github.com/containerd/containerd.git containerd-1.6.x - -content/v1.6.x: containerd-1.6.x - cp -r containerd-1.6.x/docs content/v1.6.x - -serve: content/v1.7.x content/v1.6.x +serve: refresh-docs hugo server \ --buildDrafts \ --buildFuture \ --disableFastRender -production-build: content/v1.7.x content/v1.6.x +production-build: refresh-docs hugo \ --minify -preview-build: content/v1.7.x content/v1.6.x +preview-build: refresh-docs hugo \ --baseURL $(DEPLOY_PRIME_URL) \ --buildDrafts \ diff --git a/README.md b/README.md index c31b686..2ca3312 100644 --- a/README.md +++ b/README.md @@ -38,15 +38,13 @@ You can also access the deploy preview for a pull request by clicking **Show all ## Contributing to the documentation -All of containerd's documentation is written in [GitHub-flavored Markdown](https://github.github.com/gfm/) and contained in the [`content/docs`](content/docs) folder. +The source of truth for containerd's documentation is the [`docs folder`](https://github.com/containerd/containerd/tree/main/docs) in the containerd/containerd repo. Documentation is syncronized to this repo daily using the [Sync-Documentation](/.github/workflows/sync-documentation.yml) workflow. ### Adding new docs -To create a new doc, add a Markdown file to `content/docs`. The name of the file will determine its URL. This doc, for example, would be available at `https://containerd.io/docs/client-libraries`: +All of containerd's documentation is written in [GitHub-flavored Markdown](https://github.github.com/gfm/). To create a new doc, add a Markdown file in the [`docs folder`](https://github.com/containerd/containerd/tree/main/docs) in the containerd/containerd repo, and it will automatically be cloned into this repo. **DO NOT WRITE DOCUMENTATION DIRECTLY TO THIS REPO -- IT WILL BE DELETED BY THE SYNC-DOCUMENTATION WORKFLOW.** -```shell -touch content/docs/client-libraries.md -``` +The name, path, and release branch of the file in the containerd/containerd repo will determine its URL on this site. For example, a document committed to `https://github.com/containerd/containerd/blob/release/1.7/docs/NRI.md` would be available at `https://containerd.io/docs/v1.7.x/nri/`. Once you've added the doc you'll need to add the following page metadata at the top, as YAML: diff --git a/containerd1.6 b/containerd1.6 new file mode 160000 index 0000000..d68034c --- /dev/null +++ b/containerd1.6 @@ -0,0 +1 @@ +Subproject commit d68034c2fe20ce0fc29692f87afced1edf7d77da diff --git a/containerd1.7 b/containerd1.7 new file mode 160000 index 0000000..dcf2847 --- /dev/null +++ b/containerd1.7 @@ -0,0 +1 @@ +Subproject commit dcf2847247e18caba8dce86522029642f60fe96b diff --git a/content/docs/_index.md b/content/docs/_index.md index 81352af..6dc240d 100644 --- a/content/docs/_index.md +++ b/content/docs/_index.md @@ -4,14 +4,17 @@ short: Overview weight: 1 --- -Welcome to the containerd documentation! This document contains some basic project-level information about containerd. +## Overview -If you'd like to get started running containerd locally on your machine, see the [Getting started](https://github.com/containerd/containerd/blob/main/docs/getting-started.md) guide. +Welcome to the containerd documentation! This document contains some basic project-level information about containerd. -See also other docs: https://github.com/containerd/containerd/tree/main/docs +If you'd like to get started running containerd locally on your machine, see the [getting started](#getting-started) guide. ## Repositories -The containerd project is encapsulated in a variety of [GitHub](https://github.com) repositories. +The containerd project is encapsulated in a variety of GitHub repositories; see https://github.com/containerd . + +## Getting Started -See https://github.com/containerd . +- [1.7.x](v1.7.x/docs/getting-started/) +- [1.6.x](v1.6.x/docs/getting-started/) diff --git a/content/docs/getting-started.md b/content/docs/getting-started.md index 2349be2..5471156 100644 --- a/content/docs/getting-started.md +++ b/content/docs/getting-started.md @@ -4,5 +4,4 @@ short: Getting started weight: 2 --- -- [1.7.x](/v1.7.x/getting-started/) -- [1.6.x](/v1.6.x/getting-started/) +This page has been consolidated to the [overview page](/docs/#getting-started) \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index 54d8407..0846684 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ publish = "public" command = "make production-build" [build.environment] -HUGO_VERSION = "0.111.3" +HUGO_VERSION = "0.116.0" [context.deploy-preview] command = "make preview-build" diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..58c2569 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,18 @@ +{ + "name": "containerd.io", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "bulma": "^0.9.4" + } + }, + "node_modules/bulma": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.4.tgz", + "integrity": "sha512-86FlT5+1GrsgKbPLRRY7cGDg8fsJiP/jzTqXXVqiUZZ2aZT8uemEOHlU1CDU+TxklPEZ11HZNNWclRBBecP4CQ==", + "dev": true + } + } +} diff --git a/themes/containerd/layouts/docs/list.html b/themes/containerd/layouts/docs/list.html index 375493a..ca279ec 100644 --- a/themes/containerd/layouts/docs/list.html +++ b/themes/containerd/layouts/docs/list.html @@ -1,5 +1,5 @@ {{ define "title" }} -containerd docs – {{ .Title }} +containerd docs – {{ cond (eq .Title "") (.File.BaseFileName | humanize | title) .Title }} {{ end }} {{ define "main" }} @@ -7,19 +7,23 @@ {{- $pages := where .Site.Pages "Section" $section }} {{ partial "hero.html" . }} -{{ partial "docs/tabs.html" (dict "pages" $pages "currentUrl" .RelPermalink) }} +{{ $Content := .Content }}
-
+ {{ partial "docs/sidebar.html" . }} + +
{{ partial "docs/dropdown.html" . }}
- {{ .Content }} + + {{- $content := (replaceRE `\.md` "" .Content) }} + {{ $content | safeHTML }}
@@ -27,8 +31,8 @@
{{- if .TableOfContents }}