Skip to content

Use UBI base images and OCI labels for Konflux Enterprise Contract#126

Merged
openshift-merge-bot[bot] merged 5 commits into
mainfrom
konflux-ec-dockerfile-fix
Jul 14, 2026
Merged

Use UBI base images and OCI labels for Konflux Enterprise Contract#126
openshift-merge-bot[bot] merged 5 commits into
mainfrom
konflux-ec-dockerfile-fix

Conversation

@MitaliBhalla

@MitaliBhalla MitaliBhalla commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace golang:1.25-alpine and gcr.io/distroless/static-debian12 with Red Hat UBI builder/runtime images so Konflux Enterprise Contract accepts the base registries.
  • Add required OCI labels (name, vendor, version, release, description, com.redhat.component, distribution-scope, url, etc.) expected by app-interface-standard.

Context

Konflux build on #125 succeeded, but EC failed with:

  • base_image_registries — distroless not on permitted registry list
  • labels.required_labels — missing Red Hat OCI labels
  • ecosystem-cert-preflight-checks errored (downstream of the above)

Plan: merge this first, then update/retest #125 so the bootstrap PR gets a green EC check.

Test plan

Made with Cursor

Summary by CodeRabbit

  • Chores
    • Updated the application container base images to Red Hat UBI equivalents and adjusted the Go build environment accordingly.
    • Improved container metadata with build version/release and service description details.
    • Updated runtime to run as a non-root user (UID/GID 65534).
    • Adjusted exposed ports to 8000, 8081, and 9090 (removing 8080).
    • Preserved the existing build flow, producing a static Go binary for the runtime image.

Switch the builder and runtime from golang:alpine and distroless to
Red Hat UBI images and add the labels required by Enterprise Contract.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift-online/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 50fc355c-1485-46b6-8521-8cc97c372825

📥 Commits

Reviewing files that changed from the base of the PR and between 75e172e and 6426429.

📒 Files selected for processing (1)
  • Dockerfile
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dockerfile

Walkthrough

The Dockerfile migrates build and runtime stages to Red Hat UBI images, preserves the Go compilation flow, adds image metadata, and updates the runtime port and user settings.

Changes

Container image migration

Layer / File(s) Summary
UBI builder stage
Dockerfile
The builder switches to the UBI Go toolset image, removes Alpine dependency installation, preserves cross-compilation settings, and adds -buildvcs=false.
Runtime image and metadata
Dockerfile
The runtime switches to UBI minimal and adds version, release, Kubernetes, and distribution-scope labels.
Runtime execution settings
Dockerfile
The image exposes 8081 instead of 8080 and runs the binary as UID and GID 65534, while retaining the working directory and other exposed ports.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai-Attribution ⚠️ Warning PR mentions Cursor, and HEAD commit uses Co-authored-by: Cursor; no Assisted-by or Generated-by trailers were found. Replace the AI tool attribution with Red Hat-compliant Assisted-by or Generated-by trailer(s) and remove Co-authored-by for Cursor.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: switching to UBI base images and adding OCI labels for Konflux compliance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Weak-Crypto ✅ Passed Only the Dockerfile changed, and the diff contains no weak crypto primitives, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed No privileged/root-risk settings found: manifests lack privileged, host*, allowPrivilegeEscalation, and SYS_ADMIN fields; Dockerfile uses USER 65534:65534.
No-Sensitive-Data-In-Logs ✅ Passed Only Dockerfile changed; it adds no logging or runtime output, and no sensitive data exposure appears in the diff.
No-Hardcoded-Secrets ✅ Passed The only changed file is Dockerfile, and the new lines add UBI images, labels, ports, and USER changes—no secrets, credentials, or embedded tokens.
No-Injection-Vectors ✅ Passed Only Dockerfile changed; it contains no SQL/shell/eval/pickle/yaml/os.system/innerHTML injection patterns.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch konflux-ec-dockerfile-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
Dockerfile (1)

20-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a version-based floating tag instead of :latest for ubi-minimal.

While :latest is technically a floating tag and satisfies the path instruction, it could pull UBI 10 when released, introducing unexpected breaking changes. A version-based floating tag like :9.5 or :9 is safer while still allowing Red Hat to manage updates within the major version.

♻️ Suggested change
-FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
+FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` at line 20, Update the Dockerfile’s ubi-minimal base image
reference from the unbounded :latest tag to a version-based floating tag such as
:9 or :9.5, preserving automatic updates while constraining the image to the
intended UBI 9 release line.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Line 41: Update the Dockerfile EXPOSE declaration to use port 8081 instead of
8080, exposing the application’s ports as 8000, 8081, and 9090 while leaving the
other ports unchanged.
- Around line 25-35: Update the Dockerfile LABEL metadata to use the actual
project name “rosa-regional-platform-api” consistently, including name,
display-name, component, summary, description, and related values; correct the
url to the project’s actual repository under
github.com/openshift/rosa-regional-platform-api.
- Around line 37-45: Add a Docker HEALTHCHECK after the USER instruction,
targeting the application’s configured health port 8081 and the verified health
endpoint path. Confirm whether the rosa-regional-platform-api binary provides a
health-check mechanism; otherwise use an available curl or wget command. Keep
the existing ENTRYPOINT unchanged.

---

Nitpick comments:
In `@Dockerfile`:
- Line 20: Update the Dockerfile’s ubi-minimal base image reference from the
unbounded :latest tag to a version-based floating tag such as :9 or :9.5,
preserving automatic updates while constraining the image to the intended UBI 9
release line.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift-online/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 16b5f5d6-b4ff-416f-96cb-d1ee8eb95c62

📥 Commits

Reviewing files that changed from the base of the PR and between 6775666 and 025238a.

📒 Files selected for processing (1)
  • Dockerfile

Comment thread Dockerfile
Comment thread Dockerfile
Comment thread Dockerfile Outdated
The deployment runs the API health server on 8081; 8080 is reserved for
the Envoy sidecar in manifests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@MitaliBhalla

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit feedback:

Fixed

  • EXPOSE 8000 8081 9090 — deployment runs app health on 8081; 8080 is Envoy sidecar (deployment/manifests/api.yaml).

Keeping as-is (intentional)

  • Label names (rosa-hyperfleet-api) — repo was renamed from rosa-regional-platform-api to rosa-hyperfleet-api (Konflux component + Quay path use hyperfleet naming). Binary path is still rosa-regional-platform-api for now; image metadata follows the repo/component name.
  • HEALTHCHECK — not adding in this PR. Runtime is ubi-minimal (no curl/wget), binary only exposes serve (no healthcheck subcommand), and K8s liveness/readiness probes are already defined in manifests. Can revisit if we add a minimal probe helper later.

AI attribution

  • Will use Assisted-by: instead of Co-authored-by: on squash merge per Red Hat policy.

Konflux build contexts do not include git metadata, so go build fails
with "error obtaining VCS status" unless -buildvcs=false is set.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread Dockerfile
Comment thread Dockerfile
Comment thread Dockerfile Outdated
Comment thread Dockerfile Outdated
Use fully qualified go-toolset and ubi-minimal tags instead of floating
1.26 and latest.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread Dockerfile Outdated

# Run as non-root user
USER nonroot:nonroot
USER 1001

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

on OpenShift in the past we;ve used USER 65534:65534 - what's te recommendation from Konflux - sorry I missed this first pass @MitaliBhalla

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good question — Konflux/EC doesn't prescribe a specific UID, it just checks we're not running as root.

I used 1001 because that's the common UBI/operator pattern (e.g. cloud-ingress-operator on ubi-minimal). The old distroless image used nonroot (65532).

65534:65534 (nobody) is totally fine and matches what we've used on OpenShift elsewhere — happy to switch for fleet consistency if that's the team preference. Functionally both work as long as the binary + /app are readable by that UID.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

switch for fleet consistency

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — switched to USER 65534:65534 in the latest commit.

Use USER 65534:65534 instead of 1001 to match existing OpenShift
deployment conventions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@psav

psav commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

/approved

@typeid typeid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 14, 2026
@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MitaliBhalla, typeid

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 14, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit 37246a8 into main Jul 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants