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

Konflux(ROX-22195): Install RHEL RPMs with subscription manager workaround #1573

Merged
merged 114 commits into from
Feb 29, 2024

Conversation

tommartensen
Copy link
Contributor

@tommartensen tommartensen commented Feb 22, 2024

Description

This PR changes the dependency installations in the Konflux images from using CentOS dependencies to using a UBI image with workaround entitlements to install RHEL RPMs.

Also harmonized the Dockerfiles between -slim and -full based on midstream.

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

Passing Konflux pipeline is sufficient.

tommartensen and others added 30 commits October 16, 2023 10:34
Co-authored-by: red-hat-trusted-app-pipeline <[email protected]>
Co-authored-by: red-hat-trusted-app-pipeline <123456+red-hat-trusted-app-pipeline[bot]@users.noreply.github.com>
Co-authored-by: red-hat-trusted-app-pipeline <123456+red-hat-trusted-app-pipeline[bot]@users.noreply.github.com>
Co-authored-by: red-hat-trusted-app-pipeline <123456+red-hat-trusted-app-pipeline[bot]@users.noreply.github.com>
Co-authored-by: red-hat-trusted-app-pipeline <123456+red-hat-trusted-app-pipeline[bot]@users.noreply.github.com>
Co-authored-by: red-hat-trusted-app-pipeline <123456+red-hat-trusted-app-pipeline[bot]@users.noreply.github.com>
Co-authored-by: red-hat-trusted-app-pipeline <123456+red-hat-trusted-app-pipeline[bot]@users.noreply.github.com>
Co-authored-by: red-hat-trusted-app-pipeline <123456+red-hat-trusted-app-pipeline[bot]@users.noreply.github.com>
wget \
which \
unzip \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the dependency list to https://gitlab.cee.redhat.com/stackrox/rhacs-midstream/-/blob/rhacs-1.0-rhel-8/distgit/containers/rhacs-collector-slim/Dockerfile.in?ref_type=heads. Previously it was the list of upstream dependencies because of the CentOS base image.

@tommartensen tommartensen changed the title wip: Konflux - dnf enablement with scratch final stage Konflux(ROX-22195): Install RHEL RPMs with subscription manager workaround Feb 27, 2024
@tommartensen
Copy link
Contributor Author

This is the diff between slim and full Dockerfiles:

88,125d87
< # 0.1.0 is a floating tag and it's used intentionally to pick up the most recent downstream drivers build without
< # having to routinely and frequently bump tags here.
< FROM brew.registry.redhat.io/rh-osbs/rhacs-drivers-build-rhel8:0.1.0 AS drivers-build
< 
< # TODO(ROX-20312): we can't pin image tag or digest because currently there's no mechanism to auto-update that.
< FROM registry.access.redhat.com/ubi8/ubi-minimal:latest AS unpacker
< 
< RUN microdnf install -y unzip findutils
< WORKDIR /staging
< 
< COPY staging/support-pkg.zip /staging/
< COPY kernel-modules/MODULE_VERSION MODULE_VERSION.txt
< RUN mkdir -p "/staging/kernel-modules/$(cat MODULE_VERSION.txt)"
< 
< # First, unpack upstream support package, only on x86_64
< RUN if [[ "$(uname -m)" == x86_64 ]]; then unzip support-pkg.zip ; fi
< # Fail build if there were no drivers in the support package matching the module version.
< RUN if [[ "$(uname -m)" == x86_64 && "$(ls -A /staging/kernel-modules/$(cat MODULE_VERSION.txt))" == "" ]] ; then \
<       >&2 echo "Did not find any kernel drivers for the module version $(cat MODULE_VERSION.txt) in the support package"; \
<       exit 1; \
<     fi
< 
< # Next, import modules from downstream build, which take priority over upstream, on non-x86 architectures
< COPY --from=drivers-build /kernel-modules /staging/downstream
< RUN if [[ "$(uname -m)" != x86_64 ]]; then \
<       cp -r /staging/downstream/. /staging/kernel-modules/ ; \
<     fi
< 
< # Create destination for drivers.
< RUN mkdir /kernel-modules
< # Move files for the current version to /kernel-modules
< RUN find "/staging/kernel-modules/$(cat MODULE_VERSION.txt)/" -type f -exec mv -t /kernel-modules {} +
< # Fail the build if at the end there were no drivers matching the module version.
< RUN if [[ "$(ls -A /kernel-modules)" == "" ]]; then \
<         >&2 echo "Did not find any kernel drivers for the module version $(cat MODULE_VERSION.txt)."; \
<         exit 1; \
<     fi
< 
159c121
<     com.redhat.component="rhacs-collector-container" \
---
>     com.redhat.component="rhacs-collector-slim-container" \
164c126
<     io.k8s.display-name="collector" \
---
>     io.k8s.display-name="collector-slim" \
167c129
<     name="rhacs-collector-rhel8" \
---
>     name="rhacs-collector-slim-rhel8" \
181d142
< COPY --from=unpacker /kernel-modules /kernel-modules

@tommartensen tommartensen marked this pull request as ready for review February 27, 2024 14:57
@tommartensen tommartensen requested review from a team as code owners February 27, 2024 14:57
.konflux/scripts/subscription-manager-bro.sh Show resolved Hide resolved
.tekton/collector-pull-request.yaml Outdated Show resolved Hide resolved
.tekton/collector-pull-request.yaml Outdated Show resolved Hide resolved
collector/container/konflux-slim.Dockerfile Show resolved Hide resolved
collector/container/konflux-slim.Dockerfile Outdated Show resolved Hide resolved
collector/container/konflux-slim.Dockerfile Outdated Show resolved Hide resolved
collector/container/konflux-slim.Dockerfile Outdated Show resolved Hide resolved
Copy link
Contributor

@msugakov msugakov left a comment

Choose a reason for hiding this comment

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

LGTM

I realized the naming suggestion I made was not the best one. Feel free to ship it with our without addressing the last two comments.

@@ -40,7 +40,9 @@ FROM scratch as builder

COPY --from=rpm-implanter-builder /mnt /

COPY . .
ARG SOURCES_DIR=/staging
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional, cosmetics, and up to you.

Suggested change
ARG SOURCES_DIR=/staging
ARG SOURCES_DIR=/src

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the chances of a directory in ubi existing called /src are slightly higher than /staging, so let's keep it like that.

@@ -40,7 +40,9 @@ FROM scratch as builder

COPY --from=rpm-implanter-builder /mnt /

COPY . .
ARG SOURCES_DIR=/staging
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional, cosmetics, and up to you.

Suggested change
ARG SOURCES_DIR=/staging
ARG SOURCES_DIR=/src

@tommartensen tommartensen merged commit d6049ab into master Feb 29, 2024
52 checks passed
@tommartensen tommartensen deleted the tm/konflux-scratch-final-stage branch February 29, 2024 09:16
@tommartensen tommartensen mentioned this pull request Feb 29, 2024
5 tasks
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.

2 participants