Compare commits
8 Commits
bcbb855dd8
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5df1894803 | |||
| ee81dd9e51 | |||
| bbbb4a4bbc | |||
| 06488b8d18 | |||
| 9416722b9a | |||
| 105487c090 | |||
| 0e211893db | |||
| 4fda9c535c |
@@ -1,81 +0,0 @@
|
||||
when:
|
||||
- event: tag
|
||||
ref: refs/tags/node-image-*
|
||||
|
||||
# Builds the AlmaLinux 9 node rootfs with dnf --installroot, tars it as
|
||||
# almalinux9-node-<ver>.tar.zst and PUTs it to the artifactapi rootfs-images
|
||||
# local (generic) repo, where the almalinux9-image catalog entry's liveimg
|
||||
# points. Tag as node-image-<ver> (e.g. node-image-20260729); the tarball
|
||||
# version is that suffix. Baked here = everything the image %post assumes is
|
||||
# already installed (kernel/grub/dracut, NetworkManager, openssh, chrony,
|
||||
# kexec-tools, curl, puppet-agent, ...). Per-host config stays in image.ks.tmpl.
|
||||
steps:
|
||||
- name: build-rootfs
|
||||
image: git.unkin.net/unkin/almalinux9-base:20260606
|
||||
commands:
|
||||
- dnf -y install tar zstd dnf-plugins-core
|
||||
- VER="${CI_COMMIT_TAG#node-image-}"
|
||||
- ROOT="$${CI_WORKSPACE}/rootfs"
|
||||
- mkdir -p "$$ROOT"
|
||||
# Base system + boot chain (BIOS + UEFI), storage, networking, node tools.
|
||||
- |
|
||||
dnf -y --installroot="$$ROOT" --releasever=9 --setopt=install_weak_deps=False install \
|
||||
@core kernel \
|
||||
grub2-pc grub2-efi-x64 shim-x64 grub2-tools grub2-tools-efi efibootmgr \
|
||||
dracut dracut-config-generic \
|
||||
lvm2 xfsprogs e2fsprogs dosfstools \
|
||||
NetworkManager selinux-policy-targeted policycoreutils \
|
||||
openssh-server chrony kexec-tools bind-utils vim-minimal tmux git curl \
|
||||
glibc-langpack-en
|
||||
# Puppet agent baked in; image.ks.tmpl %post only configures it.
|
||||
- dnf -y --installroot="$$ROOT" install https://yum.puppet.com/puppet8-release-el-9.noarch.rpm
|
||||
- dnf -y --installroot="$$ROOT" install puppet-agent
|
||||
- dnf -y --installroot="$$ROOT" clean all
|
||||
- rm -rf "$$ROOT"/var/cache/dnf/* "$$ROOT"/var/log/dnf* "$$ROOT"/etc/machine-id
|
||||
# Reproducible, ownership/xattr/SELinux-preserving tarball.
|
||||
- tar --numeric-owner --acls --xattrs --selinux -C "$$ROOT" -caf "almalinux9-node-$${VER}.tar.zst" .
|
||||
- ls -lh "almalinux9-node-$${VER}.tar.zst"
|
||||
backend_options:
|
||||
kubernetes:
|
||||
serviceAccountName: default
|
||||
resources:
|
||||
requests:
|
||||
memory: 2Gi
|
||||
cpu: 2
|
||||
ephemeral-storage: 8Gi
|
||||
limits:
|
||||
memory: 4Gi
|
||||
cpu: 4
|
||||
ephemeral-storage: 16Gi
|
||||
|
||||
- name: upload
|
||||
image: git.unkin.net/unkin/almalinux9-base:20260606
|
||||
commands:
|
||||
- VER="${CI_COMMIT_TAG#node-image-}"
|
||||
- |
|
||||
HOST="https://artifactapi.k8s.syd1.au.unkin.net"
|
||||
REPO="rootfs-images"
|
||||
FILE="almalinux9-node-$${VER}.tar.zst"
|
||||
# Local generic repo: PUT stores the raw file; overwrites 409-reject, so
|
||||
# skip if this version already exists (probe the GET path).
|
||||
code=$$(curl -s -o /dev/null -w '%{http_code}' "$$HOST/api/v2/remotes/$$REPO/files/$$FILE" || true)
|
||||
if [ "$$code" = "200" ]; then
|
||||
echo "$$FILE already exists (HTTP $$code); skipping upload"
|
||||
exit 0
|
||||
fi
|
||||
curl -f -X PUT "$$HOST/api/v2/remotes/$$REPO/files/$$FILE" \
|
||||
-H "Content-Type: application/zstd" \
|
||||
--data-binary @"$$FILE"
|
||||
depends_on: [build-rootfs]
|
||||
backend_options:
|
||||
kubernetes:
|
||||
serviceAccountName: default
|
||||
resources:
|
||||
requests:
|
||||
memory: 512Mi
|
||||
cpu: 500m
|
||||
ephemeral-storage: 8Gi
|
||||
limits:
|
||||
memory: 1Gi
|
||||
cpu: 1
|
||||
ephemeral-storage: 16Gi
|
||||
+14
-11
@@ -29,11 +29,11 @@ YAML + template change here — **no bootapi code change**.
|
||||
`almalinux/<ver>/BaseOS/<arch>/os/`. Generic / VM default (autopart on `sda`).
|
||||
- **fedora** — artifactapi `fedora` remote, tree
|
||||
`fedora/releases/<ver>/Everything/<arch>/os/`.
|
||||
- **optiplex-3050 / optiplex-3060 / optiplex-7080** — AlmaLinux 9 on the Dell
|
||||
OptiPlex fleet. Same install tree and `almalinux9` kickstart template, but
|
||||
each passes a `storage_mode` (and, for the 7080, `vg_grow`) var so the one
|
||||
template lays disks out per model. Ported from the Cobbler profiles
|
||||
`almalinux9-dell_3050 / _3060 / _7080`. See "Per-model variants" below.
|
||||
- **optiplex-3050 / optiplex-3060 / optiplex-3070 / optiplex-7080** — AlmaLinux 9
|
||||
on the Dell OptiPlex fleet. Same install tree and `almalinux9` kickstart
|
||||
template, but each passes a `storage_mode` (and, for the 7080, `vg_grow`) var
|
||||
so the one template lays disks out per model. Ported from the Cobbler profiles
|
||||
`almalinux9-dell_3050 / _3060 / _3070 / _7080`. See "Per-model variants" below.
|
||||
|
||||
## Per-model variants (Dell OptiPlex)
|
||||
|
||||
@@ -45,6 +45,7 @@ model-specific `storage_mode` var:
|
||||
|-------|----------------|----------------|----------|--------|
|
||||
| `optiplex-3050` | `fixed-nvme` | static `nvme0n1` | legacy BIOS/MBR | fixed ~31G |
|
||||
| `optiplex-3060` | `auto-nvme` | `%pre` picks first NVMe <512G | UEFI-aware (EFI part if booted UEFI) | fixed ~31G |
|
||||
| `optiplex-3070` | `auto-nvme` | `%pre` picks first NVMe <512G | UEFI-aware | fixed ~31G |
|
||||
| `optiplex-7080` | `auto-nvme` + `vg_grow: "true"` | `%pre` picks first NVMe <512G | UEFI-aware | grows to fill disk |
|
||||
|
||||
The kickstart (`kickstart/almalinux9.ks.tmpl`) reads `.DistroVars.storage_mode`
|
||||
@@ -54,7 +55,7 @@ autopart-on-`sda` path.
|
||||
|
||||
**Model selection (NetBox-driven, no code change):** the entry `name` is the
|
||||
OptiPlex **device_type slug**. Set the device's `provision_template` custom
|
||||
field to that slug (`optiplex-3050` / `-3060` / `-7080`) and bootapi's catalog
|
||||
field to that slug (`optiplex-3050` / `-3060` / `-3070` / `-7080`) and bootapi's catalog
|
||||
`Select` picks the matching entry (override precedence beats platform/family).
|
||||
The `match.platforms` slug on each entry is the device_type slug too — not a
|
||||
real NetBox platform slug — so these entries are *only* reachable via the
|
||||
@@ -86,11 +87,13 @@ vars:
|
||||
- **Networking is templated per-host in `%post`** (NetworkManager keyfiles from
|
||||
the same NetBox interface data), because the generic image has no per-host
|
||||
identity and the `liveimg` unpack overwrites `/etc`.
|
||||
- The tarball is built by `.woodpecker/build-image.yaml` (tag `node-image-<ver>`)
|
||||
and uploaded to the artifactapi `rootfs-images` local repo. Baked into the
|
||||
image = everything the `%post` assumes present (kernel/grub/dracut,
|
||||
NetworkManager, openssh, chrony, kexec-tools, curl, puppet-agent). Bump an
|
||||
image = new tag + one-line `rootfs_tarball` edit here.
|
||||
- The tarball is built by the separate
|
||||
[bootapi-images](https://git.unkin.net/unkin/bootapi-images) repo (a `v*` tag
|
||||
builds and uploads `almalinux9-node-<ver>.tar.zst` to the artifactapi
|
||||
`rootfs-images` local repo). Baked into the image = everything the `%post`
|
||||
assumes present (kernel/grub/dracut, NetworkManager, openssh, chrony,
|
||||
kexec-tools, curl, puppet-agent). Bump an image = new bootapi-images release +
|
||||
a one-line `rootfs_tarball` edit here.
|
||||
|
||||
## Adding another distro (the intended path)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ kernel_args:
|
||||
- inst.text
|
||||
- net.ifnames=0
|
||||
vars:
|
||||
# Prebuilt node rootfs on the artifactapi rootfs-images local repo, built by
|
||||
# .woodpecker/build-image.yaml. Immutable, date-versioned; bump this one line
|
||||
# to roll the fleet forward (overwrites are 409-rejected).
|
||||
rootfs_tarball: "https://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/rootfs-images/files/almalinux9-node-20260729.tar.zst"
|
||||
# Prebuilt node rootfs on the artifactapi rootfs-images local repo, built and
|
||||
# published by the bootapi-images repo (v* tag). Immutable, semver-versioned;
|
||||
# bump this one line to roll the fleet forward (overwrites are 409-rejected).
|
||||
rootfs_tarball: "https://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/rootfs-images/files/almalinux9-node-1.0.0.tar.zst"
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Distro catalog entry: AlmaLinux 9 on the Dell OptiPlex 3070.
|
||||
#
|
||||
# Ported for the six prodnxsr0014-0019 bare-metal hosts registered on the legacy
|
||||
# Cobbler server under profile almalinux9-dell_3070. Mirrors optiplex-3060: a
|
||||
# %pre script auto-selects the internal NVMe (first under 512G), is UEFI-aware,
|
||||
# sets bootloader --boot-drive, and uses a fixed ~31G LVM (no grow). The Cobbler
|
||||
# almalinux9_dell3070 kickstart template currently fails to render on cobbler,
|
||||
# so the closest working per-model profile (3060, same UEFI/auto-NVMe layout,
|
||||
# fixed LVM) was used as the source of truth. Select it by setting the device's
|
||||
# `provision_template` custom field to "optiplex-3070" (the device_type slug).
|
||||
name: optiplex-3070
|
||||
match:
|
||||
platforms: [optiplex-3070]
|
||||
kickstart: almalinux9
|
||||
version_default: "9"
|
||||
kernel_url: "{{.ArtifactBase}}/almalinux/{{.Version}}/BaseOS/{{.Arch}}/os/images/pxeboot/vmlinuz"
|
||||
initrd_url: "{{.ArtifactBase}}/almalinux/{{.Version}}/BaseOS/{{.Arch}}/os/images/pxeboot/initrd.img"
|
||||
kernel_args:
|
||||
- inst.text
|
||||
- net.ifnames=0
|
||||
vars:
|
||||
mirror: "{{.ArtifactBase}}/almalinux/{{.Version}}"
|
||||
storage_mode: auto-nvme
|
||||
@@ -16,6 +16,6 @@ kernel_args:
|
||||
- inst.text
|
||||
- net.ifnames=0
|
||||
vars:
|
||||
rootfs_tarball: "https://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/rootfs-images/files/almalinux9-node-20260729.tar.zst"
|
||||
rootfs_tarball: "https://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/rootfs-images/files/almalinux9-node-1.0.0.tar.zst"
|
||||
storage_mode: auto-nvme
|
||||
vg_grow: "true"
|
||||
|
||||
+4
-2
@@ -6,12 +6,14 @@ it. Mirrors how Cobbler generated a per-MAC gPXE script carrying inst.ks=.
|
||||
|
||||
KernelURL/InitrdURL/RepoURL come from the selected catalog entry (artifactapi
|
||||
remote); KernelArgs are the catalog's extra args. KickstartURL uses
|
||||
BOOTAPI_BASE_URL (http://).
|
||||
BOOTAPI_BASE_URL (http://). inst.ks.sendmac makes anaconda send its interface
|
||||
MACs as X-RHN-Provisioning-MAC-N headers when fetching the kickstart (Cobbler
|
||||
parity; lets /ks resolve a host by MAC as well as by name).
|
||||
*/ -}}
|
||||
#!ipxe
|
||||
echo bootapi: provisioning {{ .FQDN }} ({{ .Platform }})
|
||||
{{ if and .KernelURL .InitrdURL -}}
|
||||
kernel {{ .KernelURL }} initrd=initrd.img{{ if .RepoURL }} inst.repo={{ .RepoURL }}{{ end }} inst.ks={{ .KickstartURL }} ip=dhcp{{ range .KernelArgs }} {{ . }}{{ end }}
|
||||
kernel {{ .KernelURL }} initrd=initrd.img{{ if .RepoURL }} inst.repo={{ .RepoURL }}{{ end }} inst.ks.sendmac inst.ks={{ .KickstartURL }} ip=dhcp{{ range .KernelArgs }} {{ . }}{{ end }}
|
||||
initrd {{ .InitrdURL }}
|
||||
boot
|
||||
{{- else -}}
|
||||
|
||||
Reference in New Issue
Block a user