Skip to content

Commit d9d5ad6

Browse files
Add README.md for bb env GH workflows
1 parent 2281ea4 commit d9d5ad6

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/REAMDE.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Building containerized build environments for Buildbot
2+
3+
**A build environment is a Docker container image used by Buildbot to build and test the server.**
4+
5+
Most of the build environments are created using `build-` workflows that share the same template file: [bbw_build_container_template.yml](bbw_build_container_template.yml).
6+
An exception is [bbw_build_container_rhel.yml](bbw_build_container_rhel.yml), which contains special tasks only applicable to `RHEL`.
7+
8+
Each workflow defines a matrix of images to be built. Adding a new image is as simple as adding a new item to the matrix. See **Adding a new image**.
9+
10+
## From Build to Production
11+
12+
Workflows are triggered by `Dockerfile` changes in [/ci_build_images/](../../ci_build_images/)
13+
14+
In **quay** and **ghcr**, we use two types of tags:
15+
16+
1. `dev_#image_name#` — used by `buildbot.dev.mariadb.org`
17+
1. `#image_name#` — used by `buildbot.mariadb.org`
18+
19+
To update a **production** image, create a Pull Request, merge it into the `DEV` branch, and then sync the changes to `MAIN`.
20+
21+
## Events that trigger a workflow
22+
23+
1. **Pull Request** – The image is built, and the result is reported as a CI Check.
24+
1. **Push to DEV** – The image is built and pushed to **quay** and **ghcr** with the tag `dev_#image_name#`.
25+
1. **Push to MAIN** – The `dev_#image_name#` tag is moved to `#image_name#` in both **quay** and **ghcr**.
26+
1. **Schedule** – See **Workflow dispatcher**.
27+
28+
## Adding a new image
29+
30+
You need to identify the group where the new image belongs.
31+
For example, adding `Fedora 42` means modifying [build-fedora-based.yml](build-fedora-based.yml).
32+
33+
An item should be added under `matrix/include`. For example:
34+
35+
```
36+
matrix:
37+
include:
38+
- image: debian:11
39+
platforms: linux/amd64, linux/arm64/v8
40+
branch: 10.11
41+
nogalera: false
42+
```
43+
44+
**Required parameters**:
45+
46+
- **Image** – This is the value used in the `FROM` instruction of the Dockerfile.
47+
- **Platforms** – Specify more than one to build a multi-architecture container image.
48+
- **Dockerfile** – A space-delimited list of `Dockerfiles` from the **ci_build_images** directory. The order is important, as they are concatenated.
49+
50+
**Optional**:
51+
52+
- **tag** – The displayed tag in **quay** and **ghcr**. If not specified, it's the same as the image name with `:` removed.
53+
- **runner** – GitHub Runner used for the build.
54+
- **clang_version** – Only relevant for [ci_build_images/msan.fragment.Dockerfile](msan.fragment.Dockerfile).
55+
- **branch** – For `debian`-based `Dockerfiles`, this installs build dependencies based on the control file from the specified MariaDB branch, e.g. `mk-build-deps -r -i debian/control`.
56+
- **install_valgrind** – Installs Valgrind in the final container image. Required for builders running tests under Valgrind.
57+
- **files** – JSON list of repository files needed in the final container image.
58+
- **nogalera** – If **True**, `galera-4` will not be installed in the container. Set to **True** when no Galera package is available on `ci.mariadb.org` for the distribution.
59+
- **deploy_on_schedule** – If **True**, the image will be rebuilt and deployed to production on the schedule defined by the **workflow dispatcher**.
60+
61+
## Workflow dispatcher
62+
63+
All `build-` workflows can be manually dispatched using `build-workflow-dispatcher.yml`.
64+
65+
When dispatching the workflow, behavior depends on the `source branch`:
66+
67+
- **DEV** – Builds the image and pushes it to **quay** and **ghcr** with the `dev_#image_name#` tag.
68+
- **MAIN** – Performs a production deployment by moving the `dev_#image_name#` tag to `#image_name#`.
69+
70+
### Scheduler
71+
72+
On the specified schedule, this workflow will trigger (on the default branch) all workflows that implement `is_scheduled_event` as an input to the `workflow_call` event.
73+
74+
```
75+
on:
76+
schedule:
77+
- cron: '0 3 3 * *' # Third of the month
78+
```
79+
80+
During this event, the image is not only rebuilt and pushed to **quay** and **ghcr**, but the tag is also moved and deployed to **production**.

0 commit comments

Comments
 (0)