-
Notifications
You must be signed in to change notification settings - Fork 216
USHIFT-978 Building RPMs in container #1515
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
USHIFT-978 Building RPMs in container #1515
Conversation
hack/Containerfile.rpm-builder
Outdated
dnf install \ | ||
--setopt=tsflags=nodocs \ | ||
--setopt=install_weak_deps=False \ | ||
--repo=rhel-8-for-x86_64-baseos-rpms \ |
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.
We're supporting RHEL 9 now in the main branch. Can we use RHEL9 containers / dependencies?
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.
This is because we use registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.19-openshift-4.13
.
I see that rhel-9-release-golang-1.19-openshift-4.13
exists but it fails due to some certificates for rhel-9-for-x86_64-baseos-rpms
repo.
Also, we're still using rhel-8-release-golang-1.19-openshift-4.13
in the CI jobs
Makefile
Outdated
podman build -v /etc/pki/entitlement/:/etc/pki/entitlement -t rpm-builder - < ./hack/Containerfile.rpm-builder | ||
.PHONY: rpm-builder | ||
|
||
rpm-in-container: |
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 simplify the process by having one top-level target?
We already have 'make rpm' & 'make srpm' - can we add 'make rpm-podman'?
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.
Good idea, I'll just jam both building the image (if doesn't exist) and and this target into one
A general question: why would we want to build in a container if we have a devenv? Are you thinking to use this for building 4.12 branch on a RHEL9 machine for example? |
We'll be able to use the same image CI uses, i.e. rhel8 (or 9) + go1.19 (which isn't available in the repos yet) and drop the workaround with installing two versions of Go, therefore fixing the microshift.spec to require right Go version (now we "require" 1.18, but it'll fail if 1.19 is not used). I feel like QE's pipeline would benefit from being able to build in a container. From what I've seen recently, they only run |
Should we also add "go" invocation from the container and get rid of the "go" dependency dillema in the devenv all together? I mean, we could remove "go" installation from configure-vm.sh and have container builds executed by default for compilation and RPM creation. |
Maybe, we need to think about this. |
8ccf333
to
6091274
Compare
I may have a different workflow from others on the team. I set up a VM with all of the dependencies and do all of my work in that VM, so I install my editor, the go compiler, gopls, git, etc. I have heard others say they build elsewhere and copy files into the VM, or at least edit elsewhere. |
6091274
to
4788820
Compare
Makefile
Outdated
@@ -214,6 +214,20 @@ image-build-iso: rpm | |||
iso: image-build-configure image-build-iso | |||
.PHONY: iso | |||
|
|||
rpm-podman: | |||
@if [ -z "$(shell podman images -q microshift-rpm-builder)" ]; then \ |
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.
This test is neat. I usually just let podman build
run again and it takes a second to realize there is no change, but this looks quicker.
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.
+1 on letting podman build
figure out if there's a need to (re)build. It comes with a bonus of automatic rebuild when something changes in the Containerfile.
@pmtk , let's pull the Containerfile out of the hack directory. |
Makefile
Outdated
@if [ -z "$(shell podman images -q microshift-rpm-builder)" ]; then \ | ||
podman build \ | ||
-v /etc/pki/entitlement/:/etc/pki/entitlement \ | ||
-t microshift-rpm-builder - < ./hack/Containerfile.rpm-builder ; \ |
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.
Do we want to include a version in the image name, i.e. -t microshift-4.13-rpm-builder-rhel8-go1.19
? I mean, we should be able to easily cross-compile from different branches on the same machine now, but images may be different.
4788820
to
206a83f
Compare
Makefile
Outdated
gawk 'BEGIN { FS=":" } \ | ||
/FROM/ { \ | ||
match($$0, /rhel-([0-9]+).*golang-([0-9]\.[0-9]{2})-openshift-([0-9]+\.[0-9]+)/,m);\ | ||
printf "%s-rhel%s-go%s",m[3],m[1],m[2]; }' packaging/images/Containerfile.rpm-builder) |
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.
Since we're building the container from make, can we simplify this by defining a variable in the Makefile and passiing it to the Containerfile?
Makefile:
GOLANG_CONTAINER=release:rhel-8-release-golang-1.19-openshift-4.13
podman build --env GOLANG_CONTAINER=$GOLANG_CONTAINER ...
Containerfile:
ENV GOLANG_CONTAINER
FROM registry.ci.openshift.org/openshift/$GOLANG_CONTAINER
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.
Following your suggestion, does microshift-builder:rhel-8-release-golang-1.19-openshift-4.13
sound good as an image name:tag
?
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.
I think so, because the CI image name/version is the main identifier for it.
Unless, of course, there's a limitation in docker not allowing to use that name as-is.
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.
Changed, PTAL
206a83f
to
1ec4536
Compare
1ec4536
to
91ac0ea
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ggiguash, pmtk The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@pmtk: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
No description provided.