Skip to content

release.sh: build RHEL 7/8/9/10 RPMs into static nginx layout#374

Open
hecko wants to merge 6 commits into
masterfrom
claude/rhel-rpm-distribution-ZQagX
Open

release.sh: build RHEL 7/8/9/10 RPMs into static nginx layout#374
hecko wants to merge 6 commits into
masterfrom
claude/rhel-rpm-distribution-ZQagX

Conversation

@hecko
Copy link
Copy Markdown
Contributor

@hecko hecko commented Apr 17, 2026

Summary

Adds a standalone release.sh at the repo root that builds the existing Dockerfile-rhel{7,8,9,10} images, extracts /root/rpmbuild/{RPMS,SRPMS} from each, and arranges the artifacts in a directory layout that nginx can serve directly as static files.

Run from a checked-out repo (e.g. /var/www/html/sems/sems-sources) and it writes to ../rhel:

../rhel/
  7/x86_64/*.rpm
  7/SRPMS/*.src.rpm
  8/x86_64/*.rpm
  8/SRPMS/*.src.rpm
  9/...
  10/...

If createrepo_c is installed locally, per-EL repodata/ is generated so the tree doubles as a working yum repo; if not, it stays a plain RPM drop. No signing, no external hosting, no publish step.

Design notes

  • Single source of truth is still pkg/rpm/sems.spec + the existing Dockerfiles — the script only orchestrates and extracts.
  • docker cp from a created (not run) container, so no build-time side effects leak in.
  • Per-EL output directory is wiped before each run; sibling EL dirs are left alone so partial rebuilds (EL_VERSIONS=9 ./release.sh) are safe.
  • Auto-detects docker or podman; overridable via CONTAINER_ENGINE.
  • OUT_DIR and EL_VERSIONS are env-overridable for non-default layouts.

Test plan

  • cd into a fresh checkout and run ./release.sh — verify ../rhel/{7,8,9,10}/x86_64/*.rpm appear.
  • EL_VERSIONS=9 ./release.sh rebuilds only el9, leaves other EL dirs intact.
  • With createrepo_c installed, confirm ../rhel/9/x86_64/repodata/repomd.xml is generated and dnf install --repofrompath=test,http://<host>/rhel/9/x86_64 sems works.
  • Without createrepo_c, script still succeeds and emits the "skipping repodata" note.
  • CONTAINER_ENGINE=podman ./release.sh works on a podman-only host.

https://claude.ai/code/session_01YJFpz5oXRDnM75V8BP1B41

Copilot AI review requested due to automatic review settings April 17, 2026 11:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a repo-root release.sh that orchestrates building existing RHEL 7/8/9/10 container images, extracts RPM/SRPM artifacts from /root/rpmbuild/{RPMS,SRPMS}, and writes them into a static nginx-friendly directory layout (optionally generating repodata/ via createrepo_c).

Changes:

  • Introduces release.sh to build Dockerfile-rhel{7,8,9,10} images and extract RPM/SRPM outputs into ../rhel/<el>/{x86_64,SRPMS}.
  • Supports EL_VERSIONS, OUT_DIR, and CONTAINER_ENGINE overrides, with auto-detection of docker vs podman.
  • Optionally runs createrepo_c to generate yum/dnf metadata for each output directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread release.sh
Comment on lines +75 to +77
EL_VERSIONS="${EL_VERSIONS:-7 8 9 10}"

ENGINE="${CONTAINER_ENGINE:-}"
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any command after creating the container fails (e.g., cp/find), set -e will exit the script and leave the created container behind. Consider adding a trap in build_one_el to always rm -f the container id (and clean up the temp dir) on both success and failure.

Copilot uses AI. Check for mistakes.
Comment thread release.sh
Comment on lines +71 to +73
fi

VERSION="$(cat "$SRC_DIR/VERSION")"
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rm -rf "$dest" is potentially destructive if OUT_DIR is mis-set (e.g., empty or /). Add a safety guard before removal (e.g., reject empty///relative OUT_DIR, and/or ensure dest is under OUT_DIR and not the filesystem root) so an env typo can’t wipe unexpected paths.

Copilot uses AI. Check for mistakes.
Comment thread release.sh Outdated
Comment on lines +69 to +70
echo "error: checkout at $REF does not look like a sems tree" >&2
exit 1
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each run rebuilds and tags an image (sems-release-el<el>:<version>) but never removes it; over time this can accumulate dangling layers/images and consume significant disk. Consider adding an optional cleanup step (e.g., env flag to image rm the tag after artifacts are extracted) or at least emitting a note about pruning.

Copilot uses AI. Check for mistakes.
claude added 3 commits April 20, 2026 08:17
Adds a self-contained script that builds the existing Dockerfile-rhel<N>
images, extracts /root/rpmbuild/{RPMS,SRPMS} from each, and arranges the
artifacts under ../rhel/<el>/{x86_64,SRPMS}/ so the directory can be served
directly by nginx. Runs createrepo_c locally when available; otherwise leaves
a plain RPM drop. No signing, no external hosting, no yum repo publishing.
The script now takes the git tag/branch/SHA to build as its first argument
and stages the build in a git worktree instead of the caller's working tree.
This keeps uncommitted local changes out of the release and lets operators
run the script from a long-lived checkout without stashing.
…m list

Each <OUT_DIR>/<el>/ now contains a README.txt recording when the release was
produced, the git ref/SHA it was built from, the SEMS version, and the full
output of `rpm -qa` inside the build container. That captures the toolchain
and dependency versions responsible for the binaries so releases are
traceable without re-running the build.
@hecko hecko force-pushed the claude/rhel-rpm-distribution-ZQagX branch from 44be549 to 287f806 Compare April 20, 2026 06:18
claude added 3 commits April 20, 2026 06:23
The script now takes no arguments and builds directly from the current
checkout, matching the simpler "check out what you want, then run release.sh"
workflow. Git metadata (describe, SHA, dirty flag) is still captured in the
per-EL README when the source is a git clone, but is no longer required.
…sting

Lets several SEMS versions share the same nginx tree (e.g. rhel/9/2.1.0/x86_64
alongside rhel/9/2.2.0/x86_64). Each rebuild only wipes its own (el, version)
subtree, so older releases are preserved until explicitly removed.
The release.sh script (and existing build_test.yml CI) feeds the working tree
to docker as the build context. A local cmake out-of-source build directory
or the .git history can each be hundreds of megabytes, all of which docker
otherwise streams to the daemon and embeds in image layers via COPY.
Excluding both keeps releases reproducible and faster.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants