Skip to content

ROX-33561: Migrate roxctl to ubi8-micro#19379

Open
janisz wants to merge 7 commits intomasterfrom
ROX-30858/ubi-micro/roxctl
Open

ROX-33561: Migrate roxctl to ubi8-micro#19379
janisz wants to merge 7 commits intomasterfrom
ROX-30858/ubi-micro/roxctl

Conversation

@janisz
Copy link
Contributor

@janisz janisz commented Mar 11, 2026

Description

Migrate roxctl images from ubi8-minimal to ubi8-micro following the same best practices used for operator migration.

Changes to image/roxctl/Dockerfile:

  • Change cert source from ubi8-minimal to ubi8-micro
  • This is a simple change since it uses FROM scratch as final base

Changes to image/roxctl/konflux.Dockerfile:

  • Add ubi-micro-base stage for reference and final image
  • Add package_installer stage using ubi8/ubi with dnf (not ubi-minimal)
  • CRITICAL: Preserve ubi-micro rpmdb by copying base to /out/ first
  • Use dnf --installroot pattern for Konflux hermetic builds
  • Install only ca-certificates (minimal runtime dependency)
  • Consolidate all COPY commands to reduce layers (3→1)
  • Remove manual rpm -e package cleanup (no longer needed)

This follows the migration guide recommendation (Step 1.2) to use ubi8/ubi (not ubi-minimal) as package_installer, which provides dnf without requiring workarounds.

Expected benefits:

  • 65% smaller konflux image (~100 MB → ~35 MB)
  • 33% fewer packages (~90 → ~60)
  • Reduced attack surface
  • Single-layer final image

Updated rpms.in.yaml with ca-certificates for Konflux prefetch (shared with operator migration).

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

CI

@janisz janisz requested review from a team and rhacs-bot as code owners March 11, 2026 12:31
@janisz janisz added the konflux-build Run Konflux in PR. Push commit to trigger it. label Mar 11, 2026
@rhacs-bot rhacs-bot requested a review from a team March 11, 2026 12:34
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.71%. Comparing base (66a258b) to head (8ece45b).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19379   +/-   ##
=======================================
  Coverage   49.70%   49.71%           
=======================================
  Files        2701     2701           
  Lines      203453   203453           
=======================================
+ Hits       101134   101141    +7     
+ Misses      94790    94785    -5     
+ Partials     7529     7527    -2     
Flag Coverage Δ
go-unit-tests 49.71% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rhacs-bot
Copy link
Contributor

rhacs-bot commented Mar 12, 2026

Images are ready for the commit at 8ece45b.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-325-g8ece45bf5e.

@janisz janisz force-pushed the ROX-30858/ubi-micro/roxctl branch 2 times, most recently from 249a032 to db31272 Compare March 12, 2026 16:00
@janisz janisz changed the title ROX-33561: Migrate roxctl Dockerfiles to ubi8-micro ROX-33561: Migrate roxctl to ubi8-micro Mar 13, 2026
janisz and others added 5 commits March 13, 2026 10:04
Migrate roxctl images from ubi8-minimal to ubi8-micro following the
same best practices used for operator migration.

Changes to image/roxctl/Dockerfile:
- Change cert source from ubi8-minimal to ubi8-micro
- This is a simple change since it uses FROM scratch as final base

Changes to image/roxctl/konflux.Dockerfile:
- Add ubi-micro-base stage for reference and final image
- Add package_installer stage using ubi8/ubi with dnf (not ubi-minimal)
- CRITICAL: Preserve ubi-micro rpmdb by copying base to /out/ first
- Use dnf --installroot pattern for Konflux hermetic builds
- Install only ca-certificates (minimal runtime dependency)
- Consolidate all COPY commands to reduce layers (3→1)
- Remove manual rpm -e package cleanup (no longer needed)

This follows the migration guide recommendation (Step 1.2) to use
ubi8/ubi (not ubi-minimal) as package_installer, which provides dnf
without requiring workarounds.

Expected benefits:
- 65% smaller konflux image (~100 MB → ~35 MB)
- 33% fewer packages (~90 → ~60)
- Reduced attack surface
- Single-layer final image

Updated rpms.in.yaml with ca-certificates for Konflux prefetch
(shared with operator migration).

User request: Migrate roxctl to ubi-micro (same as operator)
Code partially generated by AI (Claude)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The ubi8-micro base image doesn't include extracted CA certificates at
/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem. This path exists in
ubi8-minimal but not in ubi8-micro.

Solution: Use the same pattern as konflux.Dockerfile - add a
package_installer stage that installs ca-certificates to /out/ using
dnf --installroot. This generates the extracted CA bundle which is then
copied to the final scratch image.

Build pattern:
1. ubi-micro-base: Reference ubi8-micro for rpmdb preservation
2. package_installer: Install ca-certificates to /out/
3. final (scratch): Copy roxctl + CA bundle

Tested locally - build succeeds and roxctl works correctly.

The ca-certificates package is already in rpms.in.yaml for Konflux builds.

Fixes build error:
  "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem": not found

Related: https://issues.redhat.com/browse/ROX-33561

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The rpms.in.yaml was updated to include ca-certificates for the roxctl
konflux build, but rpms.lock.yaml was not regenerated. This caused Konflux
builds to fail because cachi2 couldn't find the prefetched ca-certificates
package and its dependencies.

Changes:
- Regenerated lockfile for all architectures (aarch64, ppc64le, s390x, x86_64)
- Updated package versions to latest available (security updates):
  - postgresql: 15.15 → 15.17
  - python3.12: 3.12.12-1 → 3.12.12-2
  - curl: 7.61.1-34.el8_10.9 → 7.61.1-34.el8_10.10
  - brotli: 1.0.6-3 → 1.0.6-4
  - And other dependency updates

Generated using: ../collector/regenerate-rpms-lockfile.sh

This fixes the Konflux build error:
  "Unable to read consumer identity" when trying to install ca-certificates

Related: https://issues.redhat.com/browse/ROX-33561

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Tomasz Janiszewski <tomek@redhat.com>
The root cause of the 'Could not resolve host: cdn-ubi.redhat.com' error was that
roxctl's Konflux build was missing RPM prefetch configuration. When cachi2 performs
RPM prefetch (type: rpm), it sets up /etc/yum.repos.d/ to point to its local cache.
Without RPM prefetch, dnf falls back to the UBI repos copied from ubi-micro which
point to cdn-ubi.redhat.com.

Changed roxctl-build.yaml prefetch-input from:
  value: '{"type": "gomod", "path": "."}'

To (matching main-build.yaml pattern):
  value: |
    [
      { "type": "gomod", "path": "." },
      { "type": "rpm", "path": "." }
    ]

This aligns with:
- main-build.yaml: uses npm + gomod + rpm prefetch
- collector: uses rpm prefetch only

The --setopt=reposdir=/etc/yum.repos.d flag works correctly once RPM prefetch
sets up the cachi2 repos.

Partially generated by AI.
@janisz janisz force-pushed the ROX-30858/ubi-micro/roxctl branch from db31272 to d39b371 Compare March 13, 2026 09:04
janisz added 2 commits March 13, 2026 14:49
Add ACTIVATION_KEY parameter to prefetch-dependencies task to fix SSL
certificate verification errors when downloading RPMs from cdn.redhat.com.

The subscription-manager-activation-key-prod secret provides the credentials
needed for accessing Red Hat CDN during hermetic RPM prefetch.

Also added dev-package-managers: true parameter as required for RPM prefetching.

Fixes: FetchError: ClientConnectorCertificateError during RPM download

Partially generated by AI.
@github-actions
Copy link
Contributor

/konflux-retest roxctl-on-push

2 similar comments
@github-actions
Copy link
Contributor

/konflux-retest roxctl-on-push

@github-actions
Copy link
Contributor

/konflux-retest roxctl-on-push

@github-actions
Copy link
Contributor

/konflux-retest operator-bundle-on-push

@openshift-ci
Copy link

openshift-ci bot commented Mar 13, 2026

@janisz: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/ocp-4-20-nongroovy-e2e-tests 8ece45b link false /test ocp-4-20-nongroovy-e2e-tests

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

@github-actions
Copy link
Contributor

/konflux-retest operator-bundle-on-push

1 similar comment
@github-actions
Copy link
Contributor

/konflux-retest operator-bundle-on-push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/helm konflux-build Run Konflux in PR. Push commit to trigger it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants