Skip to content

Commit c3e93bc

Browse files
committed
docs: restructure diataxis and aggreagtion
Signed-off-by: Eike Waldt <waldt@b1-systems.de> On-behalf-of: SAP <eike.waldt@sap.com>
1 parent 086e74f commit c3e93bc

File tree

4 files changed

+123
-27
lines changed

4 files changed

+123
-27
lines changed
Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
---
2-
title: "Builder - Getting Started"
3-
github_target_path: "docs/reference/supporting_tools/builder/tutorials/getting_started.md"
2+
title: "Building a custom Feature"
3+
description: Create a custom Feature and build an image with the Builder
44
migration_status: "new"
55
migration_source: ""
66
migration_issue: ""
77
migration_stakeholder: "@tmangold, @yeoldegrove, @ByteOtter"
88
migration_approved: false
99
github_org: gardenlinux
1010
github_repo: builder
11-
github_source_path: docs/tutorials/getting_started.md
11+
github_source_path: docs/how-to/custom-feature.md
12+
github_target_path: "docs/how-to/custom-feature.md"
1213
---
1314

14-
# Getting Started: Creating a Custom Linux Image with Builder
15+
# Create a custom Feature and build an image with the Builder
1516

16-
This tutorial will walk you through the process of creating a custom Linux image using the Builder tool.
17-
We will start with the Builder example repository and build a *feature* to add an [`nginx` HTTP server](https://nginx.org/en/) to our image.
17+
This How-To will walk you through the process of creating a custom Linux image using the Builder tool.
18+
We will start with the Builder example repository and build a _feature_ to add an [`nginx` HTTP server](https://nginx.org/en/) to our image.
1819

1920
Let's begin by creating a new GitHub repository based on the Builder example repository using this link:
2021

@@ -53,9 +54,9 @@ mkdir features/nginx
5354
```
5455

5556
> This is where our nginx feature will live.
56-
Features are a concept of the builder that allows us to build variants of images.
57-
For example, if we wanted to add an alternative HTTP server later, we could add an `apacheHttpd` feature.
58-
At image build time, we could pick if we want the `nginx` or the `apacheHttpd` feature.
57+
> Features are a concept of the builder that allows us to build variants of images.
58+
> For example, if we wanted to add an alternative HTTP server later, we could add an `apacheHttpd` feature.
59+
> At image build time, we could pick if we want the `nginx` or the `apacheHttpd` feature.
5960
6061
2. Create a file named `info.yaml` inside `features/nginx` and edit it with the content below:
6162

@@ -68,17 +69,16 @@ features:
6869
```
6970
7071
> The `info.yaml` file is required for each feature by the builder.
71-
We'll specify that our `nginx` feature includes the `base` feature.
72-
This makes sense because the `nginx` feature on its own does not contain a full operating system, so to get a bootable image we include the debian system as it is defined in `base`.
73-
See [features documentation](../reference/features.md) for detailed information on the structure of features.
72+
> We'll specify that our `nginx` feature includes the `base` feature.
73+
> This makes sense because the `nginx` feature on its own does not contain a full operating system, so to get a bootable image we include the debian system as it is defined in `base`.
74+
> See [features documentation](../reference/features.md) for detailed information on the structure of features.
7475

7576
1. Create a file named `pkg.include` inside `features/nginx` with the following content:
7677

7778
```
7879
nginx
7980
```
8081

81-
8282
> `pkg.include` is a list of packages this feature needs, each feature on a new line.
8383

8484
4. Create a file named `exec.config` inside `features/nginx` with the following content:
@@ -91,9 +91,8 @@ set -eufo pipefail
9191
systemctl enable nginx
9292
```
9393

94-
9594
> `exec.config` is a shell script we can use to customize our image.
96-
In this case, we [enable the systemd unit for nginx](https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#enable%20UNIT…) which makes nginx start on boot.
95+
> In this case, we [enable the systemd unit for nginx](https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#enable%20UNIT…) which makes nginx start on boot.
9796

9897
5. Make the `exec.config` file executable:
9998

@@ -107,17 +106,16 @@ chmod +x features/nginx/exec.config
107106
mkdir -p features/nginx/file.include/var/www/html
108107
```
109108

110-
111109
> The `file.include` directory allows us to merge files and directories into the root filesystem of our image.
112110

113111
7. Create a dummy `index.html` file inside `features/nginx/file.include/var/www/html` with content like the following (or customize it as desired):
114112

115113
```html
116114
<!DOCTYPE html>
117115
<html>
118-
<body>
119-
<p>Hello World!</p>
120-
</body>
116+
<body>
117+
<p>Hello World!</p>
118+
</body>
121119
</html>
122120
```
123121

@@ -137,7 +135,7 @@ If everything worked as intended, you should see the system boot up. Once the sy
137135

138136
To also build the new image on GitHub Actions, we'll need to modify the `.github/workflows/build.yml` file.
139137

140-
Let's change the *build* step to include the `nginx` feature we just created, and let's upload our built image to GitHub's artifact storage:
138+
Let's change the _build_ step to include the `nginx` feature we just created, and let's upload our built image to GitHub's artifact storage:
141139

142140
```diff
143141
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
@@ -159,3 +157,8 @@ index 181a646..9e4261e 100644
159157
Now commit and push your changes and GitHub will build the image for you.
160158

161159
Congratulations! You have successfully created your first feature for the Builder and setup a CI Pipeline to build the image. :tada:
160+
161+
## Next Steps
162+
163+
- [Builder](/reference/supporting-tools/builder.md)
164+
- [Features Reference](/reference/features.md)

docs/overview/README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
title: "Builder"
3+
description: An overview of the Builder Tool
4+
migration_status: "new"
5+
migration_source: ""
6+
migration_issue: ""
7+
migration_stakeholder: "@tmangold, @yeoldegrove, @ByteOtter"
8+
migration_approved: false
9+
github_org: gardenlinux
10+
github_repo: python-gardenlinux-lib
11+
github_source_path: docs/overview/index.md
12+
github_target_path: "docs/reference/supporting_tools/builder.md"
13+
---
14+
15+
# Builder
16+
17+
## Overview
18+
19+
The Builder is a powerful tool for effortlessly building Linux system images based on config directories. It serves as the primary build tooling for the [gardenlinux](https://github.com/gardenlinux/gardenlinux) project.
20+
21+
By default, the Builder runs inside rootless Podman, enabling building without requiring elevated permissions.
22+
23+
## Requirements
24+
25+
The Builder has minimal dependencies and only requires a working container engine. We recommend using rootless Podman. Please refer to the [Podman rootless setup guide](https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md) for instructions on setting it up.
26+
27+
## Usage
28+
29+
To utilize the Builder, follow these steps:
30+
31+
1. Download the latest version of the [build script](https://github.com/gardenlinux/builder/releases/download/latest/build).
32+
2. Run the build script within a config directory.
33+
34+
```shell
35+
wget https://github.com/gardenlinux/builder/releases/download/latest/build
36+
./build ${target}
37+
```
38+
39+
By default, the Builder uses `podman` as the container engine. If you prefer using a different container engine, you can specify it using the `--container-engine` option.
40+
41+
If you decide to use `docker` on a system restricting unprivileged user namespaces with apparmor (e.g. Ubuntu 23.10 or newer) an apparmor profile allowing `userns` is required. This can be automatically created and selected by the Builder by opting in to the permanent system change. You can avoid this by:
42+
43+
- Using `podman`
44+
- Passing a custom profile using the `--apparmor-profile` option
45+
- Using a system not restricting unprivileged user namespaces
46+
47+
## Config Directory
48+
49+
A config directory serves as the input for the Builder and is used to create a Linux system image. It consists of the following components:
50+
51+
- **`features` directory**: Contains sub-directories for each feature. You can create your own features by referring to [features.md](docs/features.md).
52+
53+
- **`cert` directory** (optional): If you plan to use secure boot, include a `cert` directory.
54+
55+
In addition to the above components, your configuration directory must include the following configuration scripts:
56+
57+
- `get_commit`: This script should output the Git commit used to tag the build artifacts.
58+
- `get_repo`: This script should output the apt package repository to use.
59+
- `get_timestamp`: This script should output the timestamp to be used instead of the real system time, ensuring reproducibility of builds.
60+
- `get_version`: This script should output the version of the package repository to use. For example, use `forky` for Debian or `today` for Garden Linux.
61+
- `keyring.gpg`: The PGP key used to validate the package repository. For Debian, you can obtain this key from the [debian-archive-keyring](https://packages.debian.org/forky/debian-archive-keyring) package.
62+
63+
For a quick start guide on setting up your own config directory with your own features checkout [getting_started.md](docs/getting_started.md).
64+
65+
### Example Config Directory
66+
67+
If you're new to configuring the Builder, you can find a minimal example config directory at [gardenlinux/builder_example](https://github.com/gardenlinux/builder_example). For a more comprehensive example, refer to the main [gardenlinux](https://github.com/gardenlinux/gardenlinux) repository.
68+
69+
Feel free to explore these examples to gain a better understanding of how to effectively structure your own config directory.
70+
71+
## Local Development
72+
73+
To test changes made to the builder locally you can simply create a symlink to the build script inside the builder directory inside a config directory. This will automatically be detected by the build script and the builder re-build iff necessary.
74+
75+
e.g.: if you have the gardenlinux and builder repos both inside the same parent directory and you want to work on the builder you would do the following:
76+
77+
```
78+
cd gardenlinux
79+
ln -f -s ../builder/build build
80+
```
81+
82+
Now you can make your modifications inside the builder directory and running `./build ${target}` inside the gardenlinux repo will use the local builder, rebuilding the build container if necessary.
83+
84+
## Next Steps
85+
86+
- [Features Reference](/reference/features.md)
87+
- [Building a custom Feature](/how-to/custom-features.md)
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
2-
title: "Builder - Features"
3-
github_target_path: "docs/reference/supporting_tools/builder/reference/features.md"
2+
title: "Features"
3+
description: Detailed specification of Features
44
migration_status: "new"
55
migration_source: ""
66
migration_issue: ""
77
migration_stakeholder: "@tmangold, @yeoldegrove, @ByteOtter"
88
migration_approved: false
99
github_org: gardenlinux
1010
github_repo: builder
11-
github_source_path: docs/references/features.md
11+
github_source_path: docs/reference/features.md
12+
github_target_path: docs/reference/features.md
1213
---
1314

1415
# Features
@@ -17,15 +18,15 @@ Each feature must contain an `info.yaml` file that adheres to the following stru
1718

1819
## `info.yaml` file structure:
1920

20-
- `description`: (*optional*) A string explaining the purpose or functionality of the feature.
21+
- `description`: (_optional_) A string explaining the purpose or functionality of the feature.
2122
- `type`: Can be one of the following:
2223
- `platform`
2324
- `element`
2425
- `flag`
2526
- While the builder does not make any technical distinctions between these feature types, it is recommended that each image uses only one `platform`, and `flag` should be used for minor changes without including other features.
26-
- `features`: (*optional*) A sub-structure that contains related features.
27-
- `include`: (*optional*) A list of features that will automatically be included if this feature is selected.
28-
- `exclude`: (*optional*) A list of features that are incompatible with this feature. If any of these features were implicitly included from another feature, they will be removed from the feature set. If they were explicitly provided as part of the target, the build will fail.
27+
- `features`: (_optional_) A sub-structure that contains related features.
28+
- `include`: (_optional_) A list of features that will automatically be included if this feature is selected.
29+
- `exclude`: (_optional_) A list of features that are incompatible with this feature. If any of these features were implicitly included from another feature, they will be removed from the feature set. If they were explicitly provided as part of the target, the build will fail.
2930

3031
Here's an example of an `info.yaml` file:
3132

@@ -128,3 +129,8 @@ They take the image artifact created by an image script and output a different f
128129
Scripts of the form `convert.<ext>` get the raw image as input and produce a `.<ext>` output.
129130
Scripts of the form `convert.<extA>~<extB>` get `.<extB>` as input and produces `.<extA>` as output.
130131
The second form is only useful for advanced use cases, if you are not aware of one, you'll probably never need it!
132+
133+
## Next Steps
134+
135+
- [Builder](/reference/supporting-tools/builder.md)
136+
- [Building a custom Feature](/how-to/custom-features.md)

0 commit comments

Comments
 (0)