From 02a884740d7668f1f9722f580b14155a7ffee993 Mon Sep 17 00:00:00 2001 From: Martin Gencur Date: Mon, 2 Sep 2024 21:45:05 +0200 Subject: [PATCH] Handle empty project.imagePrefix --- cmd/generate/Dockerfile.template | 10 +++++----- cmd/generate/generate.go | 9 +++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/generate/Dockerfile.template b/cmd/generate/Dockerfile.template index 89efe131..bfe4a0d8 100644 --- a/cmd/generate/Dockerfile.template +++ b/cmd/generate/Dockerfile.template @@ -23,12 +23,12 @@ USER 65532 COPY --from=builder /usr/bin/main /usr/bin/main LABEL \ - com.redhat.component="openshift-serverless-1-{{.project_dashcase}}-{{.component_dashcase}}-rhel8-container" \ - name="openshift-serverless-1/{{.project_dashcase}}-{{.component_dashcase}}-rhel8" \ + com.redhat.component="openshift-serverless-1-{{.project_dashcase}}{{.component_dashcase}}-rhel8-container" \ + name="openshift-serverless-1/{{.project_dashcase}}{{.component_dashcase}}-rhel8" \ version=$VERSION \ - summary="Red Hat OpenShift Serverless 1 {{.project}} {{.component}}" \ + 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}}" + description="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" \ + io.k8s.display-name="Red Hat OpenShift Serverless 1 {{.project}}{{.component}}" ENTRYPOINT ["/usr/bin/main"] diff --git a/cmd/generate/generate.go b/cmd/generate/generate.go index e7dda62b..ed2d7ad9 100644 --- a/cmd/generate/generate.go +++ b/cmd/generate/generate.go @@ -186,12 +186,17 @@ func main() { for _, p := range mainPackagesPaths.List() { projectName := strings.TrimPrefix(metadata.Project.ImagePrefix, "knative-") + var projectWithSep, projectDashCaseWithSep string + if projectName != "" { + projectWithSep = capitalize(projectName) + " " + projectDashCaseWithSep = projectName + "-" + } d := map[string]interface{}{ "main": p, "builder": builderImage, "version": metadata.Project.Tag, - "project": capitalize(projectName), - "project_dashcase": projectName, + "project": projectWithSep, + "project_dashcase": projectDashCaseWithSep, "component": capitalize(p), "component_dashcase": dashcase(p), }