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 <guillaume.derouville@gmail.com>
This commit is contained in:
22
docs/faq/1229-empty-buildkit-cache.md
Normal file
22
docs/faq/1229-empty-buildkit-cache.md
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
slug: /1229/empty-buildkit-cache
|
||||
displayed_sidebar: europa
|
||||
---
|
||||
|
||||
# Empty BuildKit's cache
|
||||
|
||||
There are two ways of emptying the BuildKit cache:
|
||||
|
||||
- Run your action with the `--no-cache` option:
|
||||
|
||||
```console
|
||||
dagger do <your-action> --no-cache
|
||||
```
|
||||
|
||||
- Stop and remove the buildkitd container and remove its associated volume:
|
||||
|
||||
```console
|
||||
docker stop dagger-buildkitd ; docker rm dagger-buildkitd ; docker volume rm dagger-buildkitd
|
||||
```
|
||||
|
||||
In 99.9% of the cases, the first solution is enough
|
23
docs/faq/1230-better-logs.md
Normal file
23
docs/faq/1230-better-logs.md
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
slug: /1230/better-logs
|
||||
displayed_sidebar: europa
|
||||
---
|
||||
|
||||
# Log formats
|
||||
|
||||
Dagger exposes 2 logging format options:
|
||||
|
||||
- `--log-format auto|plain|tty|json`
|
||||
|
||||
The default mode is `auto`. If you want to keep each actions' logs, use the `plain` mode
|
||||
|
||||
- `--log-level panic|fatal|error|warn|info|debug|trace`
|
||||
|
||||
`debug` is useful to check whether an explicit dependency has been found between two actions.
|
||||
|
||||
You can also export these options as env variables:
|
||||
|
||||
```console
|
||||
export DAGGER_LOG_FORMAT="plain"
|
||||
export DAGGER_LOG_LEVEL="debug"
|
||||
```
|
24
docs/faq/1231-always-execute.md
Normal file
24
docs/faq/1231-always-execute.md
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
slug: /1231/always-execute
|
||||
displayed_sidebar: europa
|
||||
---
|
||||
|
||||
# Always executing an action
|
||||
|
||||
Dagger implemented a way to tell Buildkit not to rely on cache for a specific action.
|
||||
|
||||
The `docker.#Run` and `core.#Exec` definitions have an `always` field:
|
||||
|
||||
```cue
|
||||
// If set to true, the cache will never be triggered for that specific action.
|
||||
always: bool | *false
|
||||
```
|
||||
|
||||
Any package composed on top of it (`bash.#Run` for example) also exposes this field as it will inherit it from `docker.#Run`:
|
||||
|
||||
```cue
|
||||
test: bash.#Run & {
|
||||
always: true
|
||||
...
|
||||
}
|
||||
```
|
54
docs/faq/1232-chain-actions.md
Normal file
54
docs/faq/1232-chain-actions.md
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
slug: /1232/chain-actions
|
||||
displayed_sidebar: europa
|
||||
---
|
||||
|
||||
# Chaining actions
|
||||
|
||||
Dependencies are materialized at runtime, when your Cue files are parsed and the corresponding DAG gets generated:
|
||||
|
||||
```cue
|
||||
// Prerequisite action that runs when `test` is being called
|
||||
_dockerCLI: alpine.#Build & {
|
||||
packages: {
|
||||
bash: {}
|
||||
}
|
||||
}
|
||||
|
||||
// Main action
|
||||
foo: bash.#Run & {
|
||||
input: _dockerCLI.output // <== CHAINING of action happening here
|
||||
always: true
|
||||
script: contents: #"""
|
||||
echo "bonjour"
|
||||
"""#
|
||||
}
|
||||
```
|
||||
|
||||
On above example, `_dockerCLI` gets executed first, as the corresponding DAG shows that it is required for the action `foo` to be processed.
|
||||
|
||||
This is the `input-output` model: `foo`'s input is `_dockerCLI`'s output.
|
||||
|
||||
We currently don't support explicit dependencies at the moment (one of our top priority). But, if you need one, here is how your can hack your way around it:
|
||||
|
||||
```cue
|
||||
foo: bash.#Run & {
|
||||
input: _dockerCLI.output
|
||||
always: true
|
||||
script: contents: #"""
|
||||
echo "bonjour"
|
||||
"""#
|
||||
}
|
||||
|
||||
// Main action
|
||||
bar: bash.#Run & {
|
||||
input: _dockerCLI.output
|
||||
always: true
|
||||
script: contents: #"""
|
||||
echo "bonjour"
|
||||
"""#
|
||||
env: HACK: "\(test.success)" // <== HACK: CHAINING of action happening here
|
||||
}
|
||||
```
|
||||
|
||||
`foo` and `bar` are similar actions. I don't want to rely on the `input-output` model but still want to force a dependency between them. The easiest way is to create an environment variable that relies on the other action's success
|
33
docs/faq/index.md
Normal file
33
docs/faq/index.md
Normal file
@@ -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 <DocCardList items={customPropsItem}/>
|
||||
}
|
||||
|
||||
<FaqItems />
|
||||
```
|
Reference in New Issue
Block a user