From 204d067bccb92a868c35d21685cd8ae05396c408 Mon Sep 17 00:00:00 2001 From: guillaume Date: Tue, 12 Apr 2022 18:41:07 +0200 Subject: [PATCH] docs: Implement FAQ page, default values in Cue + fix sidebar and titles Move faq pages from guide to specific FAQ page, shown as per tailscale format. Custom in-house logic implemented because Docusaurus doesn't manage it Signed-off-by: guillaume --- .../1229-empty-buildkit-cache.md} | 4 +-- .../1230-better-logs.md} | 4 +-- .../1231-always-execute.md} | 4 +-- .../1232-chain-actions.md} | 4 +-- docs/faq/index.md | 33 +++++++++++++++++++ website/sidebars.js | 13 ++++++++ 6 files changed, 54 insertions(+), 8 deletions(-) rename docs/{guides/1227-empty-buildkit-cache.md => faq/1229-empty-buildkit-cache.md} (86%) rename docs/{guides/1228-better-logs.md => faq/1230-better-logs.md} (89%) rename docs/{guides/1229-always-execute.md => faq/1231-always-execute.md} (85%) rename docs/{guides/1230-chain-actions.md => faq/1232-chain-actions.md} (95%) create mode 100644 docs/faq/index.md diff --git a/docs/guides/1227-empty-buildkit-cache.md b/docs/faq/1229-empty-buildkit-cache.md similarity index 86% rename from docs/guides/1227-empty-buildkit-cache.md rename to docs/faq/1229-empty-buildkit-cache.md index 88e34946..c47268b7 100644 --- a/docs/guides/1227-empty-buildkit-cache.md +++ b/docs/faq/1229-empty-buildkit-cache.md @@ -1,9 +1,9 @@ --- -slug: /1227/empty-buildkit-cache +slug: /1229/empty-buildkit-cache displayed_sidebar: europa --- -# How to empty BuildKit's cache ? +# Empty BuildKit's cache There are two ways of emptying the BuildKit cache: diff --git a/docs/guides/1228-better-logs.md b/docs/faq/1230-better-logs.md similarity index 89% rename from docs/guides/1228-better-logs.md rename to docs/faq/1230-better-logs.md index b9d33b10..d4e33901 100644 --- a/docs/guides/1228-better-logs.md +++ b/docs/faq/1230-better-logs.md @@ -1,9 +1,9 @@ --- -slug: /1228/better-logs +slug: /1230/better-logs displayed_sidebar: europa --- -# How can I have better logs ? +# Log formats Dagger exposes 2 logging format options: diff --git a/docs/guides/1229-always-execute.md b/docs/faq/1231-always-execute.md similarity index 85% rename from docs/guides/1229-always-execute.md rename to docs/faq/1231-always-execute.md index 9ba2cc89..363bd833 100644 --- a/docs/guides/1229-always-execute.md +++ b/docs/faq/1231-always-execute.md @@ -1,9 +1,9 @@ --- -slug: /1229/always-execute +slug: /1231/always-execute displayed_sidebar: europa --- -# How to make sure an action is always being executed ? +# Always executing an action Dagger implemented a way to tell Buildkit not to rely on cache for a specific action. diff --git a/docs/guides/1230-chain-actions.md b/docs/faq/1232-chain-actions.md similarity index 95% rename from docs/guides/1230-chain-actions.md rename to docs/faq/1232-chain-actions.md index e5811c4d..304849c8 100644 --- a/docs/guides/1230-chain-actions.md +++ b/docs/faq/1232-chain-actions.md @@ -1,9 +1,9 @@ --- -slug: /1230/chain-actions +slug: /1232/chain-actions displayed_sidebar: europa --- -# How can I chain actions together ? +# Chaining actions Dependencies are materialized at runtime, when your Cue files are parsed and the corresponding DAG gets generated: diff --git a/docs/faq/index.md b/docs/faq/index.md new file mode 100644 index 00000000..bdee3d3b --- /dev/null +++ b/docs/faq/index.md @@ -0,0 +1,33 @@ +--- +slug: /faq +displayed_sidebar: europa +--- + +# FAQ + +```mdx-code-block +import DocCardList from '@theme/DocCardList'; +import {useDocsVersion} from '@docusaurus/theme-common'; + +export const FaqItems = () => { + {/* access root category object from Docusaurus */} + const docsVersion = useDocsVersion(); + {/* customProps object retrieved from sidebar.js */} + const faqItem = docsVersion.docsSidebars.europa.filter(item => item.label === 'FAQ'); + {/* Return custom FAQ Items array */} + const customPropsItem = faqItem[0].customProps.items.map(customPropsItem => { + const result = Object.values(docsVersion.docs).filter(item => item.id === customPropsItem.docId)[0] + if(result) + return { + type: "link", + label: result.title, + description: result.description, + href: customPropsItem.href, + docId: customPropsItem.docId + } + }) + return +} + + +``` diff --git a/website/sidebars.js b/website/sidebars.js index 764842af..4dbc6a7c 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -57,6 +57,19 @@ module.exports = { "guides/migrate-from-dagger-0.1", ], }, + { + type: "doc", + label: "FAQ", + id: "faq/index", + customProps: { + "items": [ + { docId: "faq/empty-buildkit-cache", href: "1229/empty-buildkit-cache" }, + { docId: "faq/better-logs", href: "1230/better-logs" }, + { docId: "faq/always-execute", href: "1231/always-execute" }, + { docId: "faq/chain-actions", href: "1232/chain-actions" }, + ] + } + }, { type: "category", label: "References",