From d3a4b029cde7088ec3dc3589c3680dd52095142d Mon Sep 17 00:00:00 2001 From: Martin Gencur <mgencur@redhat.com> Date: Wed, 18 Sep 2024 09:29:35 +0200 Subject: [PATCH] [main] Onboard net-kourier to automatic Dockerfile generation (#145) * Onboard net-kourier to automatic Dockerfile generation * Use @latest tag for go install --- Makefile | 3 +++ openshift/ci-operator/build-image/Dockerfile | 3 --- .../ci-operator/knative-images/kourier/Dockerfile | 10 ---------- openshift/generate.sh | 14 ++++++++++++++ openshift/project.yaml | 3 +++ openshift/release/create-release-branch.sh | 9 +++++++-- 6 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 Makefile delete mode 100644 openshift/ci-operator/build-image/Dockerfile delete mode 100644 openshift/ci-operator/knative-images/kourier/Dockerfile create mode 100755 openshift/generate.sh create mode 100644 openshift/project.yaml diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..789cf8722 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +generate-release: + ./openshift/generate.sh +.PHONY: generate-release diff --git a/openshift/ci-operator/build-image/Dockerfile b/openshift/ci-operator/build-image/Dockerfile deleted file mode 100644 index 7be99ecdc..000000000 --- a/openshift/ci-operator/build-image/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -# Dockerfile to bootstrap build and test in openshift-ci - -FROM registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.22-openshift-4.17 diff --git a/openshift/ci-operator/knative-images/kourier/Dockerfile b/openshift/ci-operator/knative-images/kourier/Dockerfile deleted file mode 100644 index 97fc4bac3..000000000 --- a/openshift/ci-operator/knative-images/kourier/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM registry.ci.openshift.org/openshift/release:rhel-8-release-golang-1.22-openshift-4.17 AS builder -WORKDIR /app/ -COPY . . -RUN go build -mod vendor -o /tmp/kourier ./cmd/kourier - -FROM openshift/origin-base -USER 65532 - -COPY --from=builder /tmp/kourier /ko-app/kourier -ENTRYPOINT ["/ko-app/kourier"] diff --git a/openshift/generate.sh b/openshift/generate.sh new file mode 100755 index 000000000..0b46bb6bd --- /dev/null +++ b/openshift/generate.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -euo pipefail + +repo_root_dir=$(dirname "$(realpath "${BASH_SOURCE[0]}")")/.. + +go install github.com/openshift-knative/hack/cmd/generate@latest + +$(go env GOPATH)/bin/generate \ + --root-dir "${repo_root_dir}" \ + --generators dockerfile \ + --includes cmd \ + --app-file-fmt "/ko-app/%s" \ + --dockerfile-image-builder-fmt "registry.ci.openshift.org/openshift/release:rhel-8-release-golang-%s-openshift-4.17" diff --git a/openshift/project.yaml b/openshift/project.yaml new file mode 100644 index 000000000..936108a6c --- /dev/null +++ b/openshift/project.yaml @@ -0,0 +1,3 @@ +project: + tag: knative-nightly + imagePrefix: net-kourier diff --git a/openshift/release/create-release-branch.sh b/openshift/release/create-release-branch.sh index b1c0dbe19..fd5d40316 100644 --- a/openshift/release/create-release-branch.sh +++ b/openshift/release/create-release-branch.sh @@ -24,8 +24,13 @@ git checkout upstream/"${upstream_release}" # Copy the openshift extra files from the OPENSHIFT/main branch. git fetch openshift main -git checkout openshift/main -- openshift OWNERS -git add openshift OWNERS +git checkout openshift/main -- openshift OWNERS Makefile + +tag=${release/release-/} +yq write --inplace openshift/project.yaml project.tag "knative-$tag" +make generate-release + +git add openshift OWNERS Makefile git commit -m "Add openshift specific files." openshift/release/download_release_artifacts.sh "${release}"