-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Framework for building RPMs in the CI #2961
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webbnh
added
Agent
Server
Code Infrastructure
packaging
Issues related to software packaging
Containerization
Of and relating to the process of setting up and maintaining container images
labels
Aug 4, 2022
dbutenhof
previously approved these changes
Aug 5, 2022
dbutenhof
previously approved these changes
Aug 5, 2022
dbutenhof
previously approved these changes
Aug 8, 2022
ndokos
previously approved these changes
Aug 10, 2022
Needs a rebase now that #2960 is merged. |
Rebased. |
dbutenhof
approved these changes
Aug 10, 2022
portante
approved these changes
Aug 10, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's file a PR to avoid the auto-increment on the sequence number across RPMs.
PBENCH-872 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Agent
Code Infrastructure
Containerization
Of and relating to the process of setting up and maintaining container images
packaging
Issues related to software packaging
Server
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the various bits of mechanism and tweaks required to build RPMs in containers. (The next step will be to enhance the CI to use the facilities added here -- this doesn't actually hook them up.)
There are several pieces to these changes, but most are small enough and localized enough that it wasn't worth splitting them into separate commits or PRs.
Here are the highlights of the changes:
agent/Makefile
: For no reason which is obvious to me, while the RHEL-9 builds worked fine, the RHEL-8 and RHEL-7 Agent builds failed with a complaint during the SRPM build where we "install" the Python components, because the target location was not a site path nor was it inPYTHONPATH
. (Apparently, this doesn't happen when building on or for COPR, but perhaps that's because no one is doing that on RHEL-7/8?) Given that in this context we don't intend to execute the stuff we're installing, this wouldn't be a problem, but the tools object nonetheless. I tried several things to address the problem and ended up simply adding the installation target to thePYTHONPATH
(which is empty, otherwise) for the duration of the installation, and that seemed to mollify the tools. Unfortunately, I kind of had to guess where the installation would land, but it's an educated guess, and it seems to work. (Also, I removed the unneeded parentheses -- Make executes each line of a recipe in its own subshell anyway -- and I replaced the;
there with a&&
which I think better represents our requirements.)agent/rpm/pbench-agent.spec.j2
: Again, for no reason which is obvious to me, while the RHEL-9 builds worked fine, the RHEL-8 and RHEL-7 Agent builds failed during the RPM build where it byte-compiles all the Python code, because it decided to run Python 2.6 instead of the Python3, because it had to guess. (Again, apparently, this doesn't happen when building on COPR; I don't know why.) The fix is to add a definition to the spec file for__python
(we already have one for__python3
...) to specify that, when we use Python, we want Python 3.server/rpm/Makefile
andagent/rpm/Makefile
:ci
target, for building binary RPM(s) for our favorite distro versions.make
invocation. If you're building a single target, there is virtually no difference (I hope!) from the old behavior. However, because the CI wants to build eight logically-independent targets, with this approach it can specify the--jobs
flag on the outermake
command and all of the RPMs will be built in parallel automagically.utils/rpm.mk
: This is the real meat of this PR.%-rpm
target, which invokes themake
command recursively inside the appropriate specific container to build the genericrpm
target. This means that any distribution/version whose tag matches an image label in the container repository can be built, and adding new distro/version can be done without having to modify the makefile simply by pushing new container images.rpmbuild
is fairly opinionated about where it gets build inputs from and where it sends its outputs to. This can be controlled by setting the_topdir
macro, but it turned out to be awkward to get too fancy with that. So, instead, I set up the container invocation to mount the output directory whererpmbuild
expects it. Nevertheless, because I wanted to be able to run multiple RPM builds (sequentially at least, and concurrently at best) without them interfering with each other or overwriting each other, it was necessary to make the input/output directory tree distro/version-specific, so I ended up explicitly specifying_topdir
anyway. The net result is thatrpmbuild
uses${HOME}/rpmbuild${DIST_SUFFIX}
, where the suffix is empty for normal builds and it's set to something like-rhel-9
for distro/version builds; thus, the makefile still behaves as it used to if you're doing a "local" build, and otherwise all of the products are maintained separately for each distro/version.g
(if we think this is a problem, and I craft a fix for it in another PR):~/rpmbuild/RPMS/noarch/pbench-agent-0.72.0-77ge34d2b480.noarch.rpm
~/rpmbuild-centos-8/RPMS/noarch/pbench-agent-0.72.0-70ge34d2b480.noarch.rpm
~/rpmbuild-centos-9/RPMS/noarch/pbench-agent-0.72.0-69ge34d2b480.noarch.rpm
~/rpmbuild-fedora-34/RPMS/noarch/pbench-agent-0.72.0-74ge34d2b480.noarch.rpm
~/rpmbuild-fedora-35/RPMS/noarch/pbench-agent-0.72.0-69ge34d2b480.noarch.rpm
~/rpmbuild-fedora-36/RPMS/noarch/pbench-agent-0.72.0-75ge34d2b480.noarch.rpm
~/rpmbuild-rhel-7/RPMS/noarch/pbench-agent-0.72.0-72ge34d2b4.noarch.rpm
~/rpmbuild-rhel-8/RPMS/noarch/pbench-agent-0.72.0-71ge34d2b480.noarch.rpm
~/rpmbuild-rhel-9/RPMS/noarch/pbench-agent-0.72.0-73ge34d2b480.noarch.rpm
VERSION
because it unaccountably (and silently) failed on the older versions of RHEL (perhaps because they have an older version of Git?). Likewise, thegit submodule
command got pissy on the older versions, but that was straightforward to work around, as well.PBENCH-720