-
Notifications
You must be signed in to change notification settings - Fork 24
Add support for RHEL 9 base images #790
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
Merged
openshift-merge-bot
merged 9 commits into
openshift-knative:main
from
dsimansk:pr/add-rhel-9-generator
Oct 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dc87840
Add support for RHEL 9 base images
dsimansk 044e5e3
Use dnf in func image
dsimansk 8aec927
Switch default to rhel 9
dsimansk 051ce1f
Parse more version variatns
dsimansk 933e897
Improve version conditionals
dsimansk 1a9a209
Bump version to RHEL 9 in s-o config
dsimansk 81e9ce0
Free some diskspace
dsimansk f416cd3
Add disk cleanup to template
dsimansk 2fdd092
Fix gh action formatting
dsimansk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
pkg/dockerfilegen/dockerfile-templates/rhel-9/BuildImage.dockerfile.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # DO NOT EDIT! Generated Dockerfile. | ||
|
|
||
| FROM registry.ci.openshift.org/ocp/4.19:cli-artifacts as tools | ||
|
|
||
| # Dockerfile to bootstrap build and test in openshift-ci | ||
| FROM {{.builder}} as builder | ||
|
|
||
| ARG TARGETARCH | ||
|
|
||
| COPY --from=tools /usr/share/openshift/linux_$TARGETARCH/oc.rhel9 /usr/bin/oc | ||
|
|
||
| RUN ln -s /usr/bin/oc /usr/bin/kubectl | ||
|
|
||
| RUN dnf install -y httpd-tools | ||
|
|
||
| RUN wget https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && \ | ||
| chmod 700 ./get-helm-3 | ||
|
|
||
| RUN ./get-helm-3 --version v3.11.3 --no-sudo && helm version | ||
|
|
||
| RUN GOFLAGS='' go install github.com/mikefarah/yq/v3@latest | ||
| RUN GOFLAGS='' go install -tags="exclude_graphdriver_btrfs containers_image_openpgp" github.com/containers/skopeo/cmd/skopeo@v1.17.0 | ||
|
|
||
| # go install creates $GOPATH/.cache with root permissions, we delete it here | ||
| # to avoid permission issues with the runtime users | ||
| RUN rm -rf $GOPATH/.cache |
39 changes: 39 additions & 0 deletions
39
pkg/dockerfilegen/dockerfile-templates/rhel-9/Default.dockerfile.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # DO NOT EDIT! Generated Dockerfile for {{.main}}. | ||
| ARG GO_BUILDER={{.builder}} | ||
| ARG GO_RUNTIME=registry.access.redhat.com/ubi9/ubi-minimal | ||
|
|
||
| FROM $GO_BUILDER as builder | ||
|
|
||
| WORKDIR /workspace | ||
| COPY . . | ||
| {{ range $c := .build_env_vars}} | ||
| ENV {{ $c }} | ||
| {{- end }} | ||
|
|
||
| RUN go build -tags strictfipsruntime -o /usr/bin/main ./{{.main}} | ||
|
|
||
| FROM $GO_RUNTIME | ||
|
|
||
| ARG VERSION={{.version}} | ||
|
|
||
| {{- range $c := .additional_instructions }} | ||
| {{ $c }} | ||
| {{- end }} | ||
|
|
||
| COPY --from=builder /usr/bin/main {{.app_file}} | ||
| COPY LICENSE /licenses/ | ||
|
|
||
| USER 65532 | ||
|
|
||
| LABEL \ | ||
| com.redhat.component="openshift-serverless-1-{{.project_dashcase}}{{.component_dashcase}}-rhel9-container" \ | ||
| name="openshift-serverless-1/{{.project_dashcase}}{{.component_dashcase}}-rhel8" \ | ||
| version=$VERSION \ | ||
| summary="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" \ | ||
| maintainer="serverless-support@redhat.com" \ | ||
| description="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" \ | ||
| io.k8s.display-name="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" \ | ||
| io.k8s.description="Red Hat OpenShift Serverless {{.project}}{{.component}}" \ | ||
| io.openshift.tags="{{.component_dashcase}}" | ||
|
|
||
| ENTRYPOINT ["{{.app_file}}"] |
46 changes: 46 additions & 0 deletions
46
pkg/dockerfilegen/dockerfile-templates/rhel-9/FuncUtil.dockerfile.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # DO NOT EDIT! Generated Dockerfile for {{.main}}. | ||
| ARG GO_BUILDER={{.builder}} | ||
| ARG GO_RUNTIME=registry.access.redhat.com/ubi9/ubi-minimal | ||
|
|
||
| FROM $GO_BUILDER as builder | ||
|
|
||
| WORKDIR /workspace | ||
| COPY . . | ||
|
|
||
| ENV CGO_ENABLED=1 | ||
| ENV GOEXPERIMENT=strictfipsruntime | ||
| ENV GOFLAGS='' | ||
|
|
||
| RUN go build -tags strictfipsruntime,exclude_graphdriver_btrfs -o /usr/bin/main ./{{.main}} | ||
|
|
||
| FROM $GO_RUNTIME | ||
|
|
||
| ARG VERSION={{.version}} | ||
|
|
||
| RUN microdnf install socat tar | ||
| {{- range $c := .additional_instructions }} | ||
| {{ $c }} | ||
| {{- end }} | ||
|
|
||
| COPY --from=builder /usr/bin/main {{.app_file}} | ||
| COPY LICENSE /licenses/ | ||
|
|
||
| RUN ln -s {{.app_file}} /usr/local/bin/deploy && \ | ||
| ln -s {{.app_file}} /usr/local/bin/scaffold && \ | ||
| ln -s {{.app_file}} /usr/local/bin/s2i && \ | ||
| ln -s {{.app_file}} /usr/local/bin/s2i-generate | ||
|
|
||
| USER 65532 | ||
|
|
||
| LABEL \ | ||
| com.redhat.component="openshift-serverless-1-{{.project_dashcase}}{{.component_dashcase}}-rhel9-container" \ | ||
| name="openshift-serverless-1/{{.project_dashcase}}{{.component_dashcase}}-rhel8" \ | ||
| version=$VERSION \ | ||
| summary="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" \ | ||
| maintainer="serverless-support@redhat.com" \ | ||
| description="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" \ | ||
| io.k8s.display-name="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" \ | ||
| io.k8s.description="Red Hat OpenShift Serverless {{.project}}{{.component}}" \ | ||
| io.openshift.tags="{{.component_dashcase}}" | ||
|
|
||
| ENTRYPOINT ["/usr/bin/bash"] |
35 changes: 35 additions & 0 deletions
35
pkg/dockerfilegen/dockerfile-templates/rhel-9/MustGather.dockerfile.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # DO NOT EDIT! Generated Dockerfile for {{.main}}. | ||
| ARG CLI_ARTIFACTS={{ .oc_cli_artifacts }} | ||
| ARG RUNTIME=registry.access.redhat.com/ubi9/ubi-minimal | ||
| FROM $CLI_ARTIFACTS AS cli-artifacts | ||
|
|
||
| FROM $RUNTIME | ||
|
|
||
| ARG TARGETARCH | ||
|
|
||
| COPY --from=cli-artifacts /usr/share/openshift/linux_$TARGETARCH/{{ .oc_binary_name }} /usr/bin/oc | ||
|
|
||
| # Copy all collection scripts to /usr/bin | ||
| COPY must-gather/bin/* /usr/bin/ | ||
| COPY LICENSE /licenses/ | ||
|
|
||
| RUN microdnf install -y rsync tar | ||
|
|
||
| ENV LOGS_DIR="/must-gather" | ||
| RUN mkdir -p $LOGS_DIR && \ | ||
| chown -R 65532:65532 $LOGS_DIR | ||
|
|
||
| USER 65532 | ||
|
|
||
| LABEL \ | ||
| com.redhat.component="openshift-serverless-1-{{.project_dashcase}}rhel9-container" \ | ||
| name="openshift-serverless-1/svls-{{.project_dashcase}}rhel8" \ | ||
| version={{.version}} \ | ||
| summary="Red Hat OpenShift Serverless 1 {{.project}}" \ | ||
| maintainer="serverless-support@redhat.com" \ | ||
| description="Red Hat OpenShift Serverless 1 {{.project}}" \ | ||
| io.k8s.display-name="Red Hat OpenShift Serverless 1 {{.project}}" \ | ||
| io.k8s.description="Red Hat OpenShift Serverless {{.project}}" \ | ||
| io.openshift.tags="{{.main}}" | ||
|
|
||
| ENTRYPOINT /usr/bin/gather |
7 changes: 7 additions & 0 deletions
7
pkg/dockerfilegen/dockerfile-templates/rhel-9/SourceImage.dockerfile.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # DO NOT EDIT! Generated Dockerfile. | ||
|
|
||
| FROM src | ||
|
|
||
| RUN chmod +x vendor/k8s.io/code-generator/generate-groups.sh || true | ||
| RUN chmod +x vendor/knative.dev/pkg/hack/generate-knative.sh || true | ||
| RUN chmod +x vendor/k8s.io/code-generator/generate-internal-groups.sh || true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| FROM registry.access.redhat.com/ubi9/ubi-minimal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| contentOrigin: | ||
| # Define at least one source of packages, but you can have as many as you want. | ||
| repofiles: | ||
| # Either local path or url pointing to .repo file | ||
| - 'https://raw.githubusercontent.com/konflux-ci/bazel-builder/refs/heads/bazel8-ubi9/ubi9.repo' | ||
| packages: | ||
| # list of rpm names to resolve | ||
| - socat | ||
| - tar | ||
| - rsync | ||
|
|
||
| reinstallPackages: | ||
| - tzdata | ||
|
|
||
| upgradePackages: | ||
| - tzdata | ||
|
|
||
| arches: | ||
| # The list of architectures can be set in the config file. Any `--arch` option set | ||
| # on the command line will override this list. | ||
| - x86_64 | ||
| - aarch64 | ||
| - s390x | ||
| - ppc64le | ||
|
|
||
| context: | ||
| # Alternative to setting command line options. Usually you will only want | ||
| # to include one of these options, with the exception of `flatpak` that | ||
| # can be combined with `image` and `containerfile` | ||
| containerfile: ubi9.Containerfile |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.