Skip to content

Commit 5442951

Browse files
authored
[release-v1.18] Add dockerfile generator (#668)
Running `make generate-release` fails, as the generate.sh file does not exist (e.g. in the current [generate-ci](https://github.com/openshift-knative/hack/actions/runs/14658039185/job/41136450034) runs). This PR adds it. :exclamation: It still references the func-util and event-plugin images from the `serverless-operator-136` repo, as they don't have builds for 1.38 yet. This needs to be adjusted, as soon we have the 1.38 builds available
1 parent d338386 commit 5442951

File tree

6 files changed

+107
-4
lines changed

6 files changed

+107
-4
lines changed

openshift/ci-operator/build-image/Dockerfile

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
FROM registry.ci.openshift.org/ocp/4.17:cli-artifacts as tools
44

55
# Dockerfile to bootstrap build and test in openshift-ci
6-
FROM registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.23-openshift-4.19 as builder
6+
FROM registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.24-openshift-4.19 as builder
77

88
ARG TARGETARCH
99

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# DO NOT EDIT! Generated Dockerfile for cmd/kn.
2+
ARG GO_BUILDER=registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.24-openshift-4.19
3+
ARG GO_RUNTIME=registry.access.redhat.com/ubi8/ubi-minimal
4+
5+
FROM $GO_BUILDER as builder
6+
7+
WORKDIR /workspace
8+
COPY . .
9+
10+
ENV CGO_ENABLED=1
11+
ENV GOEXPERIMENT=strictfipsruntime
12+
13+
RUN go build -tags strictfipsruntime -o /usr/bin/main ./cmd/kn
14+
15+
FROM $GO_RUNTIME
16+
17+
ARG VERSION=
18+
19+
COPY --from=builder /usr/bin/main /ko-app/kn
20+
COPY LICENSE /licenses/
21+
22+
USER 65532
23+
24+
LABEL \
25+
com.redhat.component="openshift-serverless-1-kn-rhel8-container" \
26+
name="openshift-serverless-1/kn-rhel8" \
27+
version=$VERSION \
28+
summary="Red Hat OpenShift Serverless 1 Kn" \
29+
maintainer="serverless-support@redhat.com" \
30+
description="Red Hat OpenShift Serverless 1 Kn" \
31+
io.k8s.display-name="Red Hat OpenShift Serverless 1 Kn" \
32+
io.k8s.description="Red Hat OpenShift Serverless Kn" \
33+
io.openshift.tags="kn"
34+
35+
ENTRYPOINT ["/ko-app/kn"]
Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,35 @@
1-
FROM openshift/origin-base
1+
# DO NOT EDIT! Generated Dockerfile for test/test_images/helloworld.
2+
ARG GO_BUILDER=registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.24-openshift-4.19
3+
ARG GO_RUNTIME=registry.access.redhat.com/ubi8/ubi-minimal
4+
5+
FROM $GO_BUILDER as builder
6+
7+
WORKDIR /workspace
8+
COPY . .
9+
10+
ENV CGO_ENABLED=1
11+
ENV GOEXPERIMENT=strictfipsruntime
12+
13+
RUN go build -tags strictfipsruntime -o /usr/bin/main ./test/test_images/helloworld
14+
15+
FROM $GO_RUNTIME
16+
17+
ARG VERSION=
18+
19+
COPY --from=builder /usr/bin/main /ko-app/helloworld
20+
COPY LICENSE /licenses/
21+
222
USER 65532
323

4-
ADD helloworld /ko-app/helloworld
24+
LABEL \
25+
com.redhat.component="openshift-serverless-1-test-test-images-helloworld-rhel8-container" \
26+
name="openshift-serverless-1/test-test-images-helloworld-rhel8" \
27+
version=$VERSION \
28+
summary="Red Hat OpenShift Serverless 1 Test Test Images Helloworld" \
29+
maintainer="serverless-support@redhat.com" \
30+
description="Red Hat OpenShift Serverless 1 Test Test Images Helloworld" \
31+
io.k8s.display-name="Red Hat OpenShift Serverless 1 Test Test Images Helloworld" \
32+
io.k8s.description="Red Hat OpenShift Serverless Test Test Images Helloworld" \
33+
io.openshift.tags="test-test-images-helloworld"
534

6-
ENTRYPOINT ["/ko-app/helloworld"]
35+
ENTRYPOINT ["/ko-app/helloworld"]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# DO NOT EDIT! Generated Dockerfile.
2+
3+
FROM src
4+
5+
RUN chmod +x vendor/k8s.io/code-generator/generate-groups.sh || true
6+
RUN chmod +x vendor/knative.dev/pkg/hack/generate-knative.sh || true
7+
RUN chmod +x vendor/k8s.io/code-generator/generate-internal-groups.sh || true

openshift/generate.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This script generates the productized Dockerfiles
4+
#
5+
6+
set -o errexit
7+
set -o nounset
8+
set -o pipefail
9+
10+
repo_root_dir=$(dirname "$(realpath "${BASH_SOURCE[0]}")")/..
11+
12+
# --app-file-fmt is used to mimic ko build, it's assumed in --cmd flag tests
13+
GOFLAGS='' go run github.com/openshift-knative/hack/cmd/generate@latest \
14+
--root-dir "${repo_root_dir}" \
15+
--generators dockerfile \
16+
--excludes ".*k8s\\.io.*" \
17+
--excludes ".*knative.dev/pkg/codegen.*" \
18+
--excludes ".*knative.dev/hack/cmd/script.*" \
19+
--app-file-fmt "/ko-app/%s"
20+
21+
#git apply $repo_root_dir/openshift/dockerfile.patch
22+
FUNC_UTIL=$(skopeo inspect -n --format '{{.Digest}}' docker://quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-136/kn-plugin-func-func-util:latest --override-os linux --override-arch amd64)
23+
EVENT_SENDER=$(skopeo inspect -n --format '{{.Digest}}' docker://quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-136/kn-plugin-event-sender:latest --override-os linux --override-arch amd64)
24+
25+
echo "func-util sha: ${FUNC_UTIL}"
26+
echo "event-sender sha: ${EVENT_SENDER}"
27+
28+
sed -i "/RUN go build.*/ i \
29+
ENV KN_PLUGIN_FUNC_UTIL_IMAGE=registry.redhat.io/openshift-serverless-1/kn-plugin-func-func-util-rhel8@${FUNC_UTIL}\n\
30+
ENV KN_PLUGIN_EVENT_SENDER_IMAGE=registry.redhat.io/openshift-serverless-1/kn-plugin-event-sender-rhel8@${EVENT_SENDER}" openshift/ci-operator/knative-images/kn/Dockerfile

openshift/images.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
knative.dev/client/cmd/kn: 'registry.ci.openshift.org/openshift/-kn:'
2+
knative.dev/client/test/test_images/helloworld: 'registry.ci.openshift.org/openshift/-test-helloworld:'

0 commit comments

Comments
 (0)