Skip to content
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

[master] RHEL PoC #991

Merged
merged 3 commits into from
Aug 19, 2024
Merged

[master] RHEL PoC #991

merged 3 commits into from
Aug 19, 2024

Conversation

neersighted
Copy link
Member

This is a PoC for building RHEL packages assuming that a RHEL username/password is available in the environment.

This is mostly intended for internal use by Docker, as it is assumed that the main utility is performing builds with a 'real RHEL' for enterprise customers.

However, when a unencumbered RHEL-equivalent distribution (e.g. Rocky) is supported, it will make sense to generalize the 'rhel' infrastructure in this repo.

@@ -1,30 +0,0 @@
# syntax=docker/dockerfile:1
Copy link
Member

Choose a reason for hiding this comment

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

This one may be in use by IBM?

Comment on lines 14 to 15
RUN subscription-manager register --username=$RH_USER --password=$RH_PASS
RUN subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
Copy link
Member

Choose a reason for hiding this comment

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

Didn't this produce a subscription-file, so something we could run in CI, and --mount ? Passing these as argument means they leak into the image produced (and build-cache).

Copy link
Member Author

Choose a reason for hiding this comment

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

This is somewhat intentional for now; the cleanup step is "manual" (read: a cron job elsewhere) as a stopgap while I work on lifecycle robustness. That being said, I hadn't considered build cache issues since we don't actually clean the cache on the Jenkins nodes, as best I can tell...

Given that, maybe it would be better to use fixed certificates; this is somewhat messier (mostly for containerd-packaging) and introduces the manual update process/point of failure, but I can mock it up as an alternative (and it does obviate the runtime lifecycle issues).

ARG RH_USER
ARG RH_PASS
RUN rm /etc/rhsm-host
RUN subscription-manager register --username=$RH_USER --password=$RH_PASS
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use RUN --mount=type=secret to avoid leaking the password in the image history (although the image is never pushed to public)

@vvoland
Copy link
Contributor

vvoland commented May 8, 2024

Rebased

@thaJeztah
Copy link
Member

rebased

@thaJeztah
Copy link
Member

Rebased

@thaJeztah thaJeztah force-pushed the rhel-poc branch 2 times, most recently from 59a5b59 to 97ab93b Compare June 20, 2024 11:03
@thaJeztah
Copy link
Member

rebased after #1030 was merged /cc @vvoland

@vvoland
Copy link
Contributor

vvoland commented Jun 21, 2024

Rebased after #1031

@vvoland
Copy link
Contributor

vvoland commented Jun 24, 2024

Rebased after #1032

@vvoland
Copy link
Contributor

vvoland commented Jul 3, 2024

Rebased after #1034

@vvoland
Copy link
Contributor

vvoland commented Jul 17, 2024

Rebased after #1038

@thaJeztah
Copy link
Member

Rebased after #1039

@thaJeztah
Copy link
Member

rebased after #1041

@thaJeztah
Copy link
Member

rebased after #1042

@thaJeztah
Copy link
Member

rebased after #1043

@vvoland
Copy link
Contributor

vvoland commented Aug 9, 2024

Rebased after #1044

Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland
Copy link
Contributor

vvoland commented Aug 16, 2024

Rebased after #1050

@vvoland vvoland mentioned this pull request Aug 16, 2024
Taking a similar approach as is used for containerd-packaging.
Note that the resulting subscription file will still be persisted
in the image, but this image is only used as an ephemeral image,
and on our builder-nodes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Member

@vvoland I pushed a commit to change the --build-arg to use a build-secret instead; Taking a similar approach as is used for containerd-packaging; also ran a test-build in the release-packaging pipeline, and it looks to be happy.

@thaJeztah
Copy link
Member

If the change LGTY, I can squash the last two commits

Copy link
Contributor

@vvoland vvoland left a comment

Choose a reason for hiding this comment

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

LGTM; also fine to leave the commits separate IMO

--username="$(cat /run/secrets/rh-user)" \
--password="$(cat /run/secrets/rh-pass)"

subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
Copy link
Member

Choose a reason for hiding this comment

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

FWIW; still looking at the $(arch) bit here; is this expanding using a RPM arg or is this a bug, just “happened to work”?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's just shelling out to arch. Looks intentional to me, but maybe not?

Copy link
Member

Choose a reason for hiding this comment

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

DOH! Of course; was with my head in env-vars and build-args, and I was thinking it was depending on some env-var or RPM macro/var 🙈

@thaJeztah
Copy link
Member

also fine to leave the commits separate IMO

Yeah, perhaps keeping the commit separate is still fine.

@thaJeztah thaJeztah marked this pull request as ready for review August 19, 2024 16:45
@thaJeztah
Copy link
Member

Let me bring this one in 👍

@thaJeztah thaJeztah merged commit 65032d1 into docker:master Aug 19, 2024
7 checks passed
@thaJeztah thaJeztah changed the title RHEL PoC [master] RHEL PoC Aug 19, 2024
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.

4 participants