Skip to content

Commit

Permalink
Handle empty project.imagePrefix
Browse files Browse the repository at this point in the history
  • Loading branch information
mgencur committed Sep 2, 2024
1 parent 3cba828 commit 02a8847
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions cmd/generate/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]" \
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"]
9 changes: 7 additions & 2 deletions cmd/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down

0 comments on commit 02a8847

Please sign in to comment.