Skip to content

Commit be01cbc

Browse files
Add docs for 'Get AlmaLinux' page (#913)
* add docs and some more functionality for generate get-almalinux --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 442bf48 commit be01cbc

File tree

10 files changed

+420
-121
lines changed

10 files changed

+420
-121
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
},
3333
"forwardPorts": [1313],
3434
"remoteUser": "alma_www_user",
35-
"postCreateCommand": "echo 'function git_branch() { local branch; branch=\"$(git symbolic-ref --short HEAD 2> /dev/null)\"; if [[ -n \"$branch\" ]]; then echo -n \"$branch\"; return 0; fi; return 1; } && function git_has_changes() { git diff --quiet HEAD 2> /dev/null || echo -n \"\"; } && export WHITE=\"\\[\\033[1;37m\\]\" && export GREEN=\"\\[\\033[0;32m\\]\" && export BLUE=\"\\[\\033[0;94m\\]\" && export RED=\"\\[\\033[1;31m\\]\" && export YELLOW=\"\\[\\033[1;33m\\]\" && export RESET=\"\\[\\033[0m\\]\" && function prompt_command() { PS1=\"${GREEN}\\u${WHITE} ➜ ${BLUE}\\w ${BLUE}(${RED}\\$(git_branch)${YELLOW}\\$(git_has_changes)${BLUE})${RESET}$ \"; } && export PROMPT_COMMAND=\"prompt_command\"' >> ~/.bashrc"
35+
"postCreateCommand": ".devcontainer/post-create.sh"
3636
}

.devcontainer/post-create.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Idempotent append of nice git prompt functions to ~/.bashrc
5+
if ! grep -q "function git_branch()" "$HOME/.bashrc" 2>/dev/null; then
6+
cat >> "$HOME/.bashrc" <<'BASHRC_APPEND'
7+
function git_branch() { local branch; branch="$(git symbolic-ref --short HEAD 2> /dev/null)"; if [[ -n "$branch" ]]; then echo -n "$branch"; return 0; fi; return 1; }
8+
function git_has_changes() { git diff --quiet HEAD 2> /dev/null || echo -n "✗"; }
9+
export WHITE="\[\033[1;37m\]"
10+
export GREEN="\[\033[0;32m\]"
11+
export BLUE="\[\033[0;94m\]"
12+
export RED="\[\033[1;31m\]"
13+
export YELLOW="\[\033[1;33m\]"
14+
export RESET="\[\033[0m\]"
15+
function prompt_command() { PS1="${GREEN}\u${WHITE} ➜ ${BLUE}\w ${BLUE}(${RED}\$(git_branch)${YELLOW}\$(git_has_changes)${BLUE})${RESET}$ "; }
16+
export PROMPT_COMMAND="prompt_command"
17+
BASHRC_APPEND
18+
fi
19+
20+
# Run generator only if output file is missing. This keeps rebuilds fast and avoids overwriting
21+
if [ ! -f data/get_almalinux.yaml ]; then
22+
echo 'Generating data/get_almalinux.yaml (first-run)...'
23+
if command -v python3 >/dev/null 2>&1; then
24+
python3 tools/generate_get_almalinux_yaml.py || echo 'Warning: generator failed'
25+
else
26+
echo 'python3 not found; skipping generator. You can run: python3 tools/generate_get_almalinux_yaml.py'
27+
fi
28+
else
29+
echo 'data/get_almalinux.yaml already present; skipping generation.'
30+
fi
31+
32+
exit 0

.github/workflows/publish-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
on: pull_request
1+
on: pull_request_target
22

33
jobs:
44
authorize:

README.md

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ For smaller contributions, follow this workflow:
4646

4747
After review and approval, the changes will be merged into the `main` branch and deployed to the live site.
4848

49-
#### For Developers
49+
### For Developers
5050

51-
##### Local Development
51+
#### Local Development
5252

5353
To set up a local development environment, you need the following installed:
5454

@@ -58,7 +58,7 @@ Run `hugo server` to start a near-production local development instance.
5858

5959
Localization is important! Please include proper localization formatting in your PR. After formatting, run `find_missing_i18n_strings.py` and `setup-pages-for-supported-languages.py`, then commit the changes. If you encounter issues with these scripts, please open an [issue](https://github.com/AlmaLinux/almalinux.org/issues) with details.
6060

61-
##### Container Development
61+
#### Container Development
6262

6363
To use a container-based development environment, install Docker and use an editor supporting the devcontainer standard. Details can be found in the [README](.devcontainer/README.md).
6464

@@ -69,10 +69,89 @@ To use a container-based development environment, install Docker and use an edit
6969
- `/i18n/` — Localization and translation files
7070
- `/static/` — Static files
7171
- `/content/` — Markdown content for site pages
72+
- `/data/` — Source data, currently only for the "Get AlmaLinux" page
7273
- `config.yaml` — Hugo configuration
7374
- `find_missing_i18n_strings.py` — Detects untranslated strings in `i18n/en.json`
7475
- `setup-pages-for-supported-languages.py` — Creates placeholder markdown pages for missing languages
7576

77+
#### Updating 'Get AlmaLinux' page
78+
79+
The "Get AlmaLinux" page is dynamically generated using structured data and Hugo partial templates. This section explains how the data flows, which files are involved, and how to update the page for new releases or changes.
80+
81+
**How it works:**
82+
83+
- **Data sources:**
84+
- `data/get_almalinux_spec.yaml`: Defines available AlmaLinux versions, supported architectures, and the configuration for
85+
each section (e.g., ISO, Cloud, Container).
86+
- `data/get_almalinux_checksums.yaml`: Contains, for each version, the current highest point release (`fullVersion`) and the
87+
checksums for all artifacts (ISOs and cloud images) per architecture. This file can (and probably will) be generated.
88+
89+
- **Generation script:**
90+
- The script `tools/generate_get_almalinux_checksums.py` reads `data/get_almalinux_spec.yaml`, queries
91+
the CHECKSUM URLs defined for ISO and Cloud images, extracts the checksums and the current minor release
92+
and produces `data/get_almalinux_checksums.yaml`.
93+
- The script `tools/generate_get_almalinux_yaml.py` reads both YAML files, merges their data, and produces `data/get_almalinux.yaml`. This merged file is used by the Hugo partials to render the page.
94+
- `data/get_almalinux.yaml` is **not** tracked in git. It is generated automatically by the GitHub CI workflow during site builds, but you must run the script manually for local development if you change the source YAML files.
95+
96+
- **Templates:**
97+
- Hugo partials in `layouts/partials/get-almalinux/` render the page:
98+
- `tabs.html`: Renders version tabs and architecture dropdowns.
99+
- `tab-content.html`: Generates the content for each tab panel.
100+
- `arch-sections.html`: Generates the page for each version+architecture combination.
101+
- `section-*.html`: Renders each section (ISO, Cloud, Container, etc.) that makes up a full page.
102+
103+
##### Editing for a New Point Release
104+
105+
**In most cases, you only need to update `get_almalinux_checksums.yaml` when a new point release is available.**
106+
107+
1. Run the checksum generation script to update `get_almalinux_checksums.yaml` by looking at the source repos:
108+
```bash
109+
python3 tools/generate_get_almalinux_checksums.py
110+
```
111+
2. Optionally, run the generation script to see your changes locally:
112+
```bash
113+
python3 tools/generate_get_almalinux_yaml.py
114+
```
115+
This updates `data/get_almalinux.yaml` for use by Hugo.
116+
This will be done automatically by the Gitlab CI scripts during deployment.
117+
3. Commit the resulting changes to `data/get_almalinux_checksums.yaml` and open a PR.
118+
119+
##### Editing Sections, Architectures, or URL Patterns
120+
121+
If you need to change which sections or architectures are shown, or adjust how URLs are generated, edit `data/get_almalinux_spec.yaml`:
122+
123+
- The YAML file contains a `common` block, which sets default configuration for each section. These defaults are merged with per-version overrides in the `versions` array.
124+
- Each version entry includes:
125+
- `id`: The major version (e.g., `10`, `10-kitten`).
126+
- `label`: The tab title.
127+
- `arches`: List of supported architectures (becomes dropdowns in the page).
128+
- `sections`: List of sections to configure for that version.
129+
- Each section (such as `iso` or `cloud`) can inherit from `common` but may be overridden per version or architecture.
130+
- A section may have its own `arches` array to restrict it to certain architectures. For example, if cloud images for AlmaLinux 10 on `ppc64le` are not supported, the `cloud` section's `arches` array should exclude `ppc64le`.
131+
- To remove a section entirely for a version, omit it from the version's `sections` list.
132+
- To remove a specific cloud image within the `cloud` section, define it with no content (see the `oci` section in 10-kitten as an example).
133+
134+
##### URL Patterns and Variables
135+
136+
Most sections define URL templates for artifacts, using variables such as:
137+
138+
- `major`: The major version, from `id` (e.g., `10`, `10-kitten`).
139+
- `full`: The full version, from `fullVersion` in `get_almalinux_checksums.yaml` (e.g., `10.1`). If `fullVersion` is not set, it falls back to `id`.
140+
- `arch`: The architecture (e.g., `x86_64`, `x86_64_v2`).
141+
142+
Some URLs may allow other variables (like `variant`), or require different patterns per architecture (e.g., `vagrant`'s `registryUrls`). For advanced options, consult the code in `tools/generate_get_almalinux_yaml.py`.
143+
144+
##### Summary of Workflow
145+
146+
1. Edit `get_almalinux_checksums.yaml` for new point releases, or `get_almalinux_spec.yaml` for section/architecture changes.
147+
2. Run the generation script to update the merged YAML:
148+
```bash
149+
python3 tools/generate_get_almalinux_yaml.py
150+
```
151+
3. Start or restart the Hugo server to see your changes locally.
152+
153+
If you have questions about advanced configuration or variable support, refer to the script or open an issue for help.
154+
76155
### Localization and Translation
77156

78157
AlmaLinux.org translations are managed on [Weblate](https://hosted.weblate.org/engage/almalinux/). To contribute, join the [AlmaLinux project](https://hosted.weblate.org/projects/almalinux/) on Weblate. Submissions through Weblate generate automated PRs to this repo, which are reviewed and merged by the Marketing SIG or another team lead.
@@ -83,7 +162,7 @@ To request a new language, open an issue in [GitHub issues](https://github.com/A
83162

84163
[![Translation status](https://hosted.weblate.org/widget/almalinux/website-backend/multi-auto.svg)](https://hosted.weblate.org/engage/almalinux/)
85164

86-
## Change Approval Process
165+
### Change Approval Process
87166

88167
- Minor or cosmetic changes (typos, small style tweaks) can be reviewed and approved by any contributor with merge rights.
89168
- Non-cosmetic changes require approval from the Marketing Lead.

0 commit comments

Comments
 (0)