Also add --regennginxconfig to reset nginx config, and ensure nginx configuration is generated for all targets not only the ones provided in the command line. This avoid the anoying effect of overriding the repositories of previous builds. Signed-off-by: Daniel Hilst Selli <392820+dhilst@users.noreply.github.com>
Testing Workflow for buildrpms.pl
Overview
Requirements:
The following software are assumed to be instaled in the host responsible for building the RPMs and running the tests.
- mock for building the RPMs
- nginx for serving RPM repositories
- podman
- This was tested on a RHEL9.7 host.
Note: Before start, ensure nginx is listening 8080. (the script will not do that for you, you need to change the nginx.conf and restart it), more on this below
Workflow:
buildrpms.pl is the entry point for generating all xCAT RPMs required for a specific mock target (for example rhel+epel-9-x86_64, rhel+epel-10-x86_64). Use mock --list-chroots to see all possible postions. But note that only rhle+epel-{8,9,10} are being tested now. Each target corresponds to a mock chroot and eventually to a container image used by the test harness. The high-level flow is:
- Prepare the dependency repositories (
../xcat-dep) for the target (more on this below) - Run
buildrpms.plto build or reuse RPMs for the target and export a repository. - Provision the testing container for the same target.
- Execute the automated test suite inside the container.
All scripts are idempotent. They only rebuild or reinstall what is missing. Pass --force to any step when you want to overwrite existing content.
xCAT Runtime Dependencies (../xcat-dep)
- The dependency repositories must live one directory above this repo, in
../xcat-dep. - We keep a tarball that already includes the EL 8, EL 9 and EL 10 dependency RPMs. Extract the tarball so that the directory tree looks like
../xcat-dep/<el version>/<arch>/. - Dependencies are only required to run xCAT. Building does not require xcat-dep.
The expected structure is like this
xcat-dep/
├── el10
│ └── x86_64
│ └── repodata
| └── *.rpm
├── el9
│ └── x86_64
│ └── repodata
| └── *.rpm
└── el8
└── x86_64
└── repodata
└── *.rpm
Building RPMs for a Target
./buildrpms.pl --target <target> [--force]
- The script invokes mock for the requested target to build all RPMs listed for that target. The target name maps to the chroot definition under
/etc/mock/. - Before building
X.rpm, the script checks whether the file already exists and skips it; use--forceto rebuild the RPM even if the file is present this is important if the source code changed since the last build!. - When the build finishes, the script collects the RPMs, runs
createrepoand writes an nginx configuration snippet so the repo can be served.
You can build a single package by specifying in the command line for example
./buildrpms.pl --target rhel+epel-9-x86_64 --package perl-xCAT --force
All builds run in parallel, use --nproc N to control the number of jobs. Also note that this will use a lot of disk space, at last 50G is required since the last run. The directories that grow are /var/lib/mock and /var/cache/mock.
nginx on Port 8080
buildrpms.plassumes nginx exposes the generated repository on port 8080. Manually update the main nginx configuration (for example/etc/nginx/nginx.conf) so that it listens on8080port. The scripts will create a/etc/nginx/conf.d/xcat-repos.conffile with all the repositories configured and restart nginx at each run.
Preparing the Test Container
test/scripts/setuptesthost.pl --setupcontainer --target <target> [--force]
- This builds a container image and creates a container named
xcattest-elX(X is 8, 9 or 10 depending on the target). - The container setup is idempotent: it checks for an existing container/image and skips recreation unless you provide
--force. - The EL
RELEASEVER(8, 9 or 10) is deduced from the target which is expected to be a triple in the format<DISTRO>-<RELEASEVER>-<ARCH>and it is used to as--build-arg RELEASEVER=<RELEASEVER>during the container image building.
Running the Automated Tests
Once the container exists and nginx is serving the repo:
podman exec -it xcattest-el10 scripts/testxcat.pl --all
- Replace
xcattest-el10with the appropriate container name. The script configures the repository inside the container, installs xCAT, ensuresxcatdis running, and finally runslsdefto verify daemon connectivity. - You can safely rerun the command; it will reuse the container state unless
--forceis supplied to the helper scripts. - In this case you call combine
--forcewith--reinstallxcatto make it remove xCAT completely and reinstalling again.
End-to-End Checklist
- Dependencies extracted to
../xcat-depfor all EL versions you plan to build. buildrpms.plcompletes successfully for the target and produces a repository.- nginx listens on port 8080 and serves the generated repository.
test/scripts/setuptesthost.pl --setupcontainer --target <target>creates or updates thexcattest-elXcontainer.podman exec -it xcattest-elX scripts/testxcat.pl --allruns to completion and verifies the xCAT stack inside the container.